// This file was automatically generated and should not be edited. #if canImport(AWSAPIPlugin) import Foundation public protocol GraphQLInputValue { } public struct GraphQLVariable { let name: String public init(_ name: String) { self.name = name } } extension GraphQLVariable: GraphQLInputValue { } extension JSONEncodable { public func evaluate(with variables: [String: JSONEncodable]?) throws -> Any { return jsonValue } } public typealias GraphQLMap = [String: JSONEncodable?] extension Dictionary where Key == String, Value == JSONEncodable? { public var withNilValuesRemoved: Dictionary { var filtered = Dictionary(minimumCapacity: count) for (key, value) in self { if value != nil { filtered[key] = value } } return filtered } } public protocol GraphQLMapConvertible: JSONEncodable { var graphQLMap: GraphQLMap { get } } public extension GraphQLMapConvertible { var jsonValue: Any { return graphQLMap.withNilValuesRemoved.jsonValue } } public typealias GraphQLID = String public protocol APISwiftGraphQLOperation: AnyObject { static var operationString: String { get } static var requestString: String { get } static var operationIdentifier: String? { get } var variables: GraphQLMap? { get } associatedtype Data: GraphQLSelectionSet } public extension APISwiftGraphQLOperation { static var requestString: String { return operationString } static var operationIdentifier: String? { return nil } var variables: GraphQLMap? { return nil } } public protocol GraphQLQuery: APISwiftGraphQLOperation {} public protocol GraphQLMutation: APISwiftGraphQLOperation {} public protocol GraphQLSubscription: APISwiftGraphQLOperation {} public protocol GraphQLFragment: GraphQLSelectionSet { static var possibleTypes: [String] { get } } public typealias Snapshot = [String: Any?] public protocol GraphQLSelectionSet: Decodable { static var selections: [GraphQLSelection] { get } var snapshot: Snapshot { get } init(snapshot: Snapshot) } extension GraphQLSelectionSet { public init(from decoder: Decoder) throws { if let jsonObject = try? APISwiftJSONValue(from: decoder) { let encoder = JSONEncoder() let jsonData = try encoder.encode(jsonObject) let decodedDictionary = try JSONSerialization.jsonObject(with: jsonData, options: []) as! [String: Any] let optionalDictionary = decodedDictionary.mapValues { $0 as Any? } self.init(snapshot: optionalDictionary) } else { self.init(snapshot: [:]) } } } enum APISwiftJSONValue: Codable { case array([APISwiftJSONValue]) case boolean(Bool) case number(Double) case object([String: APISwiftJSONValue]) case string(String) case null init(from decoder: Decoder) throws { let container = try decoder.singleValueContainer() if let value = try? container.decode([String: APISwiftJSONValue].self) { self = .object(value) } else if let value = try? container.decode([APISwiftJSONValue].self) { self = .array(value) } else if let value = try? container.decode(Double.self) { self = .number(value) } else if let value = try? container.decode(Bool.self) { self = .boolean(value) } else if let value = try? container.decode(String.self) { self = .string(value) } else { self = .null } } func encode(to encoder: Encoder) throws { var container = encoder.singleValueContainer() switch self { case .array(let value): try container.encode(value) case .boolean(let value): try container.encode(value) case .number(let value): try container.encode(value) case .object(let value): try container.encode(value) case .string(let value): try container.encode(value) case .null: try container.encodeNil() } } } public protocol GraphQLSelection { } public struct GraphQLField: GraphQLSelection { let name: String let alias: String? let arguments: [String: GraphQLInputValue]? var responseKey: String { return alias ?? name } let type: GraphQLOutputType public init(_ name: String, alias: String? = nil, arguments: [String: GraphQLInputValue]? = nil, type: GraphQLOutputType) { self.name = name self.alias = alias self.arguments = arguments self.type = type } } public indirect enum GraphQLOutputType { case scalar(JSONDecodable.Type) case object([GraphQLSelection]) case nonNull(GraphQLOutputType) case list(GraphQLOutputType) var namedType: GraphQLOutputType { switch self { case .nonNull(let innerType), .list(let innerType): return innerType.namedType case .scalar, .object: return self } } } public struct GraphQLBooleanCondition: GraphQLSelection { let variableName: String let inverted: Bool let selections: [GraphQLSelection] public init(variableName: String, inverted: Bool, selections: [GraphQLSelection]) { self.variableName = variableName self.inverted = inverted; self.selections = selections; } } public struct GraphQLTypeCondition: GraphQLSelection { let possibleTypes: [String] let selections: [GraphQLSelection] public init(possibleTypes: [String], selections: [GraphQLSelection]) { self.possibleTypes = possibleTypes self.selections = selections; } } public struct GraphQLFragmentSpread: GraphQLSelection { let fragment: GraphQLFragment.Type public init(_ fragment: GraphQLFragment.Type) { self.fragment = fragment } } public struct GraphQLTypeCase: GraphQLSelection { let variants: [String: [GraphQLSelection]] let `default`: [GraphQLSelection] public init(variants: [String: [GraphQLSelection]], default: [GraphQLSelection]) { self.variants = variants self.default = `default`; } } public typealias JSONObject = [String: Any] public protocol JSONDecodable { init(jsonValue value: Any) throws } public protocol JSONEncodable: GraphQLInputValue { var jsonValue: Any { get } } public enum JSONDecodingError: Error, LocalizedError { case missingValue case nullValue case wrongType case couldNotConvert(value: Any, to: Any.Type) public var errorDescription: String? { switch self { case .missingValue: return "Missing value" case .nullValue: return "Unexpected null value" case .wrongType: return "Wrong type" case .couldNotConvert(let value, let expectedType): return "Could not convert \"\(value)\" to \(expectedType)" } } } extension String: JSONDecodable, JSONEncodable { public init(jsonValue value: Any) throws { guard let string = value as? String else { throw JSONDecodingError.couldNotConvert(value: value, to: String.self) } self = string } public var jsonValue: Any { return self } } extension Int: JSONDecodable, JSONEncodable { public init(jsonValue value: Any) throws { guard let number = value as? NSNumber else { throw JSONDecodingError.couldNotConvert(value: value, to: Int.self) } self = number.intValue } public var jsonValue: Any { return self } } extension Float: JSONDecodable, JSONEncodable { public init(jsonValue value: Any) throws { guard let number = value as? NSNumber else { throw JSONDecodingError.couldNotConvert(value: value, to: Float.self) } self = number.floatValue } public var jsonValue: Any { return self } } extension Double: JSONDecodable, JSONEncodable { public init(jsonValue value: Any) throws { guard let number = value as? NSNumber else { throw JSONDecodingError.couldNotConvert(value: value, to: Double.self) } self = number.doubleValue } public var jsonValue: Any { return self } } extension Bool: JSONDecodable, JSONEncodable { public init(jsonValue value: Any) throws { guard let bool = value as? Bool else { throw JSONDecodingError.couldNotConvert(value: value, to: Bool.self) } self = bool } public var jsonValue: Any { return self } } extension RawRepresentable where RawValue: JSONDecodable { public init(jsonValue value: Any) throws { let rawValue = try RawValue(jsonValue: value) if let tempSelf = Self(rawValue: rawValue) { self = tempSelf } else { throw JSONDecodingError.couldNotConvert(value: value, to: Self.self) } } } extension RawRepresentable where RawValue: JSONEncodable { public var jsonValue: Any { return rawValue.jsonValue } } extension Optional where Wrapped: JSONDecodable { public init(jsonValue value: Any) throws { if value is NSNull { self = .none } else { self = .some(try Wrapped(jsonValue: value)) } } } extension Optional: JSONEncodable { public var jsonValue: Any { switch self { case .none: return NSNull() case .some(let wrapped as JSONEncodable): return wrapped.jsonValue default: fatalError("Optional is only JSONEncodable if Wrapped is") } } } extension Dictionary: JSONEncodable { public var jsonValue: Any { return jsonObject } public var jsonObject: JSONObject { var jsonObject = JSONObject(minimumCapacity: count) for (key, value) in self { if case let (key as String, value as JSONEncodable) = (key, value) { jsonObject[key] = value.jsonValue } else { fatalError("Dictionary is only JSONEncodable if Value is (and if Key is String)") } } return jsonObject } } extension Array: JSONEncodable { public var jsonValue: Any { return map() { element -> (Any) in if case let element as JSONEncodable = element { return element.jsonValue } else { fatalError("Array is only JSONEncodable if Element is") } } } } extension URL: JSONDecodable, JSONEncodable { public init(jsonValue value: Any) throws { guard let string = value as? String else { throw JSONDecodingError.couldNotConvert(value: value, to: URL.self) } self.init(string: string)! } public var jsonValue: Any { return self.absoluteString } } extension Dictionary { static func += (lhs: inout Dictionary, rhs: Dictionary) { lhs.merge(rhs) { (_, new) in new } } } #elseif canImport(AWSAppSync) import AWSAppSync #endif public struct APISwift { public struct CreateTodoInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap public init(id: GraphQLID? = nil, name: String, description: String? = nil) { graphQLMap = ["id": id, "name": name, "description": description] } public var id: GraphQLID? { get { return graphQLMap["id"] as! GraphQLID? } set { graphQLMap.updateValue(newValue, forKey: "id") } } public var name: String { get { return graphQLMap["name"] as! String } set { graphQLMap.updateValue(newValue, forKey: "name") } } public var description: String? { get { return graphQLMap["description"] as! String? } set { graphQLMap.updateValue(newValue, forKey: "description") } } } public struct ModelTodoConditionInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap public init(name: ModelStringInput? = nil, description: ModelStringInput? = nil, and: [ModelTodoConditionInput?]? = nil, or: [ModelTodoConditionInput?]? = nil, not: ModelTodoConditionInput? = nil) { graphQLMap = ["name": name, "description": description, "and": and, "or": or, "not": not] } public var name: ModelStringInput? { get { return graphQLMap["name"] as! ModelStringInput? } set { graphQLMap.updateValue(newValue, forKey: "name") } } public var description: ModelStringInput? { get { return graphQLMap["description"] as! ModelStringInput? } set { graphQLMap.updateValue(newValue, forKey: "description") } } public var and: [ModelTodoConditionInput?]? { get { return graphQLMap["and"] as! [ModelTodoConditionInput?]? } set { graphQLMap.updateValue(newValue, forKey: "and") } } public var or: [ModelTodoConditionInput?]? { get { return graphQLMap["or"] as! [ModelTodoConditionInput?]? } set { graphQLMap.updateValue(newValue, forKey: "or") } } public var not: ModelTodoConditionInput? { get { return graphQLMap["not"] as! ModelTodoConditionInput? } set { graphQLMap.updateValue(newValue, forKey: "not") } } } public struct ModelStringInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap public init(ne: String? = nil, eq: String? = nil, le: String? = nil, lt: String? = nil, ge: String? = nil, gt: String? = nil, contains: String? = nil, notContains: String? = nil, between: [String?]? = nil, beginsWith: String? = nil, attributeExists: Bool? = nil, attributeType: ModelAttributeTypes? = nil, size: ModelSizeInput? = nil) { graphQLMap = ["ne": ne, "eq": eq, "le": le, "lt": lt, "ge": ge, "gt": gt, "contains": contains, "notContains": notContains, "between": between, "beginsWith": beginsWith, "attributeExists": attributeExists, "attributeType": attributeType, "size": size] } public var ne: String? { get { return graphQLMap["ne"] as! String? } set { graphQLMap.updateValue(newValue, forKey: "ne") } } public var eq: String? { get { return graphQLMap["eq"] as! String? } set { graphQLMap.updateValue(newValue, forKey: "eq") } } public var le: String? { get { return graphQLMap["le"] as! String? } set { graphQLMap.updateValue(newValue, forKey: "le") } } public var lt: String? { get { return graphQLMap["lt"] as! String? } set { graphQLMap.updateValue(newValue, forKey: "lt") } } public var ge: String? { get { return graphQLMap["ge"] as! String? } set { graphQLMap.updateValue(newValue, forKey: "ge") } } public var gt: String? { get { return graphQLMap["gt"] as! String? } set { graphQLMap.updateValue(newValue, forKey: "gt") } } public var contains: String? { get { return graphQLMap["contains"] as! String? } set { graphQLMap.updateValue(newValue, forKey: "contains") } } public var notContains: String? { get { return graphQLMap["notContains"] as! String? } set { graphQLMap.updateValue(newValue, forKey: "notContains") } } public var between: [String?]? { get { return graphQLMap["between"] as! [String?]? } set { graphQLMap.updateValue(newValue, forKey: "between") } } public var beginsWith: String? { get { return graphQLMap["beginsWith"] as! String? } set { graphQLMap.updateValue(newValue, forKey: "beginsWith") } } public var attributeExists: Bool? { get { return graphQLMap["attributeExists"] as! Bool? } set { graphQLMap.updateValue(newValue, forKey: "attributeExists") } } public var attributeType: ModelAttributeTypes? { get { return graphQLMap["attributeType"] as! ModelAttributeTypes? } set { graphQLMap.updateValue(newValue, forKey: "attributeType") } } public var size: ModelSizeInput? { get { return graphQLMap["size"] as! ModelSizeInput? } set { graphQLMap.updateValue(newValue, forKey: "size") } } } public enum ModelAttributeTypes: RawRepresentable, Equatable, JSONDecodable, JSONEncodable { public typealias RawValue = String case binary case binarySet case bool case list case map case number case numberSet case string case stringSet case null /// Auto generated constant for unknown enum values case unknown(RawValue) public init?(rawValue: RawValue) { switch rawValue { case "binary": self = .binary case "binarySet": self = .binarySet case "bool": self = .bool case "list": self = .list case "map": self = .map case "number": self = .number case "numberSet": self = .numberSet case "string": self = .string case "stringSet": self = .stringSet case "_null": self = .null default: self = .unknown(rawValue) } } public var rawValue: RawValue { switch self { case .binary: return "binary" case .binarySet: return "binarySet" case .bool: return "bool" case .list: return "list" case .map: return "map" case .number: return "number" case .numberSet: return "numberSet" case .string: return "string" case .stringSet: return "stringSet" case .null: return "_null" case .unknown(let value): return value } } public static func == (lhs: ModelAttributeTypes, rhs: ModelAttributeTypes) -> Bool { switch (lhs, rhs) { case (.binary, .binary): return true case (.binarySet, .binarySet): return true case (.bool, .bool): return true case (.list, .list): return true case (.map, .map): return true case (.number, .number): return true case (.numberSet, .numberSet): return true case (.string, .string): return true case (.stringSet, .stringSet): return true case (.null, .null): return true case (.unknown(let lhsValue), .unknown(let rhsValue)): return lhsValue == rhsValue default: return false } } } public struct ModelSizeInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap public init(ne: Int? = nil, eq: Int? = nil, le: Int? = nil, lt: Int? = nil, ge: Int? = nil, gt: Int? = nil, between: [Int?]? = nil) { graphQLMap = ["ne": ne, "eq": eq, "le": le, "lt": lt, "ge": ge, "gt": gt, "between": between] } public var ne: Int? { get { return graphQLMap["ne"] as! Int? } set { graphQLMap.updateValue(newValue, forKey: "ne") } } public var eq: Int? { get { return graphQLMap["eq"] as! Int? } set { graphQLMap.updateValue(newValue, forKey: "eq") } } public var le: Int? { get { return graphQLMap["le"] as! Int? } set { graphQLMap.updateValue(newValue, forKey: "le") } } public var lt: Int? { get { return graphQLMap["lt"] as! Int? } set { graphQLMap.updateValue(newValue, forKey: "lt") } } public var ge: Int? { get { return graphQLMap["ge"] as! Int? } set { graphQLMap.updateValue(newValue, forKey: "ge") } } public var gt: Int? { get { return graphQLMap["gt"] as! Int? } set { graphQLMap.updateValue(newValue, forKey: "gt") } } public var between: [Int?]? { get { return graphQLMap["between"] as! [Int?]? } set { graphQLMap.updateValue(newValue, forKey: "between") } } } public struct UpdateTodoInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap public init(id: GraphQLID, name: String? = nil, description: String? = nil) { graphQLMap = ["id": id, "name": name, "description": description] } public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID } set { graphQLMap.updateValue(newValue, forKey: "id") } } public var name: String? { get { return graphQLMap["name"] as! String? } set { graphQLMap.updateValue(newValue, forKey: "name") } } public var description: String? { get { return graphQLMap["description"] as! String? } set { graphQLMap.updateValue(newValue, forKey: "description") } } } public struct DeleteTodoInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap public init(id: GraphQLID) { graphQLMap = ["id": id] } public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID } set { graphQLMap.updateValue(newValue, forKey: "id") } } } public struct ModelTodoFilterInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap public init(id: ModelIDInput? = nil, name: ModelStringInput? = nil, description: ModelStringInput? = nil, and: [ModelTodoFilterInput?]? = nil, or: [ModelTodoFilterInput?]? = nil, not: ModelTodoFilterInput? = nil) { graphQLMap = ["id": id, "name": name, "description": description, "and": and, "or": or, "not": not] } public var id: ModelIDInput? { get { return graphQLMap["id"] as! ModelIDInput? } set { graphQLMap.updateValue(newValue, forKey: "id") } } public var name: ModelStringInput? { get { return graphQLMap["name"] as! ModelStringInput? } set { graphQLMap.updateValue(newValue, forKey: "name") } } public var description: ModelStringInput? { get { return graphQLMap["description"] as! ModelStringInput? } set { graphQLMap.updateValue(newValue, forKey: "description") } } public var and: [ModelTodoFilterInput?]? { get { return graphQLMap["and"] as! [ModelTodoFilterInput?]? } set { graphQLMap.updateValue(newValue, forKey: "and") } } public var or: [ModelTodoFilterInput?]? { get { return graphQLMap["or"] as! [ModelTodoFilterInput?]? } set { graphQLMap.updateValue(newValue, forKey: "or") } } public var not: ModelTodoFilterInput? { get { return graphQLMap["not"] as! ModelTodoFilterInput? } set { graphQLMap.updateValue(newValue, forKey: "not") } } } public struct ModelIDInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap public init(ne: GraphQLID? = nil, eq: GraphQLID? = nil, le: GraphQLID? = nil, lt: GraphQLID? = nil, ge: GraphQLID? = nil, gt: GraphQLID? = nil, contains: GraphQLID? = nil, notContains: GraphQLID? = nil, between: [GraphQLID?]? = nil, beginsWith: GraphQLID? = nil, attributeExists: Bool? = nil, attributeType: ModelAttributeTypes? = nil, size: ModelSizeInput? = nil) { graphQLMap = ["ne": ne, "eq": eq, "le": le, "lt": lt, "ge": ge, "gt": gt, "contains": contains, "notContains": notContains, "between": between, "beginsWith": beginsWith, "attributeExists": attributeExists, "attributeType": attributeType, "size": size] } public var ne: GraphQLID? { get { return graphQLMap["ne"] as! GraphQLID? } set { graphQLMap.updateValue(newValue, forKey: "ne") } } public var eq: GraphQLID? { get { return graphQLMap["eq"] as! GraphQLID? } set { graphQLMap.updateValue(newValue, forKey: "eq") } } public var le: GraphQLID? { get { return graphQLMap["le"] as! GraphQLID? } set { graphQLMap.updateValue(newValue, forKey: "le") } } public var lt: GraphQLID? { get { return graphQLMap["lt"] as! GraphQLID? } set { graphQLMap.updateValue(newValue, forKey: "lt") } } public var ge: GraphQLID? { get { return graphQLMap["ge"] as! GraphQLID? } set { graphQLMap.updateValue(newValue, forKey: "ge") } } public var gt: GraphQLID? { get { return graphQLMap["gt"] as! GraphQLID? } set { graphQLMap.updateValue(newValue, forKey: "gt") } } public var contains: GraphQLID? { get { return graphQLMap["contains"] as! GraphQLID? } set { graphQLMap.updateValue(newValue, forKey: "contains") } } public var notContains: GraphQLID? { get { return graphQLMap["notContains"] as! GraphQLID? } set { graphQLMap.updateValue(newValue, forKey: "notContains") } } public var between: [GraphQLID?]? { get { return graphQLMap["between"] as! [GraphQLID?]? } set { graphQLMap.updateValue(newValue, forKey: "between") } } public var beginsWith: GraphQLID? { get { return graphQLMap["beginsWith"] as! GraphQLID? } set { graphQLMap.updateValue(newValue, forKey: "beginsWith") } } public var attributeExists: Bool? { get { return graphQLMap["attributeExists"] as! Bool? } set { graphQLMap.updateValue(newValue, forKey: "attributeExists") } } public var attributeType: ModelAttributeTypes? { get { return graphQLMap["attributeType"] as! ModelAttributeTypes? } set { graphQLMap.updateValue(newValue, forKey: "attributeType") } } public var size: ModelSizeInput? { get { return graphQLMap["size"] as! ModelSizeInput? } set { graphQLMap.updateValue(newValue, forKey: "size") } } } public final class CreateTodoMutation: GraphQLMutation { public static let operationString = "mutation CreateTodo($input: CreateTodoInput!, $condition: ModelTodoConditionInput) {\n createTodo(input: $input, condition: $condition) {\n __typename\n id\n name\n description\n createdAt\n updatedAt\n }\n}" public var input: CreateTodoInput public var condition: ModelTodoConditionInput? public init(input: CreateTodoInput, condition: ModelTodoConditionInput? = nil) { self.input = input self.condition = condition } public var variables: GraphQLMap? { return ["input": input, "condition": condition] } public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Mutation"] public static let selections: [GraphQLSelection] = [ GraphQLField("createTodo", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(CreateTodo.selections)), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { self.snapshot = snapshot } public init(createTodo: CreateTodo? = nil) { self.init(snapshot: ["__typename": "Mutation", "createTodo": createTodo.flatMap { $0.snapshot }]) } public var createTodo: CreateTodo? { get { return (snapshot["createTodo"] as? Snapshot).flatMap { CreateTodo(snapshot: $0) } } set { snapshot.updateValue(newValue?.snapshot, forKey: "createTodo") } } public struct CreateTodo: GraphQLSelectionSet { public static let possibleTypes = ["Todo"] public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), GraphQLField("name", type: .nonNull(.scalar(String.self))), GraphQLField("description", type: .scalar(String.self)), GraphQLField("createdAt", type: .nonNull(.scalar(String.self))), GraphQLField("updatedAt", type: .nonNull(.scalar(String.self))), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { self.snapshot = snapshot } public init(id: GraphQLID, name: String, description: String? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Todo", "id": id, "name": name, "description": description, "createdAt": createdAt, "updatedAt": updatedAt]) } 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 name: String { get { return snapshot["name"]! as! String } set { snapshot.updateValue(newValue, forKey: "name") } } public var description: String? { get { return snapshot["description"] as? String } set { snapshot.updateValue(newValue, forKey: "description") } } public var createdAt: String { get { return snapshot["createdAt"]! as! String } set { snapshot.updateValue(newValue, forKey: "createdAt") } } public var updatedAt: String { get { return snapshot["updatedAt"]! as! String } set { snapshot.updateValue(newValue, forKey: "updatedAt") } } } } } public final class UpdateTodoMutation: GraphQLMutation { public static let operationString = "mutation UpdateTodo($input: UpdateTodoInput!, $condition: ModelTodoConditionInput) {\n updateTodo(input: $input, condition: $condition) {\n __typename\n id\n name\n description\n createdAt\n updatedAt\n }\n}" public var input: UpdateTodoInput public var condition: ModelTodoConditionInput? public init(input: UpdateTodoInput, condition: ModelTodoConditionInput? = nil) { self.input = input self.condition = condition } public var variables: GraphQLMap? { return ["input": input, "condition": condition] } public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Mutation"] public static let selections: [GraphQLSelection] = [ GraphQLField("updateTodo", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(UpdateTodo.selections)), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { self.snapshot = snapshot } public init(updateTodo: UpdateTodo? = nil) { self.init(snapshot: ["__typename": "Mutation", "updateTodo": updateTodo.flatMap { $0.snapshot }]) } public var updateTodo: UpdateTodo? { get { return (snapshot["updateTodo"] as? Snapshot).flatMap { UpdateTodo(snapshot: $0) } } set { snapshot.updateValue(newValue?.snapshot, forKey: "updateTodo") } } public struct UpdateTodo: GraphQLSelectionSet { public static let possibleTypes = ["Todo"] public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), GraphQLField("name", type: .nonNull(.scalar(String.self))), GraphQLField("description", type: .scalar(String.self)), GraphQLField("createdAt", type: .nonNull(.scalar(String.self))), GraphQLField("updatedAt", type: .nonNull(.scalar(String.self))), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { self.snapshot = snapshot } public init(id: GraphQLID, name: String, description: String? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Todo", "id": id, "name": name, "description": description, "createdAt": createdAt, "updatedAt": updatedAt]) } 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 name: String { get { return snapshot["name"]! as! String } set { snapshot.updateValue(newValue, forKey: "name") } } public var description: String? { get { return snapshot["description"] as? String } set { snapshot.updateValue(newValue, forKey: "description") } } public var createdAt: String { get { return snapshot["createdAt"]! as! String } set { snapshot.updateValue(newValue, forKey: "createdAt") } } public var updatedAt: String { get { return snapshot["updatedAt"]! as! String } set { snapshot.updateValue(newValue, forKey: "updatedAt") } } } } } public final class DeleteTodoMutation: GraphQLMutation { public static let operationString = "mutation DeleteTodo($input: DeleteTodoInput!, $condition: ModelTodoConditionInput) {\n deleteTodo(input: $input, condition: $condition) {\n __typename\n id\n name\n description\n createdAt\n updatedAt\n }\n}" public var input: DeleteTodoInput public var condition: ModelTodoConditionInput? public init(input: DeleteTodoInput, condition: ModelTodoConditionInput? = nil) { self.input = input self.condition = condition } public var variables: GraphQLMap? { return ["input": input, "condition": condition] } public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Mutation"] public static let selections: [GraphQLSelection] = [ GraphQLField("deleteTodo", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(DeleteTodo.selections)), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { self.snapshot = snapshot } public init(deleteTodo: DeleteTodo? = nil) { self.init(snapshot: ["__typename": "Mutation", "deleteTodo": deleteTodo.flatMap { $0.snapshot }]) } public var deleteTodo: DeleteTodo? { get { return (snapshot["deleteTodo"] as? Snapshot).flatMap { DeleteTodo(snapshot: $0) } } set { snapshot.updateValue(newValue?.snapshot, forKey: "deleteTodo") } } public struct DeleteTodo: GraphQLSelectionSet { public static let possibleTypes = ["Todo"] public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), GraphQLField("name", type: .nonNull(.scalar(String.self))), GraphQLField("description", type: .scalar(String.self)), GraphQLField("createdAt", type: .nonNull(.scalar(String.self))), GraphQLField("updatedAt", type: .nonNull(.scalar(String.self))), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { self.snapshot = snapshot } public init(id: GraphQLID, name: String, description: String? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Todo", "id": id, "name": name, "description": description, "createdAt": createdAt, "updatedAt": updatedAt]) } 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 name: String { get { return snapshot["name"]! as! String } set { snapshot.updateValue(newValue, forKey: "name") } } public var description: String? { get { return snapshot["description"] as? String } set { snapshot.updateValue(newValue, forKey: "description") } } public var createdAt: String { get { return snapshot["createdAt"]! as! String } set { snapshot.updateValue(newValue, forKey: "createdAt") } } public var updatedAt: String { get { return snapshot["updatedAt"]! as! String } set { snapshot.updateValue(newValue, forKey: "updatedAt") } } } } } public final class GetTodoQuery: GraphQLQuery { public static let operationString = "query GetTodo($id: ID!) {\n getTodo(id: $id) {\n __typename\n id\n name\n description\n createdAt\n updatedAt\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 = ["Query"] public static let selections: [GraphQLSelection] = [ GraphQLField("getTodo", arguments: ["id": GraphQLVariable("id")], type: .object(GetTodo.selections)), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { self.snapshot = snapshot } public init(getTodo: GetTodo? = nil) { self.init(snapshot: ["__typename": "Query", "getTodo": getTodo.flatMap { $0.snapshot }]) } public var getTodo: GetTodo? { get { return (snapshot["getTodo"] as? Snapshot).flatMap { GetTodo(snapshot: $0) } } set { snapshot.updateValue(newValue?.snapshot, forKey: "getTodo") } } public struct GetTodo: GraphQLSelectionSet { public static let possibleTypes = ["Todo"] public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), GraphQLField("name", type: .nonNull(.scalar(String.self))), GraphQLField("description", type: .scalar(String.self)), GraphQLField("createdAt", type: .nonNull(.scalar(String.self))), GraphQLField("updatedAt", type: .nonNull(.scalar(String.self))), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { self.snapshot = snapshot } public init(id: GraphQLID, name: String, description: String? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Todo", "id": id, "name": name, "description": description, "createdAt": createdAt, "updatedAt": updatedAt]) } 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 name: String { get { return snapshot["name"]! as! String } set { snapshot.updateValue(newValue, forKey: "name") } } public var description: String? { get { return snapshot["description"] as? String } set { snapshot.updateValue(newValue, forKey: "description") } } public var createdAt: String { get { return snapshot["createdAt"]! as! String } set { snapshot.updateValue(newValue, forKey: "createdAt") } } public var updatedAt: String { get { return snapshot["updatedAt"]! as! String } set { snapshot.updateValue(newValue, forKey: "updatedAt") } } } } } public final class ListTodosQuery: GraphQLQuery { public static let operationString = "query ListTodos($filter: ModelTodoFilterInput, $limit: Int, $nextToken: String) {\n listTodos(filter: $filter, limit: $limit, nextToken: $nextToken) {\n __typename\n items {\n __typename\n id\n name\n description\n createdAt\n updatedAt\n }\n nextToken\n }\n}" public var filter: ModelTodoFilterInput? public var limit: Int? public var nextToken: String? public init(filter: ModelTodoFilterInput? = nil, limit: Int? = nil, nextToken: String? = nil) { self.filter = filter self.limit = limit self.nextToken = nextToken } public var variables: GraphQLMap? { return ["filter": filter, "limit": limit, "nextToken": nextToken] } public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Query"] public static let selections: [GraphQLSelection] = [ GraphQLField("listTodos", arguments: ["filter": GraphQLVariable("filter"), "limit": GraphQLVariable("limit"), "nextToken": GraphQLVariable("nextToken")], type: .object(ListTodo.selections)), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { self.snapshot = snapshot } public init(listTodos: ListTodo? = nil) { self.init(snapshot: ["__typename": "Query", "listTodos": listTodos.flatMap { $0.snapshot }]) } public var listTodos: ListTodo? { get { return (snapshot["listTodos"] as? Snapshot).flatMap { ListTodo(snapshot: $0) } } set { snapshot.updateValue(newValue?.snapshot, forKey: "listTodos") } } public struct ListTodo: GraphQLSelectionSet { public static let possibleTypes = ["ModelTodoConnection"] public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("items", type: .nonNull(.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?], nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelTodoConnection", "items": items.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?]).map { $0.flatMap { Item(snapshot: $0) } } } set { snapshot.updateValue(newValue.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 = ["Todo"] public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), GraphQLField("name", type: .nonNull(.scalar(String.self))), GraphQLField("description", type: .scalar(String.self)), GraphQLField("createdAt", type: .nonNull(.scalar(String.self))), GraphQLField("updatedAt", type: .nonNull(.scalar(String.self))), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { self.snapshot = snapshot } public init(id: GraphQLID, name: String, description: String? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Todo", "id": id, "name": name, "description": description, "createdAt": createdAt, "updatedAt": updatedAt]) } 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 name: String { get { return snapshot["name"]! as! String } set { snapshot.updateValue(newValue, forKey: "name") } } public var description: String? { get { return snapshot["description"] as? String } set { snapshot.updateValue(newValue, forKey: "description") } } public var createdAt: String { get { return snapshot["createdAt"]! as! String } set { snapshot.updateValue(newValue, forKey: "createdAt") } } public var updatedAt: String { get { return snapshot["updatedAt"]! as! String } set { snapshot.updateValue(newValue, forKey: "updatedAt") } } } } } } public final class OnCreateTodoSubscription: GraphQLSubscription { public static let operationString = "subscription OnCreateTodo {\n onCreateTodo {\n __typename\n id\n name\n description\n createdAt\n updatedAt\n }\n}" public init() { } public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] public static let selections: [GraphQLSelection] = [ GraphQLField("onCreateTodo", type: .object(OnCreateTodo.selections)), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { self.snapshot = snapshot } public init(onCreateTodo: OnCreateTodo? = nil) { self.init(snapshot: ["__typename": "Subscription", "onCreateTodo": onCreateTodo.flatMap { $0.snapshot }]) } public var onCreateTodo: OnCreateTodo? { get { return (snapshot["onCreateTodo"] as? Snapshot).flatMap { OnCreateTodo(snapshot: $0) } } set { snapshot.updateValue(newValue?.snapshot, forKey: "onCreateTodo") } } public struct OnCreateTodo: GraphQLSelectionSet { public static let possibleTypes = ["Todo"] public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), GraphQLField("name", type: .nonNull(.scalar(String.self))), GraphQLField("description", type: .scalar(String.self)), GraphQLField("createdAt", type: .nonNull(.scalar(String.self))), GraphQLField("updatedAt", type: .nonNull(.scalar(String.self))), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { self.snapshot = snapshot } public init(id: GraphQLID, name: String, description: String? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Todo", "id": id, "name": name, "description": description, "createdAt": createdAt, "updatedAt": updatedAt]) } 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 name: String { get { return snapshot["name"]! as! String } set { snapshot.updateValue(newValue, forKey: "name") } } public var description: String? { get { return snapshot["description"] as? String } set { snapshot.updateValue(newValue, forKey: "description") } } public var createdAt: String { get { return snapshot["createdAt"]! as! String } set { snapshot.updateValue(newValue, forKey: "createdAt") } } public var updatedAt: String { get { return snapshot["updatedAt"]! as! String } set { snapshot.updateValue(newValue, forKey: "updatedAt") } } } } } public final class OnUpdateTodoSubscription: GraphQLSubscription { public static let operationString = "subscription OnUpdateTodo {\n onUpdateTodo {\n __typename\n id\n name\n description\n createdAt\n updatedAt\n }\n}" public init() { } public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] public static let selections: [GraphQLSelection] = [ GraphQLField("onUpdateTodo", type: .object(OnUpdateTodo.selections)), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { self.snapshot = snapshot } public init(onUpdateTodo: OnUpdateTodo? = nil) { self.init(snapshot: ["__typename": "Subscription", "onUpdateTodo": onUpdateTodo.flatMap { $0.snapshot }]) } public var onUpdateTodo: OnUpdateTodo? { get { return (snapshot["onUpdateTodo"] as? Snapshot).flatMap { OnUpdateTodo(snapshot: $0) } } set { snapshot.updateValue(newValue?.snapshot, forKey: "onUpdateTodo") } } public struct OnUpdateTodo: GraphQLSelectionSet { public static let possibleTypes = ["Todo"] public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), GraphQLField("name", type: .nonNull(.scalar(String.self))), GraphQLField("description", type: .scalar(String.self)), GraphQLField("createdAt", type: .nonNull(.scalar(String.self))), GraphQLField("updatedAt", type: .nonNull(.scalar(String.self))), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { self.snapshot = snapshot } public init(id: GraphQLID, name: String, description: String? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Todo", "id": id, "name": name, "description": description, "createdAt": createdAt, "updatedAt": updatedAt]) } 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 name: String { get { return snapshot["name"]! as! String } set { snapshot.updateValue(newValue, forKey: "name") } } public var description: String? { get { return snapshot["description"] as? String } set { snapshot.updateValue(newValue, forKey: "description") } } public var createdAt: String { get { return snapshot["createdAt"]! as! String } set { snapshot.updateValue(newValue, forKey: "createdAt") } } public var updatedAt: String { get { return snapshot["updatedAt"]! as! String } set { snapshot.updateValue(newValue, forKey: "updatedAt") } } } } } public final class OnDeleteTodoSubscription: GraphQLSubscription { public static let operationString = "subscription OnDeleteTodo {\n onDeleteTodo {\n __typename\n id\n name\n description\n createdAt\n updatedAt\n }\n}" public init() { } public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] public static let selections: [GraphQLSelection] = [ GraphQLField("onDeleteTodo", type: .object(OnDeleteTodo.selections)), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { self.snapshot = snapshot } public init(onDeleteTodo: OnDeleteTodo? = nil) { self.init(snapshot: ["__typename": "Subscription", "onDeleteTodo": onDeleteTodo.flatMap { $0.snapshot }]) } public var onDeleteTodo: OnDeleteTodo? { get { return (snapshot["onDeleteTodo"] as? Snapshot).flatMap { OnDeleteTodo(snapshot: $0) } } set { snapshot.updateValue(newValue?.snapshot, forKey: "onDeleteTodo") } } public struct OnDeleteTodo: GraphQLSelectionSet { public static let possibleTypes = ["Todo"] public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), GraphQLField("name", type: .nonNull(.scalar(String.self))), GraphQLField("description", type: .scalar(String.self)), GraphQLField("createdAt", type: .nonNull(.scalar(String.self))), GraphQLField("updatedAt", type: .nonNull(.scalar(String.self))), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { self.snapshot = snapshot } public init(id: GraphQLID, name: String, description: String? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Todo", "id": id, "name": name, "description": description, "createdAt": createdAt, "updatedAt": updatedAt]) } 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 name: String { get { return snapshot["name"]! as! String } set { snapshot.updateValue(newValue, forKey: "name") } } public var description: String? { get { return snapshot["description"] as? String } set { snapshot.updateValue(newValue, forKey: "description") } } public var createdAt: String { get { return snapshot["createdAt"]! as! String } set { snapshot.updateValue(newValue, forKey: "createdAt") } } public var updatedAt: String { get { return snapshot["updatedAt"]! as! String } set { snapshot.updateValue(newValue, forKey: "updatedAt") } } } } } }