From 2ec5677d79aaf88142adc314585672b61dc72ad5 Mon Sep 17 00:00:00 2001 From: Michael law <1365977+lawmicha@users.noreply.github.com> Date: Mon, 31 Aug 2020 07:37:04 -0700 Subject: [PATCH] fix: use latest appsync 3.1.5 --- EventsApp.xcodeproj/project.pbxproj | 4 + EventsApp/AddEventViewController.swift | 27 +- EventsApp/AppDelegate.swift | 16 +- EventsApp/EventDetails.swift | 13 +- EventsApp/EventListViewController.swift | 25 +- EventsApp/EventsAPI.swift | 2206 +++++++++++------------ Podfile | 2 +- 7 files changed, 1155 insertions(+), 1138 deletions(-) diff --git a/EventsApp.xcodeproj/project.pbxproj b/EventsApp.xcodeproj/project.pbxproj index ef78cb0..8c50fd7 100644 --- a/EventsApp.xcodeproj/project.pbxproj +++ b/EventsApp.xcodeproj/project.pbxproj @@ -205,15 +205,19 @@ "${PODS_ROOT}/Target Support Files/Pods-EventsApp/Pods-EventsApp-frameworks.sh", "${BUILT_PRODUCTS_DIR}/AWSAppSync/AWSAppSync.framework", "${BUILT_PRODUCTS_DIR}/AWSCore/AWSCore.framework", + "${BUILT_PRODUCTS_DIR}/AppSyncRealTimeClient/AppSyncRealTimeClient.framework", "${BUILT_PRODUCTS_DIR}/ReachabilitySwift/Reachability.framework", "${BUILT_PRODUCTS_DIR}/SQLite.swift/SQLite.framework", + "${BUILT_PRODUCTS_DIR}/Starscream/Starscream.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AWSAppSync.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AWSCore.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AppSyncRealTimeClient.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Reachability.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SQLite.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Starscream.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; diff --git a/EventsApp/AddEventViewController.swift b/EventsApp/AddEventViewController.swift index f1a4191..9e48447 100644 --- a/EventsApp/AddEventViewController.swift +++ b/EventsApp/AddEventViewController.swift @@ -36,20 +36,21 @@ class AddEventViewController: UIViewController { // MARK: - Click handlers - @IBAction func addNewPost(_ sender: Any) { + @IBAction func addNewPost(_: Any) { guard let nameText = nameInput.text, !nameText.isEmpty, let whenText = whenInput.text, !whenText.isEmpty, let whereText = whereInput.text, !whereText.isEmpty, - let descriptionText = descriptionInput.text, !descriptionText.isEmpty else { - // Server won't accept empty strings - let alertController = UIAlertController(title: "Error", - message: "Missing values.", - preferredStyle: .alert) - let okAction = UIAlertAction(title: "OK", style: .default) - alertController.addAction(okAction) - present(alertController, animated: true) + let descriptionText = descriptionInput.text, !descriptionText.isEmpty + else { + // Server won't accept empty strings + let alertController = UIAlertController(title: "Error", + message: "Missing values.", + preferredStyle: .alert) + let okAction = UIAlertAction(title: "OK", style: .default) + alertController.addAction(okAction) + present(alertController, animated: true) - return + return } // We set up a temporary ID so we can reconcile the server-provided ID when `addEventMutation` returns @@ -82,8 +83,10 @@ class AddEventViewController: UIViewController { defer { self.navigationController?.popViewController(animated: true) + // swiftlint:disable opening_brace if let eventListViewController = - self.navigationController?.viewControllers.last as? EventListViewController { + self.navigationController?.viewControllers.last as? EventListViewController + { eventListViewController.needUpdateList = true } } @@ -129,7 +132,7 @@ class AddEventViewController: UIViewController { } } - @IBAction func onCancel(_ sender: Any) { + @IBAction func onCancel(_: Any) { dismiss(animated: true, completion: nil) } } diff --git a/EventsApp/AppDelegate.swift b/EventsApp/AppDelegate.swift index 5ec4e7c..7a4b94e 100644 --- a/EventsApp/AppDelegate.swift +++ b/EventsApp/AppDelegate.swift @@ -11,8 +11,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? var appSyncClient: AWSAppSyncClient? - func application(_ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // swiftlint:disable opening_brace + func application(_: UIApplication, + didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool + { // Override point for customization after application launch. // You can choose the directory in which AppSync stores its persistent cache databases: @@ -46,7 +48,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { return true } - func applicationWillResignActive(_ application: UIApplication) { + func applicationWillResignActive(_: UIApplication) { // Sent when the application is about to move from active to inactive state. This // can occur for certain types of temporary interruptions (such as an incoming // phone call or SMS message) or when the user quits the application and it begins @@ -56,7 +58,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { // rendering callbacks. Games should use this method to pause the game. } - func applicationDidEnterBackground(_ application: UIApplication) { + func applicationDidEnterBackground(_: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, // and store enough application state information to restore your application to // its current state in case it is terminated later. @@ -65,18 +67,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate { // instead of applicationWillTerminate: when the user quits. } - func applicationWillEnterForeground(_ application: UIApplication) { + func applicationWillEnterForeground(_: UIApplication) { // Called as part of the transition from the background to the active state; here // you can undo many of the changes made on entering the background. } - func applicationDidBecomeActive(_ application: UIApplication) { + func applicationDidBecomeActive(_: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application // was inactive. If the application was previously in the background, optionally // refresh the user interface. } - func applicationWillTerminate(_ application: UIApplication) { + func applicationWillTerminate(_: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. // See also applicationDidEnterBackground:. } diff --git a/EventsApp/EventDetails.swift b/EventsApp/EventDetails.swift index 49e8b3c..67441af 100644 --- a/EventsApp/EventDetails.swift +++ b/EventsApp/EventDetails.swift @@ -75,7 +75,7 @@ class EventDetailsViewController: UIViewController { } } - override func viewWillDisappear(_ animated: Bool) { + override func viewWillDisappear(_: Bool) { super.viewWillDisappear(true) print("Cancelling subscription") newCommentsSubscriptionWatcher?.cancel() @@ -93,8 +93,10 @@ class EventDetailsViewController: UIViewController { return } + // swiftlint:disable opening_brace if let eventListViewController = navigationController?.viewControllers[controllersCount - 2] - as? EventListViewController { + as? EventListViewController + { eventListViewController.eventList[eventListViewController.lastOpenedIndex]?.fragments.event = event } } @@ -263,14 +265,15 @@ class EventDetailsViewController: UIViewController { // MARK: - Table view delegates extension EventDetailsViewController: UITableViewDataSource, UITableViewDelegate { - func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + func tableView(_: UITableView, numberOfRowsInSection _: Int) -> Int { comments.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { guard let cell = tableView.dequeueReusableCell(withIdentifier: "CommentCell", for: indexPath) - as? CommentCell else { - return UITableViewCell() + as? CommentCell + else { + return UITableViewCell() } guard let content = comments[indexPath.row]?.content else { diff --git a/EventsApp/EventListViewController.swift b/EventsApp/EventListViewController.swift index 238b249..fad0df1 100644 --- a/EventsApp/EventListViewController.swift +++ b/EventsApp/EventListViewController.swift @@ -45,7 +45,7 @@ class EventListViewController: UIViewController { return refreshControl }() - @objc func handleRefresh(_ refreshControl: UIRefreshControl) { + @objc func handleRefresh(_: UIRefreshControl) { nextToken = nil fetchAllEventsUsingCachePolicy(.fetchIgnoringCacheData) } @@ -142,7 +142,7 @@ class EventListViewController: UIViewController { // MARK: - Table view delegates extension EventListViewController: UITableViewDataSource, UITableViewDelegate { - func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + func tableView(_: UITableView, numberOfRowsInSection _: Int) -> Int { eventList.count } @@ -161,14 +161,16 @@ extension EventListViewController: UITableViewDataSource, UITableViewDelegate { } // editing check - func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { + func tableView(_: UITableView, canEditRowAt _: IndexPath) -> Bool { true } // editing action - func tableView(_ tableView: UITableView, + // swiftlint:disable opening_brace + func tableView(_: UITableView, commit editingStyle: UITableViewCell.EditingStyle, - forRowAt indexPath: IndexPath) { + forRowAt indexPath: IndexPath) + { if editingStyle == UITableViewCell.EditingStyle.delete { guard let eventId = eventList[indexPath.row]?.id else { return @@ -203,7 +205,7 @@ extension EventListViewController: UITableViewDataSource, UITableViewDelegate { } // click handlers - func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + func tableView(_: UITableView, didSelectRowAt indexPath: IndexPath) { lastOpenedIndex = indexPath.row guard let event = eventList[indexPath.row] else { @@ -211,18 +213,21 @@ extension EventListViewController: UITableViewDataSource, UITableViewDelegate { } let storyboard = UIStoryboard(name: "Main", bundle: nil) guard let controller = storyboard.instantiateViewController(withIdentifier: "EventDetailsViewController") - as? EventDetailsViewController else { - return + as? EventDetailsViewController + else { + return } controller.event = event.fragments.event navigationController?.pushViewController(controller, animated: true) } // pagination - func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { + func tableView(_: UITableView, willDisplay _: UITableViewCell, forRowAt indexPath: IndexPath) { + // swiftlint:disable opening_brace if !isLoadInProgress, indexPath.row > eventList.count - 2, - nextToken?.count ?? 0 > 0 { + nextToken?.count ?? 0 > 0 + { fetchAllEventsUsingCachePolicy(.fetchIgnoringCacheData) } } diff --git a/EventsApp/EventsAPI.swift b/EventsApp/EventsAPI.swift index be859d1..4366e6a 100644 --- a/EventsApp/EventsAPI.swift +++ b/EventsApp/EventsAPI.swift @@ -3,1378 +3,1378 @@ import AWSAppSync public final class AddEventMutation: GraphQLMutation { - public static let operationString = - "mutation AddEvent($name: String!, $when: String!, $where: String!, $description: String!) {\n createEvent(name: $name, when: $when, where: $where, description: $description) {\n __typename\n ...Event\n }\n}" + public static let operationString = + "mutation AddEvent($name: String!, $when: String!, $where: String!, $description: String!) {\n createEvent(name: $name, when: $when, where: $where, description: $description) {\n __typename\n ...Event\n }\n}" - public static var requestString: String { return operationString.appending(Event.fragmentString) } + public static var requestString: String { return operationString.appending(Event.fragmentString) } - public var name: String - public var when: String - public var `where`: String - public var description: String + public var name: String + public var when: String + public var `where`: String + public var description: String - public init(name: String, when: String, `where`: String, description: String) { - self.name = name - self.when = when - self.where = `where` - self.description = description - } - - public var variables: GraphQLMap? { - return ["name": name, "when": when, "where": `where`, "description": description] - } - - public struct Data: GraphQLSelectionSet { - public static let possibleTypes = ["Mutation"] - - public static let selections: [GraphQLSelection] = [ - GraphQLField("createEvent", arguments: ["name": GraphQLVariable("name"), "when": GraphQLVariable("when"), "where": GraphQLVariable("where"), "description": GraphQLVariable("description")], type: .object(CreateEvent.selections)), - ] - - public var snapshot: Snapshot - - public init(snapshot: Snapshot) { - self.snapshot = snapshot - } - - public init(createEvent: CreateEvent? = nil) { - self.init(snapshot: ["__typename": "Mutation", "createEvent": createEvent.flatMap { $0.snapshot }]) + public init(name: String, when: String, where: String, description: String) { + self.name = name + self.when = when + self.where = `where` + self.description = description } - /// Create a single event. - public var createEvent: CreateEvent? { - get { - return (snapshot["createEvent"] as? Snapshot).flatMap { CreateEvent(snapshot: $0) } - } - set { - snapshot.updateValue(newValue?.snapshot, forKey: "createEvent") - } + public var variables: GraphQLMap? { + return ["name": name, "when": when, "where": `where`, "description": description] } - public struct CreateEvent: GraphQLSelectionSet { - public static let possibleTypes = ["Event"] - - public static let selections: [GraphQLSelection] = [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), - GraphQLField("description", type: .scalar(String.self)), - GraphQLField("name", type: .scalar(String.self)), - GraphQLField("when", type: .scalar(String.self)), - GraphQLField("where", type: .scalar(String.self)), - GraphQLField("comments", type: .object(Comment.selections)), - ] - - public var snapshot: Snapshot - - public init(snapshot: Snapshot) { - self.snapshot = snapshot - } - - public init(id: GraphQLID, description: String? = nil, name: String? = nil, when: String? = nil, `where`: String? = nil, comments: Comment? = nil) { - self.init(snapshot: ["__typename": "Event", "id": id, "description": description, "name": name, "when": when, "where": `where`, "comments": comments.flatMap { $0.snapshot }]) - } - - public var __typename: String { - get { - return snapshot["__typename"]! as! String - } - set { - snapshot.updateValue(newValue, forKey: "__typename") - } - } - - public var id: GraphQLID { - get { - return snapshot["id"]! as! GraphQLID - } - set { - snapshot.updateValue(newValue, forKey: "id") - } - } - - public var description: String? { - get { - return snapshot["description"] as? String - } - set { - snapshot.updateValue(newValue, forKey: "description") - } - } - - public var name: String? { - get { - return snapshot["name"] as? String - } - set { - snapshot.updateValue(newValue, forKey: "name") - } - } - - public var when: String? { - get { - return snapshot["when"] as? String - } - set { - snapshot.updateValue(newValue, forKey: "when") - } - } - - public var `where`: String? { - get { - return snapshot["where"] as? String - } - set { - snapshot.updateValue(newValue, forKey: "where") - } - } - - /// Paginate through all comments belonging to an individual post. - public var comments: Comment? { - get { - return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } - } - set { - snapshot.updateValue(newValue?.snapshot, forKey: "comments") - } - } - - public var fragments: Fragments { - get { - return Fragments(snapshot: snapshot) - } - set { - snapshot += newValue.snapshot - } - } - - public struct Fragments { - public var snapshot: Snapshot - - public var event: Event { - get { - return Event(snapshot: snapshot) - } - set { - snapshot += newValue.snapshot - } - } - } - - public struct Comment: GraphQLSelectionSet { - public static let possibleTypes = ["CommentConnection"] + public struct Data: GraphQLSelectionSet { + public static let possibleTypes = ["Mutation"] public static let selections: [GraphQLSelection] = [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("items", type: .list(.object(Item.selections))), + GraphQLField("createEvent", arguments: ["name": GraphQLVariable("name"), "when": GraphQLVariable("when"), "where": GraphQLVariable("where"), "description": GraphQLVariable("description")], type: .object(CreateEvent.selections)), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { - self.snapshot = snapshot - } - - public init(items: [Item?]? = nil) { - self.init(snapshot: ["__typename": "CommentConnection", "items": items.flatMap { $0.map { $0.flatMap { $0.snapshot } } }]) + self.snapshot = snapshot } - public var __typename: String { - get { - return snapshot["__typename"]! as! String - } - set { - snapshot.updateValue(newValue, forKey: "__typename") - } + public init(createEvent: CreateEvent? = nil) { + self.init(snapshot: ["__typename": "Mutation", "createEvent": createEvent.flatMap { $0.snapshot }]) } - public var items: [Item?]? { - get { - return (snapshot["items"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { Item(snapshot: $0) } } } - } - set { - snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "items") - } + /// Create a single event. + public var createEvent: CreateEvent? { + get { + return (snapshot["createEvent"] as? Snapshot).flatMap { CreateEvent(snapshot: $0) } + } + set { + snapshot.updateValue(newValue?.snapshot, forKey: "createEvent") + } } - public struct Item: GraphQLSelectionSet { - public static let possibleTypes = ["Comment"] + public struct CreateEvent: GraphQLSelectionSet { + public static let possibleTypes = ["Event"] - public static let selections: [GraphQLSelection] = [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("eventId", type: .nonNull(.scalar(GraphQLID.self))), - GraphQLField("commentId", type: .nonNull(.scalar(String.self))), - GraphQLField("content", type: .nonNull(.scalar(String.self))), - GraphQLField("createdAt", type: .nonNull(.scalar(String.self))), - ] + public static let selections: [GraphQLSelection] = [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), + GraphQLField("description", type: .scalar(String.self)), + GraphQLField("name", type: .scalar(String.self)), + GraphQLField("when", type: .scalar(String.self)), + GraphQLField("where", type: .scalar(String.self)), + GraphQLField("comments", type: .object(Comment.selections)), + ] - public var snapshot: Snapshot + public var snapshot: Snapshot - public init(snapshot: Snapshot) { - self.snapshot = snapshot - } + public init(snapshot: Snapshot) { + self.snapshot = snapshot + } - public init(eventId: GraphQLID, commentId: String, content: String, createdAt: String) { - self.init(snapshot: ["__typename": "Comment", "eventId": eventId, "commentId": commentId, "content": content, "createdAt": createdAt]) - } + public init(id: GraphQLID, description: String? = nil, name: String? = nil, when: String? = nil, where: String? = nil, comments: Comment? = nil) { + self.init(snapshot: ["__typename": "Event", "id": id, "description": description, "name": name, "when": when, "where": `where`, "comments": comments.flatMap { $0.snapshot }]) + } - public var __typename: String { - get { - return snapshot["__typename"]! as! String + public var __typename: String { + get { + return snapshot["__typename"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "__typename") + } } - set { - snapshot.updateValue(newValue, forKey: "__typename") + + public var id: GraphQLID { + get { + return snapshot["id"]! as! GraphQLID + } + set { + snapshot.updateValue(newValue, forKey: "id") + } } - } - /// The id of the comment's parent event. - public var eventId: GraphQLID { - get { - return snapshot["eventId"]! as! GraphQLID + public var description: String? { + get { + return snapshot["description"] as? String + } + set { + snapshot.updateValue(newValue, forKey: "description") + } } - set { - snapshot.updateValue(newValue, forKey: "eventId") + + public var name: String? { + get { + return snapshot["name"] as? String + } + set { + snapshot.updateValue(newValue, forKey: "name") + } } - } - /// A unique identifier for the comment. - public var commentId: String { - get { - return snapshot["commentId"]! as! String + public var when: String? { + get { + return snapshot["when"] as? String + } + set { + snapshot.updateValue(newValue, forKey: "when") + } } - set { - snapshot.updateValue(newValue, forKey: "commentId") + + public var `where`: String? { + get { + return snapshot["where"] as? String + } + set { + snapshot.updateValue(newValue, forKey: "where") + } } - } - /// The comment's content. - public var content: String { - get { - return snapshot["content"]! as! String + /// Paginate through all comments belonging to an individual post. + public var comments: Comment? { + get { + return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } + } + set { + snapshot.updateValue(newValue?.snapshot, forKey: "comments") + } } - set { - snapshot.updateValue(newValue, forKey: "content") + + public var fragments: Fragments { + get { + return Fragments(snapshot: snapshot) + } + set { + snapshot += newValue.snapshot + } } - } - /// The comment timestamp. This field is indexed to enable sorted pagination. - public var createdAt: String { - get { - return snapshot["createdAt"]! as! String + public struct Fragments { + public var snapshot: Snapshot + + public var event: Event { + get { + return Event(snapshot: snapshot) + } + set { + snapshot += newValue.snapshot + } + } } - set { - snapshot.updateValue(newValue, forKey: "createdAt") + + public struct Comment: GraphQLSelectionSet { + public static let possibleTypes = ["CommentConnection"] + + public static let selections: [GraphQLSelection] = [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("items", type: .list(.object(Item.selections))), + ] + + public var snapshot: Snapshot + + public init(snapshot: Snapshot) { + self.snapshot = snapshot + } + + public init(items: [Item?]? = nil) { + self.init(snapshot: ["__typename": "CommentConnection", "items": items.flatMap { $0.map { $0.flatMap { $0.snapshot } } }]) + } + + public var __typename: String { + get { + return snapshot["__typename"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "__typename") + } + } + + public var items: [Item?]? { + get { + return (snapshot["items"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { Item(snapshot: $0) } } } + } + set { + snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "items") + } + } + + public struct Item: GraphQLSelectionSet { + public static let possibleTypes = ["Comment"] + + public static let selections: [GraphQLSelection] = [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("eventId", type: .nonNull(.scalar(GraphQLID.self))), + GraphQLField("commentId", type: .nonNull(.scalar(String.self))), + GraphQLField("content", type: .nonNull(.scalar(String.self))), + GraphQLField("createdAt", type: .nonNull(.scalar(String.self))), + ] + + public var snapshot: Snapshot + + public init(snapshot: Snapshot) { + self.snapshot = snapshot + } + + public init(eventId: GraphQLID, commentId: String, content: String, createdAt: String) { + self.init(snapshot: ["__typename": "Comment", "eventId": eventId, "commentId": commentId, "content": content, "createdAt": createdAt]) + } + + public var __typename: String { + get { + return snapshot["__typename"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "__typename") + } + } + + /// The id of the comment's parent event. + public var eventId: GraphQLID { + get { + return snapshot["eventId"]! as! GraphQLID + } + set { + snapshot.updateValue(newValue, forKey: "eventId") + } + } + + /// A unique identifier for the comment. + public var commentId: String { + get { + return snapshot["commentId"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "commentId") + } + } + + /// The comment's content. + public var content: String { + get { + return snapshot["content"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "content") + } + } + + /// The comment timestamp. This field is indexed to enable sorted pagination. + public var createdAt: String { + get { + return snapshot["createdAt"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "createdAt") + } + } + } } - } } - } } - } } public final class DeleteEventMutation: GraphQLMutation { - public static let operationString = - "mutation DeleteEvent($id: ID!) {\n deleteEvent(id: $id) {\n __typename\n id\n description\n name\n }\n}" - - public var id: GraphQLID - - public init(id: GraphQLID) { - self.id = id - } - - public var variables: GraphQLMap? { - return ["id": id] - } - - public struct Data: GraphQLSelectionSet { - public static let possibleTypes = ["Mutation"] + public static let operationString = + "mutation DeleteEvent($id: ID!) {\n deleteEvent(id: $id) {\n __typename\n id\n description\n name\n }\n}" - public static let selections: [GraphQLSelection] = [ - GraphQLField("deleteEvent", arguments: ["id": GraphQLVariable("id")], type: .object(DeleteEvent.selections)), - ] - - public var snapshot: Snapshot - - public init(snapshot: Snapshot) { - self.snapshot = snapshot - } + public var id: GraphQLID - public init(deleteEvent: DeleteEvent? = nil) { - self.init(snapshot: ["__typename": "Mutation", "deleteEvent": deleteEvent.flatMap { $0.snapshot }]) + public init(id: GraphQLID) { + self.id = id } - /// Delete a single event by id. - public var deleteEvent: DeleteEvent? { - get { - return (snapshot["deleteEvent"] as? Snapshot).flatMap { DeleteEvent(snapshot: $0) } - } - set { - snapshot.updateValue(newValue?.snapshot, forKey: "deleteEvent") - } + public var variables: GraphQLMap? { + return ["id": id] } - public struct DeleteEvent: GraphQLSelectionSet { - public static let possibleTypes = ["Event"] + public struct Data: GraphQLSelectionSet { + public static let possibleTypes = ["Mutation"] - public static let selections: [GraphQLSelection] = [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), - GraphQLField("description", type: .scalar(String.self)), - GraphQLField("name", type: .scalar(String.self)), - ] - - public var snapshot: Snapshot - - public init(snapshot: Snapshot) { - self.snapshot = snapshot - } - - public init(id: GraphQLID, description: String? = nil, name: String? = nil) { - self.init(snapshot: ["__typename": "Event", "id": id, "description": description, "name": name]) - } + public static let selections: [GraphQLSelection] = [ + GraphQLField("deleteEvent", arguments: ["id": GraphQLVariable("id")], type: .object(DeleteEvent.selections)), + ] - public var __typename: String { - get { - return snapshot["__typename"]! as! String - } - set { - snapshot.updateValue(newValue, forKey: "__typename") - } - } + public var snapshot: Snapshot - public var id: GraphQLID { - get { - return snapshot["id"]! as! GraphQLID - } - set { - snapshot.updateValue(newValue, forKey: "id") + public init(snapshot: Snapshot) { + self.snapshot = snapshot } - } - public var description: String? { - get { - return snapshot["description"] as? String - } - set { - snapshot.updateValue(newValue, forKey: "description") + public init(deleteEvent: DeleteEvent? = nil) { + self.init(snapshot: ["__typename": "Mutation", "deleteEvent": deleteEvent.flatMap { $0.snapshot }]) } - } - public var name: String? { - get { - return snapshot["name"] as? String - } - set { - snapshot.updateValue(newValue, forKey: "name") + /// Delete a single event by id. + public var deleteEvent: DeleteEvent? { + get { + return (snapshot["deleteEvent"] as? Snapshot).flatMap { DeleteEvent(snapshot: $0) } + } + set { + snapshot.updateValue(newValue?.snapshot, forKey: "deleteEvent") + } } - } - } - } -} - -public final class CommentOnEventMutation: GraphQLMutation { - public static let operationString = - "mutation CommentOnEvent($eventId: ID!, $content: String!, $createdAt: String!) {\n commentOnEvent(eventId: $eventId, content: $content, createdAt: $createdAt) {\n __typename\n eventId\n content\n commentId\n createdAt\n }\n}" - public var eventId: GraphQLID - public var content: String - public var createdAt: String + public struct DeleteEvent: GraphQLSelectionSet { + public static let possibleTypes = ["Event"] - public init(eventId: GraphQLID, content: String, createdAt: String) { - self.eventId = eventId - self.content = content - self.createdAt = createdAt - } + public static let selections: [GraphQLSelection] = [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), + GraphQLField("description", type: .scalar(String.self)), + GraphQLField("name", type: .scalar(String.self)), + ] - public var variables: GraphQLMap? { - return ["eventId": eventId, "content": content, "createdAt": createdAt] - } + public var snapshot: Snapshot - public struct Data: GraphQLSelectionSet { - public static let possibleTypes = ["Mutation"] + public init(snapshot: Snapshot) { + self.snapshot = snapshot + } - public static let selections: [GraphQLSelection] = [ - GraphQLField("commentOnEvent", arguments: ["eventId": GraphQLVariable("eventId"), "content": GraphQLVariable("content"), "createdAt": GraphQLVariable("createdAt")], type: .object(CommentOnEvent.selections)), - ] + public init(id: GraphQLID, description: String? = nil, name: String? = nil) { + self.init(snapshot: ["__typename": "Event", "id": id, "description": description, "name": name]) + } - public var snapshot: Snapshot + public var __typename: String { + get { + return snapshot["__typename"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "__typename") + } + } - public init(snapshot: Snapshot) { - self.snapshot = snapshot - } + public var id: GraphQLID { + get { + return snapshot["id"]! as! GraphQLID + } + set { + snapshot.updateValue(newValue, forKey: "id") + } + } - public init(commentOnEvent: CommentOnEvent? = nil) { - self.init(snapshot: ["__typename": "Mutation", "commentOnEvent": commentOnEvent.flatMap { $0.snapshot }]) - } + public var description: String? { + get { + return snapshot["description"] as? String + } + set { + snapshot.updateValue(newValue, forKey: "description") + } + } - /// Comment on an event. - public var commentOnEvent: CommentOnEvent? { - get { - return (snapshot["commentOnEvent"] as? Snapshot).flatMap { CommentOnEvent(snapshot: $0) } - } - set { - snapshot.updateValue(newValue?.snapshot, forKey: "commentOnEvent") - } + public var name: String? { + get { + return snapshot["name"] as? String + } + set { + snapshot.updateValue(newValue, forKey: "name") + } + } + } } +} - public struct CommentOnEvent: GraphQLSelectionSet { - public static let possibleTypes = ["Comment"] +public final class CommentOnEventMutation: GraphQLMutation { + public static let operationString = + "mutation CommentOnEvent($eventId: ID!, $content: String!, $createdAt: String!) {\n commentOnEvent(eventId: $eventId, content: $content, createdAt: $createdAt) {\n __typename\n eventId\n content\n commentId\n createdAt\n }\n}" - public static let selections: [GraphQLSelection] = [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("eventId", type: .nonNull(.scalar(GraphQLID.self))), - GraphQLField("content", type: .nonNull(.scalar(String.self))), - GraphQLField("commentId", type: .nonNull(.scalar(String.self))), - GraphQLField("createdAt", type: .nonNull(.scalar(String.self))), - ] + public var eventId: GraphQLID + public var content: String + public var createdAt: String - public var snapshot: Snapshot + public init(eventId: GraphQLID, content: String, createdAt: String) { + self.eventId = eventId + self.content = content + self.createdAt = createdAt + } - public init(snapshot: Snapshot) { - self.snapshot = snapshot - } + public var variables: GraphQLMap? { + return ["eventId": eventId, "content": content, "createdAt": createdAt] + } - public init(eventId: GraphQLID, content: String, commentId: String, createdAt: String) { - self.init(snapshot: ["__typename": "Comment", "eventId": eventId, "content": content, "commentId": commentId, "createdAt": createdAt]) - } + public struct Data: GraphQLSelectionSet { + public static let possibleTypes = ["Mutation"] - public var __typename: String { - get { - return snapshot["__typename"]! as! String - } - set { - snapshot.updateValue(newValue, forKey: "__typename") - } - } + public static let selections: [GraphQLSelection] = [ + GraphQLField("commentOnEvent", arguments: ["eventId": GraphQLVariable("eventId"), "content": GraphQLVariable("content"), "createdAt": GraphQLVariable("createdAt")], type: .object(CommentOnEvent.selections)), + ] - /// The id of the comment's parent event. - public var eventId: GraphQLID { - get { - return snapshot["eventId"]! as! GraphQLID - } - set { - snapshot.updateValue(newValue, forKey: "eventId") - } - } + public var snapshot: Snapshot - /// The comment's content. - public var content: String { - get { - return snapshot["content"]! as! String - } - set { - snapshot.updateValue(newValue, forKey: "content") + public init(snapshot: Snapshot) { + self.snapshot = snapshot } - } - /// A unique identifier for the comment. - public var commentId: String { - get { - return snapshot["commentId"]! as! String - } - set { - snapshot.updateValue(newValue, forKey: "commentId") + public init(commentOnEvent: CommentOnEvent? = nil) { + self.init(snapshot: ["__typename": "Mutation", "commentOnEvent": commentOnEvent.flatMap { $0.snapshot }]) } - } - /// The comment timestamp. This field is indexed to enable sorted pagination. - public var createdAt: String { - get { - return snapshot["createdAt"]! as! String - } - set { - snapshot.updateValue(newValue, forKey: "createdAt") + /// Comment on an event. + public var commentOnEvent: CommentOnEvent? { + get { + return (snapshot["commentOnEvent"] as? Snapshot).flatMap { CommentOnEvent(snapshot: $0) } + } + set { + snapshot.updateValue(newValue?.snapshot, forKey: "commentOnEvent") + } } - } - } - } -} - -public final class GetEventQuery: GraphQLQuery { - public static let operationString = - "query GetEvent($id: ID!) {\n getEvent(id: $id) {\n __typename\n ...Event\n }\n}" - - public static var requestString: String { return operationString.appending(Event.fragmentString) } - - public var id: GraphQLID - - public init(id: GraphQLID) { - self.id = id - } - - public var variables: GraphQLMap? { - return ["id": id] - } - - public struct Data: GraphQLSelectionSet { - public static let possibleTypes = ["Query"] - - public static let selections: [GraphQLSelection] = [ - GraphQLField("getEvent", arguments: ["id": GraphQLVariable("id")], type: .object(GetEvent.selections)), - ] - - public var snapshot: Snapshot - - public init(snapshot: Snapshot) { - self.snapshot = snapshot - } - - public init(getEvent: GetEvent? = nil) { - self.init(snapshot: ["__typename": "Query", "getEvent": getEvent.flatMap { $0.snapshot }]) - } - - /// Get a single event by id. - public var getEvent: GetEvent? { - get { - return (snapshot["getEvent"] as? Snapshot).flatMap { GetEvent(snapshot: $0) } - } - set { - snapshot.updateValue(newValue?.snapshot, forKey: "getEvent") - } - } - public struct GetEvent: GraphQLSelectionSet { - public static let possibleTypes = ["Event"] + public struct CommentOnEvent: GraphQLSelectionSet { + public static let possibleTypes = ["Comment"] - public static let selections: [GraphQLSelection] = [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), - GraphQLField("description", type: .scalar(String.self)), - GraphQLField("name", type: .scalar(String.self)), - GraphQLField("when", type: .scalar(String.self)), - GraphQLField("where", type: .scalar(String.self)), - GraphQLField("comments", type: .object(Comment.selections)), - ] + public static let selections: [GraphQLSelection] = [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("eventId", type: .nonNull(.scalar(GraphQLID.self))), + GraphQLField("content", type: .nonNull(.scalar(String.self))), + GraphQLField("commentId", type: .nonNull(.scalar(String.self))), + GraphQLField("createdAt", type: .nonNull(.scalar(String.self))), + ] - public var snapshot: Snapshot + public var snapshot: Snapshot - public init(snapshot: Snapshot) { - self.snapshot = snapshot - } + public init(snapshot: Snapshot) { + self.snapshot = snapshot + } - public init(id: GraphQLID, description: String? = nil, name: String? = nil, when: String? = nil, `where`: String? = nil, comments: Comment? = nil) { - self.init(snapshot: ["__typename": "Event", "id": id, "description": description, "name": name, "when": when, "where": `where`, "comments": comments.flatMap { $0.snapshot }]) - } + public init(eventId: GraphQLID, content: String, commentId: String, createdAt: String) { + self.init(snapshot: ["__typename": "Comment", "eventId": eventId, "content": content, "commentId": commentId, "createdAt": createdAt]) + } - public var __typename: String { - get { - return snapshot["__typename"]! as! String - } - set { - snapshot.updateValue(newValue, forKey: "__typename") - } - } + public var __typename: String { + get { + return snapshot["__typename"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "__typename") + } + } - public var id: GraphQLID { - get { - return snapshot["id"]! as! GraphQLID - } - set { - snapshot.updateValue(newValue, forKey: "id") - } - } + /// The id of the comment's parent event. + public var eventId: GraphQLID { + get { + return snapshot["eventId"]! as! GraphQLID + } + set { + snapshot.updateValue(newValue, forKey: "eventId") + } + } - public var description: String? { - get { - return snapshot["description"] as? String - } - set { - snapshot.updateValue(newValue, forKey: "description") - } - } + /// The comment's content. + public var content: String { + get { + return snapshot["content"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "content") + } + } - public var name: String? { - get { - return snapshot["name"] as? String - } - set { - snapshot.updateValue(newValue, forKey: "name") - } - } + /// A unique identifier for the comment. + public var commentId: String { + get { + return snapshot["commentId"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "commentId") + } + } - public var when: String? { - get { - return snapshot["when"] as? String - } - set { - snapshot.updateValue(newValue, forKey: "when") + /// The comment timestamp. This field is indexed to enable sorted pagination. + public var createdAt: String { + get { + return snapshot["createdAt"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "createdAt") + } + } } - } + } +} - public var `where`: String? { - get { - return snapshot["where"] as? String - } - set { - snapshot.updateValue(newValue, forKey: "where") - } - } +public final class GetEventQuery: GraphQLQuery { + public static let operationString = + "query GetEvent($id: ID!) {\n getEvent(id: $id) {\n __typename\n ...Event\n }\n}" - /// Paginate through all comments belonging to an individual post. - public var comments: Comment? { - get { - return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } - } - set { - snapshot.updateValue(newValue?.snapshot, forKey: "comments") - } - } + public static var requestString: String { return operationString.appending(Event.fragmentString) } - public var fragments: Fragments { - get { - return Fragments(snapshot: snapshot) - } - set { - snapshot += newValue.snapshot - } - } + public var id: GraphQLID - public struct Fragments { - public var snapshot: Snapshot + public init(id: GraphQLID) { + self.id = id + } - public var event: Event { - get { - return Event(snapshot: snapshot) - } - set { - snapshot += newValue.snapshot - } - } - } + public var variables: GraphQLMap? { + return ["id": id] + } - public struct Comment: GraphQLSelectionSet { - public static let possibleTypes = ["CommentConnection"] + public struct Data: GraphQLSelectionSet { + public static let possibleTypes = ["Query"] public static let selections: [GraphQLSelection] = [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("items", type: .list(.object(Item.selections))), + GraphQLField("getEvent", arguments: ["id": GraphQLVariable("id")], type: .object(GetEvent.selections)), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { - self.snapshot = snapshot - } - - public init(items: [Item?]? = nil) { - self.init(snapshot: ["__typename": "CommentConnection", "items": items.flatMap { $0.map { $0.flatMap { $0.snapshot } } }]) + self.snapshot = snapshot } - public var __typename: String { - get { - return snapshot["__typename"]! as! String - } - set { - snapshot.updateValue(newValue, forKey: "__typename") - } + public init(getEvent: GetEvent? = nil) { + self.init(snapshot: ["__typename": "Query", "getEvent": getEvent.flatMap { $0.snapshot }]) } - public var items: [Item?]? { - get { - return (snapshot["items"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { Item(snapshot: $0) } } } - } - set { - snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "items") - } + /// Get a single event by id. + public var getEvent: GetEvent? { + get { + return (snapshot["getEvent"] as? Snapshot).flatMap { GetEvent(snapshot: $0) } + } + set { + snapshot.updateValue(newValue?.snapshot, forKey: "getEvent") + } } - public struct Item: GraphQLSelectionSet { - public static let possibleTypes = ["Comment"] + public struct GetEvent: GraphQLSelectionSet { + public static let possibleTypes = ["Event"] - public static let selections: [GraphQLSelection] = [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("eventId", type: .nonNull(.scalar(GraphQLID.self))), - GraphQLField("commentId", type: .nonNull(.scalar(String.self))), - GraphQLField("content", type: .nonNull(.scalar(String.self))), - GraphQLField("createdAt", type: .nonNull(.scalar(String.self))), - ] + public static let selections: [GraphQLSelection] = [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), + GraphQLField("description", type: .scalar(String.self)), + GraphQLField("name", type: .scalar(String.self)), + GraphQLField("when", type: .scalar(String.self)), + GraphQLField("where", type: .scalar(String.self)), + GraphQLField("comments", type: .object(Comment.selections)), + ] - public var snapshot: Snapshot + public var snapshot: Snapshot - public init(snapshot: Snapshot) { - self.snapshot = snapshot - } + public init(snapshot: Snapshot) { + self.snapshot = snapshot + } - public init(eventId: GraphQLID, commentId: String, content: String, createdAt: String) { - self.init(snapshot: ["__typename": "Comment", "eventId": eventId, "commentId": commentId, "content": content, "createdAt": createdAt]) - } + public init(id: GraphQLID, description: String? = nil, name: String? = nil, when: String? = nil, where: String? = nil, comments: Comment? = nil) { + self.init(snapshot: ["__typename": "Event", "id": id, "description": description, "name": name, "when": when, "where": `where`, "comments": comments.flatMap { $0.snapshot }]) + } - public var __typename: String { - get { - return snapshot["__typename"]! as! String + public var __typename: String { + get { + return snapshot["__typename"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "__typename") + } } - set { - snapshot.updateValue(newValue, forKey: "__typename") + + public var id: GraphQLID { + get { + return snapshot["id"]! as! GraphQLID + } + set { + snapshot.updateValue(newValue, forKey: "id") + } } - } - /// The id of the comment's parent event. - public var eventId: GraphQLID { - get { - return snapshot["eventId"]! as! GraphQLID + public var description: String? { + get { + return snapshot["description"] as? String + } + set { + snapshot.updateValue(newValue, forKey: "description") + } } - set { - snapshot.updateValue(newValue, forKey: "eventId") + + public var name: String? { + get { + return snapshot["name"] as? String + } + set { + snapshot.updateValue(newValue, forKey: "name") + } } - } - /// A unique identifier for the comment. - public var commentId: String { - get { - return snapshot["commentId"]! as! String + public var when: String? { + get { + return snapshot["when"] as? String + } + set { + snapshot.updateValue(newValue, forKey: "when") + } } - set { - snapshot.updateValue(newValue, forKey: "commentId") + + public var `where`: String? { + get { + return snapshot["where"] as? String + } + set { + snapshot.updateValue(newValue, forKey: "where") + } } - } - /// The comment's content. - public var content: String { - get { - return snapshot["content"]! as! String + /// Paginate through all comments belonging to an individual post. + public var comments: Comment? { + get { + return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } + } + set { + snapshot.updateValue(newValue?.snapshot, forKey: "comments") + } } - set { - snapshot.updateValue(newValue, forKey: "content") + + public var fragments: Fragments { + get { + return Fragments(snapshot: snapshot) + } + set { + snapshot += newValue.snapshot + } } - } - /// The comment timestamp. This field is indexed to enable sorted pagination. - public var createdAt: String { - get { - return snapshot["createdAt"]! as! String + public struct Fragments { + public var snapshot: Snapshot + + public var event: Event { + get { + return Event(snapshot: snapshot) + } + set { + snapshot += newValue.snapshot + } + } } - set { - snapshot.updateValue(newValue, forKey: "createdAt") + + public struct Comment: GraphQLSelectionSet { + public static let possibleTypes = ["CommentConnection"] + + public static let selections: [GraphQLSelection] = [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("items", type: .list(.object(Item.selections))), + ] + + public var snapshot: Snapshot + + public init(snapshot: Snapshot) { + self.snapshot = snapshot + } + + public init(items: [Item?]? = nil) { + self.init(snapshot: ["__typename": "CommentConnection", "items": items.flatMap { $0.map { $0.flatMap { $0.snapshot } } }]) + } + + public var __typename: String { + get { + return snapshot["__typename"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "__typename") + } + } + + public var items: [Item?]? { + get { + return (snapshot["items"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { Item(snapshot: $0) } } } + } + set { + snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "items") + } + } + + public struct Item: GraphQLSelectionSet { + public static let possibleTypes = ["Comment"] + + public static let selections: [GraphQLSelection] = [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("eventId", type: .nonNull(.scalar(GraphQLID.self))), + GraphQLField("commentId", type: .nonNull(.scalar(String.self))), + GraphQLField("content", type: .nonNull(.scalar(String.self))), + GraphQLField("createdAt", type: .nonNull(.scalar(String.self))), + ] + + public var snapshot: Snapshot + + public init(snapshot: Snapshot) { + self.snapshot = snapshot + } + + public init(eventId: GraphQLID, commentId: String, content: String, createdAt: String) { + self.init(snapshot: ["__typename": "Comment", "eventId": eventId, "commentId": commentId, "content": content, "createdAt": createdAt]) + } + + public var __typename: String { + get { + return snapshot["__typename"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "__typename") + } + } + + /// The id of the comment's parent event. + public var eventId: GraphQLID { + get { + return snapshot["eventId"]! as! GraphQLID + } + set { + snapshot.updateValue(newValue, forKey: "eventId") + } + } + + /// A unique identifier for the comment. + public var commentId: String { + get { + return snapshot["commentId"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "commentId") + } + } + + /// The comment's content. + public var content: String { + get { + return snapshot["content"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "content") + } + } + + /// The comment timestamp. This field is indexed to enable sorted pagination. + public var createdAt: String { + get { + return snapshot["createdAt"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "createdAt") + } + } + } } - } } - } } - } } public final class ListEventsQuery: GraphQLQuery { - public static let operationString = - "query ListEvents($limit: Int, $nextToken: String) {\n listEvents(limit: $limit, nextToken: $nextToken) {\n __typename\n items {\n __typename\n ...Event\n }\n nextToken\n }\n}" - - public static var requestString: String { return operationString.appending(Event.fragmentString) } - - public var limit: Int? - public var nextToken: String? - - public init(limit: Int? = nil, nextToken: String? = nil) { - self.limit = limit - self.nextToken = nextToken - } - - public var variables: GraphQLMap? { - return ["limit": limit, "nextToken": nextToken] - } - - public struct Data: GraphQLSelectionSet { - public static let possibleTypes = ["Query"] - - public static let selections: [GraphQLSelection] = [ - GraphQLField("listEvents", arguments: ["limit": GraphQLVariable("limit"), "nextToken": GraphQLVariable("nextToken")], type: .object(ListEvent.selections)), - ] + public static let operationString = + "query ListEvents($limit: Int, $nextToken: String) {\n listEvents(limit: $limit, nextToken: $nextToken) {\n __typename\n items {\n __typename\n ...Event\n }\n nextToken\n }\n}" - public var snapshot: Snapshot + public static var requestString: String { return operationString.appending(Event.fragmentString) } - public init(snapshot: Snapshot) { - self.snapshot = snapshot - } + public var limit: Int? + public var nextToken: String? - public init(listEvents: ListEvent? = nil) { - self.init(snapshot: ["__typename": "Query", "listEvents": listEvents.flatMap { $0.snapshot }]) + public init(limit: Int? = nil, nextToken: String? = nil) { + self.limit = limit + self.nextToken = nextToken } - /// Paginate through events. - public var listEvents: ListEvent? { - get { - return (snapshot["listEvents"] as? Snapshot).flatMap { ListEvent(snapshot: $0) } - } - set { - snapshot.updateValue(newValue?.snapshot, forKey: "listEvents") - } + public var variables: GraphQLMap? { + return ["limit": limit, "nextToken": nextToken] } - public struct ListEvent: GraphQLSelectionSet { - public static let possibleTypes = ["EventConnection"] - - public static let selections: [GraphQLSelection] = [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("items", type: .list(.object(Item.selections))), - GraphQLField("nextToken", type: .scalar(String.self)), - ] - - public var snapshot: Snapshot - - public init(snapshot: Snapshot) { - self.snapshot = snapshot - } - - public init(items: [Item?]? = nil, nextToken: String? = nil) { - self.init(snapshot: ["__typename": "EventConnection", "items": items.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, "nextToken": nextToken]) - } - - public var __typename: String { - get { - return snapshot["__typename"]! as! String - } - set { - snapshot.updateValue(newValue, forKey: "__typename") - } - } - - public var items: [Item?]? { - get { - return (snapshot["items"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { Item(snapshot: $0) } } } - } - set { - snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "items") - } - } - - public var nextToken: String? { - get { - return snapshot["nextToken"] as? String - } - set { - snapshot.updateValue(newValue, forKey: "nextToken") - } - } - - public struct Item: GraphQLSelectionSet { - public static let possibleTypes = ["Event"] + public struct Data: GraphQLSelectionSet { + public static let possibleTypes = ["Query"] public static let selections: [GraphQLSelection] = [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), - GraphQLField("description", type: .scalar(String.self)), - GraphQLField("name", type: .scalar(String.self)), - GraphQLField("when", type: .scalar(String.self)), - GraphQLField("where", type: .scalar(String.self)), - GraphQLField("comments", type: .object(Comment.selections)), + GraphQLField("listEvents", arguments: ["limit": GraphQLVariable("limit"), "nextToken": GraphQLVariable("nextToken")], type: .object(ListEvent.selections)), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { - self.snapshot = snapshot - } - - public init(id: GraphQLID, description: String? = nil, name: String? = nil, when: String? = nil, `where`: String? = nil, comments: Comment? = nil) { - self.init(snapshot: ["__typename": "Event", "id": id, "description": description, "name": name, "when": when, "where": `where`, "comments": comments.flatMap { $0.snapshot }]) + self.snapshot = snapshot } - public var __typename: String { - get { - return snapshot["__typename"]! as! String - } - set { - snapshot.updateValue(newValue, forKey: "__typename") - } + public init(listEvents: ListEvent? = nil) { + self.init(snapshot: ["__typename": "Query", "listEvents": listEvents.flatMap { $0.snapshot }]) } - public var id: GraphQLID { - get { - return snapshot["id"]! as! GraphQLID - } - set { - snapshot.updateValue(newValue, forKey: "id") - } + /// Paginate through events. + public var listEvents: ListEvent? { + get { + return (snapshot["listEvents"] as? Snapshot).flatMap { ListEvent(snapshot: $0) } + } + set { + snapshot.updateValue(newValue?.snapshot, forKey: "listEvents") + } } - public var description: String? { - get { - return snapshot["description"] as? String - } - set { - snapshot.updateValue(newValue, forKey: "description") - } - } + public struct ListEvent: GraphQLSelectionSet { + public static let possibleTypes = ["EventConnection"] - public var name: String? { - get { - return snapshot["name"] as? String - } - set { - snapshot.updateValue(newValue, forKey: "name") - } - } + public static let selections: [GraphQLSelection] = [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("items", type: .list(.object(Item.selections))), + GraphQLField("nextToken", type: .scalar(String.self)), + ] - public var when: String? { - get { - return snapshot["when"] as? String - } - set { - snapshot.updateValue(newValue, forKey: "when") - } - } + public var snapshot: Snapshot - public var `where`: String? { - get { - return snapshot["where"] as? String - } - set { - snapshot.updateValue(newValue, forKey: "where") - } - } + public init(snapshot: Snapshot) { + self.snapshot = snapshot + } - /// Paginate through all comments belonging to an individual post. - public var comments: Comment? { - get { - return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } - } - set { - snapshot.updateValue(newValue?.snapshot, forKey: "comments") - } - } + public init(items: [Item?]? = nil, nextToken: String? = nil) { + self.init(snapshot: ["__typename": "EventConnection", "items": items.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, "nextToken": nextToken]) + } - public var fragments: Fragments { - get { - return Fragments(snapshot: snapshot) - } - set { - snapshot += newValue.snapshot - } - } + public var __typename: String { + get { + return snapshot["__typename"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "__typename") + } + } - public struct Fragments { - public var snapshot: Snapshot + public var items: [Item?]? { + get { + return (snapshot["items"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { Item(snapshot: $0) } } } + } + set { + snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "items") + } + } - public var event: Event { - get { - return Event(snapshot: snapshot) + public var nextToken: String? { + get { + return snapshot["nextToken"] as? String + } + set { + snapshot.updateValue(newValue, forKey: "nextToken") + } } - set { - snapshot += newValue.snapshot + + public struct Item: GraphQLSelectionSet { + public static let possibleTypes = ["Event"] + + public static let selections: [GraphQLSelection] = [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), + GraphQLField("description", type: .scalar(String.self)), + GraphQLField("name", type: .scalar(String.self)), + GraphQLField("when", type: .scalar(String.self)), + GraphQLField("where", type: .scalar(String.self)), + GraphQLField("comments", type: .object(Comment.selections)), + ] + + public var snapshot: Snapshot + + public init(snapshot: Snapshot) { + self.snapshot = snapshot + } + + public init(id: GraphQLID, description: String? = nil, name: String? = nil, when: String? = nil, where: String? = nil, comments: Comment? = nil) { + self.init(snapshot: ["__typename": "Event", "id": id, "description": description, "name": name, "when": when, "where": `where`, "comments": comments.flatMap { $0.snapshot }]) + } + + public var __typename: String { + get { + return snapshot["__typename"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "__typename") + } + } + + public var id: GraphQLID { + get { + return snapshot["id"]! as! GraphQLID + } + set { + snapshot.updateValue(newValue, forKey: "id") + } + } + + public var description: String? { + get { + return snapshot["description"] as? String + } + set { + snapshot.updateValue(newValue, forKey: "description") + } + } + + public var name: String? { + get { + return snapshot["name"] as? String + } + set { + snapshot.updateValue(newValue, forKey: "name") + } + } + + public var when: String? { + get { + return snapshot["when"] as? String + } + set { + snapshot.updateValue(newValue, forKey: "when") + } + } + + public var `where`: String? { + get { + return snapshot["where"] as? String + } + set { + snapshot.updateValue(newValue, forKey: "where") + } + } + + /// Paginate through all comments belonging to an individual post. + public var comments: Comment? { + get { + return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } + } + set { + snapshot.updateValue(newValue?.snapshot, forKey: "comments") + } + } + + public var fragments: Fragments { + get { + return Fragments(snapshot: snapshot) + } + set { + snapshot += newValue.snapshot + } + } + + public struct Fragments { + public var snapshot: Snapshot + + public var event: Event { + get { + return Event(snapshot: snapshot) + } + set { + snapshot += newValue.snapshot + } + } + } + + public struct Comment: GraphQLSelectionSet { + public static let possibleTypes = ["CommentConnection"] + + public static let selections: [GraphQLSelection] = [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("items", type: .list(.object(Item.selections))), + ] + + public var snapshot: Snapshot + + public init(snapshot: Snapshot) { + self.snapshot = snapshot + } + + public init(items: [Item?]? = nil) { + self.init(snapshot: ["__typename": "CommentConnection", "items": items.flatMap { $0.map { $0.flatMap { $0.snapshot } } }]) + } + + public var __typename: String { + get { + return snapshot["__typename"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "__typename") + } + } + + public var items: [Item?]? { + get { + return (snapshot["items"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { Item(snapshot: $0) } } } + } + set { + snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "items") + } + } + + public struct Item: GraphQLSelectionSet { + public static let possibleTypes = ["Comment"] + + public static let selections: [GraphQLSelection] = [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("eventId", type: .nonNull(.scalar(GraphQLID.self))), + GraphQLField("commentId", type: .nonNull(.scalar(String.self))), + GraphQLField("content", type: .nonNull(.scalar(String.self))), + GraphQLField("createdAt", type: .nonNull(.scalar(String.self))), + ] + + public var snapshot: Snapshot + + public init(snapshot: Snapshot) { + self.snapshot = snapshot + } + + public init(eventId: GraphQLID, commentId: String, content: String, createdAt: String) { + self.init(snapshot: ["__typename": "Comment", "eventId": eventId, "commentId": commentId, "content": content, "createdAt": createdAt]) + } + + public var __typename: String { + get { + return snapshot["__typename"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "__typename") + } + } + + /// The id of the comment's parent event. + public var eventId: GraphQLID { + get { + return snapshot["eventId"]! as! GraphQLID + } + set { + snapshot.updateValue(newValue, forKey: "eventId") + } + } + + /// A unique identifier for the comment. + public var commentId: String { + get { + return snapshot["commentId"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "commentId") + } + } + + /// The comment's content. + public var content: String { + get { + return snapshot["content"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "content") + } + } + + /// The comment timestamp. This field is indexed to enable sorted pagination. + public var createdAt: String { + get { + return snapshot["createdAt"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "createdAt") + } + } + } + } } - } } + } +} - public struct Comment: GraphQLSelectionSet { - public static let possibleTypes = ["CommentConnection"] +public final class NewCommentOnEventSubscription: GraphQLSubscription { + public static let operationString = + "subscription NewCommentOnEvent($eventId: String!) {\n subscribeToEventComments(eventId: $eventId) {\n __typename\n eventId\n commentId\n content\n createdAt\n }\n}" - public static let selections: [GraphQLSelection] = [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("items", type: .list(.object(Item.selections))), - ] + public var eventId: String - public var snapshot: Snapshot + public init(eventId: String) { + self.eventId = eventId + } - public init(snapshot: Snapshot) { - self.snapshot = snapshot - } + public var variables: GraphQLMap? { + return ["eventId": eventId] + } - public init(items: [Item?]? = nil) { - self.init(snapshot: ["__typename": "CommentConnection", "items": items.flatMap { $0.map { $0.flatMap { $0.snapshot } } }]) - } + public struct Data: GraphQLSelectionSet { + public static let possibleTypes = ["Subscription"] - public var __typename: String { - get { - return snapshot["__typename"]! as! String - } - set { - snapshot.updateValue(newValue, forKey: "__typename") - } - } + public static let selections: [GraphQLSelection] = [ + GraphQLField("subscribeToEventComments", arguments: ["eventId": GraphQLVariable("eventId")], type: .object(SubscribeToEventComment.selections)), + ] - public var items: [Item?]? { + public var snapshot: Snapshot + + public init(snapshot: Snapshot) { + self.snapshot = snapshot + } + + public init(subscribeToEventComments: SubscribeToEventComment? = nil) { + self.init(snapshot: ["__typename": "Subscription", "subscribeToEventComments": subscribeToEventComments.flatMap { $0.snapshot }]) + } + + public var subscribeToEventComments: SubscribeToEventComment? { get { - return (snapshot["items"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { Item(snapshot: $0) } } } + return (snapshot["subscribeToEventComments"] as? Snapshot).flatMap { SubscribeToEventComment(snapshot: $0) } } set { - snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "items") + snapshot.updateValue(newValue?.snapshot, forKey: "subscribeToEventComments") } - } + } - public struct Item: GraphQLSelectionSet { + public struct SubscribeToEventComment: GraphQLSelectionSet { public static let possibleTypes = ["Comment"] public static let selections: [GraphQLSelection] = [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("eventId", type: .nonNull(.scalar(GraphQLID.self))), - GraphQLField("commentId", type: .nonNull(.scalar(String.self))), - GraphQLField("content", type: .nonNull(.scalar(String.self))), - GraphQLField("createdAt", type: .nonNull(.scalar(String.self))), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("eventId", type: .nonNull(.scalar(GraphQLID.self))), + GraphQLField("commentId", type: .nonNull(.scalar(String.self))), + GraphQLField("content", type: .nonNull(.scalar(String.self))), + GraphQLField("createdAt", type: .nonNull(.scalar(String.self))), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { - self.snapshot = snapshot + self.snapshot = snapshot } public init(eventId: GraphQLID, commentId: String, content: String, createdAt: String) { - self.init(snapshot: ["__typename": "Comment", "eventId": eventId, "commentId": commentId, "content": content, "createdAt": createdAt]) + self.init(snapshot: ["__typename": "Comment", "eventId": eventId, "commentId": commentId, "content": content, "createdAt": createdAt]) } public var __typename: String { - get { - return snapshot["__typename"]! as! String - } - set { - snapshot.updateValue(newValue, forKey: "__typename") - } + get { + return snapshot["__typename"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "__typename") + } } /// The id of the comment's parent event. public var eventId: GraphQLID { - get { - return snapshot["eventId"]! as! GraphQLID - } - set { - snapshot.updateValue(newValue, forKey: "eventId") - } + get { + return snapshot["eventId"]! as! GraphQLID + } + set { + snapshot.updateValue(newValue, forKey: "eventId") + } } /// A unique identifier for the comment. public var commentId: String { - get { - return snapshot["commentId"]! as! String - } - set { - snapshot.updateValue(newValue, forKey: "commentId") - } + get { + return snapshot["commentId"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "commentId") + } } /// The comment's content. public var content: String { - get { - return snapshot["content"]! as! String - } - set { - snapshot.updateValue(newValue, forKey: "content") - } + get { + return snapshot["content"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "content") + } } /// The comment timestamp. This field is indexed to enable sorted pagination. public var createdAt: String { - get { - return snapshot["createdAt"]! as! String - } - set { - snapshot.updateValue(newValue, forKey: "createdAt") - } - } - } + get { + return snapshot["createdAt"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "createdAt") + } + } } - } } - } } -public final class NewCommentOnEventSubscription: GraphQLSubscription { - public static let operationString = - "subscription NewCommentOnEvent($eventId: String!) {\n subscribeToEventComments(eventId: $eventId) {\n __typename\n eventId\n commentId\n content\n createdAt\n }\n}" - - public var eventId: String - - public init(eventId: String) { - self.eventId = eventId - } - - public var variables: GraphQLMap? { - return ["eventId": eventId] - } +public struct Event: GraphQLFragment { + public static let fragmentString = + "fragment Event on Event {\n __typename\n id\n description\n name\n when\n where\n comments {\n __typename\n items {\n __typename\n eventId\n commentId\n content\n createdAt\n }\n }\n}" - public struct Data: GraphQLSelectionSet { - public static let possibleTypes = ["Subscription"] + public static let possibleTypes = ["Event"] public static let selections: [GraphQLSelection] = [ - GraphQLField("subscribeToEventComments", arguments: ["eventId": GraphQLVariable("eventId")], type: .object(SubscribeToEventComment.selections)), + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), + GraphQLField("description", type: .scalar(String.self)), + GraphQLField("name", type: .scalar(String.self)), + GraphQLField("when", type: .scalar(String.self)), + GraphQLField("where", type: .scalar(String.self)), + GraphQLField("comments", type: .object(Comment.selections)), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { - self.snapshot = snapshot - } - - public init(subscribeToEventComments: SubscribeToEventComment? = nil) { - self.init(snapshot: ["__typename": "Subscription", "subscribeToEventComments": subscribeToEventComments.flatMap { $0.snapshot }]) + self.snapshot = snapshot } - public var subscribeToEventComments: SubscribeToEventComment? { - get { - return (snapshot["subscribeToEventComments"] as? Snapshot).flatMap { SubscribeToEventComment(snapshot: $0) } - } - set { - snapshot.updateValue(newValue?.snapshot, forKey: "subscribeToEventComments") - } + public init(id: GraphQLID, description: String? = nil, name: String? = nil, when: String? = nil, where: String? = nil, comments: Comment? = nil) { + self.init(snapshot: ["__typename": "Event", "id": id, "description": description, "name": name, "when": when, "where": `where`, "comments": comments.flatMap { $0.snapshot }]) } - public struct SubscribeToEventComment: GraphQLSelectionSet { - public static let possibleTypes = ["Comment"] - - public static let selections: [GraphQLSelection] = [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("eventId", type: .nonNull(.scalar(GraphQLID.self))), - GraphQLField("commentId", type: .nonNull(.scalar(String.self))), - GraphQLField("content", type: .nonNull(.scalar(String.self))), - GraphQLField("createdAt", type: .nonNull(.scalar(String.self))), - ] - - public var snapshot: Snapshot - - public init(snapshot: Snapshot) { - self.snapshot = snapshot - } - - public init(eventId: GraphQLID, commentId: String, content: String, createdAt: String) { - self.init(snapshot: ["__typename": "Comment", "eventId": eventId, "commentId": commentId, "content": content, "createdAt": createdAt]) - } - - public var __typename: String { + public var __typename: String { get { - return snapshot["__typename"]! as! String + return snapshot["__typename"]! as! String } set { - snapshot.updateValue(newValue, forKey: "__typename") + snapshot.updateValue(newValue, forKey: "__typename") } - } + } - /// The id of the comment's parent event. - public var eventId: GraphQLID { + public var id: GraphQLID { get { - return snapshot["eventId"]! as! GraphQLID + return snapshot["id"]! as! GraphQLID } set { - snapshot.updateValue(newValue, forKey: "eventId") + snapshot.updateValue(newValue, forKey: "id") } - } + } - /// A unique identifier for the comment. - public var commentId: String { + public var description: String? { get { - return snapshot["commentId"]! as! String + return snapshot["description"] as? String } set { - snapshot.updateValue(newValue, forKey: "commentId") + snapshot.updateValue(newValue, forKey: "description") } - } + } - /// The comment's content. - public var content: String { + public var name: String? { get { - return snapshot["content"]! as! String + return snapshot["name"] as? String } set { - snapshot.updateValue(newValue, forKey: "content") + snapshot.updateValue(newValue, forKey: "name") } - } + } - /// The comment timestamp. This field is indexed to enable sorted pagination. - public var createdAt: String { + public var when: String? { get { - return snapshot["createdAt"]! as! String + return snapshot["when"] as? String } set { - snapshot.updateValue(newValue, forKey: "createdAt") + snapshot.updateValue(newValue, forKey: "when") } - } - } - } -} - -public struct Event: GraphQLFragment { - public static let fragmentString = - "fragment Event on Event {\n __typename\n id\n description\n name\n when\n where\n comments {\n __typename\n items {\n __typename\n eventId\n commentId\n content\n createdAt\n }\n }\n}" - - public static let possibleTypes = ["Event"] - - public static let selections: [GraphQLSelection] = [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), - GraphQLField("description", type: .scalar(String.self)), - GraphQLField("name", type: .scalar(String.self)), - GraphQLField("when", type: .scalar(String.self)), - GraphQLField("where", type: .scalar(String.self)), - GraphQLField("comments", type: .object(Comment.selections)), - ] - - public var snapshot: Snapshot - - public init(snapshot: Snapshot) { - self.snapshot = snapshot - } - - public init(id: GraphQLID, description: String? = nil, name: String? = nil, when: String? = nil, `where`: String? = nil, comments: Comment? = nil) { - self.init(snapshot: ["__typename": "Event", "id": id, "description": description, "name": name, "when": when, "where": `where`, "comments": comments.flatMap { $0.snapshot }]) - } - - public var __typename: String { - get { - return snapshot["__typename"]! as! String - } - set { - snapshot.updateValue(newValue, forKey: "__typename") - } - } - - public var id: GraphQLID { - get { - return snapshot["id"]! as! GraphQLID - } - set { - snapshot.updateValue(newValue, forKey: "id") - } - } - - public var description: String? { - get { - return snapshot["description"] as? String - } - set { - snapshot.updateValue(newValue, forKey: "description") - } - } - - public var name: String? { - get { - return snapshot["name"] as? String - } - set { - snapshot.updateValue(newValue, forKey: "name") } - } - public var when: String? { - get { - return snapshot["when"] as? String - } - set { - snapshot.updateValue(newValue, forKey: "when") - } - } - - public var `where`: String? { - get { - return snapshot["where"] as? String - } - set { - snapshot.updateValue(newValue, forKey: "where") + public var `where`: String? { + get { + return snapshot["where"] as? String + } + set { + snapshot.updateValue(newValue, forKey: "where") + } } - } - /// Paginate through all comments belonging to an individual post. - public var comments: Comment? { - get { - return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } - } - set { - snapshot.updateValue(newValue?.snapshot, forKey: "comments") + /// Paginate through all comments belonging to an individual post. + public var comments: Comment? { + get { + return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } + } + set { + snapshot.updateValue(newValue?.snapshot, forKey: "comments") + } } - } - public struct Comment: GraphQLSelectionSet { - public static let possibleTypes = ["CommentConnection"] + public struct Comment: GraphQLSelectionSet { + public static let possibleTypes = ["CommentConnection"] - public static let selections: [GraphQLSelection] = [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("items", type: .list(.object(Item.selections))), - ] + public static let selections: [GraphQLSelection] = [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("items", type: .list(.object(Item.selections))), + ] - public var snapshot: Snapshot + public var snapshot: Snapshot - public init(snapshot: Snapshot) { - self.snapshot = snapshot - } + public init(snapshot: Snapshot) { + self.snapshot = snapshot + } - public init(items: [Item?]? = nil) { - self.init(snapshot: ["__typename": "CommentConnection", "items": items.flatMap { $0.map { $0.flatMap { $0.snapshot } } }]) - } + public init(items: [Item?]? = nil) { + self.init(snapshot: ["__typename": "CommentConnection", "items": items.flatMap { $0.map { $0.flatMap { $0.snapshot } } }]) + } - public var __typename: String { - get { - return snapshot["__typename"]! as! String - } - set { - snapshot.updateValue(newValue, forKey: "__typename") - } - } + public var __typename: String { + get { + return snapshot["__typename"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "__typename") + } + } - public var items: [Item?]? { - get { - return (snapshot["items"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { Item(snapshot: $0) } } } - } - set { - snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "items") - } - } + public var items: [Item?]? { + get { + return (snapshot["items"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { Item(snapshot: $0) } } } + } + set { + snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "items") + } + } - public struct Item: GraphQLSelectionSet { - public static let possibleTypes = ["Comment"] + public struct Item: GraphQLSelectionSet { + public static let possibleTypes = ["Comment"] - public static let selections: [GraphQLSelection] = [ - GraphQLField("__typename", type: .nonNull(.scalar(String.self))), - GraphQLField("eventId", type: .nonNull(.scalar(GraphQLID.self))), - GraphQLField("commentId", type: .nonNull(.scalar(String.self))), - GraphQLField("content", type: .nonNull(.scalar(String.self))), - GraphQLField("createdAt", type: .nonNull(.scalar(String.self))), - ] + public static let selections: [GraphQLSelection] = [ + GraphQLField("__typename", type: .nonNull(.scalar(String.self))), + GraphQLField("eventId", type: .nonNull(.scalar(GraphQLID.self))), + GraphQLField("commentId", type: .nonNull(.scalar(String.self))), + GraphQLField("content", type: .nonNull(.scalar(String.self))), + GraphQLField("createdAt", type: .nonNull(.scalar(String.self))), + ] - public var snapshot: Snapshot + public var snapshot: Snapshot - public init(snapshot: Snapshot) { - self.snapshot = snapshot - } + public init(snapshot: Snapshot) { + self.snapshot = snapshot + } - public init(eventId: GraphQLID, commentId: String, content: String, createdAt: String) { - self.init(snapshot: ["__typename": "Comment", "eventId": eventId, "commentId": commentId, "content": content, "createdAt": createdAt]) - } + public init(eventId: GraphQLID, commentId: String, content: String, createdAt: String) { + self.init(snapshot: ["__typename": "Comment", "eventId": eventId, "commentId": commentId, "content": content, "createdAt": createdAt]) + } - public var __typename: String { - get { - return snapshot["__typename"]! as! String - } - set { - snapshot.updateValue(newValue, forKey: "__typename") - } - } + public var __typename: String { + get { + return snapshot["__typename"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "__typename") + } + } - /// The id of the comment's parent event. - public var eventId: GraphQLID { - get { - return snapshot["eventId"]! as! GraphQLID - } - set { - snapshot.updateValue(newValue, forKey: "eventId") - } - } + /// The id of the comment's parent event. + public var eventId: GraphQLID { + get { + return snapshot["eventId"]! as! GraphQLID + } + set { + snapshot.updateValue(newValue, forKey: "eventId") + } + } - /// A unique identifier for the comment. - public var commentId: String { - get { - return snapshot["commentId"]! as! String - } - set { - snapshot.updateValue(newValue, forKey: "commentId") - } - } + /// A unique identifier for the comment. + public var commentId: String { + get { + return snapshot["commentId"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "commentId") + } + } - /// The comment's content. - public var content: String { - get { - return snapshot["content"]! as! String - } - set { - snapshot.updateValue(newValue, forKey: "content") - } - } + /// The comment's content. + public var content: String { + get { + return snapshot["content"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "content") + } + } - /// The comment timestamp. This field is indexed to enable sorted pagination. - public var createdAt: String { - get { - return snapshot["createdAt"]! as! String - } - set { - snapshot.updateValue(newValue, forKey: "createdAt") + /// The comment timestamp. This field is indexed to enable sorted pagination. + public var createdAt: String { + get { + return snapshot["createdAt"]! as! String + } + set { + snapshot.updateValue(newValue, forKey: "createdAt") + } + } } - } } - } } diff --git a/Podfile b/Podfile index 4c9e0e5..a727651 100644 --- a/Podfile +++ b/Podfile @@ -6,7 +6,7 @@ target 'EventsApp' do use_frameworks! # Pods for EventsApp - pod 'AWSAppSync', '~> 2.15.0' + pod 'AWSAppSync', '~> 3.1.0' # Build tools