From 89a657eec84bde51cb8ed938e03f759c403298c0 Mon Sep 17 00:00:00 2001 From: Satindar Dhillon Date: Mon, 3 Oct 2022 08:09:06 -0700 Subject: [PATCH] generate swift gql --- .../Services/DataService/GQLSchema.swift | 1267 +++++++++++++++++ 1 file changed, 1267 insertions(+) diff --git a/apple/OmnivoreKit/Sources/Services/DataService/GQLSchema.swift b/apple/OmnivoreKit/Sources/Services/DataService/GQLSchema.swift index f34630594..1876683b6 100644 --- a/apple/OmnivoreKit/Sources/Services/DataService/GQLSchema.swift +++ b/apple/OmnivoreKit/Sources/Services/DataService/GQLSchema.swift @@ -3774,6 +3774,137 @@ extension Selection where TypeLock == Never, Type == Never { typealias DeleteHighlightSuccess = Selection } +extension Objects { + struct DeleteIntegrationError { + let __typename: TypeName = .deleteIntegrationError + let errorCodes: [String: [Enums.DeleteIntegrationErrorCode]] + + enum TypeName: String, Codable { + case deleteIntegrationError = "DeleteIntegrationError" + } + } +} + +extension Objects.DeleteIntegrationError: Decodable { + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: DynamicCodingKeys.self) + + var map = HashMap() + for codingKey in container.allKeys { + if codingKey.isTypenameKey { continue } + + let alias = codingKey.stringValue + let field = GraphQLField.getFieldNameFromAlias(alias) + + switch field { + case "errorCodes": + if let value = try container.decode([Enums.DeleteIntegrationErrorCode]?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown key \(field)." + ) + ) + } + } + + errorCodes = map["errorCodes"] + } +} + +extension Fields where TypeLock == Objects.DeleteIntegrationError { + func errorCodes() throws -> [Enums.DeleteIntegrationErrorCode] { + let field = GraphQLField.leaf( + name: "errorCodes", + arguments: [] + ) + select(field) + + switch response { + case let .decoding(data): + if let data = data.errorCodes[field.alias!] { + return data + } + throw HttpError.badpayload + case .mocking: + return [] + } + } +} + +extension Selection where TypeLock == Never, Type == Never { + typealias DeleteIntegrationError = Selection +} + +extension Objects { + struct DeleteIntegrationSuccess { + let __typename: TypeName = .deleteIntegrationSuccess + let integration: [String: Objects.Integration] + + enum TypeName: String, Codable { + case deleteIntegrationSuccess = "DeleteIntegrationSuccess" + } + } +} + +extension Objects.DeleteIntegrationSuccess: Decodable { + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: DynamicCodingKeys.self) + + var map = HashMap() + for codingKey in container.allKeys { + if codingKey.isTypenameKey { continue } + + let alias = codingKey.stringValue + let field = GraphQLField.getFieldNameFromAlias(alias) + + switch field { + case "integration": + if let value = try container.decode(Objects.Integration?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown key \(field)." + ) + ) + } + } + + integration = map["integration"] + } +} + +extension Fields where TypeLock == Objects.DeleteIntegrationSuccess { + func integration(selection: Selection) throws -> Type { + let field = GraphQLField.composite( + name: "integration", + arguments: [], + selection: selection.selection + ) + select(field) + + switch response { + case let .decoding(data): + if let data = data.integration[field.alias!] { + return try selection.decode(data: data) + } + throw HttpError.badpayload + case .mocking: + return selection.mock() + } + } +} + +extension Selection where TypeLock == Never, Type == Never { + typealias DeleteIntegrationSuccess = Selection +} + extension Objects { struct DeleteLabelError { let __typename: TypeName = .deleteLabelError @@ -6330,6 +6461,322 @@ extension Selection where TypeLock == Never, Type == Never { typealias HighlightStats = Selection } +extension Objects { + struct Integration { + let __typename: TypeName = .integration + let createdAt: [String: DateTime] + let enabled: [String: Bool] + let id: [String: String] + let token: [String: String] + let type: [String: Enums.IntegrationType] + let updatedAt: [String: DateTime] + + enum TypeName: String, Codable { + case integration = "Integration" + } + } +} + +extension Objects.Integration: Decodable { + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: DynamicCodingKeys.self) + + var map = HashMap() + for codingKey in container.allKeys { + if codingKey.isTypenameKey { continue } + + let alias = codingKey.stringValue + let field = GraphQLField.getFieldNameFromAlias(alias) + + switch field { + case "createdAt": + if let value = try container.decode(DateTime?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } + case "enabled": + if let value = try container.decode(Bool?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } + case "id": + if let value = try container.decode(String?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } + case "token": + if let value = try container.decode(String?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } + case "type": + if let value = try container.decode(Enums.IntegrationType?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } + case "updatedAt": + if let value = try container.decode(DateTime?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown key \(field)." + ) + ) + } + } + + createdAt = map["createdAt"] + enabled = map["enabled"] + id = map["id"] + token = map["token"] + type = map["type"] + updatedAt = map["updatedAt"] + } +} + +extension Fields where TypeLock == Objects.Integration { + func createdAt() throws -> DateTime { + let field = GraphQLField.leaf( + name: "createdAt", + arguments: [] + ) + select(field) + + switch response { + case let .decoding(data): + if let data = data.createdAt[field.alias!] { + return data + } + throw HttpError.badpayload + case .mocking: + return DateTime.mockValue + } + } + + func enabled() throws -> Bool { + let field = GraphQLField.leaf( + name: "enabled", + arguments: [] + ) + select(field) + + switch response { + case let .decoding(data): + if let data = data.enabled[field.alias!] { + return data + } + throw HttpError.badpayload + case .mocking: + return Bool.mockValue + } + } + + func id() throws -> String { + let field = GraphQLField.leaf( + name: "id", + arguments: [] + ) + select(field) + + switch response { + case let .decoding(data): + if let data = data.id[field.alias!] { + return data + } + throw HttpError.badpayload + case .mocking: + return String.mockValue + } + } + + func token() throws -> String { + let field = GraphQLField.leaf( + name: "token", + arguments: [] + ) + select(field) + + switch response { + case let .decoding(data): + if let data = data.token[field.alias!] { + return data + } + throw HttpError.badpayload + case .mocking: + return String.mockValue + } + } + + func type() throws -> Enums.IntegrationType { + let field = GraphQLField.leaf( + name: "type", + arguments: [] + ) + select(field) + + switch response { + case let .decoding(data): + if let data = data.type[field.alias!] { + return data + } + throw HttpError.badpayload + case .mocking: + return Enums.IntegrationType.allCases.first! + } + } + + func updatedAt() throws -> DateTime { + let field = GraphQLField.leaf( + name: "updatedAt", + arguments: [] + ) + select(field) + + switch response { + case let .decoding(data): + if let data = data.updatedAt[field.alias!] { + return data + } + throw HttpError.badpayload + case .mocking: + return DateTime.mockValue + } + } +} + +extension Selection where TypeLock == Never, Type == Never { + typealias Integration = Selection +} + +extension Objects { + struct IntegrationsError { + let __typename: TypeName = .integrationsError + let errorCodes: [String: [Enums.IntegrationsErrorCode]] + + enum TypeName: String, Codable { + case integrationsError = "IntegrationsError" + } + } +} + +extension Objects.IntegrationsError: Decodable { + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: DynamicCodingKeys.self) + + var map = HashMap() + for codingKey in container.allKeys { + if codingKey.isTypenameKey { continue } + + let alias = codingKey.stringValue + let field = GraphQLField.getFieldNameFromAlias(alias) + + switch field { + case "errorCodes": + if let value = try container.decode([Enums.IntegrationsErrorCode]?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown key \(field)." + ) + ) + } + } + + errorCodes = map["errorCodes"] + } +} + +extension Fields where TypeLock == Objects.IntegrationsError { + func errorCodes() throws -> [Enums.IntegrationsErrorCode] { + let field = GraphQLField.leaf( + name: "errorCodes", + arguments: [] + ) + select(field) + + switch response { + case let .decoding(data): + if let data = data.errorCodes[field.alias!] { + return data + } + throw HttpError.badpayload + case .mocking: + return [] + } + } +} + +extension Selection where TypeLock == Never, Type == Never { + typealias IntegrationsError = Selection +} + +extension Objects { + struct IntegrationsSuccess { + let __typename: TypeName = .integrationsSuccess + let integrations: [String: [Objects.Integration]] + + enum TypeName: String, Codable { + case integrationsSuccess = "IntegrationsSuccess" + } + } +} + +extension Objects.IntegrationsSuccess: Decodable { + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: DynamicCodingKeys.self) + + var map = HashMap() + for codingKey in container.allKeys { + if codingKey.isTypenameKey { continue } + + let alias = codingKey.stringValue + let field = GraphQLField.getFieldNameFromAlias(alias) + + switch field { + case "integrations": + if let value = try container.decode([Objects.Integration]?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown key \(field)." + ) + ) + } + } + + integrations = map["integrations"] + } +} + +extension Fields where TypeLock == Objects.IntegrationsSuccess { + func integrations(selection: Selection) throws -> Type { + let field = GraphQLField.composite( + name: "integrations", + arguments: [], + selection: selection.selection + ) + select(field) + + switch response { + case let .decoding(data): + if let data = data.integrations[field.alias!] { + return try selection.decode(data: data) + } + throw HttpError.badpayload + case .mocking: + return selection.mock() + } + } +} + +extension Selection where TypeLock == Never, Type == Never { + typealias IntegrationsSuccess = Selection +} + extension Objects { struct Label { let __typename: TypeName = .label @@ -6338,6 +6785,7 @@ extension Objects { let description: [String: String] let id: [String: String] let name: [String: String] + let position: [String: Int] enum TypeName: String, Codable { case label = "Label" @@ -6377,6 +6825,10 @@ extension Objects.Label: Decodable { if let value = try container.decode(String?.self, forKey: codingKey) { map.set(key: field, hash: alias, value: value as Any) } + case "position": + if let value = try container.decode(Int?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } default: throw DecodingError.dataCorrupted( DecodingError.Context( @@ -6392,6 +6844,7 @@ extension Objects.Label: Decodable { description = map["description"] id = map["id"] name = map["name"] + position = map["position"] } } @@ -6479,6 +6932,21 @@ extension Fields where TypeLock == Objects.Label { return String.mockValue } } + + func position() throws -> Int? { + let field = GraphQLField.leaf( + name: "position", + arguments: [] + ) + select(field) + + switch response { + case let .decoding(data): + return data.position[field.alias!] + case .mocking: + return nil + } + } } extension Selection where TypeLock == Never, Type == Never { @@ -7501,6 +7969,137 @@ extension Selection where TypeLock == Never, Type == Never { typealias MergeHighlightSuccess = Selection } +extension Objects { + struct MoveLabelError { + let __typename: TypeName = .moveLabelError + let errorCodes: [String: [Enums.MoveLabelErrorCode]] + + enum TypeName: String, Codable { + case moveLabelError = "MoveLabelError" + } + } +} + +extension Objects.MoveLabelError: Decodable { + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: DynamicCodingKeys.self) + + var map = HashMap() + for codingKey in container.allKeys { + if codingKey.isTypenameKey { continue } + + let alias = codingKey.stringValue + let field = GraphQLField.getFieldNameFromAlias(alias) + + switch field { + case "errorCodes": + if let value = try container.decode([Enums.MoveLabelErrorCode]?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown key \(field)." + ) + ) + } + } + + errorCodes = map["errorCodes"] + } +} + +extension Fields where TypeLock == Objects.MoveLabelError { + func errorCodes() throws -> [Enums.MoveLabelErrorCode] { + let field = GraphQLField.leaf( + name: "errorCodes", + arguments: [] + ) + select(field) + + switch response { + case let .decoding(data): + if let data = data.errorCodes[field.alias!] { + return data + } + throw HttpError.badpayload + case .mocking: + return [] + } + } +} + +extension Selection where TypeLock == Never, Type == Never { + typealias MoveLabelError = Selection +} + +extension Objects { + struct MoveLabelSuccess { + let __typename: TypeName = .moveLabelSuccess + let label: [String: Objects.Label] + + enum TypeName: String, Codable { + case moveLabelSuccess = "MoveLabelSuccess" + } + } +} + +extension Objects.MoveLabelSuccess: Decodable { + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: DynamicCodingKeys.self) + + var map = HashMap() + for codingKey in container.allKeys { + if codingKey.isTypenameKey { continue } + + let alias = codingKey.stringValue + let field = GraphQLField.getFieldNameFromAlias(alias) + + switch field { + case "label": + if let value = try container.decode(Objects.Label?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown key \(field)." + ) + ) + } + } + + label = map["label"] + } +} + +extension Fields where TypeLock == Objects.MoveLabelSuccess { + func label(selection: Selection) throws -> Type { + let field = GraphQLField.composite( + name: "label", + arguments: [], + selection: selection.selection + ) + select(field) + + switch response { + case let .decoding(data): + if let data = data.label[field.alias!] { + return try selection.decode(data: data) + } + throw HttpError.badpayload + case .mocking: + return selection.mock() + } + } +} + +extension Selection where TypeLock == Never, Type == Never { + typealias MoveLabelSuccess = Selection +} + extension Objects { struct Mutation { let __typename: TypeName = .mutation @@ -7516,6 +8115,7 @@ extension Objects { let deleteAccount: [String: Unions.DeleteAccountResult] let deleteHighlight: [String: Unions.DeleteHighlightResult] let deleteHighlightReply: [String: Unions.DeleteHighlightReplyResult] + let deleteIntegration: [String: Unions.DeleteIntegrationResult] let deleteLabel: [String: Unions.DeleteLabelResult] let deleteNewsletterEmail: [String: Unions.DeleteNewsletterEmailResult] let deleteReaction: [String: Unions.DeleteReactionResult] @@ -7526,6 +8126,7 @@ extension Objects { let googleSignup: [String: Unions.GoogleSignupResult] let logOut: [String: Unions.LogOutResult] let mergeHighlight: [String: Unions.MergeHighlightResult] + let moveLabel: [String: Unions.MoveLabelResult] let reportItem: [String: Objects.ReportItemResult] let revokeApiKey: [String: Unions.RevokeApiKeyResult] let saveArticleReadingProgress: [String: Unions.SaveArticleReadingProgressResult] @@ -7535,6 +8136,7 @@ extension Objects { let setBookmarkArticle: [String: Unions.SetBookmarkArticleResult] let setDeviceToken: [String: Unions.SetDeviceTokenResult] let setFollow: [String: Unions.SetFollowResult] + let setIntegration: [String: Unions.SetIntegrationResult] let setLabels: [String: Unions.SetLabelsResult] let setLabelsForHighlight: [String: Unions.SetLabelsResult] let setLinkArchived: [String: Unions.ArchiveLinkResult] @@ -7621,6 +8223,10 @@ extension Objects.Mutation: Decodable { if let value = try container.decode(Unions.DeleteHighlightReplyResult?.self, forKey: codingKey) { map.set(key: field, hash: alias, value: value as Any) } + case "deleteIntegration": + if let value = try container.decode(Unions.DeleteIntegrationResult?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } case "deleteLabel": if let value = try container.decode(Unions.DeleteLabelResult?.self, forKey: codingKey) { map.set(key: field, hash: alias, value: value as Any) @@ -7661,6 +8267,10 @@ extension Objects.Mutation: Decodable { if let value = try container.decode(Unions.MergeHighlightResult?.self, forKey: codingKey) { map.set(key: field, hash: alias, value: value as Any) } + case "moveLabel": + if let value = try container.decode(Unions.MoveLabelResult?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } case "reportItem": if let value = try container.decode(Objects.ReportItemResult?.self, forKey: codingKey) { map.set(key: field, hash: alias, value: value as Any) @@ -7697,6 +8307,10 @@ extension Objects.Mutation: Decodable { if let value = try container.decode(Unions.SetFollowResult?.self, forKey: codingKey) { map.set(key: field, hash: alias, value: value as Any) } + case "setIntegration": + if let value = try container.decode(Unions.SetIntegrationResult?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } case "setLabels": if let value = try container.decode(Unions.SetLabelsResult?.self, forKey: codingKey) { map.set(key: field, hash: alias, value: value as Any) @@ -7795,6 +8409,7 @@ extension Objects.Mutation: Decodable { deleteAccount = map["deleteAccount"] deleteHighlight = map["deleteHighlight"] deleteHighlightReply = map["deleteHighlightReply"] + deleteIntegration = map["deleteIntegration"] deleteLabel = map["deleteLabel"] deleteNewsletterEmail = map["deleteNewsletterEmail"] deleteReaction = map["deleteReaction"] @@ -7805,6 +8420,7 @@ extension Objects.Mutation: Decodable { googleSignup = map["googleSignup"] logOut = map["logOut"] mergeHighlight = map["mergeHighlight"] + moveLabel = map["moveLabel"] reportItem = map["reportItem"] revokeApiKey = map["revokeApiKey"] saveArticleReadingProgress = map["saveArticleReadingProgress"] @@ -7814,6 +8430,7 @@ extension Objects.Mutation: Decodable { setBookmarkArticle = map["setBookmarkArticle"] setDeviceToken = map["setDeviceToken"] setFollow = map["setFollow"] + setIntegration = map["setIntegration"] setLabels = map["setLabels"] setLabelsForHighlight = map["setLabelsForHighlight"] setLinkArchived = map["setLinkArchived"] @@ -8065,6 +8682,25 @@ extension Fields where TypeLock == Objects.Mutation { } } + func deleteIntegration(id: String, selection: Selection) throws -> Type { + let field = GraphQLField.composite( + name: "deleteIntegration", + arguments: [Argument(name: "id", type: "ID!", value: id)], + selection: selection.selection + ) + select(field) + + switch response { + case let .decoding(data): + if let data = data.deleteIntegration[field.alias!] { + return try selection.decode(data: data) + } + throw HttpError.badpayload + case .mocking: + return selection.mock() + } + } + func deleteLabel(id: String, selection: Selection) throws -> Type { let field = GraphQLField.composite( name: "deleteLabel", @@ -8255,6 +8891,25 @@ extension Fields where TypeLock == Objects.Mutation { } } + func moveLabel(input: InputObjects.MoveLabelInput, selection: Selection) throws -> Type { + let field = GraphQLField.composite( + name: "moveLabel", + arguments: [Argument(name: "input", type: "MoveLabelInput!", value: input)], + selection: selection.selection + ) + select(field) + + switch response { + case let .decoding(data): + if let data = data.moveLabel[field.alias!] { + return try selection.decode(data: data) + } + throw HttpError.badpayload + case .mocking: + return selection.mock() + } + } + func reportItem(input: InputObjects.ReportItemInput, selection: Selection) throws -> Type { let field = GraphQLField.composite( name: "reportItem", @@ -8426,6 +9081,25 @@ extension Fields where TypeLock == Objects.Mutation { } } + func setIntegration(input: InputObjects.SetIntegrationInput, selection: Selection) throws -> Type { + let field = GraphQLField.composite( + name: "setIntegration", + arguments: [Argument(name: "input", type: "SetIntegrationInput!", value: input)], + selection: selection.selection + ) + select(field) + + switch response { + case let .decoding(data): + if let data = data.setIntegration[field.alias!] { + return try selection.decode(data: data) + } + throw HttpError.badpayload + case .mocking: + return selection.mock() + } + } + func setLabels(input: InputObjects.SetLabelsInput, selection: Selection) throws -> Type { let field = GraphQLField.composite( name: "setLabels", @@ -9720,6 +10394,7 @@ extension Objects { let getFollowing: [String: Unions.GetFollowingResult] let getUserPersonalization: [String: Unions.GetUserPersonalizationResult] let hello: [String: String] + let integrations: [String: Unions.IntegrationsResult] let labels: [String: Unions.LabelsResult] let me: [String: Objects.User] let newsletterEmails: [String: Unions.NewsletterEmailsResult] @@ -9790,6 +10465,10 @@ extension Objects.Query: Decodable { if let value = try container.decode(String?.self, forKey: codingKey) { map.set(key: field, hash: alias, value: value as Any) } + case "integrations": + if let value = try container.decode(Unions.IntegrationsResult?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } case "labels": if let value = try container.decode(Unions.LabelsResult?.self, forKey: codingKey) { map.set(key: field, hash: alias, value: value as Any) @@ -9869,6 +10548,7 @@ extension Objects.Query: Decodable { getFollowing = map["getFollowing"] getUserPersonalization = map["getUserPersonalization"] hello = map["hello"] + integrations = map["integrations"] labels = map["labels"] me = map["me"] newsletterEmails = map["newsletterEmails"] @@ -10055,6 +10735,25 @@ extension Fields where TypeLock == Objects.Query { } } + func integrations(selection: Selection) throws -> Type { + let field = GraphQLField.composite( + name: "integrations", + arguments: [], + selection: selection.selection + ) + select(field) + + switch response { + case let .decoding(data): + if let data = data.integrations[field.alias!] { + return try selection.decode(data: data) + } + throw HttpError.badpayload + case .mocking: + return selection.mock() + } + } + func labels(selection: Selection) throws -> Type { let field = GraphQLField.composite( name: "labels", @@ -11491,6 +12190,7 @@ extension Objects { let readingProgressPercent: [String: Double] let savedAt: [String: DateTime] let shortId: [String: String] + let siteIcon: [String: String] let siteName: [String: String] let slug: [String: String] let state: [String: Enums.ArticleSavingRequestStatus] @@ -11608,6 +12308,10 @@ extension Objects.SearchItem: Decodable { if let value = try container.decode(String?.self, forKey: codingKey) { map.set(key: field, hash: alias, value: value as Any) } + case "siteIcon": + if let value = try container.decode(String?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } case "siteName": if let value = try container.decode(String?.self, forKey: codingKey) { map.set(key: field, hash: alias, value: value as Any) @@ -11680,6 +12384,7 @@ extension Objects.SearchItem: Decodable { readingProgressPercent = map["readingProgressPercent"] savedAt = map["savedAt"] shortId = map["shortId"] + siteIcon = map["siteIcon"] siteName = map["siteName"] slug = map["slug"] state = map["state"] @@ -12050,6 +12755,21 @@ extension Fields where TypeLock == Objects.SearchItem { } } + func siteIcon() throws -> String? { + let field = GraphQLField.leaf( + name: "siteIcon", + arguments: [] + ) + select(field) + + switch response { + case let .decoding(data): + return data.siteIcon[field.alias!] + case .mocking: + return nil + } + } + func siteName() throws -> String? { let field = GraphQLField.leaf( name: "siteName", @@ -12918,6 +13638,137 @@ extension Selection where TypeLock == Never, Type == Never { typealias SetFollowSuccess = Selection } +extension Objects { + struct SetIntegrationError { + let __typename: TypeName = .setIntegrationError + let errorCodes: [String: [Enums.SetIntegrationErrorCode]] + + enum TypeName: String, Codable { + case setIntegrationError = "SetIntegrationError" + } + } +} + +extension Objects.SetIntegrationError: Decodable { + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: DynamicCodingKeys.self) + + var map = HashMap() + for codingKey in container.allKeys { + if codingKey.isTypenameKey { continue } + + let alias = codingKey.stringValue + let field = GraphQLField.getFieldNameFromAlias(alias) + + switch field { + case "errorCodes": + if let value = try container.decode([Enums.SetIntegrationErrorCode]?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown key \(field)." + ) + ) + } + } + + errorCodes = map["errorCodes"] + } +} + +extension Fields where TypeLock == Objects.SetIntegrationError { + func errorCodes() throws -> [Enums.SetIntegrationErrorCode] { + let field = GraphQLField.leaf( + name: "errorCodes", + arguments: [] + ) + select(field) + + switch response { + case let .decoding(data): + if let data = data.errorCodes[field.alias!] { + return data + } + throw HttpError.badpayload + case .mocking: + return [] + } + } +} + +extension Selection where TypeLock == Never, Type == Never { + typealias SetIntegrationError = Selection +} + +extension Objects { + struct SetIntegrationSuccess { + let __typename: TypeName = .setIntegrationSuccess + let integration: [String: Objects.Integration] + + enum TypeName: String, Codable { + case setIntegrationSuccess = "SetIntegrationSuccess" + } + } +} + +extension Objects.SetIntegrationSuccess: Decodable { + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: DynamicCodingKeys.self) + + var map = HashMap() + for codingKey in container.allKeys { + if codingKey.isTypenameKey { continue } + + let alias = codingKey.stringValue + let field = GraphQLField.getFieldNameFromAlias(alias) + + switch field { + case "integration": + if let value = try container.decode(Objects.Integration?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown key \(field)." + ) + ) + } + } + + integration = map["integration"] + } +} + +extension Fields where TypeLock == Objects.SetIntegrationSuccess { + func integration(selection: Selection) throws -> Type { + let field = GraphQLField.composite( + name: "integration", + arguments: [], + selection: selection.selection + ) + select(field) + + switch response { + case let .decoding(data): + if let data = data.integration[field.alias!] { + return try selection.decode(data: data) + } + throw HttpError.badpayload + case .mocking: + return selection.mock() + } + } +} + +extension Selection where TypeLock == Never, Type == Never { + typealias SetIntegrationSuccess = Selection +} + extension Objects { struct SetLabelsError { let __typename: TypeName = .setLabelsError @@ -13996,6 +14847,7 @@ extension Objects { let __typename: TypeName = .subscription let createdAt: [String: DateTime] let description: [String: String] + let icon: [String: String] let id: [String: String] let name: [String: String] let newsletterEmail: [String: String] @@ -14031,6 +14883,10 @@ extension Objects.Subscription: Decodable { if let value = try container.decode(String?.self, forKey: codingKey) { map.set(key: field, hash: alias, value: value as Any) } + case "icon": + if let value = try container.decode(String?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } case "id": if let value = try container.decode(String?.self, forKey: codingKey) { map.set(key: field, hash: alias, value: value as Any) @@ -14075,6 +14931,7 @@ extension Objects.Subscription: Decodable { createdAt = map["createdAt"] description = map["description"] + icon = map["icon"] id = map["id"] name = map["name"] newsletterEmail = map["newsletterEmail"] @@ -14120,6 +14977,21 @@ extension Fields where TypeLock == Objects.Subscription { } } + func icon() throws -> String? { + let field = GraphQLField.leaf( + name: "icon", + arguments: [] + ) + select(field) + + switch response { + case let .decoding(data): + return data.icon[field.alias!] + case .mocking: + return nil + } + } + func id() throws -> String { let field = GraphQLField.leaf( name: "id", @@ -19035,6 +19907,80 @@ extension Selection where TypeLock == Never, Type == Never { typealias DeleteHighlightResult = Selection } +extension Unions { + struct DeleteIntegrationResult { + let __typename: TypeName + let errorCodes: [String: [Enums.DeleteIntegrationErrorCode]] + let integration: [String: Objects.Integration] + + enum TypeName: String, Codable { + case deleteIntegrationError = "DeleteIntegrationError" + case deleteIntegrationSuccess = "DeleteIntegrationSuccess" + } + } +} + +extension Unions.DeleteIntegrationResult: Decodable { + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: DynamicCodingKeys.self) + + var map = HashMap() + for codingKey in container.allKeys { + if codingKey.isTypenameKey { continue } + + let alias = codingKey.stringValue + let field = GraphQLField.getFieldNameFromAlias(alias) + + switch field { + case "errorCodes": + if let value = try container.decode([Enums.DeleteIntegrationErrorCode]?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } + case "integration": + if let value = try container.decode(Objects.Integration?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown key \(field)." + ) + ) + } + } + + __typename = try container.decode(TypeName.self, forKey: DynamicCodingKeys(stringValue: "__typename")!) + + errorCodes = map["errorCodes"] + integration = map["integration"] + } +} + +extension Fields where TypeLock == Unions.DeleteIntegrationResult { + func on(deleteIntegrationError: Selection, deleteIntegrationSuccess: Selection) throws -> Type { + select([GraphQLField.fragment(type: "DeleteIntegrationError", selection: deleteIntegrationError.selection), GraphQLField.fragment(type: "DeleteIntegrationSuccess", selection: deleteIntegrationSuccess.selection)]) + + switch response { + case let .decoding(data): + switch data.__typename { + case .deleteIntegrationError: + let data = Objects.DeleteIntegrationError(errorCodes: data.errorCodes) + return try deleteIntegrationError.decode(data: data) + case .deleteIntegrationSuccess: + let data = Objects.DeleteIntegrationSuccess(integration: data.integration) + return try deleteIntegrationSuccess.decode(data: data) + } + case .mocking: + return deleteIntegrationError.mock() + } + } +} + +extension Selection where TypeLock == Never, Type == Never { + typealias DeleteIntegrationResult = Selection +} + extension Unions { struct DeleteLabelResult { let __typename: TypeName @@ -19855,6 +20801,80 @@ extension Selection where TypeLock == Never, Type == Never { typealias GoogleSignupResult = Selection } +extension Unions { + struct IntegrationsResult { + let __typename: TypeName + let errorCodes: [String: [Enums.IntegrationsErrorCode]] + let integrations: [String: [Objects.Integration]] + + enum TypeName: String, Codable { + case integrationsError = "IntegrationsError" + case integrationsSuccess = "IntegrationsSuccess" + } + } +} + +extension Unions.IntegrationsResult: Decodable { + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: DynamicCodingKeys.self) + + var map = HashMap() + for codingKey in container.allKeys { + if codingKey.isTypenameKey { continue } + + let alias = codingKey.stringValue + let field = GraphQLField.getFieldNameFromAlias(alias) + + switch field { + case "errorCodes": + if let value = try container.decode([Enums.IntegrationsErrorCode]?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } + case "integrations": + if let value = try container.decode([Objects.Integration]?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown key \(field)." + ) + ) + } + } + + __typename = try container.decode(TypeName.self, forKey: DynamicCodingKeys(stringValue: "__typename")!) + + errorCodes = map["errorCodes"] + integrations = map["integrations"] + } +} + +extension Fields where TypeLock == Unions.IntegrationsResult { + func on(integrationsError: Selection, integrationsSuccess: Selection) throws -> Type { + select([GraphQLField.fragment(type: "IntegrationsError", selection: integrationsError.selection), GraphQLField.fragment(type: "IntegrationsSuccess", selection: integrationsSuccess.selection)]) + + switch response { + case let .decoding(data): + switch data.__typename { + case .integrationsError: + let data = Objects.IntegrationsError(errorCodes: data.errorCodes) + return try integrationsError.decode(data: data) + case .integrationsSuccess: + let data = Objects.IntegrationsSuccess(integrations: data.integrations) + return try integrationsSuccess.decode(data: data) + } + case .mocking: + return integrationsError.mock() + } + } +} + +extension Selection where TypeLock == Never, Type == Never { + typealias IntegrationsResult = Selection +} + extension Unions { struct LabelsResult { let __typename: TypeName @@ -20157,6 +21177,80 @@ extension Selection where TypeLock == Never, Type == Never { typealias MergeHighlightResult = Selection } +extension Unions { + struct MoveLabelResult { + let __typename: TypeName + let errorCodes: [String: [Enums.MoveLabelErrorCode]] + let label: [String: Objects.Label] + + enum TypeName: String, Codable { + case moveLabelError = "MoveLabelError" + case moveLabelSuccess = "MoveLabelSuccess" + } + } +} + +extension Unions.MoveLabelResult: Decodable { + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: DynamicCodingKeys.self) + + var map = HashMap() + for codingKey in container.allKeys { + if codingKey.isTypenameKey { continue } + + let alias = codingKey.stringValue + let field = GraphQLField.getFieldNameFromAlias(alias) + + switch field { + case "errorCodes": + if let value = try container.decode([Enums.MoveLabelErrorCode]?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } + case "label": + if let value = try container.decode(Objects.Label?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown key \(field)." + ) + ) + } + } + + __typename = try container.decode(TypeName.self, forKey: DynamicCodingKeys(stringValue: "__typename")!) + + errorCodes = map["errorCodes"] + label = map["label"] + } +} + +extension Fields where TypeLock == Unions.MoveLabelResult { + func on(moveLabelError: Selection, moveLabelSuccess: Selection) throws -> Type { + select([GraphQLField.fragment(type: "MoveLabelError", selection: moveLabelError.selection), GraphQLField.fragment(type: "MoveLabelSuccess", selection: moveLabelSuccess.selection)]) + + switch response { + case let .decoding(data): + switch data.__typename { + case .moveLabelError: + let data = Objects.MoveLabelError(errorCodes: data.errorCodes) + return try moveLabelError.decode(data: data) + case .moveLabelSuccess: + let data = Objects.MoveLabelSuccess(label: data.label) + return try moveLabelSuccess.decode(data: data) + } + case .mocking: + return moveLabelError.mock() + } + } +} + +extension Selection where TypeLock == Never, Type == Never { + typealias MoveLabelResult = Selection +} + extension Unions { struct NewsletterEmailsResult { let __typename: TypeName @@ -20915,6 +22009,80 @@ extension Selection where TypeLock == Never, Type == Never { typealias SetFollowResult = Selection } +extension Unions { + struct SetIntegrationResult { + let __typename: TypeName + let errorCodes: [String: [Enums.SetIntegrationErrorCode]] + let integration: [String: Objects.Integration] + + enum TypeName: String, Codable { + case setIntegrationError = "SetIntegrationError" + case setIntegrationSuccess = "SetIntegrationSuccess" + } + } +} + +extension Unions.SetIntegrationResult: Decodable { + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: DynamicCodingKeys.self) + + var map = HashMap() + for codingKey in container.allKeys { + if codingKey.isTypenameKey { continue } + + let alias = codingKey.stringValue + let field = GraphQLField.getFieldNameFromAlias(alias) + + switch field { + case "errorCodes": + if let value = try container.decode([Enums.SetIntegrationErrorCode]?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } + case "integration": + if let value = try container.decode(Objects.Integration?.self, forKey: codingKey) { + map.set(key: field, hash: alias, value: value as Any) + } + default: + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Unknown key \(field)." + ) + ) + } + } + + __typename = try container.decode(TypeName.self, forKey: DynamicCodingKeys(stringValue: "__typename")!) + + errorCodes = map["errorCodes"] + integration = map["integration"] + } +} + +extension Fields where TypeLock == Unions.SetIntegrationResult { + func on(setIntegrationError: Selection, setIntegrationSuccess: Selection) throws -> Type { + select([GraphQLField.fragment(type: "SetIntegrationError", selection: setIntegrationError.selection), GraphQLField.fragment(type: "SetIntegrationSuccess", selection: setIntegrationSuccess.selection)]) + + switch response { + case let .decoding(data): + switch data.__typename { + case .setIntegrationError: + let data = Objects.SetIntegrationError(errorCodes: data.errorCodes) + return try setIntegrationError.decode(data: data) + case .setIntegrationSuccess: + let data = Objects.SetIntegrationSuccess(integration: data.integration) + return try setIntegrationSuccess.decode(data: data) + } + case .mocking: + return setIntegrationError.mock() + } + } +} + +extension Selection where TypeLock == Never, Type == Never { + typealias SetIntegrationResult = Selection +} + extension Unions { struct SetLabelsResult { let __typename: TypeName @@ -23025,6 +24193,17 @@ extension Enums { } } +extension Enums { + /// DeleteIntegrationErrorCode + enum DeleteIntegrationErrorCode: String, CaseIterable, Codable { + case badRequest = "BAD_REQUEST" + + case notFound = "NOT_FOUND" + + case unauthorized = "UNAUTHORIZED" + } +} + extension Enums { /// DeleteLabelErrorCode enum DeleteLabelErrorCode: String, CaseIterable, Codable { @@ -23119,6 +24298,22 @@ extension Enums { } } +extension Enums { + /// IntegrationType + enum IntegrationType: String, CaseIterable, Codable { + case readwise = "READWISE" + } +} + +extension Enums { + /// IntegrationsErrorCode + enum IntegrationsErrorCode: String, CaseIterable, Codable { + case badRequest = "BAD_REQUEST" + + case unauthorized = "UNAUTHORIZED" + } +} + extension Enums { /// LabelsErrorCode enum LabelsErrorCode: String, CaseIterable, Codable { @@ -23169,6 +24364,17 @@ extension Enums { } } +extension Enums { + /// MoveLabelErrorCode + enum MoveLabelErrorCode: String, CaseIterable, Codable { + case badRequest = "BAD_REQUEST" + + case notFound = "NOT_FOUND" + + case unauthorized = "UNAUTHORIZED" + } +} + extension Enums { /// NewsletterEmailsErrorCode enum NewsletterEmailsErrorCode: String, CaseIterable, Codable { @@ -23318,6 +24524,21 @@ extension Enums { } } +extension Enums { + /// SetIntegrationErrorCode + enum SetIntegrationErrorCode: String, CaseIterable, Codable { + case alreadyExists = "ALREADY_EXISTS" + + case badRequest = "BAD_REQUEST" + + case invalidToken = "INVALID_TOKEN" + + case notFound = "NOT_FOUND" + + case unauthorized = "UNAUTHORIZED" + } +} + extension Enums { /// SetLabelsErrorCode enum SetLabelsErrorCode: String, CaseIterable, Codable { @@ -24040,6 +25261,25 @@ extension InputObjects { } } +extension InputObjects { + struct MoveLabelInput: Encodable, Hashable { + var afterLabelId: OptionalArgument = .absent() + + var labelId: String + + func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if afterLabelId.hasValue { try container.encode(afterLabelId, forKey: .afterLabelId) } + try container.encode(labelId, forKey: .labelId) + } + + enum CodingKeys: String, CodingKey { + case afterLabelId + case labelId + } + } +} + extension InputObjects { struct PageInfoInput: Encodable, Hashable { var author: OptionalArgument = .absent() @@ -24290,6 +25530,33 @@ extension InputObjects { } } +extension InputObjects { + struct SetIntegrationInput: Encodable, Hashable { + var enabled: Bool + + var id: OptionalArgument = .absent() + + var token: String + + var type: Enums.IntegrationType + + func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(enabled, forKey: .enabled) + if id.hasValue { try container.encode(id, forKey: .id) } + try container.encode(token, forKey: .token) + try container.encode(type, forKey: .type) + } + + enum CodingKeys: String, CodingKey { + case enabled + case id + case token + case type + } + } +} + extension InputObjects { struct SetLabelsForHighlightInput: Encodable, Hashable { var highlightId: String