From e75d0e125bfb07a8426984f7a9bd810c7e5470f1 Mon Sep 17 00:00:00 2001 From: Tuan Pham <103537251+phantumcode@users.noreply.github.com> Date: Wed, 2 Oct 2024 15:24:30 -0500 Subject: [PATCH] chore(api): resolve swiftformat errors and warnings (#3845) * chore(api): resolve swiftformat errors and warnings * updated swiftformat rules * fix build error * update rules --- ...lugin+APIAuthProviderFactoryBehavior.swift | 4 +- .../AWSAPIPlugin+AuthInformation.swift | 6 +- .../AWSAPIPlugin/AWSAPIPlugin+Configure.swift | 14 +- .../AWSAPIPlugin+GraphQLBehavior.swift | 75 +- .../AWSAPIPlugin+InterceptorBehavior.swift | 6 +- .../AWSAPIPlugin+RESTBehavior.swift | 224 +- .../AWSAPIPlugin+Reachability.swift | 19 +- ...APIPlugin+URLSessionBehaviorDelegate.swift | 16 +- .../AWSAPIPlugin+URLSessionDelegate.swift | 50 +- .../Sources/AWSAPIPlugin/AWSAPIPlugin.swift | 4 +- .../AppSyncRealTimeClient+HandleRequest.swift | 9 +- .../AppSyncRealTimeClient.swift | 85 +- .../AppSyncRealTimeRequest.swift | 11 +- .../AppSyncRealTimeRequestAuth.swift | 1 - .../AppSyncRealTimeResponse.swift | 2 +- .../AppSyncRealTimeSubscription.swift | 29 +- .../AppSyncRequestInterceptor.swift | 1 - .../AppSyncSubscriptionEvent.swift | 3 +- .../AppSyncWebSocketClientProtocol.swift | 3 +- ...ryPluginConfiguration+EndpointConfig.swift | 139 +- .../AWSAPICategoryPluginConfiguration.swift | 154 +- .../AWSAPIEndpointInterceptors.swift | 67 +- .../Core/AppSyncListDecoder.swift | 4 +- .../Core/AppSyncListPayload.swift | 16 +- .../Core/AppSyncListProvider.swift | 190 +- .../Core/AppSyncListResponse.swift | 15 +- .../Core/AppSyncModelDecoder.swift | 12 +- .../Core/AppSyncModelMetadata.swift | 82 +- .../Core/AppSyncModelProvider.swift | 23 +- .../APIKeyURLRequestInterceptor.swift | 2 +- .../AuthTokenProviderWrapper.swift | 2 +- .../AuthTokenURLRequestInterceptor.swift | 30 +- .../IAMURLRequestInterceptor.swift | 19 +- .../APIKeyAuthInterceptor.swift | 5 +- .../AuthTokenInterceptor.swift | 4 +- .../IAMAuthInterceptor.swift | 23 +- .../Operation/APIOperationResponse.swift | 2 +- .../AWSAPIOperation+APIOperation.swift | 2 +- .../AWSGraphQLOperation+APIOperation.swift | 2 +- .../Operation/AWSGraphQLOperation.swift | 46 +- .../AWSGraphQLSubscriptionTaskRunner.swift | 80 +- .../Operation/AWSHTTPURLResponse.swift | 30 +- .../Operation/AWSRESTOperation.swift | 28 +- .../Reachability/AmplifyReachability.swift | 54 +- .../AmplifyRechability+watchOS.swift | 10 +- .../NetworkReachabilityNotifier.swift | 31 +- .../AWSOIDCAuthProvider.swift | 2 +- .../AppSyncRealTimeClientFactory.swift | 21 +- .../Constants/URLRequestConstants.swift | 6 +- .../Support/Decode/GraphQLErrorDecoder.swift | 16 +- .../GraphQLResponseDecoder+DecodeData.swift | 33 +- .../Decode/GraphQLResponseDecoder.swift | 25 +- .../Internal/AWSAppSyncGraphQLResponse.swift | 26 +- .../Utils/APIError+DecodingError.swift | 2 +- .../Support/Utils/AnyModel+JSONInit.swift | 13 +- .../Support/Utils/Array+Error+TypeCast.swift | 5 +- .../GraphQLOperationRequest+Validate.swift | 2 +- ...aphQLOperationRequestUtils+Validator.swift | 4 +- .../Utils/GraphQLOperationRequestUtils.swift | 2 +- .../Utils/GraphQLRequest+toListQuery.swift | 68 +- .../GraphQLRequest+toOperationRequest.swift | 18 +- .../RESTOperationRequest+RESTRequest.swift | 16 +- .../Utils/RESTOperationRequest+Validate.swift | 4 +- .../RESTOperationRequestUtils+Validator.swift | 2 +- .../Utils/RESTOperationRequestUtils.swift | 6 +- .../OperationTaskMapper.swift | 6 +- .../URLSessionBehaviorDelegate.swift | 16 +- .../URLSessionFactory.swift | 8 +- .../APIHostApp/SubscriptionView.swift | 47 +- .../AWSAPIPluginFunctionalTests/API.swift | 15458 ++++++++-------- .../AnyModelIntegrationTests.swift | 30 +- .../AppSyncRealTimeClientTests.swift | 25 +- ...phQLConnectionScenario1APISwiftTests.swift | 66 +- .../GraphQLConnectionScenario1Tests.swift | 63 +- .../GraphQLConnectionScenario2Tests.swift | 37 +- ...tionScenario3APISwiftTests+Subscribe.swift | 19 +- ...phQLConnectionScenario3Tests+Helpers.swift | 4 +- ...GraphQLConnectionScenario3Tests+List.swift | 16 +- ...QLConnectionScenario3Tests+Subscribe.swift | 14 +- .../GraphQLConnectionScenario3Tests.swift | 2 +- .../GraphQLConnectionScenario4Tests.swift | 17 +- .../GraphQLConnectionScenario5Tests.swift | 6 +- .../GraphQLConnectionScenario6Tests.swift | 13 +- .../GraphQLModelBasedTests+List.swift | 12 +- .../GraphQLModelBasedTests.swift | 123 +- .../GraphQLScalarAPISwiftTests.swift | 24 +- .../GraphQLScalarTests.swift | 197 +- .../GraphQLSyncBasedTests.swift | 77 +- .../GraphQLSyncCustomPrimaryKeyTests.swift | 74 +- .../GraphQLTestBase.swift | 2 +- .../Models/AmplifyModels.swift | 15 +- .../Models/Blog6+Schema.swift | 29 +- .../Models/Blog6.swift | 37 +- .../Models/Comment+Schema.swift | 29 +- .../Models/Comment.swift | 39 +- .../Models/Comment3+Schema.swift | 31 +- .../Models/Comment3.swift | 37 +- .../Models/Comment4+Schema.swift | 31 +- .../Models/Comment4.swift | 37 +- .../Models/Comment6+Schema.swift | 31 +- .../Models/Comment6.swift | 37 +- .../Models/EnumTestModel+Schema.swift | 29 +- .../Models/EnumTestModel.swift | 53 +- .../Models/ListIntContainer+Schema.swift | 29 +- .../Models/ListIntContainer.swift | 53 +- .../Models/ListStringContainer+Schema.swift | 29 +- .../Models/ListStringContainer.swift | 53 +- .../Models/Nested+Schema.swift | 29 +- .../Models/Nested.swift | 9 +- .../Models/NestedTypeTestModel+Schema.swift | 29 +- .../Models/NestedTypeTestModel.swift | 53 +- .../Models/Post+Schema.swift | 29 +- .../Models/Post.swift | 17 +- .../Models/Post3+Schema.swift | 29 +- .../Models/Post3.swift | 37 +- .../Models/Post4+Schema.swift | 29 +- .../Models/Post4.swift | 37 +- .../Models/Post5+Schema.swift | 29 +- .../Models/Post5.swift | 37 +- .../Models/Post6+Schema.swift | 31 +- .../Models/Post6.swift | 41 +- .../Models/PostEditor5+Schema.swift | 31 +- .../Models/PostEditor5.swift | 37 +- .../Models/PostStatus.swift | 9 +- .../Models/Project1+Schema.swift | 29 +- .../Models/Project1.swift | 37 +- .../Models/Project2+Schema.swift | 29 +- .../Models/Project2.swift | 41 +- .../Models/ScalarContainer+Schema.swift | 29 +- .../Models/ScalarContainer.swift | 81 +- .../Models/Team1+Schema.swift | 29 +- .../Models/Team1.swift | 33 +- .../Models/Team2+Schema.swift | 29 +- .../Models/Team2.swift | 33 +- .../Models/TestEnum.swift | 9 +- .../Models/User5+Schema.swift | 29 +- .../Models/User5.swift | 37 +- .../AWSAPIPluginFunctionalTests/Todo.swift | 28 +- .../AWSAPIPluginGen2GraphQLBaseTest.swift | 45 +- .../AuthSignInHelper.swift | 11 +- .../GraphQLLocationPostUser1Tests.swift | 3 +- .../Gen2_1/Location1+Schema.swift | 29 +- .../Gen2_1/Location1.swift | 9 +- .../Gen2_1/Post1+Schema.swift | 57 +- .../Gen2_1/Post1.swift | 37 +- .../Gen2_1/User1+Schema.swift | 53 +- .../Gen2_1/User1.swift | 33 +- .../Gen2_10/Customer10+Schema.swift | 65 +- .../Gen2_10/Customer10.swift | 41 +- .../Gen2_10/GraphQLCustomer10Tests.swift | 10 +- .../Gen2_11/GraphQLPost11Tests.swift | 11 +- .../Gen2_11/Post11+Schema.swift | 61 +- .../Gen2_11/Post11.swift | 37 +- .../Gen2_12/GraphQLTodo12Tests.swift | 5 +- .../Gen2_12/Todo12+Schema.swift | 57 +- .../Gen2_12/Todo12.swift | 33 +- .../Gen2_13/GraphQLTodo13Tests.swift | 3 +- .../Gen2_13/Todo13+Schema.swift | 57 +- .../Gen2_13/Todo13.swift | 33 +- .../Gen2_14/GraphQLTodo14Tests.swift | 6 +- .../Gen2_14/Todo14+Schema.swift | 57 +- .../Gen2_14/Todo14.swift | 33 +- .../Gen2_15/GraphQLTodo15Tests.swift | 15 +- .../Gen2_15/Todo15+Schema.swift | 31 +- .../Gen2_15/Todo15.swift | 33 +- .../Gen2_16/GraphQLTodo16Tests.swift | 6 +- .../Gen2_16/Todo16+Schema.swift | 57 +- .../Gen2_16/Todo16.swift | 33 +- .../Gen2_17/GraphQLTodo17Tests.swift | 6 +- .../Gen2_17/Todo17+Schema.swift | 57 +- .../Gen2_17/Todo17.swift | 33 +- .../Gen2_18/GraphQLSalary18Tests.swift | 11 +- .../Gen2_18/Salary18+Schema.swift | 61 +- .../Gen2_18/Salary18.swift | 37 +- ...GraphQLPostVideoPrivacySetting2Tests.swift | 3 +- .../Gen2_2/Post2+Schema.swift | 57 +- .../Gen2_2/Post2.swift | 37 +- .../Gen2_2/PrivacySetting2.swift | 9 +- .../Gen2_2/Video2+Schema.swift | 53 +- .../Gen2_2/Video2.swift | 33 +- .../Gen2_3/GraphQLTeamMember3Tests.swift | 25 +- .../Gen2_3/Member3+Schema.swift | 61 +- .../Gen2_3/Member3.swift | 55 +- .../Gen2_3/Team3+Schema.swift | 59 +- .../Gen2_3/Team3.swift | 37 +- .../Gen2_4/Cart4+Schema.swift | 61 +- .../Gen2_4/Cart4.swift | 55 +- .../Gen2_4/Customer4+Schema.swift | 59 +- .../Gen2_4/Customer4.swift | 55 +- .../Gen2_41/GraphQLPostPerson41Tests.swift | 6 +- .../Gen2_4/Gen2_41/Person41+Schema.swift | 65 +- .../Gen2_4/Gen2_41/Person41.swift | 41 +- .../Gen2_4/Gen2_41/Post41+Schema.swift | 69 +- .../Gen2_4/Gen2_41/Post41.swift | 75 +- .../Gen2_4/GraphQLCartCustomer4Tests.swift | 15 +- .../Gen2_5/GraphQLTodo5Tests.swift | 3 +- .../Gen2_5/Todo5+Schema.swift | 61 +- .../Gen2_5/Todo5.swift | 37 +- .../Gen2_6/GraphQLTodo6Tests.swift | 3 +- .../Gen2_6/Todo6+Schema.swift | 67 +- .../Gen2_6/Todo6.swift | 37 +- .../Gen2_7/GraphQLStoreBranch7Tests.swift | 9 +- .../Gen2_7/StoreBranch7+Schema.swift | 87 +- .../Gen2_7/StoreBranch7.swift | 53 +- .../Gen2_8/Customer8+Schema.swift | 65 +- .../Gen2_8/Customer8.swift | 41 +- .../Gen2_8/GraphQLCustomer8Tests.swift | 5 +- .../Gen2_9/Customer9+Schema.swift | 65 +- .../Gen2_9/Customer9.swift | 41 +- .../Gen2_9/GraphQLCustomer9Tests.swift | 5 +- .../LL1/Comment4V2+Schema.swift | 61 +- .../LL1/Comment4V2.swift | 55 +- .../GraphQLLazyLoadPostComment4V2Tests.swift | 93 +- .../LL1/Post4V2+Schema.swift | 59 +- .../LL1/Post4V2.swift | 37 +- .../LL3/CommentWithCompositeKey+Schema.swift | 71 +- .../LL3/CommentWithCompositeKey.swift | 55 +- ...LoadPostCommentWithCompositeKeyTests.swift | 233 +- .../LL3/PostWithCompositeKey+Schema.swift | 71 +- .../LL3/PostWithCompositeKey.swift | 37 +- .../AWSAPIPluginGraphQLIAMTests/API.swift | 608 +- ...aphQLWithIAMIntegrationAPISwiftTests.swift | 26 +- .../GraphQLWithIAMIntegrationTests.swift | 56 +- .../AWSAPIPluginGraphQLIAMTests/Todo.swift | 28 +- ...raphQLWithLambdaAuthIntegrationTests.swift | 34 +- .../Todo.swift | 28 +- .../API.swift | 608 +- .../Base/AsyncExpectation.swift | 84 +- ...WithUserPoolIntegrationAPISwiftTests.swift | 28 +- .../GraphQLWithUserPoolIntegrationTests.swift | 275 +- .../Todo.swift | 28 +- .../Base/AuthSignInHelper.swift | 2 +- ...GraphQLAuthDirectiveIntegrationTests.swift | 110 +- .../SocialNote.swift | 16 +- .../GraphQLLazyLoadBaseTest.swift | 88 +- .../L13/GraphQLLazyLoadPhoneCallTests.swift | 86 +- .../L13/Person+Schema.swift | 45 +- .../L13/Person.swift | 39 +- .../L13/PhoneCall+Schema.swift | 47 +- .../L13/PhoneCall.swift | 69 +- .../L13/Transcript+Schema.swift | 45 +- .../L13/Transcript.swift | 55 +- .../LL1/Comment4V2+Schema.swift | 45 +- .../LL1/Comment4V2.swift | 55 +- .../GraphQLLazyLoadPostComment4V2Tests.swift | 93 +- .../LL1/Post4V2+Schema.swift | 39 +- .../LL1/Post4V2.swift | 37 +- .../LL10/Comment7+Schema.swift | 53 +- .../LL10/Comment7.swift | 49 +- .../GraphQLLazyLoadPostComment7Tests.swift | 195 +- .../LL10/Post7+Schema.swift | 53 +- .../LL10/Post7.swift | 35 +- .../LL11/Comment8+Schema.swift | 55 +- .../LL11/Comment8.swift | 41 +- .../GraphQLLazyLoadPostComment8Tests.swift | 136 +- .../LL11/Post8+Schema.swift | 53 +- .../LL11/Post8.swift | 37 +- .../ChildSansBelongsTo+Schema.swift | 73 +- .../LL12/CompositePK/ChildSansBelongsTo.swift | 39 +- .../CompositePK/CompositePKChild+Schema.swift | 69 +- .../LL12/CompositePK/CompositePKChild.swift | 49 +- .../CompositePKParent+Schema.swift | 79 +- .../LL12/CompositePK/CompositePKParent.swift | 47 +- ...hQLLazyLoadCompositePKChildSansTests.swift | 73 +- ...GraphQLLazyLoadCompositePKChildTests.swift | 78 +- ...phQLLazyLoadCompositePKImplicitTests.swift | 86 +- ...yLoadCompositePKStrangeExplicitTests.swift | 86 +- .../GraphQLLazyLoadCompositePKTests.swift | 36 +- .../CompositePK/ImplicitChild+Schema.swift | 69 +- .../LL12/CompositePK/ImplicitChild.swift | 49 +- .../StrangeExplicitChild+Schema.swift | 69 +- .../CompositePK/StrangeExplicitChild.swift | 49 +- .../DefaultPK/DefaultPKChild+Schema.swift | 59 +- .../LL12/DefaultPK/DefaultPKChild.swift | 49 +- .../DefaultPK/DefaultPKParent+Schema.swift | 59 +- .../LL12/DefaultPK/DefaultPKParent.swift | 35 +- .../GraphQLLazyLoadDefaultPKTests.swift | 86 +- .../GraphQLLazyLoadHasOneTests.swift | 80 +- .../HasOneChild+Schema.swift | 55 +- .../LL12/HasOneParentChild/HasOneChild.swift | 31 +- .../HasOneParent+Schema.swift | 59 +- .../LL12/HasOneParentChild/HasOneParent.swift | 49 +- .../LL14/Comment14+Schema.swift | 65 +- .../LL14/Comment14.swift | 69 +- .../GraphQLLazyLoadUserPostCommentTests.swift | 62 +- .../LL14/Post14+Schema.swift | 69 +- .../LL14/Post14.swift | 73 +- .../LL14/PostStatus.swift | 9 +- .../LL14/User14+Schema.swift | 73 +- .../LL14/User14.swift | 73 +- .../LL14/UserSettings14+Schema.swift | 61 +- .../LL14/UserSettings14.swift | 55 +- .../LL15/EnumTestModel+Schema.swift | 51 +- .../LL15/EnumTestModel.swift | 53 +- .../LL15/ListIntContainer+Schema.swift | 75 +- .../LL15/ListIntContainer.swift | 53 +- .../LL15/ListStringContainer+Schema.swift | 75 +- .../LL15/ListStringContainer.swift | 53 +- .../LL15/Nested+Schema.swift | 29 +- .../LL15/Nested.swift | 9 +- .../LL15/NestedTypeTestModel+Schema.swift | 51 +- .../LL15/NestedTypeTestModel.swift | 53 +- .../LL15/ScalarContainer+Schema.swift | 103 +- .../LL15/ScalarContainer.swift | 81 +- .../LL15/TestEnum.swift | 9 +- .../LL2/Blog8V2+Schema.swift | 37 +- .../LL2/Blog8V2.swift | 43 +- .../LL2/Comment8V2+Schema.swift | 37 +- .../LL2/Comment8V2.swift | 55 +- ...aphQLLazyLoadBlogPostComment8V2Tests.swift | 104 +- .../LL2/MyCustomModel8+Schema.swift | 29 +- .../LL2/MyCustomModel8.swift | 9 +- .../LL2/MyNestedModel8+Schema.swift | 29 +- .../LL2/MyNestedModel8.swift | 9 +- .../LL2/Post8V2+Schema.swift | 37 +- .../LL2/Post8V2.swift | 71 +- .../LL3/CommentWithCompositeKey+Schema.swift | 53 +- .../LL3/CommentWithCompositeKey.swift | 55 +- ...LoadPostCommentWithCompositeKeyTests.swift | 233 +- .../LL3/PostWithCompositeKey+Schema.swift | 53 +- .../LL3/PostWithCompositeKey.swift | 37 +- .../LL4/GraphQLLazyLoadPostTagTests.swift | 181 +- .../LL4/PostTagsWithCompositeKey+Schema.swift | 43 +- .../LL4/PostTagsWithCompositeKey.swift | 59 +- .../LL4/PostWithTagsCompositeKey+Schema.swift | 53 +- .../LL4/PostWithTagsCompositeKey.swift | 37 +- .../LL4/TagWithCompositeKey+Schema.swift | 53 +- .../LL4/TagWithCompositeKey.swift | 37 +- .../GraphQLLazyLoadProjectTeam1Tests.swift | 170 +- .../LL5/Project1+Schema.swift | 57 +- .../LL5/Project1.swift | 71 +- .../LL5/Team1+Schema.swift | 53 +- .../AWSAPIPluginLazyLoadTests/LL5/Team1.swift | 55 +- .../GraphQLLazyLoadProjectTeam2Tests.swift | 133 +- .../LL6/Project2+Schema.swift | 33 +- .../LL6/Project2.swift | 71 +- .../LL6/Team2+Schema.swift | 47 +- .../AWSAPIPluginLazyLoadTests/LL6/Team2.swift | 33 +- .../LL7/Comment4+Schema.swift | 55 +- .../LL7/Comment4.swift | 39 +- .../GraphQLLazyLoadPostComment4Tests.swift | 116 +- .../LL7/Post4+Schema.swift | 53 +- .../AWSAPIPluginLazyLoadTests/LL7/Post4.swift | 37 +- .../GraphQLLazyLoadProjectTeam5Tests.swift | 208 +- .../LL8/Project5+Schema.swift | 57 +- .../LL8/Project5.swift | 61 +- .../LL8/Team5+Schema.swift | 53 +- .../AWSAPIPluginLazyLoadTests/LL8/Team5.swift | 49 +- .../GraphQLLazyLoadProjectTeam6Tests.swift | 145 +- .../LL9/Project6+Schema.swift | 57 +- .../LL9/Project6.swift | 61 +- .../LL9/Team6+Schema.swift | 51 +- .../AWSAPIPluginLazyLoadTests/LL9/Team6.swift | 31 +- .../RESTWithIAMIntegrationTests.swift | 34 +- .../RESTWithUserPoolIntegrationTests.swift | 54 +- .../GraphQLAPIStressTests.swift | 68 +- .../Models/AmplifyModels.swift | 6 +- .../Models/Post+Schema.swift | 24 +- .../GraphQLAPIStressTests/Models/Post.swift | 32 +- .../AWSAPIPluginTestCommon/Model/Todo.swift | 26 +- .../APISwiftCompatibility/API.swift | 51 +- .../APISwiftCompatibility/APISwiftTests.swift | 9 +- .../AWSAPICategoryPlugin+ConfigureTests.swift | 15 +- ...ICategoryPlugin+GraphQLBehaviorTests.swift | 36 +- ...egoryPlugin+InterceptorBehaviorTests.swift | 4 +- ...tegoryPlugin+RESTClientBehaviorTests.swift | 2 +- ...SAPICategoryPlugin+ReachabilityTests.swift | 21 +- ...ategoryPluginAmplifyVersionableTests.swift | 2 +- .../AWSAPICategoryPluginTestBase.swift | 18 +- .../AppSyncRealTimeClientTests.swift | 16 +- .../AppSyncRealTimeRequestAuthTests.swift | 8 +- ...uginConfigurationEndpointConfigTests.swift | 59 +- ...SAPICategoryPluginConfigurationTests.swift | 32 +- .../AWSAPIEndpointInterceptorsTests.swift | 69 +- .../Core/AppSyncListDecoderTests.swift | 28 +- .../Core/AppSyncListPayloadTests.swift | 32 +- .../AppSyncListProviderPaginationTests.swift | 30 +- .../Core/AppSyncListProviderTests.swift | 114 +- .../Core/AppSyncListResponseTests.swift | 22 +- .../Core/AppSyncModelMetadataTests.swift | 10 +- .../AWSAPIPluginTests/Core/ListTests.swift | 10 +- .../APIKeyURLRequestInterceptorTests.swift | 2 +- .../AuthTokenURLRequestInterceptorTests.swift | 17 +- .../APIKeyAuthInterceptorTests.swift | 3 +- .../CognitoAuthInterceptorTests.swift | 7 +- .../Mocks/MockReachability.swift | 2 +- .../Mocks/MockSessionFactory.swift | 2 +- .../Mocks/MockSubscription.swift | 6 +- .../Mocks/MockURLSession.swift | 8 +- .../Mocks/MockURLSessionTask.swift | 10 +- .../Operation/AWSGraphQLOperationTests.swift | 50 +- ...phQLSubscriptionOperationCancelTests.swift | 49 +- ...hQLSubscriptionTaskRunnerCancelTests.swift | 47 +- .../Operation/AWSHTTPURLResponseTests.swift | 32 +- .../Operation/AWSRESTOperationTests.swift | 2 +- .../Operation/GraphQLMutateCombineTests.swift | 4 +- .../Operation/GraphQLQueryCombineTests.swift | 53 +- .../GraphQLSubscribeCombineTests.swift | 46 +- .../Operation/GraphQLSubscribeTaskTests.swift | 24 +- .../Operation/GraphQLSubscribeTests.swift | 125 +- .../Operation/OperationTestBase.swift | 28 +- .../Operation/RESTCombineTests.swift | 4 +- .../NetworkReachabilityNotifierTests.swift | 10 +- .../GraphQLOperationRequestUtilsTests.swift | 9 +- ...GraphQLOperationRequestValidateTests.swift | 14 +- .../RESTOperationRequestValidateTests.swift | 10 +- .../AppSyncRealTimeClientFactoryTests.swift | 1 - .../Decode/GraphQLErrorDecoderTests.swift | 8 +- ...aphQLResponseDecoder+DecodeDataTests.swift | 68 +- ...sponseDecoderLazyPostComment4V2Tests.swift | 76 +- ...QLResponseDecoderPostComment4V2Tests.swift | 68 +- .../Decode/GraphQLResponseDecoderTests.swift | 51 +- .../AWSAppSyncGrpahQLResponseTests.swift | 2 +- .../Utils/Array+Error+TypeCastTests.swift | 1 - .../GraphQLRequestToListQueryTests.swift | 56 +- .../Support/Utils/RESTRequestUtilsTests.swift | 2 +- .../Support/Utils/Result+AsyncTests.swift | 7 +- 417 files changed, 18895 insertions(+), 15482 deletions(-) diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+APIAuthProviderFactoryBehavior.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+APIAuthProviderFactoryBehavior.swift index d4b8f1a683..2349059fb7 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+APIAuthProviderFactoryBehavior.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+APIAuthProviderFactoryBehavior.swift @@ -8,8 +8,8 @@ import Amplify import Foundation -extension AWSAPIPlugin { - public func apiAuthProviderFactory() -> APIAuthProviderFactory { +public extension AWSAPIPlugin { + func apiAuthProviderFactory() -> APIAuthProviderFactory { return authProviderFactory } } diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+AuthInformation.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+AuthInformation.swift index 8def8d268a..f2e2c5dfa1 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+AuthInformation.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+AuthInformation.swift @@ -9,12 +9,12 @@ import Amplify import AWSPluginsCore import Foundation -extension AWSAPIPlugin { - public func defaultAuthType() throws -> AWSAuthorizationType { +public extension AWSAPIPlugin { + func defaultAuthType() throws -> AWSAuthorizationType { try defaultAuthType(for: nil) } - public func defaultAuthType(for apiName: String?) throws -> AWSAuthorizationType { + func defaultAuthType(for apiName: String?) throws -> AWSAuthorizationType { try pluginConfig.endpoints.getConfig(for: apiName).authorizationType } } diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+Configure.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+Configure.swift index e63ed08dcb..31f85afb79 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+Configure.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+Configure.swift @@ -6,9 +6,9 @@ // @_spi(InternalAmplifyConfiguration) import Amplify +import AwsCommonRuntimeKit import AWSPluginsCore import InternalAmplifyCredentials -import AwsCommonRuntimeKit public extension AWSAPIPlugin { @@ -22,11 +22,15 @@ public extension AWSAPIPlugin { func configure(using configuration: Any?) throws { let dependencies: ConfigurationDependencies if let configuration = configuration as? AmplifyOutputsData { - dependencies = try ConfigurationDependencies(configuration: configuration, - apiAuthProviderFactory: authProviderFactory) + dependencies = try ConfigurationDependencies( + configuration: configuration, + apiAuthProviderFactory: authProviderFactory + ) } else if let jsonValue = configuration as? JSONValue { - dependencies = try ConfigurationDependencies(configurationValues: jsonValue, - apiAuthProviderFactory: authProviderFactory) + dependencies = try ConfigurationDependencies( + configurationValues: jsonValue, + apiAuthProviderFactory: authProviderFactory + ) } else { throw PluginError.pluginConfigurationError( diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+GraphQLBehavior.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+GraphQLBehavior.swift index ae2d999245..78f25677c6 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+GraphQLBehavior.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+GraphQLBehavior.swift @@ -9,45 +9,57 @@ import Amplify public extension AWSAPIPlugin { - func query(request: GraphQLRequest, - listener: GraphQLOperation.ResultListener?) -> GraphQLOperation { - let operation = AWSGraphQLOperation(request: request.toOperationRequest(operationType: .query), - session: session, - mapper: mapper, - pluginConfig: pluginConfig, - resultListener: listener) + func query( + request: GraphQLRequest, + listener: GraphQLOperation.ResultListener? + ) -> GraphQLOperation { + let operation = AWSGraphQLOperation( + request: request.toOperationRequest(operationType: .query), + session: session, + mapper: mapper, + pluginConfig: pluginConfig, + resultListener: listener + ) queue.addOperation(operation) return operation } func query(request: GraphQLRequest) async throws -> GraphQLTask.Success { - let operation = AWSGraphQLOperation(request: request.toOperationRequest(operationType: .query), - session: session, - mapper: mapper, - pluginConfig: pluginConfig, - resultListener: nil) + let operation = AWSGraphQLOperation( + request: request.toOperationRequest(operationType: .query), + session: session, + mapper: mapper, + pluginConfig: pluginConfig, + resultListener: nil + ) let task = AmplifyOperationTaskAdapter(operation: operation) queue.addOperation(operation) return try await task.value } - func mutate(request: GraphQLRequest, - listener: GraphQLOperation.ResultListener?) -> GraphQLOperation { - let operation = AWSGraphQLOperation(request: request.toOperationRequest(operationType: .mutation), - session: session, - mapper: mapper, - pluginConfig: pluginConfig, - resultListener: listener) + func mutate( + request: GraphQLRequest, + listener: GraphQLOperation.ResultListener? + ) -> GraphQLOperation { + let operation = AWSGraphQLOperation( + request: request.toOperationRequest(operationType: .mutation), + session: session, + mapper: mapper, + pluginConfig: pluginConfig, + resultListener: listener + ) queue.addOperation(operation) return operation } func mutate(request: GraphQLRequest) async throws -> GraphQLTask.Success { - let operation = AWSGraphQLOperation(request: request.toOperationRequest(operationType: .mutation), - session: session, - mapper: mapper, - pluginConfig: pluginConfig, - resultListener: nil) + let operation = AWSGraphQLOperation( + request: request.toOperationRequest(operationType: .mutation), + session: session, + mapper: mapper, + pluginConfig: pluginConfig, + resultListener: nil + ) let task = AmplifyOperationTaskAdapter(operation: operation) queue.addOperation(operation) return try await task.value @@ -65,18 +77,21 @@ public extension AWSAPIPlugin { authService: authService, apiAuthProviderFactory: authProviderFactory, inProcessListener: valueListener, - resultListener: completionListener) + resultListener: completionListener + ) queue.addOperation(operation) return operation } func subscribe(request: GraphQLRequest) -> AmplifyAsyncThrowingSequence> { let request = request.toOperationRequest(operationType: .subscription) - let runner = AWSGraphQLSubscriptionTaskRunner(request: request, - pluginConfig: pluginConfig, - appSyncClientFactory: appSyncRealTimeClientFactory, - authService: authService, - apiAuthProviderFactory: authProviderFactory) + let runner = AWSGraphQLSubscriptionTaskRunner( + request: request, + pluginConfig: pluginConfig, + appSyncClientFactory: appSyncRealTimeClientFactory, + authService: authService, + apiAuthProviderFactory: authProviderFactory + ) return runner.sequence } } diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+InterceptorBehavior.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+InterceptorBehavior.swift index 98c8b6df96..46f10d5216 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+InterceptorBehavior.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+InterceptorBehavior.swift @@ -10,8 +10,10 @@ import Amplify public extension AWSAPIPlugin { func add(interceptor: URLRequestInterceptor, for apiName: String) throws { guard pluginConfig.endpoints[apiName] != nil else { - throw PluginError.pluginConfigurationError("Failed to get endpoint configuration for apiName: \(apiName)", - "") + throw PluginError.pluginConfigurationError( + "Failed to get endpoint configuration for apiName: \(apiName)", + "" + ) } pluginConfig.addInterceptor(interceptor, toEndpoint: apiName) diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+RESTBehavior.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+RESTBehavior.swift index 59642d79c0..ab5ce8980a 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+RESTBehavior.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+RESTBehavior.swift @@ -11,28 +11,36 @@ import Foundation public extension AWSAPIPlugin { func get(request: RESTRequest, listener: RESTOperation.ResultListener?) -> RESTOperation { - let operationRequest = RESTOperationRequest(request: request, - operationType: .get) - - let operation = AWSRESTOperation(request: operationRequest, - session: session, - mapper: mapper, - pluginConfig: pluginConfig, - resultListener: listener) + let operationRequest = RESTOperationRequest( + request: request, + operationType: .get + ) + + let operation = AWSRESTOperation( + request: operationRequest, + session: session, + mapper: mapper, + pluginConfig: pluginConfig, + resultListener: listener + ) queue.addOperation(operation) return operation } func get(request: RESTRequest) async throws -> RESTTask.Success { - let operationRequest = RESTOperationRequest(request: request, - operationType: .get) - - let operation = AWSRESTOperation(request: operationRequest, - session: session, - mapper: mapper, - pluginConfig: pluginConfig, - resultListener: nil) + let operationRequest = RESTOperationRequest( + request: request, + operationType: .get + ) + + let operation = AWSRESTOperation( + request: operationRequest, + session: session, + mapper: mapper, + pluginConfig: pluginConfig, + resultListener: nil + ) let task = AmplifyOperationTaskAdapter(operation: operation) queue.addOperation(operation) @@ -40,28 +48,36 @@ public extension AWSAPIPlugin { } func put(request: RESTRequest, listener: RESTOperation.ResultListener?) -> RESTOperation { - let operationRequest = RESTOperationRequest(request: request, - operationType: .put) - - let operation = AWSRESTOperation(request: operationRequest, - session: session, - mapper: mapper, - pluginConfig: pluginConfig, - resultListener: listener) + let operationRequest = RESTOperationRequest( + request: request, + operationType: .put + ) + + let operation = AWSRESTOperation( + request: operationRequest, + session: session, + mapper: mapper, + pluginConfig: pluginConfig, + resultListener: listener + ) queue.addOperation(operation) return operation } func put(request: RESTRequest) async throws -> RESTTask.Success { - let operationRequest = RESTOperationRequest(request: request, - operationType: .put) - - let operation = AWSRESTOperation(request: operationRequest, - session: session, - mapper: mapper, - pluginConfig: pluginConfig, - resultListener: nil) + let operationRequest = RESTOperationRequest( + request: request, + operationType: .put + ) + + let operation = AWSRESTOperation( + request: operationRequest, + session: session, + mapper: mapper, + pluginConfig: pluginConfig, + resultListener: nil + ) let task = AmplifyOperationTaskAdapter(operation: operation) queue.addOperation(operation) @@ -69,28 +85,36 @@ public extension AWSAPIPlugin { } func post(request: RESTRequest, listener: RESTOperation.ResultListener?) -> RESTOperation { - let operationRequest = RESTOperationRequest(request: request, - operationType: .post) - - let operation = AWSRESTOperation(request: operationRequest, - session: session, - mapper: mapper, - pluginConfig: pluginConfig, - resultListener: listener) + let operationRequest = RESTOperationRequest( + request: request, + operationType: .post + ) + + let operation = AWSRESTOperation( + request: operationRequest, + session: session, + mapper: mapper, + pluginConfig: pluginConfig, + resultListener: listener + ) queue.addOperation(operation) return operation } func post(request: RESTRequest) async throws -> RESTTask.Success { - let operationRequest = RESTOperationRequest(request: request, - operationType: .post) - - let operation = AWSRESTOperation(request: operationRequest, - session: session, - mapper: mapper, - pluginConfig: pluginConfig, - resultListener: nil) + let operationRequest = RESTOperationRequest( + request: request, + operationType: .post + ) + + let operation = AWSRESTOperation( + request: operationRequest, + session: session, + mapper: mapper, + pluginConfig: pluginConfig, + resultListener: nil + ) let task = AmplifyOperationTaskAdapter(operation: operation) queue.addOperation(operation) @@ -100,11 +124,13 @@ public extension AWSAPIPlugin { func patch(request: RESTRequest, listener: RESTOperation.ResultListener?) -> RESTOperation { let operationRequest = RESTOperationRequest(request: request, operationType: .patch) - let operation = AWSRESTOperation(request: operationRequest, - session: session, - mapper: mapper, - pluginConfig: pluginConfig, - resultListener: listener) + let operation = AWSRESTOperation( + request: operationRequest, + session: session, + mapper: mapper, + pluginConfig: pluginConfig, + resultListener: listener + ) queue.addOperation(operation) return operation @@ -113,11 +139,13 @@ public extension AWSAPIPlugin { func patch(request: RESTRequest) async throws -> RESTTask.Success { let operationRequest = RESTOperationRequest(request: request, operationType: .patch) - let operation = AWSRESTOperation(request: operationRequest, - session: session, - mapper: mapper, - pluginConfig: pluginConfig, - resultListener: nil) + let operation = AWSRESTOperation( + request: operationRequest, + session: session, + mapper: mapper, + pluginConfig: pluginConfig, + resultListener: nil + ) let task = AmplifyOperationTaskAdapter(operation: operation) queue.addOperation(operation) @@ -125,28 +153,36 @@ public extension AWSAPIPlugin { } func delete(request: RESTRequest, listener: RESTOperation.ResultListener?) -> RESTOperation { - let operationRequest = RESTOperationRequest(request: request, - operationType: .delete) - - let operation = AWSRESTOperation(request: operationRequest, - session: session, - mapper: mapper, - pluginConfig: pluginConfig, - resultListener: listener) + let operationRequest = RESTOperationRequest( + request: request, + operationType: .delete + ) + + let operation = AWSRESTOperation( + request: operationRequest, + session: session, + mapper: mapper, + pluginConfig: pluginConfig, + resultListener: listener + ) queue.addOperation(operation) return operation } func delete(request: RESTRequest) async throws -> RESTTask.Success { - let operationRequest = RESTOperationRequest(request: request, - operationType: .delete) - - let operation = AWSRESTOperation(request: operationRequest, - session: session, - mapper: mapper, - pluginConfig: pluginConfig, - resultListener: nil) + let operationRequest = RESTOperationRequest( + request: request, + operationType: .delete + ) + + let operation = AWSRESTOperation( + request: operationRequest, + session: session, + mapper: mapper, + pluginConfig: pluginConfig, + resultListener: nil + ) let task = AmplifyOperationTaskAdapter(operation: operation) queue.addOperation(operation) @@ -154,28 +190,36 @@ public extension AWSAPIPlugin { } func head(request: RESTRequest, listener: RESTOperation.ResultListener?) -> RESTOperation { - let operationRequest = RESTOperationRequest(request: request, - operationType: .head) - - let operation = AWSRESTOperation(request: operationRequest, - session: session, - mapper: mapper, - pluginConfig: pluginConfig, - resultListener: listener) + let operationRequest = RESTOperationRequest( + request: request, + operationType: .head + ) + + let operation = AWSRESTOperation( + request: operationRequest, + session: session, + mapper: mapper, + pluginConfig: pluginConfig, + resultListener: listener + ) queue.addOperation(operation) return operation } func head(request: RESTRequest) async throws -> RESTTask.Success { - let operationRequest = RESTOperationRequest(request: request, - operationType: .head) - - let operation = AWSRESTOperation(request: operationRequest, - session: session, - mapper: mapper, - pluginConfig: pluginConfig, - resultListener: nil) + let operationRequest = RESTOperationRequest( + request: request, + operationType: .head + ) + + let operation = AWSRESTOperation( + request: operationRequest, + session: session, + mapper: mapper, + pluginConfig: pluginConfig, + resultListener: nil + ) let task = AmplifyOperationTaskAdapter(operation: operation) queue.addOperation(operation) diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+Reachability.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+Reachability.swift index 777d6a0767..19acb2d3b1 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+Reachability.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+Reachability.swift @@ -6,18 +6,19 @@ // import Amplify -import Foundation import Combine +import Foundation -extension AWSAPIPlugin { - public func reachabilityPublisher() throws -> AnyPublisher? { +public extension AWSAPIPlugin { + func reachabilityPublisher() throws -> AnyPublisher? { return try reachabilityPublisher(for: nil) } - public func reachabilityPublisher(for apiName: String?) throws -> AnyPublisher? { + func reachabilityPublisher(for apiName: String?) throws -> AnyPublisher? { let endpoint = try pluginConfig.endpoints.getConfig(for: apiName) guard let hostName = endpoint.baseURL.host else { - let error = APIError.invalidConfiguration("Invalid endpoint configuration", + let error = APIError.invalidConfiguration( + "Invalid endpoint configuration", """ baseURL does not contain a valid hostname """ @@ -30,9 +31,11 @@ extension AWSAPIPlugin { return networkReachability.publisher } do { - let networkReachability = try NetworkReachabilityNotifier(host: hostName, - allowsCellularAccess: true, - reachabilityFactory: AmplifyReachability.self) + let networkReachability = try NetworkReachabilityNotifier( + host: hostName, + allowsCellularAccess: true, + reachabilityFactory: AmplifyReachability.self + ) reachabilityMap[hostName] = networkReachability return networkReachability.publisher } catch { diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+URLSessionBehaviorDelegate.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+URLSessionBehaviorDelegate.swift index 7833a5ce9a..9bcb3f8fbb 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+URLSessionBehaviorDelegate.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+URLSessionBehaviorDelegate.swift @@ -8,15 +8,19 @@ import Foundation extension AWSAPIPlugin: URLSessionBehaviorDelegate { - public func urlSessionBehavior(_ session: URLSessionBehavior, - dataTaskBehavior: URLSessionDataTaskBehavior, - didCompleteWithError error: Error?) { + public func urlSessionBehavior( + _ session: URLSessionBehavior, + dataTaskBehavior: URLSessionDataTaskBehavior, + didCompleteWithError error: Error? + ) { mapper.operation(for: dataTaskBehavior)?.complete(with: error, response: dataTaskBehavior.taskBehaviorResponse) } - public func urlSessionBehavior(_ session: URLSessionBehavior, - dataTaskBehavior: URLSessionDataTaskBehavior, - didReceive data: Data) { + public func urlSessionBehavior( + _ session: URLSessionBehavior, + dataTaskBehavior: URLSessionDataTaskBehavior, + didReceive data: Data + ) { mapper.operation(for: dataTaskBehavior)?.updateProgress(data, response: dataTaskBehavior.taskBehaviorResponse) } } diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+URLSessionDelegate.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+URLSessionDelegate.swift index dd7fe7e8e7..4a5c916de3 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+URLSessionDelegate.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+URLSessionDelegate.swift @@ -10,28 +10,36 @@ import Foundation public typealias AuthChallengeDispositionHandler = (URLSession.AuthChallengeDisposition, URLCredential?) -> Void extension AWSAPIPlugin: URLSessionDelegate { - @objc public func urlSession(_ session: URLSession, - didReceive challenge: URLAuthenticationChallenge, - completionHandler: @escaping AuthChallengeDispositionHandler) { + @objc public func urlSession( + _ session: URLSession, + didReceive challenge: URLAuthenticationChallenge, + completionHandler: @escaping AuthChallengeDispositionHandler + ) { completionHandler(.performDefaultHandling, nil) } } extension AWSAPIPlugin: URLSessionTaskDelegate { - @objc public func urlSession(_ session: URLSession, - task: URLSessionTask, - didReceive challenge: URLAuthenticationChallenge, - completionHandler: @escaping AuthChallengeDispositionHandler) { + @objc public func urlSession( + _ session: URLSession, + task: URLSessionTask, + didReceive challenge: URLAuthenticationChallenge, + completionHandler: @escaping AuthChallengeDispositionHandler + ) { completionHandler(.performDefaultHandling, nil) } - @objc public func urlSession(_ session: URLSession, - task: URLSessionTask, - didCompleteWithError error: Error?) { - urlSessionBehavior(session, - dataTaskBehavior: task, - didCompleteWithError: error) + @objc public func urlSession( + _ session: URLSession, + task: URLSessionTask, + didCompleteWithError error: Error? + ) { + urlSessionBehavior( + session, + dataTaskBehavior: task, + didCompleteWithError: error + ) } @@ -45,11 +53,15 @@ extension AWSAPIPlugin: URLSessionDataDelegate { // completionHandler(.allow) // } - @objc public func urlSession(_ session: URLSession, - dataTask: URLSessionDataTask, - didReceive data: Data) { - urlSessionBehavior(session, - dataTaskBehavior: dataTask, - didReceive: data) + @objc public func urlSession( + _ session: URLSession, + dataTask: URLSessionDataTask, + didReceive data: Data + ) { + urlSessionBehavior( + session, + dataTaskBehavior: dataTask, + didReceive: data + ) } } diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin.swift index dcdcd7095a..52fee625ae 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin.swift @@ -7,10 +7,10 @@ import Amplify import AWSPluginsCore -import InternalAmplifyCredentials import Foundation +import InternalAmplifyCredentials -final public class AWSAPIPlugin: NSObject, APICategoryPlugin, AWSAPIAuthInformation { +public final class AWSAPIPlugin: NSObject, APICategoryPlugin, AWSAPIAuthInformation { /// Used for the default GraphQL API represented by the `data` category in `amplify_outputs.json` /// This constant is not used for APIs present in `amplifyconfiguration.json` since they always have names. public static let defaultGraphQLAPI = "defaultGraphQLAPI" diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRealTimeClient+HandleRequest.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRealTimeClient+HandleRequest.swift index 63842c547b..2d51cad30f 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRealTimeClient+HandleRequest.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRealTimeClient+HandleRequest.swift @@ -5,10 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // - -import Foundation -import Combine import Amplify +import Combine +import Foundation extension AppSyncRealTimeClient { /** @@ -31,7 +30,7 @@ extension AppSyncRealTimeClient { } // listen to response - self.subject + subject .setFailureType(to: AppSyncRealTimeRequest.Error.self) .flatMap { Self.filterResponse(request: request, result: $0) } .timeout(.seconds(timeout), scheduler: DispatchQueue.global(qos: .userInitiated), customError: { .timeout }) @@ -53,7 +52,7 @@ extension AppSyncRealTimeClient { event: request, url: self.endpoint ) - let requestJSON = String(data: try Self.jsonEncoder.encode(decoratedRequest), encoding: .utf8) + let requestJSON = try String(data: Self.jsonEncoder.encode(decoratedRequest), encoding: .utf8) try await self.webSocketClient.write(message: requestJSON!) } catch { diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRealTimeClient.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRealTimeClient.swift index 4e374e9fdf..bdba927e4d 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRealTimeClient.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRealTimeClient.swift @@ -5,10 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // - -import Foundation import Amplify import Combine +import Foundation @_spi(WebSocket) import AWSPluginsCore /** @@ -41,21 +40,21 @@ actor AppSyncRealTimeClient: AppSyncRealTimeClientProtocol { private var cancellablesBindToConnection = Set() /// AppSync RealTime server endpoint - internal let endpoint: URL + let endpoint: URL /// Interceptor for decorating AppSyncRealTimeRequest - internal let requestInterceptor: AppSyncRequestInterceptor + let requestInterceptor: AppSyncRequestInterceptor /// WebSocketClient offering connections at the WebSocket protocol level - internal var webSocketClient: AppSyncWebSocketClientProtocol + var webSocketClient: AppSyncWebSocketClientProtocol /// Writable data stream convert WebSocketEvent to AppSyncRealTimeResponse - internal let subject = PassthroughSubject, Never>() + let subject = PassthroughSubject, Never>() var isConnected: Bool { - self.state.value == .connected + state.value == .connected } - internal var numberOfSubscriptions: Int { - self.subscriptions.count + var numberOfSubscriptions: Int { + subscriptions.count } /** @@ -89,7 +88,7 @@ actor AppSyncRealTimeClient: AppSyncRealTimeClientProtocol { Connecting to remote AppSync real-time server. */ func connect() async throws { - switch self.state.value { + switch state.value { case .connecting, .connected: log.debug("[AppSyncRealTimeClient] client is already connecting or connected") return @@ -99,21 +98,21 @@ actor AppSyncRealTimeClient: AppSyncRealTimeClientProtocol { break } - guard self.state.value != .connecting else { + guard state.value != .connecting else { log.debug("[AppSyncRealTimeClient] actor reentry, state has been changed to connecting") return } - self.state.send(.connecting) + state.send(.connecting) log.debug("[AppSyncRealTimeClient] client start connecting") try await RetryWithJitter.execute { [weak self] in guard let self else { return } - await self.webSocketClient.connect( + await webSocketClient.connect( autoConnectOnNetworkStatusChange: true, autoRetryOnConnectionFailure: true ) - try await self.sendRequest(.connectionInit) + try await sendRequest(.connectionInit) } } @@ -121,7 +120,7 @@ actor AppSyncRealTimeClient: AppSyncRealTimeClientProtocol { Disconnect only when there are no subscriptions exist. */ func disconnectWhenIdel() async { - if self.subscriptions.isEmpty { + if subscriptions.isEmpty { log.debug("[AppSyncRealTimeClient] no subscription exist, client is trying to disconnect") await disconnect() } else { @@ -133,7 +132,7 @@ actor AppSyncRealTimeClient: AppSyncRealTimeClientProtocol { Disconnect from AppSync real-time server. */ func disconnect() async { - guard self.state.value != .disconnecting else { + guard state.value != .disconnecting else { log.debug("[AppSyncRealTimeClient] client already disconnecting") return } @@ -141,9 +140,9 @@ actor AppSyncRealTimeClient: AppSyncRealTimeClientProtocol { defer { self.state.send(.disconnected) } log.debug("[AppSyncRealTimeClient] client start disconnecting") - self.state.send(.disconnecting) - self.cancellablesBindToConnection = Set() - await self.webSocketClient.disconnect() + state.send(.disconnecting) + cancellablesBindToConnection = Set() + await webSocketClient.disconnect() log.debug("[AppSyncRealTimeClient] client is disconnected") } @@ -166,24 +165,24 @@ actor AppSyncRealTimeClient: AppSyncRealTimeClientProtocol { // promptly returning the filtered publisher for downstream consumption of all error messages. defer { Task { [weak self] in - guard let self = self else { return } - if !(await self.isConnected) { + guard let self else { return } + if await !(self.isConnected) { try await connect() try await waitForState(.connected) } - await self.bindCancellableToConnection(try await self.startSubscription(id)) + try await self.bindCancellableToConnection(self.startSubscription(id)) }.toAnyCancellable.store(in: &cancellablesBindToConnection) } - return filterAppSyncSubscriptionEvent(with: id) - .merge(with: (await subscription.publisher).toAppSyncSubscriptionEventStream()) + return await filterAppSyncSubscriptionEvent(with: id) + .merge(with: (subscription.publisher).toAppSyncSubscriptionEventStream()) .eraseToAnyPublisher() } private func waitForState(_ targetState: State) async throws { var cancellables = Set() - try await withCheckedThrowingContinuation { (continuation: CheckedContinuation) -> Void in + try await withCheckedThrowingContinuation { (continuation: CheckedContinuation) in state.filter { $0 == targetState } .setFailureType(to: AppSyncRealTimeRequest.Error.self) .timeout(.seconds(10), scheduler: DispatchQueue.global()) @@ -236,7 +235,7 @@ actor AppSyncRealTimeClient: AppSyncRealTimeClientProtocol { } private func subscribeToWebSocketEvent() async { - await self.webSocketClient.publisher.sink { [weak self] _ in + await webSocketClient.publisher.sink { [weak self] _ in self?.log.debug("[AppSyncRealTimeClient] WebSocketClient terminated") } receiveValue: { webSocketEvent in Task { [weak self] in @@ -248,7 +247,7 @@ actor AppSyncRealTimeClient: AppSyncRealTimeClientProtocol { private func resumeExistingSubscriptions() { log.debug("[AppSyncRealTimeClient] Resuming existing subscriptions") - for (id, _) in self.subscriptions { + for (id, _) in subscriptions { Task { do { try await self.startSubscription(id).store(in: &cancellablesBindToConnection) @@ -260,13 +259,13 @@ actor AppSyncRealTimeClient: AppSyncRealTimeClientProtocol { } - nonisolated private func writeAppSyncEvent(_ event: AppSyncRealTimeRequest) async throws { - guard await self.webSocketClient.isConnected else { + private nonisolated func writeAppSyncEvent(_ event: AppSyncRealTimeRequest) async throws { + guard await webSocketClient.isConnected else { log.debug("[AppSyncRealTimeClient] Attempting to write to a webSocket haven't been connected.") return } - let interceptedEvent = await self.requestInterceptor.interceptRequest(event: event, url: self.endpoint) + let interceptedEvent = await requestInterceptor.interceptRequest(event: event, url: endpoint) let eventString = try String(data: Self.jsonEncoder.encode(interceptedEvent), encoding: .utf8)! log.debug("[AppSyncRealTimeClient] Writing AppSyncEvent \(eventString)") try await webSocketClient.write(message: eventString) @@ -363,7 +362,7 @@ extension AppSyncRealTimeClient { switch event { case .connected: log.debug("[AppSyncRealTimeClient] WebSocket connected") - if self.state.value == .connectionDropped { + if state.value == .connectionDropped { log.debug("[AppSyncRealTimeClient] reconnecting appSyncClient after connection drop") Task { [weak self] in try? await self?.connect() @@ -372,15 +371,15 @@ extension AppSyncRealTimeClient { case let .disconnected(closeCode, reason): // log.debug("[AppSyncRealTimeClient] WebSocket disconnected with closeCode: \(closeCode), reason: \(String(describing: reason))") - if self.state.value != .disconnecting || self.state.value != .disconnected { - self.state.send(.connectionDropped) + if state.value != .disconnecting || state.value != .disconnected { + state.send(.connectionDropped) } - self.cancellablesBindToConnection = Set() + cancellablesBindToConnection = Set() case .error(let error): // Propagate connection error to downstream for Sync engine to restart log.debug("[AppSyncRealTimeClient] WebSocket error event: \(error)") - self.subject.send(.failure(error)) + subject.send(.failure(error)) case .string(let string): guard let data = string.data(using: .utf8) else { log.debug("[AppSyncRealTimeClient] Failed to decode string \(string)") @@ -390,14 +389,14 @@ extension AppSyncRealTimeClient { log.debug("[AppSyncRealTimeClient] Failed to decode string to AppSync event") return } - self.onAppSyncRealTimeResponse(response) + onAppSyncRealTimeResponse(response) case .data(let data): guard let response = try? Self.jsonDecoder.decode(AppSyncRealTimeResponse.self, from: data) else { log.debug("[AppSyncRealTimeClient] Failed to decode data to AppSync event") return } - self.onAppSyncRealTimeResponse(response) + onAppSyncRealTimeResponse(response) } } @@ -412,12 +411,12 @@ extension AppSyncRealTimeClient { log.debug("[AppSyncRealTimeClient] AppSync connected: \(String(describing: event.payload))") subject.send(.success(event)) - self.resumeExistingSubscriptions() - self.state.send(.connected) - self.monitorHeartBeats(event.payload) + resumeExistingSubscriptions() + state.send(.connected) + monitorHeartBeats(event.payload) case .keepAlive: - self.heartBeats.send(()) + heartBeats.send(()) default: log.debug("[AppSyncRealTimeClient] AppSync received response: \(event)") @@ -445,7 +444,7 @@ extension AppSyncRealTimeClient { extension Publisher where Output == AppSyncRealTimeSubscription.State, Failure == Never { func toAppSyncSubscriptionEventStream() -> AnyPublisher { - self.compactMap { subscriptionState -> AppSyncSubscriptionEvent? in + compactMap { subscriptionState -> AppSyncSubscriptionEvent? in switch subscriptionState { case .subscribing: return .subscribing case .subscribed: return .subscribed @@ -477,7 +476,7 @@ extension AppSyncRealTimeClient: Resettable { } } -fileprivate extension Task { +private extension Task { var toAnyCancellable: AnyCancellable { AnyCancellable { if !self.isCancelled { diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRealTimeRequest.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRealTimeRequest.swift index 19599820b4..b9fcf581b9 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRealTimeRequest.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRealTimeRequest.swift @@ -5,10 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // - -import Foundation -import Combine import Amplify +import Combine +import Foundation public enum AppSyncRealTimeRequest { case connectionInit @@ -70,8 +69,8 @@ extension AppSyncRealTimeRequest: Encodable { } -extension AppSyncRealTimeRequest { - public enum Error: Swift.Error, Equatable { +public extension AppSyncRealTimeRequest { + enum Error: Swift.Error, Equatable { case timeout case limitExceeded case maxSubscriptionsReached @@ -99,7 +98,7 @@ extension AppSyncRealTimeRequest { } - public static func parseResponseError( + static func parseResponseError( error: JSONValue ) -> AppSyncRealTimeRequest.Error? { let limitExceededErrorString = "LimitExceededError" diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRealTimeRequestAuth.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRealTimeRequestAuth.swift index 87e01b1842..3e76d4e356 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRealTimeRequestAuth.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRealTimeRequestAuth.swift @@ -5,7 +5,6 @@ // SPDX-License-Identifier: Apache-2.0 // - import Foundation public enum AppSyncRealTimeRequestAuth { diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRealTimeResponse.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRealTimeResponse.swift index dfec371035..cc710b0bc9 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRealTimeResponse.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRealTimeResponse.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify +import Foundation public struct AppSyncRealTimeResponse { diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRealTimeSubscription.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRealTimeSubscription.swift index d7e4c6ef42..b840af80cb 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRealTimeSubscription.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRealTimeSubscription.swift @@ -5,10 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // - -import Foundation -import Combine import Amplify +import Combine +import Foundation @_spi(WebSocket) import AWSPluginsCore /** @@ -51,58 +50,58 @@ actor AppSyncRealTimeSubscription { } func subscribe() async throws { - guard self.state.value != .subscribing else { + guard state.value != .subscribing else { log.debug("[AppSyncRealTimeSubscription-\(id)] Subscription already in subscribing state") return } - guard self.state.value != .subscribed else { + guard state.value != .subscribed else { log.debug("[AppSyncRealTimeSubscription-\(id)] Subscription already in subscribed state") return } log.debug("[AppSyncRealTimeSubscription-\(id)] Start subscribing") - self.state.send(.subscribing) + state.send(.subscribing) do { try await RetryWithJitter.execute(shouldRetryOnError: { error in (error as? AppSyncRealTimeRequest.Error) == .maxSubscriptionsReached }) { [weak self] in guard let self else { return } - try await self.appSyncRealTimeClient?.sendRequest( - .start(.init(id: self.id, data: self.query, auth: nil)) + try await appSyncRealTimeClient?.sendRequest( + .start(.init(id: id, data: query, auth: nil)) ) } } catch { log.debug("[AppSyncRealTimeSubscription-\(id)] Failed to subscribe, error: \(error)") - self.state.send(.failure) + state.send(.failure) throw error } log.debug("[AppSyncRealTimeSubscription-\(id)] Subscribed") - self.state.send(.subscribed) + state.send(.subscribed) } func unsubscribe() async throws { - guard self.state.value == .subscribed else { + guard state.value == .subscribed else { log.debug("[AppSyncRealTimeSubscription-\(id)] Subscription should be subscribed to be unsubscribed") return } log.debug("[AppSyncRealTimeSubscription-\(id)] Unsubscribing") - self.state.send(.unsubscribing) + state.send(.unsubscribing) do { let request = AppSyncRealTimeRequest.stop(id) try await appSyncRealTimeClient?.sendRequest(request) } catch { log.debug("[AppSyncRealTimeSubscription-\(id)] Failed to unsubscribe, error \(error)") - self.state.send(.failure) + state.send(.failure) throw error } log.debug("[AppSyncRealTimeSubscription-\(id)] Unsubscribed") - self.state.send(.unsubscribed) + state.send(.unsubscribed) } private static func sendAppSyncRealTimeRequest( @@ -110,7 +109,7 @@ actor AppSyncRealTimeSubscription { with webSocketClient: AppSyncWebSocketClientProtocol ) async throws { guard let requestJson = try String( - data: Self.jsonEncoder.encode(request), + data: jsonEncoder.encode(request), encoding: .utf8 ) else { return diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRequestInterceptor.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRequestInterceptor.swift index 92414ea28c..36e354ee57 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRequestInterceptor.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncRequestInterceptor.swift @@ -5,7 +5,6 @@ // SPDX-License-Identifier: Apache-2.0 // - import Foundation protocol AppSyncRequestInterceptor { diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncSubscriptionEvent.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncSubscriptionEvent.swift index ec86c53e6a..1b14fa90c8 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncSubscriptionEvent.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncSubscriptionEvent.swift @@ -5,9 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // - -import Foundation import Amplify +import Foundation public enum AppSyncSubscriptionEvent { case subscribing diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncWebSocketClientProtocol.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncWebSocketClientProtocol.swift index d7d9cadc29..a5d944a356 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncWebSocketClientProtocol.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AppSyncRealTimeClient/AppSyncWebSocketClientProtocol.swift @@ -5,9 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // - -import Foundation import Combine +import Foundation @_spi(WebSocket) import AWSPluginsCore protocol AppSyncWebSocketClientProtocol: AnyObject { diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPICategoryPluginConfiguration+EndpointConfig.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPICategoryPluginConfiguration+EndpointConfig.swift index 8be955bdb2..8e3aad56b8 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPICategoryPluginConfiguration+EndpointConfig.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPICategoryPluginConfiguration+EndpointConfig.swift @@ -6,8 +6,8 @@ // @_spi(InternalAmplifyConfiguration) import Amplify -import Foundation import AWSPluginsCore +import Foundation public extension AWSAPICategoryPluginConfiguration { struct EndpointConfig { @@ -27,10 +27,12 @@ public extension AWSAPICategoryPluginConfiguration { var apiKey: String? - public init(name: String, - jsonValue: JSONValue, - apiAuthProviderFactory: APIAuthProviderFactory, - authService: AWSAuthServiceBehavior? = nil) throws { + public init( + name: String, + jsonValue: JSONValue, + apiAuthProviderFactory: APIAuthProviderFactory, + authService: AWSAuthServiceBehavior? = nil + ) throws { guard case .object(let endpointJSON) = jsonValue else { throw PluginError.pluginConfigurationError( @@ -49,54 +51,66 @@ public extension AWSAPICategoryPluginConfiguration { apiKeyValue = apiKey } - try self.init(name: name, - baseURL: EndpointConfig.getBaseURL(from: endpointJSON), - region: AWSRegionType.region(from: endpointJSON), - authorizationType: AWSAuthorizationType.from(endpointJSON: endpointJSON), - endpointType: EndpointConfig.getEndpointType(from: endpointJSON), - apiKey: apiKeyValue, - apiAuthProviderFactory: apiAuthProviderFactory, - authService: authService) + try self.init( + name: name, + baseURL: EndpointConfig.getBaseURL(from: endpointJSON), + region: AWSRegionType.region(from: endpointJSON), + authorizationType: AWSAuthorizationType.from(endpointJSON: endpointJSON), + endpointType: EndpointConfig.getEndpointType(from: endpointJSON), + apiKey: apiKeyValue, + apiAuthProviderFactory: apiAuthProviderFactory, + authService: authService + ) } - init(name: String, - config: AmplifyOutputsData.DataCategory, - apiAuthProviderFactory: APIAuthProviderFactory, - authService: AWSAuthServiceBehavior? = nil) throws { - - try self.init(name: name, - baseURL: try EndpointConfig.getBaseURL(from: config.url), - region: config.awsRegion, - authorizationType: try AWSAuthorizationType.from(authorizationTypeString: config.defaultAuthorizationType.rawValue), - endpointType: .graphQL, - apiKey: config.apiKey, - apiAuthProviderFactory: apiAuthProviderFactory, - authService: authService) + init( + name: String, + config: AmplifyOutputsData.DataCategory, + apiAuthProviderFactory: APIAuthProviderFactory, + authService: AWSAuthServiceBehavior? = nil + ) throws { + + try self.init( + name: name, + baseURL: EndpointConfig.getBaseURL(from: config.url), + region: config.awsRegion, + authorizationType: AWSAuthorizationType.from(authorizationTypeString: config.defaultAuthorizationType.rawValue), + endpointType: .graphQL, + apiKey: config.apiKey, + apiAuthProviderFactory: apiAuthProviderFactory, + authService: authService + ) } - init(name: String, - baseURL: URL, - region: AWSRegionType?, - authorizationType: AWSAuthorizationType, - endpointType: AWSAPICategoryPluginEndpointType, - apiKey: String? = nil, - apiAuthProviderFactory: APIAuthProviderFactory, - authService: AWSAuthServiceBehavior? = nil) throws { + init( + name: String, + baseURL: URL, + region: AWSRegionType?, + authorizationType: AWSAuthorizationType, + endpointType: AWSAPICategoryPluginEndpointType, + apiKey: String? = nil, + apiAuthProviderFactory: APIAuthProviderFactory, + authService: AWSAuthServiceBehavior? = nil + ) throws { self.name = name self.baseURL = baseURL self.region = region self.authorizationType = authorizationType - self.authorizationConfiguration = try AWSAuthorizationConfiguration.makeConfiguration(authType: authorizationType, - region: region, - apiKey: apiKey) + self.authorizationConfiguration = try AWSAuthorizationConfiguration.makeConfiguration( + authType: authorizationType, + region: region, + apiKey: apiKey + ) self.endpointType = endpointType self.apiKey = apiKey } public func authorizationConfigurationFor(authType: AWSAuthorizationType) throws -> AWSAuthorizationConfiguration { - return try AWSAuthorizationConfiguration.makeConfiguration(authType: authType, - region: region, - apiKey: apiKey) + return try AWSAuthorizationConfiguration.makeConfiguration( + authType: authType, + region: region, + apiKey: apiKey + ) } // MARK: - Configuration file helpers @@ -165,12 +179,10 @@ public extension AWSAPICategoryPluginConfiguration { private extension AWSRegionType { static func region(from endpointJSON: [String: JSONValue]) throws -> AWSRegionType? { - let region: AWSRegionType? - - if case .string(let endpointRegion) = endpointJSON["region"] { - region = endpointRegion + let region: AWSRegionType? = if case .string(let endpointRegion) = endpointJSON["region"] { + endpointRegion } else { - region = nil + nil } return region @@ -198,7 +210,7 @@ private extension AWSAuthorizationType { static func from(authorizationTypeString: String) throws -> AWSAuthorizationType { guard let authorizationType = AWSAuthorizationType(rawValue: authorizationTypeString) else { - let authTypes = AWSAuthorizationType.allCases.map { $0.rawValue }.joined(separator: ", ") + let authTypes = AWSAuthorizationType.allCases.map(\.rawValue).joined(separator: ", ") throw PluginError.pluginConfigurationError( "Could not convert `\(authorizationTypeString)` to an AWSAuthorizationType", """ @@ -215,20 +227,22 @@ private extension AWSAuthorizationType { // MARK: - Dictionary + AWSAPICategoryPluginConfiguration.EndpointConfig -extension Dictionary where Key == String, Value == AWSAPICategoryPluginConfiguration.EndpointConfig { +extension [String: AWSAPICategoryPluginConfiguration.EndpointConfig] { /// Getting the `EndpointConfig` resolves to the following rules: /// 1. If `apiName` is specified, retrieve the endpoint configuration for this api /// 2. If `apiName` is not specified, and `endpointType` is, retrieve the endpoint if there is only one. /// 3. If nothing is specified, return the endpoint only if there is a single one, with GraphQL taking precedent /// over REST. - func getConfig(for apiName: String? = nil, - endpointType: AWSAPICategoryPluginEndpointType? = nil) throws -> + func getConfig( + for apiName: String? = nil, + endpointType: AWSAPICategoryPluginEndpointType? = nil + ) throws -> AWSAPICategoryPluginConfiguration.EndpointConfig { - if let apiName = apiName { + if let apiName { return try getConfig(for: apiName) } - if let endpointType = endpointType { + if let endpointType { return try getConfig(for: endpointType) } @@ -255,26 +269,29 @@ extension Dictionary where Key == String, Value == AWSAPICategoryPluginConfigura /// Retrieve the endpoint configuration when there is only one endpoint of the specified `endpointType` private func getConfig(for endpointType: AWSAPICategoryPluginEndpointType) throws -> AWSAPICategoryPluginConfiguration.EndpointConfig { - let apiForEndpointType = filter { (_, endpointConfig) -> Bool in + let apiForEndpointType = filter { _, endpointConfig -> Bool in return endpointConfig.endpointType == endpointType } guard let endpointConfig = apiForEndpointType.first else { - throw APIError.invalidConfiguration("Missing API for \(endpointType) endpointType", - "Add the \(endpointType) API to configuration.") + throw APIError.invalidConfiguration( + "Missing API for \(endpointType) endpointType", + "Add the \(endpointType) API to configuration." + ) } if apiForEndpointType.count > 1 { throw APIError.invalidConfiguration( "More than one \(endpointType) API configured. Could not infer which API to call", - "Use the apiName to specify which API to call") + "Use the apiName to specify which API to call" + ) } return endpointConfig.value } /// Retrieve the endpoint only if there is a single one, with GraphQL taking precedent over REST. private func getConfig() throws -> AWSAPICategoryPluginConfiguration.EndpointConfig { - let graphQLEndpoints = filter { (_, endpointConfig) -> Bool in + let graphQLEndpoints = filter { _, endpointConfig -> Bool in return endpointConfig.endpointType == .graphQL } @@ -282,7 +299,7 @@ extension Dictionary where Key == String, Value == AWSAPICategoryPluginConfigura return endpoint.value } - let restEndpoints = filter { (_, endpointConfig) -> Bool in + let restEndpoints = filter { _, endpointConfig -> Bool in return endpointConfig.endpointType == .rest } @@ -290,10 +307,12 @@ extension Dictionary where Key == String, Value == AWSAPICategoryPluginConfigura return endpoint.value } - throw APIError.invalidConfiguration("Unable to resolve endpoint configuration", - """ + throw APIError.invalidConfiguration( + "Unable to resolve endpoint configuration", + """ Pass in the apiName to specify the endpoint you are retrieving the config for - """) + """ + ) } } diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPICategoryPluginConfiguration.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPICategoryPluginConfiguration.swift index 07005a7034..0559bae0b5 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPICategoryPluginConfiguration.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPICategoryPluginConfiguration.swift @@ -6,8 +6,8 @@ // @_spi(InternalAmplifyConfiguration) import Amplify -import Foundation import AWSPluginsCore +import Foundation import InternalAmplifyCredentials // Convenience typealias @@ -20,9 +20,11 @@ public struct AWSAPICategoryPluginConfiguration { private var apiAuthProviderFactory: APIAuthProviderFactory? private var authService: AWSAuthCredentialsProviderBehavior? - init(jsonValue: JSONValue, - apiAuthProviderFactory: APIAuthProviderFactory, - authService: AWSAuthCredentialsProviderBehavior) throws { + init( + jsonValue: JSONValue, + apiAuthProviderFactory: APIAuthProviderFactory, + authService: AWSAuthCredentialsProviderBehavior + ) throws { guard case .object(let config) = jsonValue else { throw PluginError.pluginConfigurationError( "Could not cast incoming configuration to a JSONValue `.object`", @@ -35,23 +37,31 @@ public struct AWSAPICategoryPluginConfiguration { ) } - let endpoints = try AWSAPICategoryPluginConfiguration.endpointsFromConfig(config: config, - apiAuthProviderFactory: apiAuthProviderFactory, - authService: authService) - let interceptors = try AWSAPICategoryPluginConfiguration.makeInterceptors(forEndpoints: endpoints, - apiAuthProviderFactory: apiAuthProviderFactory, - authService: authService) + let endpoints = try AWSAPICategoryPluginConfiguration.endpointsFromConfig( + config: config, + apiAuthProviderFactory: apiAuthProviderFactory, + authService: authService + ) + let interceptors = try AWSAPICategoryPluginConfiguration.makeInterceptors( + forEndpoints: endpoints, + apiAuthProviderFactory: apiAuthProviderFactory, + authService: authService + ) - self.init(endpoints: endpoints, - interceptors: interceptors, - apiAuthProviderFactory: apiAuthProviderFactory, - authService: authService) + self.init( + endpoints: endpoints, + interceptors: interceptors, + apiAuthProviderFactory: apiAuthProviderFactory, + authService: authService + ) } - init(configuration: AmplifyOutputsData, - apiAuthProviderFactory: APIAuthProviderFactory, - authService: AWSAuthCredentialsProviderBehavior) throws { + init( + configuration: AmplifyOutputsData, + apiAuthProviderFactory: APIAuthProviderFactory, + authService: AWSAuthCredentialsProviderBehavior + ) throws { guard let data = configuration.data else { throw PluginError.pluginConfigurationError( @@ -66,16 +76,20 @@ public struct AWSAPICategoryPluginConfiguration { let endpoints = try AWSAPICategoryPluginConfiguration.endpointsFromConfig( config: data, apiAuthProviderFactory: apiAuthProviderFactory, - authService: authService) + authService: authService + ) let interceptors = try AWSAPICategoryPluginConfiguration.makeInterceptors( forEndpoints: endpoints, apiAuthProviderFactory: apiAuthProviderFactory, - authService: authService) + authService: authService + ) - self.init(endpoints: endpoints, - interceptors: interceptors, - apiAuthProviderFactory: apiAuthProviderFactory, - authService: authService) + self.init( + endpoints: endpoints, + interceptors: interceptors, + apiAuthProviderFactory: apiAuthProviderFactory, + authService: authService + ) } @@ -83,8 +97,10 @@ public struct AWSAPICategoryPluginConfiguration { /// - Parameters: /// - endpoints: dictionary of EndpointConfig whose keys are the API endpoint name /// - interceptors: dictionary of AWSAPIEndpointInterceptors whose keys are the API endpoint name - internal init(endpoints: [APIEndpointName: EndpointConfig], - interceptors: [APIEndpointName: AWSAPIEndpointInterceptors] = [:]) { + init( + endpoints: [APIEndpointName: EndpointConfig], + interceptors: [APIEndpointName: AWSAPIEndpointInterceptors] = [:] + ) { self.endpoints = endpoints self.interceptors = interceptors } @@ -93,10 +109,12 @@ public struct AWSAPICategoryPluginConfiguration { /// - Parameters: /// - endpoints: dictionary of EndpointConfig whose keys are the API endpoint name /// - interceptors: dictionary of AWSAPIEndpointInterceptors whose keys are the API endpoint name - internal init(endpoints: [APIEndpointName: EndpointConfig], - interceptors: [APIEndpointName: AWSAPIEndpointInterceptors] = [:], - apiAuthProviderFactory: APIAuthProviderFactory, - authService: AWSAuthCredentialsProviderBehavior) { + init( + endpoints: [APIEndpointName: EndpointConfig], + interceptors: [APIEndpointName: AWSAPIEndpointInterceptors] = [:], + apiAuthProviderFactory: APIAuthProviderFactory, + authService: AWSAuthCredentialsProviderBehavior + ) { self.endpoints = endpoints self.interceptors = interceptors self.apiAuthProviderFactory = apiAuthProviderFactory @@ -106,8 +124,10 @@ public struct AWSAPICategoryPluginConfiguration { /// Registers an customer interceptor for the provided API endpoint /// - Parameter interceptor: operation interceptor used to decorate API requests /// - Parameter toEndpoint: API endpoint name - mutating func addInterceptor(_ interceptor: URLRequestInterceptor, - toEndpoint apiName: APIEndpointName) { + mutating func addInterceptor( + _ interceptor: URLRequestInterceptor, + toEndpoint apiName: APIEndpointName + ) { guard interceptors[apiName] != nil else { log.error("No interceptors configuration found for \(apiName)") return @@ -118,7 +138,7 @@ public struct AWSAPICategoryPluginConfiguration { /// Returns all the interceptors registered for `apiName` API endpoint /// - Parameter apiName: API endpoint name /// - Returns: Optional AWSAPIEndpointInterceptors for the apiName - internal func interceptorsForEndpoint(named apiName: APIEndpointName) -> AWSAPIEndpointInterceptors? { + func interceptorsForEndpoint(named apiName: APIEndpointName) -> AWSAPIEndpointInterceptors? { return interceptors[apiName] } @@ -126,7 +146,7 @@ public struct AWSAPICategoryPluginConfiguration { /// - Parameters: /// - endpointConfig: endpoint configuration /// - Returns: Optional AWSAPIEndpointInterceptors for the endpointConfig - internal func interceptorsForEndpoint(withConfig endpointConfig: EndpointConfig) -> AWSAPIEndpointInterceptors? { + func interceptorsForEndpoint(withConfig endpointConfig: EndpointConfig) -> AWSAPIEndpointInterceptors? { return interceptorsForEndpoint(named: endpointConfig.name) } @@ -136,23 +156,29 @@ public struct AWSAPICategoryPluginConfiguration { /// - authType: overrides the registered auth interceptor /// - Throws: PluginConfigurationError in case of failure building an instance of AWSAuthorizationConfiguration /// - Returns: Optional AWSAPIEndpointInterceptors for the endpointConfig and authType - internal func interceptorsForEndpoint( + func interceptorsForEndpoint( withConfig endpointConfig: EndpointConfig, authType: AWSAuthorizationType ) throws -> AWSAPIEndpointInterceptors? { - guard let apiAuthProviderFactory = self.apiAuthProviderFactory else { + guard let apiAuthProviderFactory else { return interceptorsForEndpoint(named: endpointConfig.name) } - var config = AWSAPIEndpointInterceptors(endpointName: endpointConfig.name, - apiAuthProviderFactory: apiAuthProviderFactory, - authService: authService) - let authConfiguration = try AWSAuthorizationConfiguration.makeConfiguration(authType: authType, - region: endpointConfig.region, - apiKey: endpointConfig.apiKey) - try config.addAuthInterceptorsToEndpoint(endpointType: endpointConfig.endpointType, - authConfiguration: authConfiguration) + var config = AWSAPIEndpointInterceptors( + endpointName: endpointConfig.name, + apiAuthProviderFactory: apiAuthProviderFactory, + authService: authService + ) + let authConfiguration = try AWSAuthorizationConfiguration.makeConfiguration( + authType: authType, + region: endpointConfig.region, + apiKey: endpointConfig.apiKey + ) + try config.addAuthInterceptorsToEndpoint( + endpointType: endpointConfig.endpointType, + authConfiguration: authConfiguration + ) // retrieve current interceptors and replace auth interceptor let currentInterceptors = interceptorsForEndpoint(named: endpointConfig.name) @@ -181,10 +207,12 @@ public struct AWSAPICategoryPluginConfiguration { for (key, jsonValue) in config { let name = key - let endpointConfig = try EndpointConfig(name: name, - jsonValue: jsonValue, - apiAuthProviderFactory: apiAuthProviderFactory, - authService: authService) + let endpointConfig = try EndpointConfig( + name: name, + jsonValue: jsonValue, + apiAuthProviderFactory: apiAuthProviderFactory, + authService: authService + ) endpoints[name] = endpointConfig } @@ -198,10 +226,12 @@ public struct AWSAPICategoryPluginConfiguration { ) throws -> [APIEndpointName: EndpointConfig] { var endpoints = [APIEndpointName: EndpointConfig]() let name = AWSAPIPlugin.defaultGraphQLAPI - let endpointConfig = try EndpointConfig(name: name, - config: config, - apiAuthProviderFactory: apiAuthProviderFactory, - authService: authService) + let endpointConfig = try EndpointConfig( + name: name, + config: config, + apiAuthProviderFactory: apiAuthProviderFactory, + authService: authService + ) endpoints[name] = endpointConfig return endpoints } @@ -214,16 +244,22 @@ public struct AWSAPICategoryPluginConfiguration { /// - authService: authService /// - Throws: /// - Returns: dictionary of AWSAPIEndpointInterceptors indexed by API endpoint name - private static func makeInterceptors(forEndpoints endpoints: [APIEndpointName: EndpointConfig], - apiAuthProviderFactory: APIAuthProviderFactory, - authService: AWSAuthCredentialsProviderBehavior) throws -> [APIEndpointName: AWSAPIEndpointInterceptors] { + private static func makeInterceptors( + forEndpoints endpoints: [APIEndpointName: EndpointConfig], + apiAuthProviderFactory: APIAuthProviderFactory, + authService: AWSAuthCredentialsProviderBehavior + ) throws -> [APIEndpointName: AWSAPIEndpointInterceptors] { var interceptors: [APIEndpointName: AWSAPIEndpointInterceptors] = [:] for (name, config) in endpoints { - var interceptorsConfig = AWSAPIEndpointInterceptors(endpointName: name, - apiAuthProviderFactory: apiAuthProviderFactory, - authService: authService) - try interceptorsConfig.addAuthInterceptorsToEndpoint(endpointType: config.endpointType, - authConfiguration: config.authorizationConfiguration) + var interceptorsConfig = AWSAPIEndpointInterceptors( + endpointName: name, + apiAuthProviderFactory: apiAuthProviderFactory, + authService: authService + ) + try interceptorsConfig.addAuthInterceptorsToEndpoint( + endpointType: config.endpointType, + authConfiguration: config.authorizationConfiguration + ) interceptors[name] = interceptorsConfig } diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPIEndpointInterceptors.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPIEndpointInterceptors.swift index 99191e40dc..cff8e3838b 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPIEndpointInterceptors.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPIEndpointInterceptors.swift @@ -6,8 +6,8 @@ // import Amplify -import Foundation import AWSPluginsCore +import Foundation import InternalAmplifyCredentials /// The order of interceptor decoration is as follows: @@ -31,23 +31,26 @@ struct AWSAPIEndpointInterceptors { var postludeInterceptors: [URLRequestInterceptor] = [] - /// Validates whether the access token has expired. A best-effort attempt is made, + /// Validates whether the access token has expired. A best-effort attempt is made, /// and it returns `false` if the expiration cannot be determined. - var expiryValidator: ((String) -> Bool) { + var expiryValidator: (String) -> Bool { { token in guard let authService, let claims = try? authService.getTokenClaims(tokenString: token).get(), - let tokenExpiration = claims["exp"]?.doubleValue else { + let tokenExpiration = claims["exp"]?.doubleValue + else { return false } let currentTime = Date().timeIntervalSince1970 return currentTime > tokenExpiration } } - - init(endpointName: APIEndpointName, - apiAuthProviderFactory: APIAuthProviderFactory, - authService: AWSAuthCredentialsProviderBehavior? = nil) { + + init( + endpointName: APIEndpointName, + apiAuthProviderFactory: APIAuthProviderFactory, + authService: AWSAuthCredentialsProviderBehavior? = nil + ) { self.apiEndpointName = endpointName self.apiAuthProviderFactory = apiAuthProviderFactory self.authService = authService @@ -60,8 +63,10 @@ struct AWSAPIEndpointInterceptors { } /// Initialize authorization interceptors - mutating func addAuthInterceptorsToEndpoint(endpointType: AWSAPICategoryPluginEndpointType, - authConfiguration: AWSAuthorizationConfiguration) throws { + mutating func addAuthInterceptorsToEndpoint( + endpointType: AWSAPICategoryPluginEndpointType, + authConfiguration: AWSAuthorizationConfiguration + ) throws { switch authConfiguration { case .none: // No interceptors needed @@ -71,36 +76,48 @@ struct AWSAPIEndpointInterceptors { let interceptor = APIKeyURLRequestInterceptor(apiKeyProvider: provider) preludeInterceptors.append(interceptor) case .awsIAM(let iamConfig): - guard let authService = authService else { - throw PluginError.pluginConfigurationError("AuthService is not set for IAM", - "") + guard let authService else { + throw PluginError.pluginConfigurationError( + "AuthService is not set for IAM", + "" + ) } let provider = BasicIAMCredentialsProvider(authService: authService) - let interceptor = IAMURLRequestInterceptor(iamCredentialsProvider: provider, - region: iamConfig.region, - endpointType: endpointType) + let interceptor = IAMURLRequestInterceptor( + iamCredentialsProvider: provider, + region: iamConfig.region, + endpointType: endpointType + ) postludeInterceptors.append(interceptor) case .amazonCognitoUserPools: - guard let authService = authService else { - throw PluginError.pluginConfigurationError("AuthService not set for cognito user pools", - "") + guard let authService else { + throw PluginError.pluginConfigurationError( + "AuthService not set for cognito user pools", + "" + ) } let provider = BasicUserPoolTokenProvider(authService: authService) - let interceptor = AuthTokenURLRequestInterceptor(authTokenProvider: provider, - isTokenExpired: expiryValidator) + let interceptor = AuthTokenURLRequestInterceptor( + authTokenProvider: provider, + isTokenExpired: expiryValidator + ) preludeInterceptors.append(interceptor) case .openIDConnect: guard let oidcAuthProvider = apiAuthProviderFactory.oidcAuthProvider() else { - throw PluginError.pluginConfigurationError("AuthService not set for OIDC", - "Provide an AmplifyOIDCAuthProvider via API plugin configuration") + throw PluginError.pluginConfigurationError( + "AuthService not set for OIDC", + "Provide an AmplifyOIDCAuthProvider via API plugin configuration" + ) } let wrappedAuthProvider = AuthTokenProviderWrapper(tokenAuthProvider: oidcAuthProvider) let interceptor = AuthTokenURLRequestInterceptor(authTokenProvider: wrappedAuthProvider) preludeInterceptors.append(interceptor) case .function: guard let functionAuthProvider = apiAuthProviderFactory.functionAuthProvider() else { - throw PluginError.pluginConfigurationError("AuthService not set for function auth", - "Provide an AmplifyFunctionAuthProvider via API plugin configuration") + throw PluginError.pluginConfigurationError( + "AuthService not set for function auth", + "Provide an AmplifyFunctionAuthProvider via API plugin configuration" + ) } let wrappedAuthProvider = AuthTokenProviderWrapper(tokenAuthProvider: functionAuthProvider) let interceptor = AuthTokenURLRequestInterceptor(authTokenProvider: wrappedAuthProvider) diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncListDecoder.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncListDecoder.swift index e75add220b..bb385814ea 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncListDecoder.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncListDecoder.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify import AWSPluginsCore +import Foundation /// This decoder is registered and used to detect various data payloads objects to store /// inside an AppSyncListProvider when decoding to the Lazy `List` type as a "not yet loaded" List. If the data payload @@ -25,7 +25,7 @@ public struct AppSyncListDecoder: ModelListDecoder { /// Used by the custom decoder implemented in the `List` type to detect if the payload can be /// decoded to an AppSyncListProvider. public static func decode(modelType: ModelType.Type, decoder: Decoder) -> AnyModelListProvider? { - self.shouldDecodeToAppSyncListProvider(modelType: modelType, decoder: decoder)?.eraseToAnyModelListProvider() + shouldDecodeToAppSyncListProvider(modelType: modelType, decoder: decoder)?.eraseToAnyModelListProvider() } static func shouldDecodeToAppSyncListProvider(modelType: ModelType.Type, decoder: Decoder) -> AppSyncListProvider? { diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncListPayload.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncListPayload.swift index 033c718d86..6cd95ca1c5 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncListPayload.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncListPayload.swift @@ -18,10 +18,12 @@ public struct AppSyncListPayload: Codable { let apiName: String? let authMode: AWSAuthorizationType? - public init(graphQLData: JSONValue, - apiName: String?, - authMode: AWSAuthorizationType?, - variables: [String: JSONValue]?) { + public init( + graphQLData: JSONValue, + apiName: String?, + authMode: AWSAuthorizationType?, + variables: [String: JSONValue]? + ) { self.apiName = apiName self.authMode = authMode self.variables = variables @@ -35,7 +37,8 @@ public struct AppSyncListPayload: Codable { var graphQLFilter: [String: Any]? { guard let storedVariables = variables, let filters = storedVariables["filter"], - case let .object(filterValue) = filters else { + case let .object(filterValue) = filters + else { return nil } @@ -46,7 +49,8 @@ public struct AppSyncListPayload: Codable { // `GraphQLFilter`. guard let filterVariablesData = try? encoder.encode(filterValue), let filterVariablesJSON = try? JSONSerialization.jsonObject(with: filterVariablesData) - as? GraphQLFilter else { + as? GraphQLFilter + else { assertionFailure("Filter variables is not a valid JSON object: \(filterValue)") return nil diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncListProvider.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncListProvider.swift index 19f1368dd6..26b1ebdbf6 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncListProvider.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncListProvider.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify import AWSPluginsCore +import Foundation public class AppSyncListProvider: ModelListProvider { @@ -28,14 +28,18 @@ public class AppSyncListProvider: ModelListProvider { /// The associatedFields represents the field to which the owner of the `List` is linked to. /// For example, if `Post.comments` is associated with `Comment.post` the `List` /// of `Post` will have a reference to the `post` field in `Comment`. - case notLoaded(associatedIdentifiers: [String], - associatedFields: [String]) + case notLoaded( + associatedIdentifiers: [String], + associatedFields: [String] + ) /// If the list is retrieved directly, this state holds the underlying data, nextToken used to create /// the subsequent GraphQL request, and previous filter used to create the loaded list - case loaded(elements: [Element], - nextToken: String?, - filter: [String: Any]?) + case loaded( + elements: [Element], + nextToken: String?, + filter: [String: Any]? + ) } var loadedState: LoadedState @@ -43,52 +47,68 @@ public class AppSyncListProvider: ModelListProvider { // MARK: - Initializers convenience init(payload: AppSyncListPayload) throws { - let listResponse = try AppSyncListResponse.initWithMetadata(type: Element.self, - graphQLData: payload.graphQLData, - apiName: payload.apiName, - authMode: payload.authMode) - - self.init(elements: listResponse.items, - nextToken: listResponse.nextToken, - apiName: payload.apiName, - limit: payload.limit, - filter: payload.graphQLFilter) + let listResponse = try AppSyncListResponse.initWithMetadata( + type: Element.self, + graphQLData: payload.graphQLData, + apiName: payload.apiName, + authMode: payload.authMode + ) + + self.init( + elements: listResponse.items, + nextToken: listResponse.nextToken, + apiName: payload.apiName, + limit: payload.limit, + filter: payload.graphQLFilter + ) } convenience init(listResponse: AppSyncListResponse) throws { - self.init(elements: listResponse.items, - nextToken: listResponse.nextToken) + self.init( + elements: listResponse.items, + nextToken: listResponse.nextToken + ) } convenience init(metadata: AppSyncListDecoder.Metadata) { - self.init(associatedIdentifiers: metadata.appSyncAssociatedIdentifiers, - associatedFields: metadata.appSyncAssociatedFields, - apiName: metadata.apiName, - authMode: metadata.authMode) + self.init( + associatedIdentifiers: metadata.appSyncAssociatedIdentifiers, + associatedFields: metadata.appSyncAssociatedFields, + apiName: metadata.apiName, + authMode: metadata.authMode + ) } // Internal initializer for testing - init(elements: [Element], - nextToken: String? = nil, - apiName: String? = nil, - authMode: AWSAuthorizationType? = nil, - limit: Int? = nil, - filter: [String: Any]? = nil) { - self.loadedState = .loaded(elements: elements, - nextToken: nextToken, - filter: filter) + init( + elements: [Element], + nextToken: String? = nil, + apiName: String? = nil, + authMode: AWSAuthorizationType? = nil, + limit: Int? = nil, + filter: [String: Any]? = nil + ) { + self.loadedState = .loaded( + elements: elements, + nextToken: nextToken, + filter: filter + ) self.apiName = apiName self.authMode = authMode self.limit = limit } // Internal initializer for testing - init(associatedIdentifiers: [String], - associatedFields: [String], - apiName: String? = nil, - authMode: AWSAuthorizationType? = nil) { - self.loadedState = .notLoaded(associatedIdentifiers: associatedIdentifiers, - associatedFields: associatedFields) + init( + associatedIdentifiers: [String], + associatedFields: [String], + apiName: String? = nil, + authMode: AWSAuthorizationType? = nil + ) { + self.loadedState = .notLoaded( + associatedIdentifiers: associatedIdentifiers, + associatedFields: associatedFields + ) self.apiName = apiName self.authMode = authMode } @@ -114,8 +134,10 @@ public class AppSyncListProvider: ModelListProvider { } //// Internal `load` to perform the retrieval of the first page and storing it in memory - func load(associatedIdentifiers: [String], - associatedFields: [String]) async throws -> [Element] { + func load( + associatedIdentifiers: [String], + associatedFields: [String] + ) async throws -> [Element] { let filter: GraphQLFilter if associatedIdentifiers.count == 1, let associatedId = associatedIdentifiers.first, @@ -128,49 +150,60 @@ public class AppSyncListProvider: ModelListProvider { let columnNames = columnNames(fields: associatedFields, Element.schema) let predicateValues = zip(columnNames, associatedIdentifiers) for (identifierName, identifierValue) in predicateValues { - queryPredicates.append(QueryPredicateOperation(field: identifierName, - operator: .equals(identifierValue))) + queryPredicates.append(QueryPredicateOperation( + field: identifierName, + operator: .equals(identifierValue) + )) } let groupedQueryPredicates = QueryPredicateGroup(type: .and, predicates: queryPredicates) filter = groupedQueryPredicates.graphQLFilter(for: Element.schema) } - let request = GraphQLRequest.listQuery(responseType: JSONValue.self, - modelSchema: Element.schema, - filter: filter, - limit: limit, - apiName: apiName, - authMode: authMode) + let request = GraphQLRequest.listQuery( + responseType: JSONValue.self, + modelSchema: Element.schema, + filter: filter, + limit: limit, + apiName: apiName, + authMode: authMode + ) do { let graphQLResponse = try await Amplify.API.query(request: request) switch graphQLResponse { case .success(let graphQLData): - guard let listResponse = try? AppSyncListResponse.initWithMetadata(type: Element.self, - graphQLData: graphQLData, - apiName: self.apiName, - authMode: self.authMode) else { + guard let listResponse = try? AppSyncListResponse.initWithMetadata( + type: Element.self, + graphQLData: graphQLData, + apiName: apiName, + authMode: authMode + ) else { throw CoreError.listOperation(""" The AppSync response return successfully, but could not decode to AWSAppSyncListResponse from: \(graphQLData) """, "", nil) } - self.loadedState = .loaded(elements: listResponse.items, - nextToken: listResponse.nextToken, - filter: filter) + loadedState = .loaded( + elements: listResponse.items, + nextToken: listResponse.nextToken, + filter: filter + ) return listResponse.items case .failure(let graphQLError): log.error(error: graphQLError) throw CoreError.listOperation( "The AppSync response returned successfully with GraphQL errors.", "Check the underlying error for the failed GraphQL response.", - graphQLError) + graphQLError + ) } } catch let apiError as APIError { log.error(error: apiError) - throw CoreError.listOperation("The AppSync request failed", - "See underlying `APIError` for more details.", - apiError) + throw CoreError.listOperation( + "The AppSync request failed", + "See underlying `APIError` for more details.", + apiError + ) } catch { throw error } @@ -193,24 +226,30 @@ public class AppSyncListProvider: ModelListProvider { """, "", nil) } guard let nextToken = nextTokenOptional else { - throw CoreError.clientValidation("There is no next page.", - "Only call `getNextPage()` when `hasNextPage()` is true.", - nil) + throw CoreError.clientValidation( + "There is no next page.", + "Only call `getNextPage()` when `hasNextPage()` is true.", + nil + ) } return try await getNextPage(nextToken: nextToken, filter: filter) } /// Internal `getNextPage` to retrieve the next page and return it as a new List object - func getNextPage(nextToken: String, - filter: [String: Any]?) async throws -> List { - let request = GraphQLRequest>.listQuery(responseType: List.self, - modelSchema: Element.schema, - filter: filter, - limit: limit, - nextToken: nextToken, - apiName: apiName, - authMode: authMode) + func getNextPage( + nextToken: String, + filter: [String: Any]? + ) async throws -> List { + let request = GraphQLRequest>.listQuery( + responseType: List.self, + modelSchema: Element.schema, + filter: filter, + limit: limit, + nextToken: nextToken, + apiName: apiName, + authMode: authMode + ) do { let graphQLResponse = try await Amplify.API.query(request: request) switch graphQLResponse { @@ -225,9 +264,11 @@ public class AppSyncListProvider: ModelListProvider { } } catch let apiError as APIError { log.error(error: apiError) - throw CoreError.listOperation("The AppSync request failed", - "See underlying `APIError` for more details.", - apiError) + throw CoreError.listOperation( + "The AppSync request failed", + "See underlying `APIError` for more details.", + apiError + ) } catch { throw error } @@ -240,7 +281,8 @@ public class AppSyncListProvider: ModelListProvider { appSyncAssociatedIdentifiers: associatedIdentifiers, appSyncAssociatedFields: associatedFields, apiName: apiName, - authMode: authMode) + authMode: authMode + ) var container = encoder.singleValueContainer() try container.encode(metadata) case .loaded(let elements, _, _): diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncListResponse.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncListResponse.swift index a30821853d..c867897249 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncListResponse.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncListResponse.swift @@ -6,8 +6,8 @@ // import Amplify -import Foundation import AWSPluginsCore +import Foundation /// Resembles the AppSync's GraphQL response for a list operation. struct AppSyncListResponse: Codable { @@ -24,16 +24,19 @@ extension AppSyncListResponse { /// Modify the incoming `graphQLData` by decoding each item in the response with /// model metadata on its array associations. - static func initWithMetadata(type: Element.Type, - graphQLData: JSONValue, - apiName: String?, - authMode: AWSAuthorizationType?) throws -> AppSyncListResponse { + static func initWithMetadata( + type: Element.Type, + graphQLData: JSONValue, + apiName: String?, + authMode: AWSAuthorizationType? + ) throws -> AppSyncListResponse { var elements = [Element]() if case let .array(jsonArray) = graphQLData["items"] { let jsonArrayWithMetadata = AppSyncModelMetadataUtils.addMetadata( toModelArray: jsonArray, apiName: apiName, - authMode: authMode) + authMode: authMode + ) let encoder = JSONEncoder() encoder.dateEncodingStrategy = ModelDateFormatting.encodingStrategy diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncModelDecoder.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncModelDecoder.swift index dab2e44756..eb24725b95 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncModelDecoder.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncModelDecoder.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify import AWSPluginsCore +import Foundation /// This decoder is registered and used to detect various data payloads to store /// inside an `AppSyncModelProvider` when decoding to the `LazyReference` as a "not yet loaded" Reference. If the data payload @@ -21,10 +21,12 @@ public struct AppSyncModelDecoder: ModelProviderDecoder { let authMode: AWSAuthorizationType? let source: String - init(identifiers: [LazyReferenceIdentifier], - apiName: String?, - authMode: AWSAuthorizationType?, - source: String = ModelProviderRegistry.DecoderSource.appSync) { + init( + identifiers: [LazyReferenceIdentifier], + apiName: String?, + authMode: AWSAuthorizationType?, + source: String = ModelProviderRegistry.DecoderSource.appSync + ) { self.identifiers = identifiers self.apiName = apiName self.authMode = authMode diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncModelMetadata.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncModelMetadata.swift index 20f0b88dd0..73fd5c5291 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncModelMetadata.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncModelMetadata.swift @@ -6,11 +6,11 @@ // import Amplify -import Foundation import AWSPluginsCore +import Foundation /// Holds the methods to traverse and maniupulate the response data object by injecting -public struct AppSyncModelMetadataUtils { +public enum AppSyncModelMetadataUtils { // A fairly light check to make sure the payload is an object and we have the schema for `addMetadata`. // Note: `addMetadata` should be very tightly checking the associated fields to determine when it should add @@ -25,10 +25,12 @@ public struct AppSyncModelMetadataUtils { return true } - static func addMetadata(toModelArray graphQLDataArray: [JSONValue], - apiName: String?, - authMode: AWSAuthorizationType?) -> [JSONValue] { - return graphQLDataArray.map { (graphQLData) -> JSONValue in + static func addMetadata( + toModelArray graphQLDataArray: [JSONValue], + apiName: String?, + authMode: AWSAuthorizationType? + ) -> [JSONValue] { + return graphQLDataArray.map { graphQLData -> JSONValue in addMetadata(toModel: graphQLData, apiName: apiName, authMode: authMode) } } @@ -37,8 +39,9 @@ public struct AppSyncModelMetadataUtils { toModel graphQLData: JSONValue, apiName: String?, authMode: AWSAuthorizationType?, - source: String = ModelProviderRegistry.DecoderSource.appSync) -> JSONValue { - + source: String = ModelProviderRegistry.DecoderSource.appSync + ) -> JSONValue { + guard case var .object(modelJSON) = graphQLData else { Amplify.API.log.debug("Not an model object: \(graphQLData)") return graphQLData @@ -89,11 +92,13 @@ public struct AppSyncModelMetadataUtils { let associatedModelType = ModelRegistry.modelType(from: associatedModelName) { // Scenario: Belongs-To Primary Keys only are available for lazy loading - if let modelIdentifierMetadata = createModelIdentifierMetadata(associatedModelType, - modelObject: modelObject, - apiName: apiName, - authMode: authMode, - source: source) { + if let modelIdentifierMetadata = createModelIdentifierMetadata( + associatedModelType, + modelObject: modelObject, + apiName: apiName, + authMode: authMode, + source: source + ) { if let serializedMetadata = try? encoder.encode(modelIdentifierMetadata), let metadataJSON = try? decoder.decode(JSONValue.self, from: serializedMetadata) { Amplify.API.log.verbose("Adding [\(modelField.name): \(metadataJSON)]") @@ -108,9 +113,11 @@ public struct AppSyncModelMetadataUtils { // add metadata to its fields, to create not loaded LazyReference objects // only if the model type allowsfor lazy loading functionality else if associatedModelType.rootPath != nil { - let nestedModelWithMetadata = addMetadata(toModel: nestedModelJSON, - apiName: apiName, - authMode: authMode) + let nestedModelWithMetadata = addMetadata( + toModel: nestedModelJSON, + apiName: apiName, + authMode: authMode + ) modelJSON.updateValue(nestedModelWithMetadata, forKey: modelField.name) } // otherwise do nothing to the data. @@ -124,10 +131,12 @@ public struct AppSyncModelMetadataUtils { // Store the association data (parent's identifier and field name) // This allows the list to perform lazy loading of child items using parent identifier as the predicate if modelJSON[modelField.name] == nil { - let appSyncModelMetadata = AppSyncListDecoder.Metadata(appSyncAssociatedIdentifiers: identifiers, - appSyncAssociatedFields: modelField.associatedFieldNames, - apiName: apiName, - authMode: authMode) + let appSyncModelMetadata = AppSyncListDecoder.Metadata( + appSyncAssociatedIdentifiers: identifiers, + appSyncAssociatedFields: modelField.associatedFieldNames, + apiName: apiName, + authMode: authMode + ) if let serializedMetadata = try? encoder.encode(appSyncModelMetadata), let metadataJSON = try? decoder.decode(JSONValue.self, from: serializedMetadata) { log.verbose("Adding [\(modelField.name): \(metadataJSON)]") @@ -148,17 +157,21 @@ public struct AppSyncModelMetadataUtils { associatedModelType.rootPath != nil { for (index, item) in graphQLDataArray.enumerated() { - let modelJSON = AppSyncModelMetadataUtils.addMetadata(toModel: item, - apiName: apiName, - authMode: authMode) + let modelJSON = AppSyncModelMetadataUtils.addMetadata( + toModel: item, + apiName: apiName, + authMode: authMode + ) graphQLDataArray[index] = modelJSON } graphQLDataObject["items"] = JSONValue.array(graphQLDataArray) - let payload = AppSyncListPayload(graphQLData: JSONValue.object(graphQLDataObject), - apiName: apiName, - authMode: authMode, - variables: nil) + let payload = AppSyncListPayload( + graphQLData: JSONValue.object(graphQLDataObject), + apiName: apiName, + authMode: authMode, + variables: nil + ) if let serializedPayload = try? encoder.encode(payload), let payloadJSON = try? decoder.decode(JSONValue.self, from: serializedPayload) { @@ -178,11 +191,13 @@ public struct AppSyncModelMetadataUtils { /// fields on the `modelObject` is useful determining if the `modelOject` is eager or lazy loaded. If the identifiers /// plus one additional field (`__typename`) doesn't match the number of keys on the `modelObject` then there /// are more keys in the `modelObject` which means it was eager loaded. - static func createModelIdentifierMetadata(_ associatedModel: Model.Type, - modelObject: [String: JSONValue], - apiName: String?, - authMode: AWSAuthorizationType?, - source: String) -> AppSyncModelDecoder.Metadata? { + static func createModelIdentifierMetadata( + _ associatedModel: Model.Type, + modelObject: [String: JSONValue], + apiName: String?, + authMode: AWSAuthorizationType?, + source: String + ) -> AppSyncModelDecoder.Metadata? { let primarykeys = associatedModel.schema.primaryKey var identifiers = [LazyReferenceIdentifier]() for identifierField in primarykeys.fields { @@ -200,7 +215,8 @@ public struct AppSyncModelMetadataUtils { identifiers: identifiers, apiName: apiName, authMode: authMode, - source: source) + source: source + ) } else { return nil } diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncModelProvider.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncModelProvider.swift index cdcaa16d88..f8fcc29125 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncModelProvider.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Core/AppSyncModelProvider.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify import AWSPluginsCore +import Foundation public class AppSyncModelProvider: ModelProvider { @@ -38,22 +38,24 @@ public class AppSyncModelProvider: ModelProvider { switch loadedState { case .notLoaded(let identifiers): - guard let identifiers = identifiers else { - self.loadedState = .loaded(model: nil) + guard let identifiers else { + loadedState = .loaded(model: nil) return nil } - let request = GraphQLRequest.getRequest(ModelType.self, - byIdentifiers: identifiers, - apiName: apiName, - authMode: authMode) + let request = GraphQLRequest.getRequest( + ModelType.self, + byIdentifiers: identifiers, + apiName: apiName, + authMode: authMode + ) log.verbose("Loading \(ModelType.modelName) with \(identifiers)") let graphQLResponse = try await Amplify.API.query(request: request) switch graphQLResponse { case .success(let model): - self.loadedState = .loaded(model: model) + loadedState = .loaded(model: model) return model case .failure(let graphQLError): - self.log.error(error: graphQLError) + log.error(error: graphQLError) throw graphQLError } case .loaded(let element): @@ -72,7 +74,8 @@ public class AppSyncModelProvider: ModelProvider { identifiers: identifiers ?? [], apiName: apiName, authMode: authMode, - source: source) + source: source + ) try metadata.encode(to: encoder) case .loaded(let element): diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/APIKeyURLRequestInterceptor.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/APIKeyURLRequestInterceptor.swift index 225d597c04..f8f360e538 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/APIKeyURLRequestInterceptor.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/APIKeyURLRequestInterceptor.swift @@ -7,8 +7,8 @@ import Amplify import AWSPluginsCore -import InternalAmplifyCredentials import Foundation +import InternalAmplifyCredentials struct APIKeyURLRequestInterceptor: URLRequestInterceptor { diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/AuthTokenProviderWrapper.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/AuthTokenProviderWrapper.swift index 9137c018b5..6cd1164cd0 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/AuthTokenProviderWrapper.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/AuthTokenProviderWrapper.swift @@ -7,8 +7,8 @@ import Amplify import AWSPluginsCore -import InternalAmplifyCredentials import Foundation +import InternalAmplifyCredentials class AuthTokenProviderWrapper: AuthTokenProvider { diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/AuthTokenURLRequestInterceptor.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/AuthTokenURLRequestInterceptor.swift index 9ed5783c28..413d5c6e52 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/AuthTokenURLRequestInterceptor.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/AuthTokenURLRequestInterceptor.swift @@ -7,8 +7,8 @@ import Amplify import AWSPluginsCore -import InternalAmplifyCredentials import Foundation +import InternalAmplifyCredentials struct AuthTokenURLRequestInterceptor: URLRequestInterceptor { @@ -18,8 +18,10 @@ struct AuthTokenURLRequestInterceptor: URLRequestInterceptor { let authTokenProvider: AuthTokenProvider let isTokenExpired: ((String) -> Bool)? - init(authTokenProvider: AuthTokenProvider, - isTokenExpired: ((String) -> Bool)? = nil) { + init( + authTokenProvider: AuthTokenProvider, + isTokenExpired: ((String) -> Bool)? = nil + ) { self.authTokenProvider = authTokenProvider self.isTokenExpired = isTokenExpired } @@ -34,10 +36,14 @@ struct AuthTokenURLRequestInterceptor: URLRequestInterceptor { dateFormatter.dateFormat = Self.AWSDateISO8601DateFormat2 let amzDate = dateFormatter.string(from: date) - mutableRequest.setValue(amzDate, - forHTTPHeaderField: URLRequestConstants.Header.xAmzDate) - mutableRequest.addValue(userAgent, - forHTTPHeaderField: URLRequestConstants.Header.userAgent) + mutableRequest.setValue( + amzDate, + forHTTPHeaderField: URLRequestConstants.Header.xAmzDate + ) + mutableRequest.addValue( + userAgent, + forHTTPHeaderField: URLRequestConstants.Header.userAgent + ) let token: String do { @@ -45,13 +51,15 @@ struct AuthTokenURLRequestInterceptor: URLRequestInterceptor { } catch { throw APIError.operationError("Failed to retrieve authorization token.", "", error) } - + if isTokenExpired?(token) ?? false { // If the access token has expired, we send back the underlying "AuthError.sessionExpired" error. // Without a more specific AuthError case like "tokenExpired", this is the closest representation. - throw APIError.operationError("Auth Token Provider returned a expired token.", - "Please call `Amplify.Auth.fetchAuthSession()` or sign in again.", - AuthError.sessionExpired("", "", nil)) + throw APIError.operationError( + "Auth Token Provider returned a expired token.", + "Please call `Amplify.Auth.fetchAuthSession()` or sign in again.", + AuthError.sessionExpired("", "", nil) + ) } mutableRequest.setValue(token, forHTTPHeaderField: "authorization") diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/IAMURLRequestInterceptor.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/IAMURLRequestInterceptor.swift index 5b354abb1d..eef23f8f2e 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/IAMURLRequestInterceptor.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/IAMURLRequestInterceptor.swift @@ -7,9 +7,9 @@ import Amplify import AWSPluginsCore -import InternalAmplifyCredentials -import Foundation import ClientRuntime +import Foundation +import InternalAmplifyCredentials typealias AWSRegionType = String @@ -19,9 +19,11 @@ struct IAMURLRequestInterceptor: URLRequestInterceptor { let endpointType: AWSAPICategoryPluginEndpointType private let userAgent = AmplifyAWSServiceConfiguration.userAgentLib - init(iamCredentialsProvider: IAMCredentialsProvider, - region: AWSRegionType, - endpointType: AWSAPICategoryPluginEndpointType) { + init( + iamCredentialsProvider: IAMCredentialsProvider, + region: AWSRegionType, + endpointType: AWSAPICategoryPluginEndpointType + ) { self.iamCredentialsProvider = iamCredentialsProvider self.region = region self.endpointType = endpointType @@ -56,12 +58,11 @@ struct IAMURLRequestInterceptor: URLRequestInterceptor { .withHeaders(.init(request.allHTTPHeaderFields ?? [:])) .withBody(.data(request.httpBody)) - let signingName: String - switch endpointType { + let signingName: String = switch endpointType { case .graphQL: - signingName = URLRequestConstants.appSyncServiceName + URLRequestConstants.appSyncServiceName case .rest: - signingName = URLRequestConstants.apiGatewayServiceName + URLRequestConstants.apiGatewayServiceName } guard let urlRequest = try await AmplifyAWSSignatureV4Signer().sigV4SignedRequest( diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/SubscriptionInterceptor/APIKeyAuthInterceptor.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/SubscriptionInterceptor/APIKeyAuthInterceptor.swift index f52ded490e..644b67d2a0 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/SubscriptionInterceptor/APIKeyAuthInterceptor.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/SubscriptionInterceptor/APIKeyAuthInterceptor.swift @@ -5,9 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // - -import Foundation import Amplify +import Foundation @_spi(WebSocket) import AWSPluginsCore class APIKeyAuthInterceptor { @@ -43,7 +42,7 @@ extension APIKeyAuthInterceptor: AppSyncRequestInterceptor { } } -fileprivate func authHeaderBuilder() -> (String, String) -> AppSyncRealTimeRequestAuth.ApiKey { +private func authHeaderBuilder() -> (String, String) -> AppSyncRealTimeRequestAuth.ApiKey { let formatter = DateFormatter() formatter.timeZone = TimeZone(secondsFromGMT: 0) formatter.locale = Locale(identifier: "en_US_POSIX") diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/SubscriptionInterceptor/AuthTokenInterceptor.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/SubscriptionInterceptor/AuthTokenInterceptor.swift index b0f19ffd78..61beb9a0ea 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/SubscriptionInterceptor/AuthTokenInterceptor.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/SubscriptionInterceptor/AuthTokenInterceptor.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify +import Foundation @_spi(WebSocket) import AWSPluginsCore /// General purpose authenticatication subscriptions interceptor for providers whose only @@ -33,7 +33,7 @@ class AuthTokenInterceptor { // the authorization check, which ends up being propagated back to the caller // as a "bad request". Example of bad requests are when the header and payload // query strings are missing or when the data is not base64 encoded. - (try? await getLatestAuthToken()) ?? "" + await (try? getLatestAuthToken()) ?? "" } } diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/SubscriptionInterceptor/IAMAuthInterceptor.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/SubscriptionInterceptor/IAMAuthInterceptor.swift index cd023676c7..617e7b5f6e 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/SubscriptionInterceptor/IAMAuthInterceptor.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/SubscriptionInterceptor/IAMAuthInterceptor.swift @@ -5,12 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation -@_spi(WebSocket) import AWSPluginsCore -import InternalAmplifyCredentials import Amplify import AWSClientRuntime +import Foundation +@_spi(WebSocket) import AWSPluginsCore import ClientRuntime +import InternalAmplifyCredentials class IAMAuthInterceptor { @@ -50,11 +50,13 @@ class IAMAuthInterceptor { /// 2. The request is SigV4 signed by using all the available headers on the request. By signing the request, the signature is added to /// the request headers as authorization and security token. do { - guard let urlRequest = try await signer.sigV4SignedRequest(requestBuilder: requestBuilder, - credentialsProvider: authProvider, - signingName: "appsync", - signingRegion: region, - date: Date()) else { + guard let urlRequest = try await signer.sigV4SignedRequest( + requestBuilder: requestBuilder, + credentialsProvider: authProvider, + signingName: "appsync", + signingRegion: region, + date: Date() + ) else { Amplify.Logging.error("Unable to sign request") return nil } @@ -93,7 +95,7 @@ extension IAMAuthInterceptor: WebSocketInterceptor { guard let authHeader = await getAuthHeader(connectUrl, with: "{}") else { return connectUrl } - + return AppSyncRealTimeRequestAuth.URLQuery( header: .iam(authHeader) ).withBaseURL(url) @@ -111,7 +113,8 @@ extension IAMAuthInterceptor: AppSyncRequestInterceptor { let authHeader = await getAuthHeader( AppSyncRealTimeClientFactory.appSyncApiEndpoint(url), - with: request.data) + with: request.data + ) return .start(.init( id: request.id, data: request.data, diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/APIOperationResponse.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/APIOperationResponse.swift index 0e750a66b1..709e6d4898 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/APIOperationResponse.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/APIOperationResponse.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify +import Foundation struct APIOperationResponse { let urlError: URLError? diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSAPIOperation+APIOperation.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSAPIOperation+APIOperation.swift index 99e67ac46b..4ca3693e40 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSAPIOperation+APIOperation.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSAPIOperation+APIOperation.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify +import Foundation extension AWSRESTOperation: APIOperation { func getOperationId() -> UUID { diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLOperation+APIOperation.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLOperation+APIOperation.swift index 97cd297bee..ba48c86493 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLOperation+APIOperation.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLOperation+APIOperation.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify +import Foundation extension AWSGraphQLOperation: APIOperation { func getOperationId() -> UUID { diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLOperation.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLOperation.swift index b3a61608fb..4d39b2e001 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLOperation.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLOperation.swift @@ -9,28 +9,32 @@ import Amplify import AWSPluginsCore import Foundation -final public class AWSGraphQLOperation: GraphQLOperation { +public final class AWSGraphQLOperation: GraphQLOperation { let session: URLSessionBehavior let mapper: OperationTaskMapper let pluginConfig: AWSAPICategoryPluginConfiguration let graphQLResponseDecoder: GraphQLResponseDecoder - init(request: GraphQLOperationRequest, - session: URLSessionBehavior, - mapper: OperationTaskMapper, - pluginConfig: AWSAPICategoryPluginConfiguration, - resultListener: AWSGraphQLOperation.ResultListener?) { + init( + request: GraphQLOperationRequest, + session: URLSessionBehavior, + mapper: OperationTaskMapper, + pluginConfig: AWSAPICategoryPluginConfiguration, + resultListener: AWSGraphQLOperation.ResultListener? + ) { self.session = session self.mapper = mapper self.pluginConfig = pluginConfig self.graphQLResponseDecoder = GraphQLResponseDecoder(request: request) - super.init(categoryType: .api, - eventName: request.operationType.hubEventName, - request: request, - resultListener: resultListener) + super.init( + categoryType: .api, + eventName: request.operationType.hubEventName, + request: request, + resultListener: resultListener + ) } override public func main() { @@ -119,17 +123,21 @@ final public class AWSGraphQLOperation: GraphQLOperation { private func getRequestPayload(from request: GraphQLOperationRequest) -> Result { // Prepare request payload - let queryDocument = GraphQLOperationRequestUtils.getQueryDocument(document: request.document, - variables: request.variables) + let queryDocument = GraphQLOperationRequestUtils.getQueryDocument( + document: request.document, + variables: request.variables + ) if Amplify.API.log.logLevel == .verbose, - let serializedJSON = try? JSONSerialization.data(withJSONObject: queryDocument, - options: .prettyPrinted), + let serializedJSON = try? JSONSerialization.data( + withJSONObject: queryDocument, + options: .prettyPrinted + ), let prettyPrintedQueryDocument = String(data: serializedJSON, encoding: .utf8) { Amplify.API.log.verbose("\(prettyPrintedQueryDocument)") } do { - return .success(try JSONSerialization.data(withJSONObject: queryDocument)) + return try .success(JSONSerialization.data(withJSONObject: queryDocument)) } catch { return .failure(APIError.operationError( "Failed to serialize query document", @@ -141,7 +149,7 @@ final public class AWSGraphQLOperation: GraphQLOperation { private func getEndpointConfig(from request: GraphQLOperationRequest) -> Result { do { - return .success(try pluginConfig.endpoints.getConfig(for: request.apiName, endpointType: .graphQL)) + return try .success(pluginConfig.endpoints.getConfig(for: request.apiName, endpointType: .graphQL)) } catch let error as APIError { return .failure(error) @@ -155,12 +163,12 @@ final public class AWSGraphQLOperation: GraphQLOperation { do { if let pluginOptions = request.options.pluginOptions as? AWSAPIPluginDataStoreOptions, let authType = pluginOptions.authType { - return .success(try pluginConfig.interceptorsForEndpoint( + return try .success(pluginConfig.interceptorsForEndpoint( withConfig: endpointConfig, authType: authType )) } else if let authType = request.authMode as? AWSAuthorizationType { - return .success(try pluginConfig.interceptorsForEndpoint( + return try .success(pluginConfig.interceptorsForEndpoint( withConfig: endpointConfig, authType: authType )) @@ -177,7 +185,7 @@ final public class AWSGraphQLOperation: GraphQLOperation { private func applyInterceptor(_ interceptor: URLRequestInterceptor, request: URLRequest) async -> Result { do { - return .success(try await interceptor.intercept(request)) + return try await .success(interceptor.intercept(request)) } catch let error as APIError { return .failure(error) } catch { diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLSubscriptionTaskRunner.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLSubscriptionTaskRunner.swift index 3ee8e9856f..421808869f 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLSubscriptionTaskRunner.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLSubscriptionTaskRunner.swift @@ -8,8 +8,8 @@ import Amplify import Foundation @_spi(WebSocket) import AWSPluginsCore -import InternalAmplifyCredentials import Combine +import InternalAmplifyCredentials public class AWSGraphQLSubscriptionTaskRunner: InternalTaskRunner, InternalTaskAsyncThrowingSequence, InternalTaskThrowingChannel { @@ -22,7 +22,7 @@ public class AWSGraphQLSubscriptionTaskRunner: InternalTaskRunner, var appSyncClient: AppSyncRealTimeClientProtocol? var subscription: AnyCancellable? { willSet { - self.subscription?.cancel() + subscription?.cancel() } } let appSyncClientFactory: AppSyncRealTimeClientFactoryProtocol @@ -34,11 +34,13 @@ public class AWSGraphQLSubscriptionTaskRunner: InternalTaskRunner, private var running = false - init(request: Request, - pluginConfig: AWSAPICategoryPluginConfiguration, - appSyncClientFactory: AppSyncRealTimeClientFactoryProtocol, - authService: AWSAuthCredentialsProviderBehavior, - apiAuthProviderFactory: APIAuthProviderFactory) { + init( + request: Request, + pluginConfig: AWSAPICategoryPluginConfiguration, + appSyncClientFactory: AppSyncRealTimeClientFactoryProtocol, + authService: AWSAuthCredentialsProviderBehavior, + apiAuthProviderFactory: APIAuthProviderFactory + ) { self.request = request self.pluginConfig = pluginConfig self.appSyncClientFactory = appSyncClientFactory @@ -50,7 +52,7 @@ public class AWSGraphQLSubscriptionTaskRunner: InternalTaskRunner, /// In this situation, we need to send the disconnected event because /// the top-level AmplifyThrowingSequence is terminated immediately upon cancellation. public func cancel() { - self.send(GraphQLSubscriptionEvent.connection(.disconnected)) + send(GraphQLSubscriptionEvent.connection(.disconnected)) Task { guard let appSyncClient = self.appSyncClient else { return @@ -93,17 +95,16 @@ public class AWSGraphQLSubscriptionTaskRunner: InternalTaskRunner, return } - let authType: AWSAuthorizationType? - if let pluginOptions = request.options.pluginOptions as? AWSAPIPluginDataStoreOptions { - authType = pluginOptions.authType + let authType: AWSAuthorizationType? = if let pluginOptions = request.options.pluginOptions as? AWSAPIPluginDataStoreOptions { + pluginOptions.authType } else if let authorizationMode = request.authMode as? AWSAuthorizationType { - authType = authorizationMode + authorizationMode } else { - authType = nil + nil } // Retrieve the subscription connection do { - self.appSyncClient = try await appSyncClientFactory.getAppSyncRealTimeClient( + appSyncClient = try await appSyncClientFactory.getAppSyncRealTimeClient( for: endpointConfig, endpoint: endpointConfig.baseURL, authService: authService, @@ -112,7 +113,7 @@ public class AWSGraphQLSubscriptionTaskRunner: InternalTaskRunner, ) // Create subscription - self.subscription = try await appSyncClient?.subscribe( + subscription = try await appSyncClient?.subscribe( id: subscriptionId, query: encodeRequest(query: request.document, variables: request.variables) ).sink(receiveValue: { [weak self] event in @@ -183,7 +184,7 @@ public class AWSGraphQLSubscriptionTaskRunner: InternalTaskRunner, } // Class is still necessary. See https://github.com/aws-amplify/amplify-swift/issues/2252 -final public class AWSGraphQLSubscriptionOperation: GraphQLSubscriptionOperation { +public final class AWSGraphQLSubscriptionOperation: GraphQLSubscriptionOperation { let pluginConfig: AWSAPICategoryPluginConfiguration let appSyncRealTimeClientFactory: AppSyncRealTimeClientFactoryProtocol @@ -193,31 +194,35 @@ final public class AWSGraphQLSubscriptionOperation: GraphQLSubscri var appSyncRealTimeClient: AppSyncRealTimeClientProtocol? var subscription: AnyCancellable? { willSet { - self.subscription?.cancel() + subscription?.cancel() } } var apiAuthProviderFactory: APIAuthProviderFactory private let subscriptionId = UUID().uuidString - init(request: GraphQLOperationRequest, - pluginConfig: AWSAPICategoryPluginConfiguration, - appSyncRealTimeClientFactory: AppSyncRealTimeClientFactoryProtocol, - authService: AWSAuthCredentialsProviderBehavior, - apiAuthProviderFactory: APIAuthProviderFactory, - inProcessListener: AWSGraphQLSubscriptionOperation.InProcessListener?, - resultListener: AWSGraphQLSubscriptionOperation.ResultListener?) { + init( + request: GraphQLOperationRequest, + pluginConfig: AWSAPICategoryPluginConfiguration, + appSyncRealTimeClientFactory: AppSyncRealTimeClientFactoryProtocol, + authService: AWSAuthCredentialsProviderBehavior, + apiAuthProviderFactory: APIAuthProviderFactory, + inProcessListener: AWSGraphQLSubscriptionOperation.InProcessListener?, + resultListener: AWSGraphQLSubscriptionOperation.ResultListener? + ) { self.pluginConfig = pluginConfig self.appSyncRealTimeClientFactory = appSyncRealTimeClientFactory self.authService = authService self.apiAuthProviderFactory = apiAuthProviderFactory - super.init(categoryType: .api, - eventName: HubPayload.EventName.API.subscribe, - request: request, - inProcessListener: inProcessListener, - resultListener: resultListener) + super.init( + categoryType: .api, + eventName: HubPayload.EventName.API.subscribe, + request: request, + inProcessListener: inProcessListener, + resultListener: resultListener + ) } override public func cancel() { @@ -271,13 +276,12 @@ final public class AWSGraphQLSubscriptionOperation: GraphQLSubscri return } - let authType: AWSAuthorizationType? - if let pluginOptions = request.options.pluginOptions as? AWSAPIPluginDataStoreOptions { - authType = pluginOptions.authType + let authType: AWSAuthorizationType? = if let pluginOptions = request.options.pluginOptions as? AWSAPIPluginDataStoreOptions { + pluginOptions.authType } else if let authorizationMode = request.authMode as? AWSAuthorizationType { - authType = authorizationMode + authorizationMode } else { - authType = nil + nil } Task { do { @@ -367,7 +371,7 @@ final public class AWSGraphQLSubscriptionOperation: GraphQLSubscri } } -fileprivate func encodeRequest(query: String, variables: [String: Any]?) -> String { +private func encodeRequest(query: String, variables: [String: Any]?) -> String { var json: [String: Any] = [ "query": query ] @@ -377,18 +381,18 @@ fileprivate func encodeRequest(query: String, variables: [String: Any]?) -> Stri } do { - return String(data: try JSONSerialization.data(withJSONObject: json), encoding: .utf8)! + return try String(data: JSONSerialization.data(withJSONObject: json), encoding: .utf8)! } catch { return "" } } -fileprivate func toAPIError(_ errors: [Error], type: R.Type) -> APIError { +private func toAPIError(_ errors: [Error], type: R.Type) -> APIError { func errorDescription(_ hasAuthorizationError: Bool = false) -> String { "Subscription item event failed with error" + (hasAuthorizationError ? ": \(APIError.UnauthorizedMessageString)" : "") } - + switch errors { case let errors as [AppSyncRealTimeRequest.Error]: let hasAuthorizationError = errors.contains(where: { $0 == .unauthorized}) diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSHTTPURLResponse.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSHTTPURLResponse.swift index bb4a87396d..250be888c6 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSHTTPURLResponse.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSHTTPURLResponse.swift @@ -37,10 +37,12 @@ public class AWSHTTPURLResponse: HTTPURLResponse { // Call the super class initializer with dummy values to satisfy the requirement of the inheritance. // Subsequent access to any properties of this instance (including `url`) will be delegated to // the `response`. - super.init(url: URL(string: "dummyURL")!, - statusCode: 0, - httpVersion: nil, - headerFields: nil) + super.init( + url: URL(string: "dummyURL")!, + statusCode: 0, + httpVersion: nil, + headerFields: nil + ) } required init?(coder: NSCoder) { @@ -49,45 +51,45 @@ public class AWSHTTPURLResponse: HTTPURLResponse { super.init(coder: coder) } - public override class var supportsSecureCoding: Bool { + override public class var supportsSecureCoding: Bool { return true } - public override func encode(with coder: NSCoder) { + override public func encode(with coder: NSCoder) { coder.encode(body, forKey: "body") coder.encode(response, forKey: "response") super.encode(with: coder) } - public override var url: URL? { + override public var url: URL? { response.url } - public override var mimeType: String? { + override public var mimeType: String? { response.mimeType } - public override var expectedContentLength: Int64 { + override public var expectedContentLength: Int64 { response.expectedContentLength } - public override var textEncodingName: String? { + override public var textEncodingName: String? { response.textEncodingName } - public override var suggestedFilename: String? { + override public var suggestedFilename: String? { response.suggestedFilename } - public override var statusCode: Int { + override public var statusCode: Int { response.statusCode } - public override var allHeaderFields: [AnyHashable: Any] { + override public var allHeaderFields: [AnyHashable: Any] { response.allHeaderFields } - public override func value(forHTTPHeaderField field: String) -> String? { + override public func value(forHTTPHeaderField field: String) -> String? { response.value(forHTTPHeaderField: field) } } diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSRESTOperation.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSRESTOperation.swift index 3680b22728..e431d9b495 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSRESTOperation.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSRESTOperation.swift @@ -8,7 +8,7 @@ import Amplify import Foundation -final public class AWSRESTOperation: AmplifyOperation< +public final class AWSRESTOperation: AmplifyOperation< RESTOperationRequest, Data, APIError @@ -21,20 +21,24 @@ final public class AWSRESTOperation: AmplifyOperation< var mapper: OperationTaskMapper let pluginConfig: AWSAPICategoryPluginConfiguration - init(request: RESTOperationRequest, - session: URLSessionBehavior, - mapper: OperationTaskMapper, - pluginConfig: AWSAPICategoryPluginConfiguration, - resultListener: AWSRESTOperation.ResultListener?) { + init( + request: RESTOperationRequest, + session: URLSessionBehavior, + mapper: OperationTaskMapper, + pluginConfig: AWSAPICategoryPluginConfiguration, + resultListener: AWSRESTOperation.ResultListener? + ) { self.session = session self.mapper = mapper self.pluginConfig = pluginConfig - super.init(categoryType: .api, - eventName: request.operationType.hubEventName, - request: request, - resultListener: resultListener) + super.init( + categoryType: .api, + eventName: request.operationType.hubEventName, + request: request, + resultListener: resultListener + ) } @@ -123,7 +127,7 @@ final public class AWSRESTOperation: AmplifyOperation< from request: RESTOperationRequest ) -> Result { do { - return .success(try pluginConfig.endpoints.getConfig(for: request.apiName, endpointType: .rest)) + return try .success(pluginConfig.endpoints.getConfig(for: request.apiName, endpointType: .rest)) } catch let error as APIError { return .failure(error) } catch { @@ -154,7 +158,7 @@ final public class AWSRESTOperation: AmplifyOperation< private func applyInterceptor(_ interceptor: URLRequestInterceptor, request: URLRequest) async -> Result { do { - return .success(try await interceptor.intercept(request)) + return try await .success(interceptor.intercept(request)) } catch let error as APIError { return .failure(error) } catch { diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Reachability/AmplifyReachability.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Reachability/AmplifyReachability.swift index 9045d31e03..fc7fbef2b3 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Reachability/AmplifyReachability.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Reachability/AmplifyReachability.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + #if !os(watchOS) // swiftformat:disable fileHeader /* @@ -27,10 +34,11 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import Foundation + // This code was taken from the 5.0.0 release // Commit SHA1: 98e968e7b6c1318fb61df23e347bc319761e8acb import SystemConfiguration -import Foundation public enum AmplifyReachabilityError: Error { case failedToCreateWithAddress(sockaddr, Int32) @@ -88,7 +96,7 @@ public class AmplifyReachability { public var allowsCellularConnection: Bool // The notification center on which "reachability changed" events are being posted - public var notificationCenter: NotificationCenter = NotificationCenter.default + public var notificationCenter: NotificationCenter = .default @available(*, deprecated, renamed: "connection.description") public var currentReachabilityString: String { @@ -132,29 +140,35 @@ public class AmplifyReachability { } } - required public init(reachabilityRef: SCNetworkReachability, - queueQoS: DispatchQoS = .default, - targetQueue: DispatchQueue? = nil, - notificationQueue: DispatchQueue? = .main) { + public required init( + reachabilityRef: SCNetworkReachability, + queueQoS: DispatchQoS = .default, + targetQueue: DispatchQueue? = nil, + notificationQueue: DispatchQueue? = .main + ) { self.allowsCellularConnection = true self.reachabilityRef = reachabilityRef self.reachabilitySerialQueue = DispatchQueue(label: "uk.co.ashleymills.reachability", qos: queueQoS, target: targetQueue) self.notificationQueue = notificationQueue } - public convenience init(hostname: String, - queueQoS: DispatchQoS = .default, - targetQueue: DispatchQueue? = nil, - notificationQueue: DispatchQueue? = .main) throws { + public convenience init( + hostname: String, + queueQoS: DispatchQoS = .default, + targetQueue: DispatchQueue? = nil, + notificationQueue: DispatchQueue? = .main + ) throws { guard let ref = SCNetworkReachabilityCreateWithName(nil, hostname) else { throw AmplifyReachabilityError.failedToCreateWithHostname(hostname, SCError()) } self.init(reachabilityRef: ref, queueQoS: queueQoS, targetQueue: targetQueue, notificationQueue: notificationQueue) } - public convenience init(queueQoS: DispatchQoS = .default, - targetQueue: DispatchQueue? = nil, - notificationQueue: DispatchQueue? = .main) throws { + public convenience init( + queueQoS: DispatchQoS = .default, + targetQueue: DispatchQueue? = nil, + notificationQueue: DispatchQueue? = .main + ) throws { var zeroAddress = sockaddr() zeroAddress.sa_len = UInt8(MemoryLayout.size) zeroAddress.sa_family = sa_family_t(AF_INET) @@ -178,7 +192,7 @@ public extension AmplifyReachability { guard !notifierRunning else { return } let callback: SCNetworkReachabilityCallBack = { _, flags, info in - guard let info = info else { return } + guard let info else { return } // `weakifiedReachability` is guaranteed to exist by virtue of our // retain/release callbacks which we provided to the `SCNetworkReachabilityContext`. @@ -200,7 +214,7 @@ public extension AmplifyReachability { _ = unmanagedWeakifiedReachability.retain() return UnsafeRawPointer(unmanagedWeakifiedReachability.toOpaque()) }, - release: { (info: UnsafeRawPointer) -> Void in + release: { (info: UnsafeRawPointer) in let unmanagedWeakifiedReachability = Unmanaged.fromOpaque(info) unmanagedWeakifiedReachability.release() }, @@ -262,8 +276,8 @@ private extension AmplifyReachability { func setReachabilityFlags() throws { try reachabilitySerialQueue.sync { [unowned self] in var flags = SCNetworkReachabilityFlags() - if !SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags) { - self.stopNotifier() + if !SCNetworkReachabilityGetFlags(reachabilityRef, &flags) { + stopNotifier() throw AmplifyReachabilityError.unableToGetFlags(SCError()) } @@ -273,9 +287,9 @@ private extension AmplifyReachability { func notifyReachabilityChanged() { let notify = { [weak self] in - guard let self = self else { return } - self.connection != .unavailable ? self.whenReachable?(self) : self.whenUnreachable?(self) - self.notificationCenter.post(name: .reachabilityChanged, object: self) + guard let self else { return } + connection != .unavailable ? whenReachable?(self) : whenUnreachable?(self) + notificationCenter.post(name: .reachabilityChanged, object: self) } // notify on the configured `notificationQueue`, or the caller's (i.e. `reachabilitySerialQueue`) diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Reachability/AmplifyRechability+watchOS.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Reachability/AmplifyRechability+watchOS.swift index c5bf5e5dc9..51915742f7 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Reachability/AmplifyRechability+watchOS.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Reachability/AmplifyRechability+watchOS.swift @@ -22,7 +22,7 @@ public class AmplifyReachability { public var allowsCellularConnection: Bool // The notification center on which "reachability changed" events are being posted - public var notificationCenter: NotificationCenter = NotificationCenter.default + public var notificationCenter: NotificationCenter = .default public var connection: AmplifyReachability.Connection { guard networkReachability.currentPath.status != .unsatisfied else { @@ -82,8 +82,8 @@ public class AmplifyReachability { public func startNotifier() throws { guard networkReachability.pathUpdateHandler == nil else { return } networkReachability.pathUpdateHandler = { [weak self] _ in - guard let self = self else { return } - self.notificationQueue.async { + guard let self else { return } + notificationQueue.async { self.notificationCenter.post(name: .reachabilityChanged, object: self) } } @@ -94,8 +94,8 @@ public class AmplifyReachability { } } -extension AmplifyReachability { - public enum Connection: CustomStringConvertible { +public extension AmplifyReachability { + enum Connection: CustomStringConvertible { @available(*, deprecated, renamed: "unavailable") case none case unavailable, wifi, cellular diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Reachability/NetworkReachabilityNotifier.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Reachability/NetworkReachabilityNotifier.swift index 5a6b0212fa..d814ca9236 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Reachability/NetworkReachabilityNotifier.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Reachability/NetworkReachabilityNotifier.swift @@ -6,8 +6,8 @@ // import Amplify -import Foundation import Combine +import Foundation class NetworkReachabilityNotifier { private var reachability: NetworkReachabilityProviding? @@ -19,9 +19,11 @@ class NetworkReachabilityNotifier { return reachabilityPublisher.eraseToAnyPublisher() } - public init(host: String, - allowsCellularAccess: Bool, - reachabilityFactory: NetworkReachabilityProvidingFactory.Type) throws { + public init( + host: String, + allowsCellularAccess: Bool, + reachabilityFactory: NetworkReachabilityProvidingFactory.Type + ) throws { #if os(watchOS) self.reachability = reachabilityFactory.make() #else @@ -30,10 +32,12 @@ class NetworkReachabilityNotifier { self.allowsCellularAccess = allowsCellularAccess // Add listener for Reachability and start its notifier - NotificationCenter.default.addObserver(self, - selector: #selector(respondToReachabilityChange), - name: .reachabilityChanged, - object: nil) + NotificationCenter.default.addObserver( + self, + selector: #selector(respondToReachabilityChange), + name: .reachabilityChanged, + object: nil + ) do { try reachability?.startNotifier() } catch { @@ -49,18 +53,17 @@ class NetworkReachabilityNotifier { // MARK: - Notifications @objc private func respondToReachabilityChange() { - guard let reachability = reachability else { + guard let reachability else { return } - let isReachable: Bool - switch reachability.connection { + let isReachable: Bool = switch reachability.connection { case .wifi: - isReachable = true + true case .cellular: - isReachable = allowsCellularAccess + allowsCellularAccess case .none, .unavailable: - isReachable = false + false } let reachabilityMessageUpdate = ReachabilityUpdate(isOnline: isReachable) diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/SubscriptionFactory/AWSOIDCAuthProvider.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/SubscriptionFactory/AWSOIDCAuthProvider.swift index 1887aa1b06..f062dc9594 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/SubscriptionFactory/AWSOIDCAuthProvider.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/SubscriptionFactory/AWSOIDCAuthProvider.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import AWSPluginsCore +import Foundation class AWSOIDCAuthProvider { diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/SubscriptionFactory/AppSyncRealTimeClientFactory.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/SubscriptionFactory/AppSyncRealTimeClientFactory.swift index 57a3708e1e..363c217429 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/SubscriptionFactory/AppSyncRealTimeClientFactory.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/SubscriptionFactory/AppSyncRealTimeClientFactory.swift @@ -5,10 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // - -import Foundation import Amplify import Combine +import Foundation import InternalAmplifyCredentials @_spi(WebSocket) import AWSPluginsCore @@ -47,8 +46,8 @@ actor AppSyncRealTimeClientFactory: AppSyncRealTimeClientFactoryProtocol { ) throws -> AppSyncRealTimeClientProtocol { let apiName = endpointConfig.name - let authInterceptor = try self.getInterceptor( - for: self.getOrCreateAuthConfiguration(from: endpointConfig, authType: authType), + let authInterceptor = try getInterceptor( + for: getOrCreateAuthConfiguration(from: endpointConfig, authType: authType), authService: authService, apiAuthProviderFactory: apiAuthProviderFactory ) @@ -82,7 +81,7 @@ actor AppSyncRealTimeClientFactory: AppSyncRealTimeClientFactoryProtocol { authType: AWSAuthorizationType? ) throws -> AWSAuthorizationConfiguration { // create a configuration if there's an override auth type - if let authType = authType { + if let authType { return try endpointConfig.authorizationConfigurationFor(authType: authType) } @@ -101,20 +100,24 @@ actor AppSyncRealTimeClientFactory: AppSyncRealTimeClientFactoryProtocol { let provider = AWSOIDCAuthProvider(authService: authService) return AuthTokenInterceptor(getLatestAuthToken: provider.getLatestAuthToken) case .awsIAM(let awsIAMConfiguration): - return IAMAuthInterceptor(authService.getCredentialsProvider(), - region: awsIAMConfiguration.region) + return IAMAuthInterceptor( + authService.getCredentialsProvider(), + region: awsIAMConfiguration.region + ) case .openIDConnect: guard let oidcAuthProvider = apiAuthProviderFactory.oidcAuthProvider() else { throw APIError.invalidConfiguration( "Using openIDConnect requires passing in an APIAuthProvider with an OIDC AuthProvider", - "When instantiating AWSAPIPlugin pass in an instance of APIAuthProvider", nil) + "When instantiating AWSAPIPlugin pass in an instance of APIAuthProvider", nil + ) } return AuthTokenInterceptor(getLatestAuthToken: oidcAuthProvider.getLatestAuthToken) case .function: guard let functionAuthProvider = apiAuthProviderFactory.functionAuthProvider() else { throw APIError.invalidConfiguration( "Using function as auth provider requires passing in an APIAuthProvider with a Function AuthProvider", - "When instantiating AWSAPIPlugin pass in an instance of APIAuthProvider", nil) + "When instantiating AWSAPIPlugin pass in an instance of APIAuthProvider", nil + ) } return AuthTokenInterceptor(authTokenProvider: functionAuthProvider) case .none: diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Constants/URLRequestConstants.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Constants/URLRequestConstants.swift index 2cc34b8235..37f3f921ed 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Constants/URLRequestConstants.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Constants/URLRequestConstants.swift @@ -8,11 +8,11 @@ import Foundation // TODO: remove this https://github.com/aws-amplify/amplify-ios/issues/75 -struct URLRequestConstants { +enum URLRequestConstants { static let appSyncServiceName = "appsync" static let apiGatewayServiceName = "execute-api" - struct Header { + enum Header { static let xAmzDate = "X-Amz-Date" static let contentType = "Content-Type" static let userAgent = "User-Agent" @@ -21,7 +21,7 @@ struct URLRequestConstants { static let webSocketSubprotocols = "Sec-WebSocket-Protocol" } - struct ContentType { + enum ContentType { static let applicationJson = "application/json" } } diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Decode/GraphQLErrorDecoder.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Decode/GraphQLErrorDecoder.swift index f6c80c047c..3e3b6a95f6 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Decode/GraphQLErrorDecoder.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Decode/GraphQLErrorDecoder.swift @@ -8,7 +8,7 @@ import Amplify import Foundation -struct GraphQLErrorDecoder { +enum GraphQLErrorDecoder { static func decodeErrors(graphQLErrors: [JSONValue]) throws -> [GraphQLError] { var responseErrors = [GraphQLError]() for error in graphQLErrors { @@ -60,17 +60,19 @@ struct GraphQLErrorDecoder { return graphQLError } - graphQLErrorObject.forEach { key, value in + for (key, value) in graphQLErrorObject { if keys.contains(key) { - return + continue } mergedExtensions[key] = value } - return GraphQLError(message: graphQLError.message, - locations: graphQLError.locations, - path: graphQLError.path, - extensions: mergedExtensions.isEmpty ? nil : mergedExtensions) + return GraphQLError( + message: graphQLError.message, + locations: graphQLError.locations, + path: graphQLError.path, + extensions: mergedExtensions.isEmpty ? nil : mergedExtensions + ) } } diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Decode/GraphQLResponseDecoder+DecodeData.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Decode/GraphQLResponseDecoder+DecodeData.swift index 425a0c46c5..cb195b1b28 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Decode/GraphQLResponseDecoder+DecodeData.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Decode/GraphQLResponseDecoder+DecodeData.swift @@ -14,7 +14,7 @@ extension GraphQLResponseDecoder { /* The sequence of `responseType` checking attempts to decode to specific types before falling back to (5) serializing the data and letting the default decode run its course (6). - + 1. String, special case where the object is serialized as a JSON string. 2. AnyModel, used by DataStore's sync engine 3. ModelListMarker, checks if it is a List type, inject additional information to create a loaded list. @@ -47,31 +47,36 @@ extension GraphQLResponseDecoder { case .object(var graphQLDataObject) = graphQLData, case .array(var graphQLDataArray) = graphQLDataObject["items"] { for (index, item) in graphQLDataArray.enumerated() { - let modelJSON: JSONValue - if let _ = (request.options.pluginOptions as? AWSAPIPluginDataStoreOptions) { - modelJSON = AppSyncModelMetadataUtils.addMetadata( + let modelJSON: JSONValue = if let _ = (request.options.pluginOptions as? AWSAPIPluginDataStoreOptions) { + AppSyncModelMetadataUtils.addMetadata( toModel: item, apiName: request.apiName, authMode: request.authMode as? AWSAuthorizationType, - source: ModelProviderRegistry.DecoderSource.dataStore) + source: ModelProviderRegistry.DecoderSource.dataStore + ) } else { - modelJSON = AppSyncModelMetadataUtils.addMetadata( + AppSyncModelMetadataUtils.addMetadata( toModel: item, apiName: request.apiName, - authMode: request.authMode as? AWSAuthorizationType) + authMode: request.authMode as? AWSAuthorizationType + ) } graphQLDataArray[index] = modelJSON } graphQLDataObject["items"] = JSONValue.array(graphQLDataArray) - let payload = AppSyncListPayload(graphQLData: JSONValue.object(graphQLDataObject), - apiName: request.apiName, - authMode: request.authMode as? AWSAuthorizationType, - variables: try getVariablesJSON()) + let payload = try AppSyncListPayload( + graphQLData: JSONValue.object(graphQLDataObject), + apiName: request.apiName, + authMode: request.authMode as? AWSAuthorizationType, + variables: getVariablesJSON() + ) serializedJSON = try encoder.encode(payload) } else if AppSyncModelMetadataUtils.shouldAddMetadata(toModel: graphQLData) { // 4 - let modelJSON = AppSyncModelMetadataUtils.addMetadata(toModel: graphQLData, - apiName: request.apiName, - authMode: request.authMode as? AWSAuthorizationType) + let modelJSON = AppSyncModelMetadataUtils.addMetadata( + toModel: graphQLData, + apiName: request.apiName, + authMode: request.authMode as? AWSAuthorizationType + ) serializedJSON = try encoder.encode(modelJSON) } else { // 5 serializedJSON = try encoder.encode(graphQLData) diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Decode/GraphQLResponseDecoder.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Decode/GraphQLResponseDecoder.swift index a80a16e4b3..0aa330d50e 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Decode/GraphQLResponseDecoder.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Decode/GraphQLResponseDecoder.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify import AWSPluginsCore +import Foundation class GraphQLResponseDecoder { @@ -45,13 +45,16 @@ class GraphQLResponseDecoder { case .invalidResponse: guard let rawGraphQLResponseString = String(data: response, encoding: .utf8) else { throw APIError.operationError( - "Could not get the String representation of the GraphQL response", "") + "Could not get the String representation of the GraphQL response", "" + ) } - throw APIError.unknown("The service returned some data without any `data` and `errors`", - """ + throw APIError.unknown( + "The service returned some data without any `data` and `errors`", + """ The service did not return an expected GraphQL response: \ \(rawGraphQLResponseString) - """) + """ + ) } } @@ -63,7 +66,8 @@ class GraphQLResponseDecoder { let error = APIError(error: decodingError) guard let rawGraphQLResponseString = String(data: response, encoding: .utf8) else { throw APIError.operationError( - "Could not get the String representation of the GraphQL response", "") + "Could not get the String representation of the GraphQL response", "" + ) } return GraphQLResponse.failure(.transformationError(rawGraphQLResponseString, error)) } catch { @@ -76,8 +80,10 @@ class GraphQLResponseDecoder { return GraphQLResponse.failure(.error(responseErrors)) } - func decodePartial(graphQLData: [String: JSONValue], - graphQLErrors: [JSONValue]) throws -> GraphQLResponse { + func decodePartial( + graphQLData: [String: JSONValue], + graphQLErrors: [JSONValue] + ) throws -> GraphQLResponse { do { if let first = graphQLData.first, case .null = first.value { let responseErrors = try GraphQLErrorDecoder.decodeErrors(graphQLErrors: graphQLErrors) @@ -90,7 +96,8 @@ class GraphQLResponseDecoder { let error = APIError(error: decodingError) guard let rawGraphQLResponseString = String(data: response, encoding: .utf8) else { throw APIError.operationError( - "Could not get the String representation of the GraphQL response", "") + "Could not get the String representation of the GraphQL response", "" + ) } return GraphQLResponse.failure(.transformationError(rawGraphQLResponseString, error)) } catch { diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Internal/AWSAppSyncGraphQLResponse.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Internal/AWSAppSyncGraphQLResponse.swift index dd16b335b1..c0aae13474 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Internal/AWSAppSyncGraphQLResponse.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Internal/AWSAppSyncGraphQLResponse.swift @@ -45,14 +45,18 @@ enum AWSAppSyncGraphQLResponse { decoder.dateDecodingStrategy = ModelDateFormatting.decodingStrategy json = try decoder.decode(JSONValue.self, from: graphQLResponse) } catch { - throw APIError.operationError("Could not decode to JSONValue from the GraphQL Response", - "Service issue", - error) + throw APIError.operationError( + "Could not decode to JSONValue from the GraphQL Response", + "Service issue", + error + ) } guard case .object(let jsonObject) = json else { - throw APIError.unknown("The GraphQL response is not an object", - "The AppSync service returned a malformed GraphQL response") + throw APIError.unknown( + "The GraphQL response is not an object", + "The AppSync service returned a malformed GraphQL response" + ) } return jsonObject @@ -64,8 +68,10 @@ enum AWSAppSyncGraphQLResponse { } guard case .array(let errorArray) = errors else { - throw APIError.unknown("The GraphQL response containing errors should be an array", - "The AppSync service returned a malformed GraphQL response") + throw APIError.unknown( + "The GraphQL response containing errors should be an array", + "The AppSync service returned a malformed GraphQL response" + ) } return errorArray @@ -82,8 +88,10 @@ enum AWSAppSyncGraphQLResponse { case .null: return nil default: - throw APIError.unknown("Failed to get object or null from data.", - "The AppSync service returned a malformed GraphQL response") + throw APIError.unknown( + "Failed to get object or null from data.", + "The AppSync service returned a malformed GraphQL response" + ) } } } diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/APIError+DecodingError.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/APIError+DecodingError.swift index 2426474dc4..c63b4751b2 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/APIError+DecodingError.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/APIError+DecodingError.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify +import Foundation // TODO: Extract context and fill out better error handling diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/AnyModel+JSONInit.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/AnyModel+JSONInit.swift index 3578239708..80daef24dd 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/AnyModel+JSONInit.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/AnyModel+JSONInit.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify import AWSPluginsCore +import Foundation extension AnyModel { /// Initializes an AnyModel instance from incoming JSONValue. The JSONValue is expected to be provided by the AWS @@ -27,7 +27,8 @@ extension AnyModel { } guard let underlyingModelData = try? JSONEncoder().encode(modelJSON), - let underlyingModelString = String(data: underlyingModelData, encoding: .utf8) else { + let underlyingModelString = String(data: underlyingModelData, encoding: .utf8) + else { throw APIError.operationError( "Could not convert model data to string", """ @@ -42,9 +43,11 @@ extension AnyModel { let decoder = JSONDecoder() decoder.dateDecodingStrategy = ModelDateFormatting.decodingStrategy - let model = try ModelRegistry.decode(modelName: typename, - from: underlyingModelString, - jsonDecoder: decoder) + let model = try ModelRegistry.decode( + modelName: typename, + from: underlyingModelString, + jsonDecoder: decoder + ) self.init(model) } diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/Array+Error+TypeCast.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/Array+Error+TypeCast.swift index 3592791dc2..703b5d7ea7 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/Array+Error+TypeCast.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/Array+Error+TypeCast.swift @@ -5,13 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 // - import Foundation @_spi(AmplifyAPI) -extension Array where Element == Error { +extension [Error] { func cast(to type: T.Type) -> [T]? { - self.reduce([]) { partialResult, ele in + reduce([]) { partialResult, ele in if let partialResult, let ele = ele as? T { return partialResult + [ele] } diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/GraphQLOperationRequest+Validate.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/GraphQLOperationRequest+Validate.swift index 1faa65afde..b110375135 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/GraphQLOperationRequest+Validate.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/GraphQLOperationRequest+Validate.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify +import Foundation extension GraphQLOperationRequest { // Performs client side validation and returns a `APIError` for any validation failures diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/GraphQLOperationRequestUtils+Validator.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/GraphQLOperationRequestUtils+Validator.swift index b8e1a6ae65..e8266c1403 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/GraphQLOperationRequestUtils+Validator.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/GraphQLOperationRequestUtils+Validator.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify +import Foundation extension GraphQLOperationRequestUtils { @@ -17,7 +17,7 @@ extension GraphQLOperationRequestUtils { } static func validateVariables(_ variables: [String: Any]?) throws { - if let variables = variables { + if let variables { if !JSONSerialization.isValidJSONObject(variables) { throw APIError.operationError("Variables is a not a valid JSON object", "") diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/GraphQLOperationRequestUtils.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/GraphQLOperationRequestUtils.swift index 80e7bc74df..88e49368c0 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/GraphQLOperationRequestUtils.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/GraphQLOperationRequestUtils.swift @@ -12,7 +12,7 @@ class GraphQLOperationRequestUtils { // Get the graphQL request payload from the query document and variables static func getQueryDocument(document: String, variables: [String: Any]?) -> [String: Any] { var queryDocument = ["query": document] as [String: Any] - if let variables = variables { + if let variables { queryDocument["variables"] = variables } diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/GraphQLRequest+toListQuery.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/GraphQLRequest+toListQuery.swift index d023097d9d..cdcf856acf 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/GraphQLRequest+toListQuery.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/GraphQLRequest+toListQuery.swift @@ -11,45 +11,57 @@ import AWSPluginsCore extension GraphQLRequest { /// Retrieve a GraphQL List operation request - static func listQuery(responseType: ResponseType.Type, - modelSchema: ModelSchema, - filter: [String: Any]? = nil, - limit: Int? = nil, - nextToken: String? = nil, - apiName: String? = nil, - authMode: AWSAuthorizationType?) -> GraphQLRequest { - var documentBuilder = ModelBasedGraphQLDocumentBuilder(modelSchema: modelSchema, - operationType: .query) + static func listQuery( + responseType: ResponseType.Type, + modelSchema: ModelSchema, + filter: [String: Any]? = nil, + limit: Int? = nil, + nextToken: String? = nil, + apiName: String? = nil, + authMode: AWSAuthorizationType? + ) -> GraphQLRequest { + var documentBuilder = ModelBasedGraphQLDocumentBuilder( + modelSchema: modelSchema, + operationType: .query + ) documentBuilder.add(decorator: DirectiveNameDecorator(type: .list)) - if let filter = filter { + if let filter { documentBuilder.add(decorator: FilterDecorator(filter: filter)) } documentBuilder.add(decorator: PaginationDecorator(limit: limit, nextToken: nextToken)) let document = documentBuilder.build() - return GraphQLRequest(apiName: apiName, - document: document.stringValue, - variables: document.variables, - responseType: responseType.self, - decodePath: document.name, - authMode: authMode) + return GraphQLRequest( + apiName: apiName, + document: document.stringValue, + variables: document.variables, + responseType: responseType.self, + decodePath: document.name, + authMode: authMode + ) } - static func getRequest(_ modelType: M.Type, - byIdentifiers identifiers: [LazyReferenceIdentifier], - apiName: String?, - authMode: AWSAuthorizationType?) -> GraphQLRequest { - var documentBuilder = ModelBasedGraphQLDocumentBuilder(modelSchema: modelType.schema, - operationType: .query) + static func getRequest( + _ modelType: M.Type, + byIdentifiers identifiers: [LazyReferenceIdentifier], + apiName: String?, + authMode: AWSAuthorizationType? + ) -> GraphQLRequest { + var documentBuilder = ModelBasedGraphQLDocumentBuilder( + modelSchema: modelType.schema, + operationType: .query + ) documentBuilder.add(decorator: DirectiveNameDecorator(type: .get)) documentBuilder.add(decorator: ModelIdDecorator(identifiers: identifiers)) let document = documentBuilder.build() - return GraphQLRequest(apiName: apiName, - document: document.stringValue, - variables: document.variables, - responseType: M?.self, - decodePath: document.name, - authMode: authMode) + return GraphQLRequest( + apiName: apiName, + document: document.stringValue, + variables: document.variables, + responseType: M?.self, + decodePath: document.name, + authMode: authMode + ) } } diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/GraphQLRequest+toOperationRequest.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/GraphQLRequest+toOperationRequest.swift index ba518bbe6e..a6d24d7961 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/GraphQLRequest+toOperationRequest.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/GraphQLRequest+toOperationRequest.swift @@ -10,13 +10,15 @@ import Amplify extension GraphQLRequest { func toOperationRequest(operationType: GraphQLOperationType) -> GraphQLOperationRequest { let requestOptions = GraphQLOperationRequest.Options(pluginOptions: options?.pluginOptions) - return GraphQLOperationRequest(apiName: apiName, - operationType: operationType, - document: document, - variables: variables, - responseType: responseType, - decodePath: decodePath, - authMode: authMode, - options: requestOptions) + return GraphQLOperationRequest( + apiName: apiName, + operationType: operationType, + document: document, + variables: variables, + responseType: responseType, + decodePath: decodePath, + authMode: authMode, + options: requestOptions + ) } } diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/RESTOperationRequest+RESTRequest.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/RESTOperationRequest+RESTRequest.swift index 40f99d7dc4..947ebbcdc1 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/RESTOperationRequest+RESTRequest.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/RESTOperationRequest+RESTRequest.swift @@ -9,12 +9,14 @@ import Amplify extension RESTOperationRequest { init(request: RESTRequest, operationType: RESTOperationType) { - self = RESTOperationRequest(apiName: request.apiName, - operationType: operationType, - path: request.path, - headers: request.headers, - queryParameters: request.queryParameters, - body: request.body, - options: RESTOperationRequest.Options()) + self = RESTOperationRequest( + apiName: request.apiName, + operationType: operationType, + path: request.path, + headers: request.headers, + queryParameters: request.queryParameters, + body: request.body, + options: RESTOperationRequest.Options() + ) } } diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/RESTOperationRequest+Validate.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/RESTOperationRequest+Validate.swift index 570e4c7d88..27185229fe 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/RESTOperationRequest+Validate.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/RESTOperationRequest+Validate.swift @@ -5,13 +5,13 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify +import Foundation extension RESTOperationRequest { // Performs client side validation and returns a `APIError` for any validation failures func validate() throws { - if let apiName = apiName { + if let apiName { try RESTOperationRequestUtils.validateApiName(apiName) } } diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/RESTOperationRequestUtils+Validator.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/RESTOperationRequestUtils+Validator.swift index dd56377d91..10736575bb 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/RESTOperationRequestUtils+Validator.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/RESTOperationRequestUtils+Validator.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify +import Foundation extension RESTOperationRequestUtils { diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/RESTOperationRequestUtils.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/RESTOperationRequestUtils.swift index a73f46eaae..7ee535e1bb 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/RESTOperationRequestUtils.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Support/Utils/RESTOperationRequestUtils.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify +import Foundation final class RESTOperationRequestUtils { private init() {} @@ -29,11 +29,11 @@ final class RESTOperationRequestUtils { ) } - if let path = path { + if let path { components.path.append(path) } - if let queryParameters = queryParameters { + if let queryParameters { components.queryItems = try prepareQueryParamsForSigning(params: queryParameters) } diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/URLSessionBehavior/OperationTaskMapper.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/URLSessionBehavior/OperationTaskMapper.swift index b649290614..00266cfccd 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/URLSessionBehavior/OperationTaskMapper.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/URLSessionBehavior/OperationTaskMapper.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify +import Foundation /// Maps operations, which conform to `APIOperation`, to URLSessionTaskBehaviors and /// provides convenience methods for accessing them @@ -79,11 +79,11 @@ class OperationTaskMapper { /// Not inherently thread safe--this must be called from `concurrencyQueue` private func removePair(operationId: UUID?, taskId: Int?) { dispatchPrecondition(condition: .onQueue(Self.concurrencyQueue)) - if let operationId = operationId { + if let operationId { operations[operationId] = nil taskIdsByOperationId[operationId] = nil } - if let taskId = taskId { + if let taskId { tasks[taskId] = nil operationIdsByTaskId[taskId] = nil } diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/URLSessionBehavior/URLSessionBehaviorDelegate.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/URLSessionBehavior/URLSessionBehaviorDelegate.swift index c8bb175d85..d30027b188 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/URLSessionBehavior/URLSessionBehaviorDelegate.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/URLSessionBehavior/URLSessionBehaviorDelegate.swift @@ -9,13 +9,17 @@ import Foundation /// Defines URLSession behaviors used during fulfillment of API tasks public protocol URLSessionBehaviorDelegate: AnyObject { - func urlSessionBehavior(_ session: URLSessionBehavior, - dataTaskBehavior: URLSessionDataTaskBehavior, - didCompleteWithError error: Error?) + func urlSessionBehavior( + _ session: URLSessionBehavior, + dataTaskBehavior: URLSessionDataTaskBehavior, + didCompleteWithError error: Error? + ) - func urlSessionBehavior(_ session: URLSessionBehavior, - dataTaskBehavior: URLSessionDataTaskBehavior, - didReceive data: Data) + func urlSessionBehavior( + _ session: URLSessionBehavior, + dataTaskBehavior: URLSessionDataTaskBehavior, + didReceive data: Data + ) } diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/URLSessionBehavior/URLSessionFactory.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/URLSessionBehavior/URLSessionFactory.swift index 706f790aa3..1eccd804de 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/URLSessionBehavior/URLSessionFactory.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/URLSessionBehavior/URLSessionFactory.swift @@ -13,9 +13,11 @@ struct URLSessionFactory: URLSessionBehaviorFactory { func makeSession(withDelegate delegate: URLSessionBehaviorDelegate?) -> URLSessionBehavior { let urlSessionDelegate = delegate?.asURLSessionDelegate - let session = URLSession(configuration: configuration, - delegate: urlSessionDelegate, - delegateQueue: delegateQueue) + let session = URLSession( + configuration: configuration, + delegate: urlSessionDelegate, + delegateQueue: delegateQueue + ) return session } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/APIHostApp/SubscriptionView.swift b/AmplifyPlugins/API/Tests/APIHostApp/APIHostApp/SubscriptionView.swift index 5f29525508..afc43d900d 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/APIHostApp/SubscriptionView.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/APIHostApp/SubscriptionView.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // -import SwiftUI +import Amplify import AWSAPIPlugin import AWSPluginsCore -import Amplify +import SwiftUI public extension AsyncSequence { func forEach(_ block: (Element) async throws -> Void) async rethrows { @@ -19,7 +19,7 @@ public extension AsyncSequence { } class SubscriptionViewModel: ObservableObject { - + @Published var todos = [Todo]() let apiPlugin = AWSAPIPlugin() @@ -29,12 +29,12 @@ class SubscriptionViewModel: ObservableObject { try await subscription.forEach { subscriptionEvent in await self.processSubscription(subscriptionEvent) } - + } catch { print("Failed to subscribe error: \(error)") } } - + func processSubscription(_ subscriptionEvent: GraphQLSubscriptionEvent) async { switch subscriptionEvent { case .connection(let subscriptionConnectionState): @@ -49,29 +49,29 @@ class SubscriptionViewModel: ObservableObject { } } } - + @MainActor func storeTodo(_ todo: Todo) async { - self.todos.append(todo) + todos.append(todo) } } @available(iOS 14.0, *) struct SubscriptionView: View { @StateObject var vm = SubscriptionViewModel() - + var body: some View { if #available(iOS 15.0, *) { VStack { - + }.task { await vm.subscribe() } - + } else { // Fallback on earlier versions Text("task is on iOS 15.0") } - + } - + } @available(iOS 14.0, *) @@ -86,35 +86,38 @@ public struct Todo: Model { public var name: String public var description: String? - public init(id: String = UUID().uuidString, - name: String, - description: String? = nil) { + public init( + id: String = UUID().uuidString, + name: String, + description: String? = nil + ) { self.id = id self.name = name self.description = description } } -extension Todo { +public extension Todo { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id case name case description } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let todo = Todo.keys model.listPluralName = "Todos" model.syncPluralName = "Todos" model.fields( - .id(), - .field(todo.name, is: .required, ofType: .string), - .field(todo.description, is: .optional, ofType: .string)) + .id(), + .field(todo.name, is: .required, ofType: .string), + .field(todo.description, is: .optional, ofType: .string) + ) } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/API.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/API.swift index 81f1b87158..4b17109a40 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/API.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/API.swift @@ -1,26 +1,34 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // 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 { +public extension JSONEncodable { + 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) +public extension [String: JSONEncodable?] { + var withNilValuesRemoved: [String: JSONEncodable] { + var filtered = [String: JSONEncodable](minimumCapacity: count) for (key, value) in self { if value != nil { filtered[key] = value @@ -39,13 +47,13 @@ public extension GraphQLMapConvertible { } 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 { @@ -68,12 +76,12 @@ public protocol GraphQLFragment: GraphQLSelectionSet { 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 { +public extension GraphQLSelectionSet { + init(from decoder: Decoder) throws { if let jsonObject = try? APISwiftJSONValue(from: decoder) { let encoder = JSONEncoder() let jsonData = try encoder.encode(jsonObject) @@ -92,10 +100,10 @@ enum APISwiftJSONValue: Codable { 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) { @@ -110,10 +118,10 @@ enum APISwiftJSONValue: Codable { self = .null } } - + func encode(to encoder: Encoder) throws { var container = encoder.singleValueContainer() - + switch self { case .array(let value): try container.encode(value) @@ -136,19 +144,19 @@ 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 } } @@ -157,7 +165,7 @@ public indirect enum GraphQLOutputType { case object([GraphQLSelection]) case nonNull(GraphQLOutputType) case list(GraphQLOutputType) - + var namedType: GraphQLOutputType { switch self { case .nonNull(let innerType), .list(let innerType): @@ -171,25 +179,25 @@ 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; + 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; + self.selections = selections } } public struct GraphQLFragmentSpread: GraphQLSelection { let fragment: GraphQLFragment.Type - + public init(_ fragment: GraphQLFragment.Type) { self.fragment = fragment } @@ -197,10 +205,10 @@ public struct GraphQLFragmentSpread: GraphQLSelection { public struct GraphQLTypeCase: GraphQLSelection { let variants: [String: [GraphQLSelection]] let `default`: [GraphQLSelection] - + public init(variants: [String: [GraphQLSelection]], default: [GraphQLSelection]) { self.variants = variants - self.default = `default`; + self.default = `default` } } public typealias JSONObject = [String: Any] @@ -215,7 +223,7 @@ public enum JSONDecodingError: Error, LocalizedError { case nullValue case wrongType case couldNotConvert(value: Any, to: Any.Type) - + public var errorDescription: String? { switch self { case .missingValue: @@ -284,8 +292,8 @@ extension Bool: JSONDecodable, JSONEncodable { return self } } -extension RawRepresentable where RawValue: JSONDecodable { - public init(jsonValue value: Any) throws { +public extension RawRepresentable where RawValue: JSONDecodable { + init(jsonValue value: Any) throws { let rawValue = try RawValue(jsonValue: value) if let tempSelf = Self(rawValue: rawValue) { self = tempSelf @@ -294,17 +302,17 @@ extension RawRepresentable where RawValue: JSONDecodable { } } } -extension RawRepresentable where RawValue: JSONEncodable { - public var jsonValue: Any { +public extension RawRepresentable where RawValue: JSONEncodable { + var jsonValue: Any { return rawValue.jsonValue } } -extension Optional where Wrapped: JSONDecodable { - public init(jsonValue value: Any) throws { +public extension Optional where Wrapped: JSONDecodable { + init(jsonValue value: Any) throws { if value is NSNull { self = .none } else { - self = .some(try Wrapped(jsonValue: value)) + self = try .some(Wrapped(jsonValue: value)) } } } @@ -324,7 +332,7 @@ extension Dictionary: JSONEncodable { public var jsonValue: Any { return jsonObject } - + public var jsonObject: JSONObject { var jsonObject = JSONObject(minimumCapacity: count) for (key, value) in self { @@ -339,7 +347,7 @@ extension Dictionary: JSONEncodable { } extension Array: JSONEncodable { public var jsonValue: Any { - return map() { element -> (Any) in + return map { element -> (Any) in if case let element as JSONEncodable = element { return element.jsonValue } else { @@ -356,12 +364,12 @@ extension URL: JSONDecodable, JSONEncodable { self.init(string: string)! } public var jsonValue: Any { - return self.absoluteString + return absoluteString } } extension Dictionary { static func += (lhs: inout Dictionary, rhs: Dictionary) { - lhs.merge(rhs) { (_, new) in new } + lhs.merge(rhs) { _, new in new } } } #elseif canImport(AWSAppSync) @@ -369,15 +377,15 @@ import AWSAppSync #endif public struct APISwift { - - + + public struct CreatePostInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID? = nil, title: String, content: String, createdAt: String? = nil, updatedAt: String? = nil, draft: Bool? = nil, rating: Double? = nil, status: PostStatus? = nil) { - graphQLMap = ["id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status] + self.graphQLMap = ["id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status] } - + public var id: GraphQLID? { get { return graphQLMap["id"] as! GraphQLID? @@ -386,7 +394,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return graphQLMap["title"] as! String @@ -395,7 +403,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "title") } } - + public var content: String { get { return graphQLMap["content"] as! String @@ -404,7 +412,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "content") } } - + public var createdAt: String? { get { return graphQLMap["createdAt"] as! String? @@ -413,7 +421,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String? { get { return graphQLMap["updatedAt"] as! String? @@ -422,7 +430,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "updatedAt") } } - + public var draft: Bool? { get { return graphQLMap["draft"] as! Bool? @@ -431,7 +439,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "draft") } } - + public var rating: Double? { get { return graphQLMap["rating"] as! Double? @@ -440,7 +448,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "rating") } } - + public var status: PostStatus? { get { return graphQLMap["status"] as! PostStatus? @@ -450,7 +458,7 @@ public struct APISwift { } } } - + public enum PostStatus: RawRepresentable, Equatable, JSONDecodable, JSONEncodable { public typealias RawValue = String case `private` @@ -458,7 +466,7 @@ public struct APISwift { case published /// Auto generated constant for unknown enum values case unknown(RawValue) - + public init?(rawValue: RawValue) { switch rawValue { case "PRIVATE": self = .private @@ -467,7 +475,7 @@ public struct APISwift { default: self = .unknown(rawValue) } } - + public var rawValue: RawValue { switch self { case .private: return "PRIVATE" @@ -476,7 +484,7 @@ public struct APISwift { case .unknown(let value): return value } } - + public static func == (lhs: PostStatus, rhs: PostStatus) -> Bool { switch (lhs, rhs) { case (.private, .private): return true @@ -487,14 +495,14 @@ public struct APISwift { } } } - + public struct ModelPostConditionInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(title: ModelStringInput? = nil, content: ModelStringInput? = nil, createdAt: ModelStringInput? = nil, updatedAt: ModelStringInput? = nil, draft: ModelBooleanInput? = nil, rating: ModelFloatInput? = nil, status: ModelPostStatusInput? = nil, and: [ModelPostConditionInput?]? = nil, or: [ModelPostConditionInput?]? = nil, not: ModelPostConditionInput? = nil) { - graphQLMap = ["title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "and": and, "or": or, "not": not] + self.graphQLMap = ["title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "and": and, "or": or, "not": not] } - + public var title: ModelStringInput? { get { return graphQLMap["title"] as! ModelStringInput? @@ -503,7 +511,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "title") } } - + public var content: ModelStringInput? { get { return graphQLMap["content"] as! ModelStringInput? @@ -512,7 +520,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "content") } } - + public var createdAt: ModelStringInput? { get { return graphQLMap["createdAt"] as! ModelStringInput? @@ -521,7 +529,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: ModelStringInput? { get { return graphQLMap["updatedAt"] as! ModelStringInput? @@ -530,7 +538,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "updatedAt") } } - + public var draft: ModelBooleanInput? { get { return graphQLMap["draft"] as! ModelBooleanInput? @@ -539,7 +547,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "draft") } } - + public var rating: ModelFloatInput? { get { return graphQLMap["rating"] as! ModelFloatInput? @@ -548,7 +556,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "rating") } } - + public var status: ModelPostStatusInput? { get { return graphQLMap["status"] as! ModelPostStatusInput? @@ -557,7 +565,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "status") } } - + public var and: [ModelPostConditionInput?]? { get { return graphQLMap["and"] as! [ModelPostConditionInput?]? @@ -566,7 +574,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelPostConditionInput?]? { get { return graphQLMap["or"] as! [ModelPostConditionInput?]? @@ -575,7 +583,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelPostConditionInput? { get { return graphQLMap["not"] as! ModelPostConditionInput? @@ -585,14 +593,14 @@ public struct APISwift { } } } - + 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] + self.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? @@ -601,7 +609,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "ne") } } - + public var eq: String? { get { return graphQLMap["eq"] as! String? @@ -610,7 +618,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "eq") } } - + public var le: String? { get { return graphQLMap["le"] as! String? @@ -619,7 +627,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "le") } } - + public var lt: String? { get { return graphQLMap["lt"] as! String? @@ -628,7 +636,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "lt") } } - + public var ge: String? { get { return graphQLMap["ge"] as! String? @@ -637,7 +645,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "ge") } } - + public var gt: String? { get { return graphQLMap["gt"] as! String? @@ -646,7 +654,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "gt") } } - + public var contains: String? { get { return graphQLMap["contains"] as! String? @@ -655,7 +663,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "contains") } } - + public var notContains: String? { get { return graphQLMap["notContains"] as! String? @@ -664,7 +672,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "notContains") } } - + public var between: [String?]? { get { return graphQLMap["between"] as! [String?]? @@ -673,7 +681,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "between") } } - + public var beginsWith: String? { get { return graphQLMap["beginsWith"] as! String? @@ -682,7 +690,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "beginsWith") } } - + public var attributeExists: Bool? { get { return graphQLMap["attributeExists"] as! Bool? @@ -691,7 +699,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "attributeExists") } } - + public var attributeType: ModelAttributeTypes? { get { return graphQLMap["attributeType"] as! ModelAttributeTypes? @@ -700,7 +708,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "attributeType") } } - + public var size: ModelSizeInput? { get { return graphQLMap["size"] as! ModelSizeInput? @@ -710,7 +718,7 @@ public struct APISwift { } } } - + public enum ModelAttributeTypes: RawRepresentable, Equatable, JSONDecodable, JSONEncodable { public typealias RawValue = String case binary @@ -725,7 +733,7 @@ public struct APISwift { case null /// Auto generated constant for unknown enum values case unknown(RawValue) - + public init?(rawValue: RawValue) { switch rawValue { case "binary": self = .binary @@ -741,7 +749,7 @@ public struct APISwift { default: self = .unknown(rawValue) } } - + public var rawValue: RawValue { switch self { case .binary: return "binary" @@ -757,7 +765,7 @@ public struct APISwift { case .unknown(let value): return value } } - + public static func == (lhs: ModelAttributeTypes, rhs: ModelAttributeTypes) -> Bool { switch (lhs, rhs) { case (.binary, .binary): return true @@ -775,14 +783,14 @@ public struct APISwift { } } } - + 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] + self.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? @@ -791,7 +799,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "ne") } } - + public var eq: Int? { get { return graphQLMap["eq"] as! Int? @@ -800,7 +808,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "eq") } } - + public var le: Int? { get { return graphQLMap["le"] as! Int? @@ -809,7 +817,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "le") } } - + public var lt: Int? { get { return graphQLMap["lt"] as! Int? @@ -818,7 +826,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "lt") } } - + public var ge: Int? { get { return graphQLMap["ge"] as! Int? @@ -827,7 +835,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "ge") } } - + public var gt: Int? { get { return graphQLMap["gt"] as! Int? @@ -836,7 +844,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "gt") } } - + public var between: [Int?]? { get { return graphQLMap["between"] as! [Int?]? @@ -846,14 +854,14 @@ public struct APISwift { } } } - + public struct ModelBooleanInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(ne: Bool? = nil, eq: Bool? = nil, attributeExists: Bool? = nil, attributeType: ModelAttributeTypes? = nil) { - graphQLMap = ["ne": ne, "eq": eq, "attributeExists": attributeExists, "attributeType": attributeType] + self.graphQLMap = ["ne": ne, "eq": eq, "attributeExists": attributeExists, "attributeType": attributeType] } - + public var ne: Bool? { get { return graphQLMap["ne"] as! Bool? @@ -862,7 +870,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "ne") } } - + public var eq: Bool? { get { return graphQLMap["eq"] as! Bool? @@ -871,7 +879,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "eq") } } - + public var attributeExists: Bool? { get { return graphQLMap["attributeExists"] as! Bool? @@ -880,7 +888,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "attributeExists") } } - + public var attributeType: ModelAttributeTypes? { get { return graphQLMap["attributeType"] as! ModelAttributeTypes? @@ -890,14 +898,14 @@ public struct APISwift { } } } - + public struct ModelFloatInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(ne: Double? = nil, eq: Double? = nil, le: Double? = nil, lt: Double? = nil, ge: Double? = nil, gt: Double? = nil, between: [Double?]? = nil, attributeExists: Bool? = nil, attributeType: ModelAttributeTypes? = nil) { - graphQLMap = ["ne": ne, "eq": eq, "le": le, "lt": lt, "ge": ge, "gt": gt, "between": between, "attributeExists": attributeExists, "attributeType": attributeType] + self.graphQLMap = ["ne": ne, "eq": eq, "le": le, "lt": lt, "ge": ge, "gt": gt, "between": between, "attributeExists": attributeExists, "attributeType": attributeType] } - + public var ne: Double? { get { return graphQLMap["ne"] as! Double? @@ -906,7 +914,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "ne") } } - + public var eq: Double? { get { return graphQLMap["eq"] as! Double? @@ -915,7 +923,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "eq") } } - + public var le: Double? { get { return graphQLMap["le"] as! Double? @@ -924,7 +932,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "le") } } - + public var lt: Double? { get { return graphQLMap["lt"] as! Double? @@ -933,7 +941,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "lt") } } - + public var ge: Double? { get { return graphQLMap["ge"] as! Double? @@ -942,7 +950,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "ge") } } - + public var gt: Double? { get { return graphQLMap["gt"] as! Double? @@ -951,7 +959,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "gt") } } - + public var between: [Double?]? { get { return graphQLMap["between"] as! [Double?]? @@ -960,7 +968,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "between") } } - + public var attributeExists: Bool? { get { return graphQLMap["attributeExists"] as! Bool? @@ -969,7 +977,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "attributeExists") } } - + public var attributeType: ModelAttributeTypes? { get { return graphQLMap["attributeType"] as! ModelAttributeTypes? @@ -979,14 +987,14 @@ public struct APISwift { } } } - + public struct ModelPostStatusInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(eq: PostStatus? = nil, ne: PostStatus? = nil) { - graphQLMap = ["eq": eq, "ne": ne] + self.graphQLMap = ["eq": eq, "ne": ne] } - + public var eq: PostStatus? { get { return graphQLMap["eq"] as! PostStatus? @@ -995,7 +1003,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "eq") } } - + public var ne: PostStatus? { get { return graphQLMap["ne"] as! PostStatus? @@ -1005,14 +1013,14 @@ public struct APISwift { } } } - + public struct UpdatePostInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID, title: String? = nil, content: String? = nil, createdAt: String? = nil, updatedAt: String? = nil, draft: Bool? = nil, rating: Double? = nil, status: PostStatus? = nil) { - graphQLMap = ["id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status] + self.graphQLMap = ["id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -1021,7 +1029,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var title: String? { get { return graphQLMap["title"] as! String? @@ -1030,7 +1038,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "title") } } - + public var content: String? { get { return graphQLMap["content"] as! String? @@ -1039,7 +1047,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "content") } } - + public var createdAt: String? { get { return graphQLMap["createdAt"] as! String? @@ -1048,7 +1056,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String? { get { return graphQLMap["updatedAt"] as! String? @@ -1057,7 +1065,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "updatedAt") } } - + public var draft: Bool? { get { return graphQLMap["draft"] as! Bool? @@ -1066,7 +1074,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "draft") } } - + public var rating: Double? { get { return graphQLMap["rating"] as! Double? @@ -1075,7 +1083,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "rating") } } - + public var status: PostStatus? { get { return graphQLMap["status"] as! PostStatus? @@ -1085,14 +1093,14 @@ public struct APISwift { } } } - + public struct DeletePostInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID) { - graphQLMap = ["id": id] + self.graphQLMap = ["id": id] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -1102,14 +1110,14 @@ public struct APISwift { } } } - + public struct CreateCommentInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID? = nil, content: String, createdAt: String? = nil, commentPostId: GraphQLID? = nil) { - graphQLMap = ["id": id, "content": content, "createdAt": createdAt, "commentPostId": commentPostId] + self.graphQLMap = ["id": id, "content": content, "createdAt": createdAt, "commentPostId": commentPostId] } - + public var id: GraphQLID? { get { return graphQLMap["id"] as! GraphQLID? @@ -1118,7 +1126,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var content: String { get { return graphQLMap["content"] as! String @@ -1127,7 +1135,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "content") } } - + public var createdAt: String? { get { return graphQLMap["createdAt"] as! String? @@ -1136,7 +1144,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "createdAt") } } - + public var commentPostId: GraphQLID? { get { return graphQLMap["commentPostId"] as! GraphQLID? @@ -1146,14 +1154,14 @@ public struct APISwift { } } } - + public struct ModelCommentConditionInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(content: ModelStringInput? = nil, createdAt: ModelStringInput? = nil, and: [ModelCommentConditionInput?]? = nil, or: [ModelCommentConditionInput?]? = nil, not: ModelCommentConditionInput? = nil) { - graphQLMap = ["content": content, "createdAt": createdAt, "and": and, "or": or, "not": not] + self.graphQLMap = ["content": content, "createdAt": createdAt, "and": and, "or": or, "not": not] } - + public var content: ModelStringInput? { get { return graphQLMap["content"] as! ModelStringInput? @@ -1162,7 +1170,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "content") } } - + public var createdAt: ModelStringInput? { get { return graphQLMap["createdAt"] as! ModelStringInput? @@ -1171,7 +1179,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "createdAt") } } - + public var and: [ModelCommentConditionInput?]? { get { return graphQLMap["and"] as! [ModelCommentConditionInput?]? @@ -1180,7 +1188,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelCommentConditionInput?]? { get { return graphQLMap["or"] as! [ModelCommentConditionInput?]? @@ -1189,7 +1197,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelCommentConditionInput? { get { return graphQLMap["not"] as! ModelCommentConditionInput? @@ -1199,14 +1207,14 @@ public struct APISwift { } } } - + public struct UpdateCommentInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID, content: String? = nil, createdAt: String? = nil, commentPostId: GraphQLID? = nil) { - graphQLMap = ["id": id, "content": content, "createdAt": createdAt, "commentPostId": commentPostId] + self.graphQLMap = ["id": id, "content": content, "createdAt": createdAt, "commentPostId": commentPostId] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -1215,7 +1223,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var content: String? { get { return graphQLMap["content"] as! String? @@ -1224,7 +1232,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "content") } } - + public var createdAt: String? { get { return graphQLMap["createdAt"] as! String? @@ -1233,7 +1241,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "createdAt") } } - + public var commentPostId: GraphQLID? { get { return graphQLMap["commentPostId"] as! GraphQLID? @@ -1243,14 +1251,14 @@ public struct APISwift { } } } - + public struct DeleteCommentInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID) { - graphQLMap = ["id": id] + self.graphQLMap = ["id": id] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -1260,14 +1268,14 @@ public struct APISwift { } } } - + public struct CreateProject1Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID? = nil, name: String? = nil, project1TeamId: GraphQLID? = nil) { - graphQLMap = ["id": id, "name": name, "project1TeamId": project1TeamId] + self.graphQLMap = ["id": id, "name": name, "project1TeamId": project1TeamId] } - + public var id: GraphQLID? { get { return graphQLMap["id"] as! GraphQLID? @@ -1276,7 +1284,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return graphQLMap["name"] as! String? @@ -1285,7 +1293,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "name") } } - + public var project1TeamId: GraphQLID? { get { return graphQLMap["project1TeamId"] as! GraphQLID? @@ -1295,14 +1303,14 @@ public struct APISwift { } } } - + public struct ModelProject1ConditionInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(name: ModelStringInput? = nil, and: [ModelProject1ConditionInput?]? = nil, or: [ModelProject1ConditionInput?]? = nil, not: ModelProject1ConditionInput? = nil) { - graphQLMap = ["name": name, "and": and, "or": or, "not": not] + self.graphQLMap = ["name": name, "and": and, "or": or, "not": not] } - + public var name: ModelStringInput? { get { return graphQLMap["name"] as! ModelStringInput? @@ -1311,7 +1319,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "name") } } - + public var and: [ModelProject1ConditionInput?]? { get { return graphQLMap["and"] as! [ModelProject1ConditionInput?]? @@ -1320,7 +1328,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelProject1ConditionInput?]? { get { return graphQLMap["or"] as! [ModelProject1ConditionInput?]? @@ -1329,7 +1337,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelProject1ConditionInput? { get { return graphQLMap["not"] as! ModelProject1ConditionInput? @@ -1339,14 +1347,14 @@ public struct APISwift { } } } - + public struct UpdateProject1Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID, name: String? = nil, project1TeamId: GraphQLID? = nil) { - graphQLMap = ["id": id, "name": name, "project1TeamId": project1TeamId] + self.graphQLMap = ["id": id, "name": name, "project1TeamId": project1TeamId] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -1355,7 +1363,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return graphQLMap["name"] as! String? @@ -1364,7 +1372,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "name") } } - + public var project1TeamId: GraphQLID? { get { return graphQLMap["project1TeamId"] as! GraphQLID? @@ -1374,14 +1382,14 @@ public struct APISwift { } } } - + public struct DeleteProject1Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID) { - graphQLMap = ["id": id] + self.graphQLMap = ["id": id] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -1391,14 +1399,14 @@ public struct APISwift { } } } - + public struct CreateTeam1Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID? = nil, name: String) { - graphQLMap = ["id": id, "name": name] + self.graphQLMap = ["id": id, "name": name] } - + public var id: GraphQLID? { get { return graphQLMap["id"] as! GraphQLID? @@ -1407,7 +1415,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return graphQLMap["name"] as! String @@ -1417,14 +1425,14 @@ public struct APISwift { } } } - + public struct ModelTeam1ConditionInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(name: ModelStringInput? = nil, and: [ModelTeam1ConditionInput?]? = nil, or: [ModelTeam1ConditionInput?]? = nil, not: ModelTeam1ConditionInput? = nil) { - graphQLMap = ["name": name, "and": and, "or": or, "not": not] + self.graphQLMap = ["name": name, "and": and, "or": or, "not": not] } - + public var name: ModelStringInput? { get { return graphQLMap["name"] as! ModelStringInput? @@ -1433,7 +1441,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "name") } } - + public var and: [ModelTeam1ConditionInput?]? { get { return graphQLMap["and"] as! [ModelTeam1ConditionInput?]? @@ -1442,7 +1450,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelTeam1ConditionInput?]? { get { return graphQLMap["or"] as! [ModelTeam1ConditionInput?]? @@ -1451,7 +1459,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelTeam1ConditionInput? { get { return graphQLMap["not"] as! ModelTeam1ConditionInput? @@ -1461,14 +1469,14 @@ public struct APISwift { } } } - + public struct UpdateTeam1Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID, name: String? = nil) { - graphQLMap = ["id": id, "name": name] + self.graphQLMap = ["id": id, "name": name] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -1477,7 +1485,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return graphQLMap["name"] as! String? @@ -1487,14 +1495,14 @@ public struct APISwift { } } } - + public struct DeleteTeam1Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID) { - graphQLMap = ["id": id] + self.graphQLMap = ["id": id] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -1504,14 +1512,14 @@ public struct APISwift { } } } - + public struct CreateProject2Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID? = nil, name: String? = nil, teamId: GraphQLID) { - graphQLMap = ["id": id, "name": name, "teamID": teamId] + self.graphQLMap = ["id": id, "name": name, "teamID": teamId] } - + public var id: GraphQLID? { get { return graphQLMap["id"] as! GraphQLID? @@ -1520,7 +1528,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return graphQLMap["name"] as! String? @@ -1529,7 +1537,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "name") } } - + public var teamId: GraphQLID { get { return graphQLMap["teamID"] as! GraphQLID @@ -1539,14 +1547,14 @@ public struct APISwift { } } } - + public struct ModelProject2ConditionInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(name: ModelStringInput? = nil, teamId: ModelIDInput? = nil, and: [ModelProject2ConditionInput?]? = nil, or: [ModelProject2ConditionInput?]? = nil, not: ModelProject2ConditionInput? = nil) { - graphQLMap = ["name": name, "teamID": teamId, "and": and, "or": or, "not": not] + self.graphQLMap = ["name": name, "teamID": teamId, "and": and, "or": or, "not": not] } - + public var name: ModelStringInput? { get { return graphQLMap["name"] as! ModelStringInput? @@ -1555,7 +1563,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "name") } } - + public var teamId: ModelIDInput? { get { return graphQLMap["teamID"] as! ModelIDInput? @@ -1564,7 +1572,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "teamID") } } - + public var and: [ModelProject2ConditionInput?]? { get { return graphQLMap["and"] as! [ModelProject2ConditionInput?]? @@ -1573,7 +1581,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelProject2ConditionInput?]? { get { return graphQLMap["or"] as! [ModelProject2ConditionInput?]? @@ -1582,7 +1590,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelProject2ConditionInput? { get { return graphQLMap["not"] as! ModelProject2ConditionInput? @@ -1592,14 +1600,14 @@ public struct APISwift { } } } - + 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] + self.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? @@ -1608,7 +1616,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "ne") } } - + public var eq: GraphQLID? { get { return graphQLMap["eq"] as! GraphQLID? @@ -1617,7 +1625,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "eq") } } - + public var le: GraphQLID? { get { return graphQLMap["le"] as! GraphQLID? @@ -1626,7 +1634,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "le") } } - + public var lt: GraphQLID? { get { return graphQLMap["lt"] as! GraphQLID? @@ -1635,7 +1643,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "lt") } } - + public var ge: GraphQLID? { get { return graphQLMap["ge"] as! GraphQLID? @@ -1644,7 +1652,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "ge") } } - + public var gt: GraphQLID? { get { return graphQLMap["gt"] as! GraphQLID? @@ -1653,7 +1661,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "gt") } } - + public var contains: GraphQLID? { get { return graphQLMap["contains"] as! GraphQLID? @@ -1662,7 +1670,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "contains") } } - + public var notContains: GraphQLID? { get { return graphQLMap["notContains"] as! GraphQLID? @@ -1671,7 +1679,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "notContains") } } - + public var between: [GraphQLID?]? { get { return graphQLMap["between"] as! [GraphQLID?]? @@ -1680,7 +1688,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "between") } } - + public var beginsWith: GraphQLID? { get { return graphQLMap["beginsWith"] as! GraphQLID? @@ -1689,7 +1697,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "beginsWith") } } - + public var attributeExists: Bool? { get { return graphQLMap["attributeExists"] as! Bool? @@ -1698,7 +1706,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "attributeExists") } } - + public var attributeType: ModelAttributeTypes? { get { return graphQLMap["attributeType"] as! ModelAttributeTypes? @@ -1707,7 +1715,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "attributeType") } } - + public var size: ModelSizeInput? { get { return graphQLMap["size"] as! ModelSizeInput? @@ -1717,14 +1725,14 @@ public struct APISwift { } } } - + public struct UpdateProject2Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID, name: String? = nil, teamId: GraphQLID? = nil) { - graphQLMap = ["id": id, "name": name, "teamID": teamId] + self.graphQLMap = ["id": id, "name": name, "teamID": teamId] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -1733,7 +1741,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return graphQLMap["name"] as! String? @@ -1742,7 +1750,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "name") } } - + public var teamId: GraphQLID? { get { return graphQLMap["teamID"] as! GraphQLID? @@ -1752,14 +1760,14 @@ public struct APISwift { } } } - + public struct DeleteProject2Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID) { - graphQLMap = ["id": id] + self.graphQLMap = ["id": id] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -1769,14 +1777,14 @@ public struct APISwift { } } } - + public struct CreateTeam2Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID? = nil, name: String) { - graphQLMap = ["id": id, "name": name] + self.graphQLMap = ["id": id, "name": name] } - + public var id: GraphQLID? { get { return graphQLMap["id"] as! GraphQLID? @@ -1785,7 +1793,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return graphQLMap["name"] as! String @@ -1795,14 +1803,14 @@ public struct APISwift { } } } - + public struct ModelTeam2ConditionInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(name: ModelStringInput? = nil, and: [ModelTeam2ConditionInput?]? = nil, or: [ModelTeam2ConditionInput?]? = nil, not: ModelTeam2ConditionInput? = nil) { - graphQLMap = ["name": name, "and": and, "or": or, "not": not] + self.graphQLMap = ["name": name, "and": and, "or": or, "not": not] } - + public var name: ModelStringInput? { get { return graphQLMap["name"] as! ModelStringInput? @@ -1811,7 +1819,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "name") } } - + public var and: [ModelTeam2ConditionInput?]? { get { return graphQLMap["and"] as! [ModelTeam2ConditionInput?]? @@ -1820,7 +1828,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelTeam2ConditionInput?]? { get { return graphQLMap["or"] as! [ModelTeam2ConditionInput?]? @@ -1829,7 +1837,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelTeam2ConditionInput? { get { return graphQLMap["not"] as! ModelTeam2ConditionInput? @@ -1839,14 +1847,14 @@ public struct APISwift { } } } - + public struct UpdateTeam2Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID, name: String? = nil) { - graphQLMap = ["id": id, "name": name] + self.graphQLMap = ["id": id, "name": name] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -1855,7 +1863,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return graphQLMap["name"] as! String? @@ -1865,14 +1873,14 @@ public struct APISwift { } } } - + public struct DeleteTeam2Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID) { - graphQLMap = ["id": id] + self.graphQLMap = ["id": id] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -1882,14 +1890,14 @@ public struct APISwift { } } } - + public struct CreatePost3Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID? = nil, title: String) { - graphQLMap = ["id": id, "title": title] + self.graphQLMap = ["id": id, "title": title] } - + public var id: GraphQLID? { get { return graphQLMap["id"] as! GraphQLID? @@ -1898,7 +1906,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return graphQLMap["title"] as! String @@ -1908,14 +1916,14 @@ public struct APISwift { } } } - + public struct ModelPost3ConditionInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(title: ModelStringInput? = nil, and: [ModelPost3ConditionInput?]? = nil, or: [ModelPost3ConditionInput?]? = nil, not: ModelPost3ConditionInput? = nil) { - graphQLMap = ["title": title, "and": and, "or": or, "not": not] + self.graphQLMap = ["title": title, "and": and, "or": or, "not": not] } - + public var title: ModelStringInput? { get { return graphQLMap["title"] as! ModelStringInput? @@ -1924,7 +1932,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "title") } } - + public var and: [ModelPost3ConditionInput?]? { get { return graphQLMap["and"] as! [ModelPost3ConditionInput?]? @@ -1933,7 +1941,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelPost3ConditionInput?]? { get { return graphQLMap["or"] as! [ModelPost3ConditionInput?]? @@ -1942,7 +1950,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelPost3ConditionInput? { get { return graphQLMap["not"] as! ModelPost3ConditionInput? @@ -1952,14 +1960,14 @@ public struct APISwift { } } } - + public struct UpdatePost3Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID, title: String? = nil) { - graphQLMap = ["id": id, "title": title] + self.graphQLMap = ["id": id, "title": title] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -1968,7 +1976,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var title: String? { get { return graphQLMap["title"] as! String? @@ -1978,14 +1986,14 @@ public struct APISwift { } } } - + public struct DeletePost3Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID) { - graphQLMap = ["id": id] + self.graphQLMap = ["id": id] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -1995,14 +2003,14 @@ public struct APISwift { } } } - + public struct CreateComment3Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID? = nil, postId: GraphQLID, content: String) { - graphQLMap = ["id": id, "postID": postId, "content": content] + self.graphQLMap = ["id": id, "postID": postId, "content": content] } - + public var id: GraphQLID? { get { return graphQLMap["id"] as! GraphQLID? @@ -2011,7 +2019,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return graphQLMap["postID"] as! GraphQLID @@ -2020,7 +2028,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return graphQLMap["content"] as! String @@ -2030,14 +2038,14 @@ public struct APISwift { } } } - + public struct ModelComment3ConditionInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(postId: ModelIDInput? = nil, content: ModelStringInput? = nil, and: [ModelComment3ConditionInput?]? = nil, or: [ModelComment3ConditionInput?]? = nil, not: ModelComment3ConditionInput? = nil) { - graphQLMap = ["postID": postId, "content": content, "and": and, "or": or, "not": not] + self.graphQLMap = ["postID": postId, "content": content, "and": and, "or": or, "not": not] } - + public var postId: ModelIDInput? { get { return graphQLMap["postID"] as! ModelIDInput? @@ -2046,7 +2054,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "postID") } } - + public var content: ModelStringInput? { get { return graphQLMap["content"] as! ModelStringInput? @@ -2055,7 +2063,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "content") } } - + public var and: [ModelComment3ConditionInput?]? { get { return graphQLMap["and"] as! [ModelComment3ConditionInput?]? @@ -2064,7 +2072,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelComment3ConditionInput?]? { get { return graphQLMap["or"] as! [ModelComment3ConditionInput?]? @@ -2073,7 +2081,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelComment3ConditionInput? { get { return graphQLMap["not"] as! ModelComment3ConditionInput? @@ -2083,14 +2091,14 @@ public struct APISwift { } } } - + public struct UpdateComment3Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID, postId: GraphQLID? = nil, content: String? = nil) { - graphQLMap = ["id": id, "postID": postId, "content": content] + self.graphQLMap = ["id": id, "postID": postId, "content": content] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -2099,7 +2107,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID? { get { return graphQLMap["postID"] as! GraphQLID? @@ -2108,7 +2116,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "postID") } } - + public var content: String? { get { return graphQLMap["content"] as! String? @@ -2118,14 +2126,14 @@ public struct APISwift { } } } - + public struct DeleteComment3Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID) { - graphQLMap = ["id": id] + self.graphQLMap = ["id": id] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -2135,14 +2143,14 @@ public struct APISwift { } } } - + public struct CreatePost4Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID? = nil, title: String) { - graphQLMap = ["id": id, "title": title] + self.graphQLMap = ["id": id, "title": title] } - + public var id: GraphQLID? { get { return graphQLMap["id"] as! GraphQLID? @@ -2151,7 +2159,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return graphQLMap["title"] as! String @@ -2161,14 +2169,14 @@ public struct APISwift { } } } - + public struct ModelPost4ConditionInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(title: ModelStringInput? = nil, and: [ModelPost4ConditionInput?]? = nil, or: [ModelPost4ConditionInput?]? = nil, not: ModelPost4ConditionInput? = nil) { - graphQLMap = ["title": title, "and": and, "or": or, "not": not] + self.graphQLMap = ["title": title, "and": and, "or": or, "not": not] } - + public var title: ModelStringInput? { get { return graphQLMap["title"] as! ModelStringInput? @@ -2177,7 +2185,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "title") } } - + public var and: [ModelPost4ConditionInput?]? { get { return graphQLMap["and"] as! [ModelPost4ConditionInput?]? @@ -2186,7 +2194,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelPost4ConditionInput?]? { get { return graphQLMap["or"] as! [ModelPost4ConditionInput?]? @@ -2195,7 +2203,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelPost4ConditionInput? { get { return graphQLMap["not"] as! ModelPost4ConditionInput? @@ -2205,14 +2213,14 @@ public struct APISwift { } } } - + public struct UpdatePost4Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID, title: String? = nil) { - graphQLMap = ["id": id, "title": title] + self.graphQLMap = ["id": id, "title": title] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -2221,7 +2229,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var title: String? { get { return graphQLMap["title"] as! String? @@ -2231,14 +2239,14 @@ public struct APISwift { } } } - + public struct DeletePost4Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID) { - graphQLMap = ["id": id] + self.graphQLMap = ["id": id] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -2248,14 +2256,14 @@ public struct APISwift { } } } - + public struct CreateComment4Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID? = nil, postId: GraphQLID, content: String) { - graphQLMap = ["id": id, "postID": postId, "content": content] + self.graphQLMap = ["id": id, "postID": postId, "content": content] } - + public var id: GraphQLID? { get { return graphQLMap["id"] as! GraphQLID? @@ -2264,7 +2272,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return graphQLMap["postID"] as! GraphQLID @@ -2273,7 +2281,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return graphQLMap["content"] as! String @@ -2283,14 +2291,14 @@ public struct APISwift { } } } - + public struct ModelComment4ConditionInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(postId: ModelIDInput? = nil, content: ModelStringInput? = nil, and: [ModelComment4ConditionInput?]? = nil, or: [ModelComment4ConditionInput?]? = nil, not: ModelComment4ConditionInput? = nil) { - graphQLMap = ["postID": postId, "content": content, "and": and, "or": or, "not": not] + self.graphQLMap = ["postID": postId, "content": content, "and": and, "or": or, "not": not] } - + public var postId: ModelIDInput? { get { return graphQLMap["postID"] as! ModelIDInput? @@ -2299,7 +2307,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "postID") } } - + public var content: ModelStringInput? { get { return graphQLMap["content"] as! ModelStringInput? @@ -2308,7 +2316,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "content") } } - + public var and: [ModelComment4ConditionInput?]? { get { return graphQLMap["and"] as! [ModelComment4ConditionInput?]? @@ -2317,7 +2325,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelComment4ConditionInput?]? { get { return graphQLMap["or"] as! [ModelComment4ConditionInput?]? @@ -2326,7 +2334,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelComment4ConditionInput? { get { return graphQLMap["not"] as! ModelComment4ConditionInput? @@ -2336,14 +2344,14 @@ public struct APISwift { } } } - + public struct UpdateComment4Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID, postId: GraphQLID? = nil, content: String? = nil) { - graphQLMap = ["id": id, "postID": postId, "content": content] + self.graphQLMap = ["id": id, "postID": postId, "content": content] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -2352,7 +2360,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID? { get { return graphQLMap["postID"] as! GraphQLID? @@ -2361,7 +2369,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "postID") } } - + public var content: String? { get { return graphQLMap["content"] as! String? @@ -2371,14 +2379,14 @@ public struct APISwift { } } } - + public struct DeleteComment4Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID) { - graphQLMap = ["id": id] + self.graphQLMap = ["id": id] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -2388,14 +2396,14 @@ public struct APISwift { } } } - + public struct CreatePost5Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID? = nil, title: String) { - graphQLMap = ["id": id, "title": title] + self.graphQLMap = ["id": id, "title": title] } - + public var id: GraphQLID? { get { return graphQLMap["id"] as! GraphQLID? @@ -2404,7 +2412,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return graphQLMap["title"] as! String @@ -2414,14 +2422,14 @@ public struct APISwift { } } } - + public struct ModelPost5ConditionInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(title: ModelStringInput? = nil, and: [ModelPost5ConditionInput?]? = nil, or: [ModelPost5ConditionInput?]? = nil, not: ModelPost5ConditionInput? = nil) { - graphQLMap = ["title": title, "and": and, "or": or, "not": not] + self.graphQLMap = ["title": title, "and": and, "or": or, "not": not] } - + public var title: ModelStringInput? { get { return graphQLMap["title"] as! ModelStringInput? @@ -2430,7 +2438,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "title") } } - + public var and: [ModelPost5ConditionInput?]? { get { return graphQLMap["and"] as! [ModelPost5ConditionInput?]? @@ -2439,7 +2447,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelPost5ConditionInput?]? { get { return graphQLMap["or"] as! [ModelPost5ConditionInput?]? @@ -2448,7 +2456,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelPost5ConditionInput? { get { return graphQLMap["not"] as! ModelPost5ConditionInput? @@ -2458,14 +2466,14 @@ public struct APISwift { } } } - + public struct UpdatePost5Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID, title: String? = nil) { - graphQLMap = ["id": id, "title": title] + self.graphQLMap = ["id": id, "title": title] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -2474,7 +2482,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var title: String? { get { return graphQLMap["title"] as! String? @@ -2484,14 +2492,14 @@ public struct APISwift { } } } - + public struct DeletePost5Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID) { - graphQLMap = ["id": id] + self.graphQLMap = ["id": id] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -2501,14 +2509,14 @@ public struct APISwift { } } } - + public struct CreatePostEditor5Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID? = nil, postId: GraphQLID, editorId: GraphQLID) { - graphQLMap = ["id": id, "postID": postId, "editorID": editorId] + self.graphQLMap = ["id": id, "postID": postId, "editorID": editorId] } - + public var id: GraphQLID? { get { return graphQLMap["id"] as! GraphQLID? @@ -2517,7 +2525,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return graphQLMap["postID"] as! GraphQLID @@ -2526,7 +2534,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "postID") } } - + public var editorId: GraphQLID { get { return graphQLMap["editorID"] as! GraphQLID @@ -2536,14 +2544,14 @@ public struct APISwift { } } } - + public struct ModelPostEditor5ConditionInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(postId: ModelIDInput? = nil, editorId: ModelIDInput? = nil, and: [ModelPostEditor5ConditionInput?]? = nil, or: [ModelPostEditor5ConditionInput?]? = nil, not: ModelPostEditor5ConditionInput? = nil) { - graphQLMap = ["postID": postId, "editorID": editorId, "and": and, "or": or, "not": not] + self.graphQLMap = ["postID": postId, "editorID": editorId, "and": and, "or": or, "not": not] } - + public var postId: ModelIDInput? { get { return graphQLMap["postID"] as! ModelIDInput? @@ -2552,7 +2560,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "postID") } } - + public var editorId: ModelIDInput? { get { return graphQLMap["editorID"] as! ModelIDInput? @@ -2561,7 +2569,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "editorID") } } - + public var and: [ModelPostEditor5ConditionInput?]? { get { return graphQLMap["and"] as! [ModelPostEditor5ConditionInput?]? @@ -2570,7 +2578,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelPostEditor5ConditionInput?]? { get { return graphQLMap["or"] as! [ModelPostEditor5ConditionInput?]? @@ -2579,7 +2587,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelPostEditor5ConditionInput? { get { return graphQLMap["not"] as! ModelPostEditor5ConditionInput? @@ -2589,14 +2597,14 @@ public struct APISwift { } } } - + public struct UpdatePostEditor5Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID, postId: GraphQLID? = nil, editorId: GraphQLID? = nil) { - graphQLMap = ["id": id, "postID": postId, "editorID": editorId] + self.graphQLMap = ["id": id, "postID": postId, "editorID": editorId] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -2605,7 +2613,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID? { get { return graphQLMap["postID"] as! GraphQLID? @@ -2614,7 +2622,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "postID") } } - + public var editorId: GraphQLID? { get { return graphQLMap["editorID"] as! GraphQLID? @@ -2624,14 +2632,14 @@ public struct APISwift { } } } - + public struct DeletePostEditor5Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID) { - graphQLMap = ["id": id] + self.graphQLMap = ["id": id] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -2641,14 +2649,14 @@ public struct APISwift { } } } - + public struct CreateUser5Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID? = nil, username: String) { - graphQLMap = ["id": id, "username": username] + self.graphQLMap = ["id": id, "username": username] } - + public var id: GraphQLID? { get { return graphQLMap["id"] as! GraphQLID? @@ -2657,7 +2665,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var username: String { get { return graphQLMap["username"] as! String @@ -2667,14 +2675,14 @@ public struct APISwift { } } } - + public struct ModelUser5ConditionInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(username: ModelStringInput? = nil, and: [ModelUser5ConditionInput?]? = nil, or: [ModelUser5ConditionInput?]? = nil, not: ModelUser5ConditionInput? = nil) { - graphQLMap = ["username": username, "and": and, "or": or, "not": not] + self.graphQLMap = ["username": username, "and": and, "or": or, "not": not] } - + public var username: ModelStringInput? { get { return graphQLMap["username"] as! ModelStringInput? @@ -2683,7 +2691,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "username") } } - + public var and: [ModelUser5ConditionInput?]? { get { return graphQLMap["and"] as! [ModelUser5ConditionInput?]? @@ -2692,7 +2700,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelUser5ConditionInput?]? { get { return graphQLMap["or"] as! [ModelUser5ConditionInput?]? @@ -2701,7 +2709,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelUser5ConditionInput? { get { return graphQLMap["not"] as! ModelUser5ConditionInput? @@ -2711,14 +2719,14 @@ public struct APISwift { } } } - + public struct UpdateUser5Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID, username: String? = nil) { - graphQLMap = ["id": id, "username": username] + self.graphQLMap = ["id": id, "username": username] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -2727,7 +2735,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var username: String? { get { return graphQLMap["username"] as! String? @@ -2737,14 +2745,14 @@ public struct APISwift { } } } - + public struct DeleteUser5Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID) { - graphQLMap = ["id": id] + self.graphQLMap = ["id": id] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -2754,14 +2762,14 @@ public struct APISwift { } } } - + public struct CreateBlog6Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID? = nil, name: String) { - graphQLMap = ["id": id, "name": name] + self.graphQLMap = ["id": id, "name": name] } - + public var id: GraphQLID? { get { return graphQLMap["id"] as! GraphQLID? @@ -2770,7 +2778,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return graphQLMap["name"] as! String @@ -2780,14 +2788,14 @@ public struct APISwift { } } } - + public struct ModelBlog6ConditionInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(name: ModelStringInput? = nil, and: [ModelBlog6ConditionInput?]? = nil, or: [ModelBlog6ConditionInput?]? = nil, not: ModelBlog6ConditionInput? = nil) { - graphQLMap = ["name": name, "and": and, "or": or, "not": not] + self.graphQLMap = ["name": name, "and": and, "or": or, "not": not] } - + public var name: ModelStringInput? { get { return graphQLMap["name"] as! ModelStringInput? @@ -2796,7 +2804,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "name") } } - + public var and: [ModelBlog6ConditionInput?]? { get { return graphQLMap["and"] as! [ModelBlog6ConditionInput?]? @@ -2805,7 +2813,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelBlog6ConditionInput?]? { get { return graphQLMap["or"] as! [ModelBlog6ConditionInput?]? @@ -2814,7 +2822,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelBlog6ConditionInput? { get { return graphQLMap["not"] as! ModelBlog6ConditionInput? @@ -2824,14 +2832,14 @@ public struct APISwift { } } } - + public struct UpdateBlog6Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID, name: String? = nil) { - graphQLMap = ["id": id, "name": name] + self.graphQLMap = ["id": id, "name": name] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -2840,7 +2848,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return graphQLMap["name"] as! String? @@ -2850,14 +2858,14 @@ public struct APISwift { } } } - + public struct DeleteBlog6Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID) { - graphQLMap = ["id": id] + self.graphQLMap = ["id": id] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -2867,14 +2875,14 @@ public struct APISwift { } } } - + public struct CreatePost6Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID? = nil, title: String, blogId: GraphQLID) { - graphQLMap = ["id": id, "title": title, "blogID": blogId] + self.graphQLMap = ["id": id, "title": title, "blogID": blogId] } - + public var id: GraphQLID? { get { return graphQLMap["id"] as! GraphQLID? @@ -2883,7 +2891,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return graphQLMap["title"] as! String @@ -2892,7 +2900,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID { get { return graphQLMap["blogID"] as! GraphQLID @@ -2902,14 +2910,14 @@ public struct APISwift { } } } - + public struct ModelPost6ConditionInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(title: ModelStringInput? = nil, blogId: ModelIDInput? = nil, and: [ModelPost6ConditionInput?]? = nil, or: [ModelPost6ConditionInput?]? = nil, not: ModelPost6ConditionInput? = nil) { - graphQLMap = ["title": title, "blogID": blogId, "and": and, "or": or, "not": not] + self.graphQLMap = ["title": title, "blogID": blogId, "and": and, "or": or, "not": not] } - + public var title: ModelStringInput? { get { return graphQLMap["title"] as! ModelStringInput? @@ -2918,7 +2926,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "title") } } - + public var blogId: ModelIDInput? { get { return graphQLMap["blogID"] as! ModelIDInput? @@ -2927,7 +2935,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "blogID") } } - + public var and: [ModelPost6ConditionInput?]? { get { return graphQLMap["and"] as! [ModelPost6ConditionInput?]? @@ -2936,7 +2944,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelPost6ConditionInput?]? { get { return graphQLMap["or"] as! [ModelPost6ConditionInput?]? @@ -2945,7 +2953,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelPost6ConditionInput? { get { return graphQLMap["not"] as! ModelPost6ConditionInput? @@ -2955,14 +2963,14 @@ public struct APISwift { } } } - + public struct UpdatePost6Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID, title: String? = nil, blogId: GraphQLID? = nil) { - graphQLMap = ["id": id, "title": title, "blogID": blogId] + self.graphQLMap = ["id": id, "title": title, "blogID": blogId] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -2971,7 +2979,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var title: String? { get { return graphQLMap["title"] as! String? @@ -2980,7 +2988,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID? { get { return graphQLMap["blogID"] as! GraphQLID? @@ -2990,14 +2998,14 @@ public struct APISwift { } } } - + public struct DeletePost6Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID) { - graphQLMap = ["id": id] + self.graphQLMap = ["id": id] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -3007,14 +3015,14 @@ public struct APISwift { } } } - + public struct CreateComment6Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID? = nil, postId: GraphQLID, content: String) { - graphQLMap = ["id": id, "postID": postId, "content": content] + self.graphQLMap = ["id": id, "postID": postId, "content": content] } - + public var id: GraphQLID? { get { return graphQLMap["id"] as! GraphQLID? @@ -3023,7 +3031,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return graphQLMap["postID"] as! GraphQLID @@ -3032,7 +3040,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return graphQLMap["content"] as! String @@ -3042,14 +3050,14 @@ public struct APISwift { } } } - + public struct ModelComment6ConditionInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(postId: ModelIDInput? = nil, content: ModelStringInput? = nil, and: [ModelComment6ConditionInput?]? = nil, or: [ModelComment6ConditionInput?]? = nil, not: ModelComment6ConditionInput? = nil) { - graphQLMap = ["postID": postId, "content": content, "and": and, "or": or, "not": not] + self.graphQLMap = ["postID": postId, "content": content, "and": and, "or": or, "not": not] } - + public var postId: ModelIDInput? { get { return graphQLMap["postID"] as! ModelIDInput? @@ -3058,7 +3066,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "postID") } } - + public var content: ModelStringInput? { get { return graphQLMap["content"] as! ModelStringInput? @@ -3067,7 +3075,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "content") } } - + public var and: [ModelComment6ConditionInput?]? { get { return graphQLMap["and"] as! [ModelComment6ConditionInput?]? @@ -3076,7 +3084,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelComment6ConditionInput?]? { get { return graphQLMap["or"] as! [ModelComment6ConditionInput?]? @@ -3085,7 +3093,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelComment6ConditionInput? { get { return graphQLMap["not"] as! ModelComment6ConditionInput? @@ -3095,14 +3103,14 @@ public struct APISwift { } } } - + public struct UpdateComment6Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID, postId: GraphQLID? = nil, content: String? = nil) { - graphQLMap = ["id": id, "postID": postId, "content": content] + self.graphQLMap = ["id": id, "postID": postId, "content": content] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -3111,7 +3119,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID? { get { return graphQLMap["postID"] as! GraphQLID? @@ -3120,7 +3128,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "postID") } } - + public var content: String? { get { return graphQLMap["content"] as! String? @@ -3130,14 +3138,14 @@ public struct APISwift { } } } - + public struct DeleteComment6Input: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID) { - graphQLMap = ["id": id] + self.graphQLMap = ["id": id] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -3147,14 +3155,14 @@ public struct APISwift { } } } - + public struct CreateScalarContainerInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID? = nil, myString: String? = nil, myInt: Int? = nil, myDouble: Double? = nil, myBool: Bool? = nil, myDate: String? = nil, myTime: String? = nil, myDateTime: String? = nil, myTimeStamp: Int? = nil, myEmail: String? = nil, myJson: String? = nil, myPhone: String? = nil, myUrl: String? = nil, myIpAddress: String? = nil) { - graphQLMap = ["id": id, "myString": myString, "myInt": myInt, "myDouble": myDouble, "myBool": myBool, "myDate": myDate, "myTime": myTime, "myDateTime": myDateTime, "myTimeStamp": myTimeStamp, "myEmail": myEmail, "myJSON": myJson, "myPhone": myPhone, "myURL": myUrl, "myIPAddress": myIpAddress] + self.graphQLMap = ["id": id, "myString": myString, "myInt": myInt, "myDouble": myDouble, "myBool": myBool, "myDate": myDate, "myTime": myTime, "myDateTime": myDateTime, "myTimeStamp": myTimeStamp, "myEmail": myEmail, "myJSON": myJson, "myPhone": myPhone, "myURL": myUrl, "myIPAddress": myIpAddress] } - + public var id: GraphQLID? { get { return graphQLMap["id"] as! GraphQLID? @@ -3163,7 +3171,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var myString: String? { get { return graphQLMap["myString"] as! String? @@ -3172,7 +3180,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myString") } } - + public var myInt: Int? { get { return graphQLMap["myInt"] as! Int? @@ -3181,7 +3189,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myInt") } } - + public var myDouble: Double? { get { return graphQLMap["myDouble"] as! Double? @@ -3190,7 +3198,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myDouble") } } - + public var myBool: Bool? { get { return graphQLMap["myBool"] as! Bool? @@ -3199,7 +3207,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myBool") } } - + public var myDate: String? { get { return graphQLMap["myDate"] as! String? @@ -3208,7 +3216,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myDate") } } - + public var myTime: String? { get { return graphQLMap["myTime"] as! String? @@ -3217,7 +3225,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myTime") } } - + public var myDateTime: String? { get { return graphQLMap["myDateTime"] as! String? @@ -3226,7 +3234,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myDateTime") } } - + public var myTimeStamp: Int? { get { return graphQLMap["myTimeStamp"] as! Int? @@ -3235,7 +3243,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myTimeStamp") } } - + public var myEmail: String? { get { return graphQLMap["myEmail"] as! String? @@ -3244,7 +3252,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myEmail") } } - + public var myJson: String? { get { return graphQLMap["myJSON"] as! String? @@ -3253,7 +3261,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myJSON") } } - + public var myPhone: String? { get { return graphQLMap["myPhone"] as! String? @@ -3262,7 +3270,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myPhone") } } - + public var myUrl: String? { get { return graphQLMap["myURL"] as! String? @@ -3271,7 +3279,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myURL") } } - + public var myIpAddress: String? { get { return graphQLMap["myIPAddress"] as! String? @@ -3281,14 +3289,14 @@ public struct APISwift { } } } - + public struct ModelScalarContainerConditionInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(myString: ModelStringInput? = nil, myInt: ModelIntInput? = nil, myDouble: ModelFloatInput? = nil, myBool: ModelBooleanInput? = nil, myDate: ModelStringInput? = nil, myTime: ModelStringInput? = nil, myDateTime: ModelStringInput? = nil, myTimeStamp: ModelIntInput? = nil, myEmail: ModelStringInput? = nil, myJson: ModelStringInput? = nil, myPhone: ModelStringInput? = nil, myUrl: ModelStringInput? = nil, myIpAddress: ModelStringInput? = nil, and: [ModelScalarContainerConditionInput?]? = nil, or: [ModelScalarContainerConditionInput?]? = nil, not: ModelScalarContainerConditionInput? = nil) { - graphQLMap = ["myString": myString, "myInt": myInt, "myDouble": myDouble, "myBool": myBool, "myDate": myDate, "myTime": myTime, "myDateTime": myDateTime, "myTimeStamp": myTimeStamp, "myEmail": myEmail, "myJSON": myJson, "myPhone": myPhone, "myURL": myUrl, "myIPAddress": myIpAddress, "and": and, "or": or, "not": not] + self.graphQLMap = ["myString": myString, "myInt": myInt, "myDouble": myDouble, "myBool": myBool, "myDate": myDate, "myTime": myTime, "myDateTime": myDateTime, "myTimeStamp": myTimeStamp, "myEmail": myEmail, "myJSON": myJson, "myPhone": myPhone, "myURL": myUrl, "myIPAddress": myIpAddress, "and": and, "or": or, "not": not] } - + public var myString: ModelStringInput? { get { return graphQLMap["myString"] as! ModelStringInput? @@ -3297,7 +3305,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myString") } } - + public var myInt: ModelIntInput? { get { return graphQLMap["myInt"] as! ModelIntInput? @@ -3306,7 +3314,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myInt") } } - + public var myDouble: ModelFloatInput? { get { return graphQLMap["myDouble"] as! ModelFloatInput? @@ -3315,7 +3323,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myDouble") } } - + public var myBool: ModelBooleanInput? { get { return graphQLMap["myBool"] as! ModelBooleanInput? @@ -3324,7 +3332,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myBool") } } - + public var myDate: ModelStringInput? { get { return graphQLMap["myDate"] as! ModelStringInput? @@ -3333,7 +3341,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myDate") } } - + public var myTime: ModelStringInput? { get { return graphQLMap["myTime"] as! ModelStringInput? @@ -3342,7 +3350,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myTime") } } - + public var myDateTime: ModelStringInput? { get { return graphQLMap["myDateTime"] as! ModelStringInput? @@ -3351,7 +3359,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myDateTime") } } - + public var myTimeStamp: ModelIntInput? { get { return graphQLMap["myTimeStamp"] as! ModelIntInput? @@ -3360,7 +3368,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myTimeStamp") } } - + public var myEmail: ModelStringInput? { get { return graphQLMap["myEmail"] as! ModelStringInput? @@ -3369,7 +3377,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myEmail") } } - + public var myJson: ModelStringInput? { get { return graphQLMap["myJSON"] as! ModelStringInput? @@ -3378,7 +3386,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myJSON") } } - + public var myPhone: ModelStringInput? { get { return graphQLMap["myPhone"] as! ModelStringInput? @@ -3387,7 +3395,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myPhone") } } - + public var myUrl: ModelStringInput? { get { return graphQLMap["myURL"] as! ModelStringInput? @@ -3396,7 +3404,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myURL") } } - + public var myIpAddress: ModelStringInput? { get { return graphQLMap["myIPAddress"] as! ModelStringInput? @@ -3405,7 +3413,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myIPAddress") } } - + public var and: [ModelScalarContainerConditionInput?]? { get { return graphQLMap["and"] as! [ModelScalarContainerConditionInput?]? @@ -3414,7 +3422,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelScalarContainerConditionInput?]? { get { return graphQLMap["or"] as! [ModelScalarContainerConditionInput?]? @@ -3423,7 +3431,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelScalarContainerConditionInput? { get { return graphQLMap["not"] as! ModelScalarContainerConditionInput? @@ -3433,14 +3441,14 @@ public struct APISwift { } } } - + public struct ModelIntInput: 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, attributeExists: Bool? = nil, attributeType: ModelAttributeTypes? = nil) { - graphQLMap = ["ne": ne, "eq": eq, "le": le, "lt": lt, "ge": ge, "gt": gt, "between": between, "attributeExists": attributeExists, "attributeType": attributeType] + self.graphQLMap = ["ne": ne, "eq": eq, "le": le, "lt": lt, "ge": ge, "gt": gt, "between": between, "attributeExists": attributeExists, "attributeType": attributeType] } - + public var ne: Int? { get { return graphQLMap["ne"] as! Int? @@ -3449,7 +3457,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "ne") } } - + public var eq: Int? { get { return graphQLMap["eq"] as! Int? @@ -3458,7 +3466,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "eq") } } - + public var le: Int? { get { return graphQLMap["le"] as! Int? @@ -3467,7 +3475,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "le") } } - + public var lt: Int? { get { return graphQLMap["lt"] as! Int? @@ -3476,7 +3484,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "lt") } } - + public var ge: Int? { get { return graphQLMap["ge"] as! Int? @@ -3485,7 +3493,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "ge") } } - + public var gt: Int? { get { return graphQLMap["gt"] as! Int? @@ -3494,7 +3502,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "gt") } } - + public var between: [Int?]? { get { return graphQLMap["between"] as! [Int?]? @@ -3503,7 +3511,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "between") } } - + public var attributeExists: Bool? { get { return graphQLMap["attributeExists"] as! Bool? @@ -3512,7 +3520,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "attributeExists") } } - + public var attributeType: ModelAttributeTypes? { get { return graphQLMap["attributeType"] as! ModelAttributeTypes? @@ -3522,14 +3530,14 @@ public struct APISwift { } } } - + public struct UpdateScalarContainerInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID, myString: String? = nil, myInt: Int? = nil, myDouble: Double? = nil, myBool: Bool? = nil, myDate: String? = nil, myTime: String? = nil, myDateTime: String? = nil, myTimeStamp: Int? = nil, myEmail: String? = nil, myJson: String? = nil, myPhone: String? = nil, myUrl: String? = nil, myIpAddress: String? = nil) { - graphQLMap = ["id": id, "myString": myString, "myInt": myInt, "myDouble": myDouble, "myBool": myBool, "myDate": myDate, "myTime": myTime, "myDateTime": myDateTime, "myTimeStamp": myTimeStamp, "myEmail": myEmail, "myJSON": myJson, "myPhone": myPhone, "myURL": myUrl, "myIPAddress": myIpAddress] + self.graphQLMap = ["id": id, "myString": myString, "myInt": myInt, "myDouble": myDouble, "myBool": myBool, "myDate": myDate, "myTime": myTime, "myDateTime": myDateTime, "myTimeStamp": myTimeStamp, "myEmail": myEmail, "myJSON": myJson, "myPhone": myPhone, "myURL": myUrl, "myIPAddress": myIpAddress] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -3538,7 +3546,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var myString: String? { get { return graphQLMap["myString"] as! String? @@ -3547,7 +3555,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myString") } } - + public var myInt: Int? { get { return graphQLMap["myInt"] as! Int? @@ -3556,7 +3564,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myInt") } } - + public var myDouble: Double? { get { return graphQLMap["myDouble"] as! Double? @@ -3565,7 +3573,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myDouble") } } - + public var myBool: Bool? { get { return graphQLMap["myBool"] as! Bool? @@ -3574,7 +3582,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myBool") } } - + public var myDate: String? { get { return graphQLMap["myDate"] as! String? @@ -3583,7 +3591,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myDate") } } - + public var myTime: String? { get { return graphQLMap["myTime"] as! String? @@ -3592,7 +3600,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myTime") } } - + public var myDateTime: String? { get { return graphQLMap["myDateTime"] as! String? @@ -3601,7 +3609,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myDateTime") } } - + public var myTimeStamp: Int? { get { return graphQLMap["myTimeStamp"] as! Int? @@ -3610,7 +3618,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myTimeStamp") } } - + public var myEmail: String? { get { return graphQLMap["myEmail"] as! String? @@ -3619,7 +3627,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myEmail") } } - + public var myJson: String? { get { return graphQLMap["myJSON"] as! String? @@ -3628,7 +3636,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myJSON") } } - + public var myPhone: String? { get { return graphQLMap["myPhone"] as! String? @@ -3637,7 +3645,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myPhone") } } - + public var myUrl: String? { get { return graphQLMap["myURL"] as! String? @@ -3646,7 +3654,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myURL") } } - + public var myIpAddress: String? { get { return graphQLMap["myIPAddress"] as! String? @@ -3656,14 +3664,14 @@ public struct APISwift { } } } - + public struct DeleteScalarContainerInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID) { - graphQLMap = ["id": id] + self.graphQLMap = ["id": id] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -3673,14 +3681,14 @@ public struct APISwift { } } } - + public struct CreateListIntContainerInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID? = nil, test: Int, nullableInt: Int? = nil, intList: [Int], intNullableList: [Int]? = nil, nullableIntList: [Int?], nullableIntNullableList: [Int?]? = nil) { - graphQLMap = ["id": id, "test": test, "nullableInt": nullableInt, "intList": intList, "intNullableList": intNullableList, "nullableIntList": nullableIntList, "nullableIntNullableList": nullableIntNullableList] + self.graphQLMap = ["id": id, "test": test, "nullableInt": nullableInt, "intList": intList, "intNullableList": intNullableList, "nullableIntList": nullableIntList, "nullableIntNullableList": nullableIntNullableList] } - + public var id: GraphQLID? { get { return graphQLMap["id"] as! GraphQLID? @@ -3689,7 +3697,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var test: Int { get { return graphQLMap["test"] as! Int @@ -3698,7 +3706,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "test") } } - + public var nullableInt: Int? { get { return graphQLMap["nullableInt"] as! Int? @@ -3707,7 +3715,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableInt") } } - + public var intList: [Int] { get { return graphQLMap["intList"] as! [Int] @@ -3716,7 +3724,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "intList") } } - + public var intNullableList: [Int]? { get { return graphQLMap["intNullableList"] as! [Int]? @@ -3725,7 +3733,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "intNullableList") } } - + public var nullableIntList: [Int?] { get { return graphQLMap["nullableIntList"] as! [Int?] @@ -3734,7 +3742,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableIntList") } } - + public var nullableIntNullableList: [Int?]? { get { return graphQLMap["nullableIntNullableList"] as! [Int?]? @@ -3744,14 +3752,14 @@ public struct APISwift { } } } - + public struct ModelListIntContainerConditionInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(test: ModelIntInput? = nil, nullableInt: ModelIntInput? = nil, intList: ModelIntInput? = nil, intNullableList: ModelIntInput? = nil, nullableIntList: ModelIntInput? = nil, nullableIntNullableList: ModelIntInput? = nil, and: [ModelListIntContainerConditionInput?]? = nil, or: [ModelListIntContainerConditionInput?]? = nil, not: ModelListIntContainerConditionInput? = nil) { - graphQLMap = ["test": test, "nullableInt": nullableInt, "intList": intList, "intNullableList": intNullableList, "nullableIntList": nullableIntList, "nullableIntNullableList": nullableIntNullableList, "and": and, "or": or, "not": not] + self.graphQLMap = ["test": test, "nullableInt": nullableInt, "intList": intList, "intNullableList": intNullableList, "nullableIntList": nullableIntList, "nullableIntNullableList": nullableIntNullableList, "and": and, "or": or, "not": not] } - + public var test: ModelIntInput? { get { return graphQLMap["test"] as! ModelIntInput? @@ -3760,7 +3768,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "test") } } - + public var nullableInt: ModelIntInput? { get { return graphQLMap["nullableInt"] as! ModelIntInput? @@ -3769,7 +3777,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableInt") } } - + public var intList: ModelIntInput? { get { return graphQLMap["intList"] as! ModelIntInput? @@ -3778,7 +3786,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "intList") } } - + public var intNullableList: ModelIntInput? { get { return graphQLMap["intNullableList"] as! ModelIntInput? @@ -3787,7 +3795,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "intNullableList") } } - + public var nullableIntList: ModelIntInput? { get { return graphQLMap["nullableIntList"] as! ModelIntInput? @@ -3796,7 +3804,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableIntList") } } - + public var nullableIntNullableList: ModelIntInput? { get { return graphQLMap["nullableIntNullableList"] as! ModelIntInput? @@ -3805,7 +3813,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableIntNullableList") } } - + public var and: [ModelListIntContainerConditionInput?]? { get { return graphQLMap["and"] as! [ModelListIntContainerConditionInput?]? @@ -3814,7 +3822,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelListIntContainerConditionInput?]? { get { return graphQLMap["or"] as! [ModelListIntContainerConditionInput?]? @@ -3823,7 +3831,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelListIntContainerConditionInput? { get { return graphQLMap["not"] as! ModelListIntContainerConditionInput? @@ -3833,14 +3841,14 @@ public struct APISwift { } } } - + public struct UpdateListIntContainerInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID, test: Int? = nil, nullableInt: Int? = nil, intList: [Int]? = nil, intNullableList: [Int]? = nil, nullableIntList: [Int?]? = nil, nullableIntNullableList: [Int?]? = nil) { - graphQLMap = ["id": id, "test": test, "nullableInt": nullableInt, "intList": intList, "intNullableList": intNullableList, "nullableIntList": nullableIntList, "nullableIntNullableList": nullableIntNullableList] + self.graphQLMap = ["id": id, "test": test, "nullableInt": nullableInt, "intList": intList, "intNullableList": intNullableList, "nullableIntList": nullableIntList, "nullableIntNullableList": nullableIntNullableList] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -3849,7 +3857,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var test: Int? { get { return graphQLMap["test"] as! Int? @@ -3858,7 +3866,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "test") } } - + public var nullableInt: Int? { get { return graphQLMap["nullableInt"] as! Int? @@ -3867,7 +3875,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableInt") } } - + public var intList: [Int]? { get { return graphQLMap["intList"] as! [Int]? @@ -3876,7 +3884,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "intList") } } - + public var intNullableList: [Int]? { get { return graphQLMap["intNullableList"] as! [Int]? @@ -3885,7 +3893,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "intNullableList") } } - + public var nullableIntList: [Int?]? { get { return graphQLMap["nullableIntList"] as! [Int?]? @@ -3894,7 +3902,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableIntList") } } - + public var nullableIntNullableList: [Int?]? { get { return graphQLMap["nullableIntNullableList"] as! [Int?]? @@ -3904,14 +3912,14 @@ public struct APISwift { } } } - + public struct DeleteListIntContainerInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID) { - graphQLMap = ["id": id] + self.graphQLMap = ["id": id] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -3921,14 +3929,14 @@ public struct APISwift { } } } - + public struct CreateListStringContainerInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID? = nil, test: String, nullableString: String? = nil, stringList: [String], stringNullableList: [String]? = nil, nullableStringList: [String?], nullableStringNullableList: [String?]? = nil) { - graphQLMap = ["id": id, "test": test, "nullableString": nullableString, "stringList": stringList, "stringNullableList": stringNullableList, "nullableStringList": nullableStringList, "nullableStringNullableList": nullableStringNullableList] + self.graphQLMap = ["id": id, "test": test, "nullableString": nullableString, "stringList": stringList, "stringNullableList": stringNullableList, "nullableStringList": nullableStringList, "nullableStringNullableList": nullableStringNullableList] } - + public var id: GraphQLID? { get { return graphQLMap["id"] as! GraphQLID? @@ -3937,7 +3945,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var test: String { get { return graphQLMap["test"] as! String @@ -3946,7 +3954,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "test") } } - + public var nullableString: String? { get { return graphQLMap["nullableString"] as! String? @@ -3955,7 +3963,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableString") } } - + public var stringList: [String] { get { return graphQLMap["stringList"] as! [String] @@ -3964,7 +3972,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "stringList") } } - + public var stringNullableList: [String]? { get { return graphQLMap["stringNullableList"] as! [String]? @@ -3973,7 +3981,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "stringNullableList") } } - + public var nullableStringList: [String?] { get { return graphQLMap["nullableStringList"] as! [String?] @@ -3982,7 +3990,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableStringList") } } - + public var nullableStringNullableList: [String?]? { get { return graphQLMap["nullableStringNullableList"] as! [String?]? @@ -3992,14 +4000,14 @@ public struct APISwift { } } } - + public struct ModelListStringContainerConditionInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(test: ModelStringInput? = nil, nullableString: ModelStringInput? = nil, stringList: ModelStringInput? = nil, stringNullableList: ModelStringInput? = nil, nullableStringList: ModelStringInput? = nil, nullableStringNullableList: ModelStringInput? = nil, and: [ModelListStringContainerConditionInput?]? = nil, or: [ModelListStringContainerConditionInput?]? = nil, not: ModelListStringContainerConditionInput? = nil) { - graphQLMap = ["test": test, "nullableString": nullableString, "stringList": stringList, "stringNullableList": stringNullableList, "nullableStringList": nullableStringList, "nullableStringNullableList": nullableStringNullableList, "and": and, "or": or, "not": not] + self.graphQLMap = ["test": test, "nullableString": nullableString, "stringList": stringList, "stringNullableList": stringNullableList, "nullableStringList": nullableStringList, "nullableStringNullableList": nullableStringNullableList, "and": and, "or": or, "not": not] } - + public var test: ModelStringInput? { get { return graphQLMap["test"] as! ModelStringInput? @@ -4008,7 +4016,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "test") } } - + public var nullableString: ModelStringInput? { get { return graphQLMap["nullableString"] as! ModelStringInput? @@ -4017,7 +4025,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableString") } } - + public var stringList: ModelStringInput? { get { return graphQLMap["stringList"] as! ModelStringInput? @@ -4026,7 +4034,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "stringList") } } - + public var stringNullableList: ModelStringInput? { get { return graphQLMap["stringNullableList"] as! ModelStringInput? @@ -4035,7 +4043,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "stringNullableList") } } - + public var nullableStringList: ModelStringInput? { get { return graphQLMap["nullableStringList"] as! ModelStringInput? @@ -4044,7 +4052,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableStringList") } } - + public var nullableStringNullableList: ModelStringInput? { get { return graphQLMap["nullableStringNullableList"] as! ModelStringInput? @@ -4053,7 +4061,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableStringNullableList") } } - + public var and: [ModelListStringContainerConditionInput?]? { get { return graphQLMap["and"] as! [ModelListStringContainerConditionInput?]? @@ -4062,7 +4070,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelListStringContainerConditionInput?]? { get { return graphQLMap["or"] as! [ModelListStringContainerConditionInput?]? @@ -4071,7 +4079,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelListStringContainerConditionInput? { get { return graphQLMap["not"] as! ModelListStringContainerConditionInput? @@ -4081,14 +4089,14 @@ public struct APISwift { } } } - + public struct UpdateListStringContainerInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID, test: String? = nil, nullableString: String? = nil, stringList: [String]? = nil, stringNullableList: [String]? = nil, nullableStringList: [String?]? = nil, nullableStringNullableList: [String?]? = nil) { - graphQLMap = ["id": id, "test": test, "nullableString": nullableString, "stringList": stringList, "stringNullableList": stringNullableList, "nullableStringList": nullableStringList, "nullableStringNullableList": nullableStringNullableList] + self.graphQLMap = ["id": id, "test": test, "nullableString": nullableString, "stringList": stringList, "stringNullableList": stringNullableList, "nullableStringList": nullableStringList, "nullableStringNullableList": nullableStringNullableList] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -4097,7 +4105,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var test: String? { get { return graphQLMap["test"] as! String? @@ -4106,7 +4114,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "test") } } - + public var nullableString: String? { get { return graphQLMap["nullableString"] as! String? @@ -4115,7 +4123,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableString") } } - + public var stringList: [String]? { get { return graphQLMap["stringList"] as! [String]? @@ -4124,7 +4132,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "stringList") } } - + public var stringNullableList: [String]? { get { return graphQLMap["stringNullableList"] as! [String]? @@ -4133,7 +4141,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "stringNullableList") } } - + public var nullableStringList: [String?]? { get { return graphQLMap["nullableStringList"] as! [String?]? @@ -4142,7 +4150,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableStringList") } } - + public var nullableStringNullableList: [String?]? { get { return graphQLMap["nullableStringNullableList"] as! [String?]? @@ -4152,14 +4160,14 @@ public struct APISwift { } } } - + public struct DeleteListStringContainerInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID) { - graphQLMap = ["id": id] + self.graphQLMap = ["id": id] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -4169,14 +4177,14 @@ public struct APISwift { } } } - + public struct CreateEnumTestModelInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID? = nil, enumVal: TestEnum, nullableEnumVal: TestEnum? = nil, enumList: [TestEnum], enumNullableList: [TestEnum]? = nil, nullableEnumList: [TestEnum?], nullableEnumNullableList: [TestEnum?]? = nil) { - graphQLMap = ["id": id, "enumVal": enumVal, "nullableEnumVal": nullableEnumVal, "enumList": enumList, "enumNullableList": enumNullableList, "nullableEnumList": nullableEnumList, "nullableEnumNullableList": nullableEnumNullableList] + self.graphQLMap = ["id": id, "enumVal": enumVal, "nullableEnumVal": nullableEnumVal, "enumList": enumList, "enumNullableList": enumNullableList, "nullableEnumList": nullableEnumList, "nullableEnumNullableList": nullableEnumNullableList] } - + public var id: GraphQLID? { get { return graphQLMap["id"] as! GraphQLID? @@ -4185,7 +4193,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var enumVal: TestEnum { get { return graphQLMap["enumVal"] as! TestEnum @@ -4194,7 +4202,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "enumVal") } } - + public var nullableEnumVal: TestEnum? { get { return graphQLMap["nullableEnumVal"] as! TestEnum? @@ -4203,7 +4211,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableEnumVal") } } - + public var enumList: [TestEnum] { get { return graphQLMap["enumList"] as! [TestEnum] @@ -4212,7 +4220,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "enumList") } } - + public var enumNullableList: [TestEnum]? { get { return graphQLMap["enumNullableList"] as! [TestEnum]? @@ -4221,7 +4229,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "enumNullableList") } } - + public var nullableEnumList: [TestEnum?] { get { return graphQLMap["nullableEnumList"] as! [TestEnum?] @@ -4230,7 +4238,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableEnumList") } } - + public var nullableEnumNullableList: [TestEnum?]? { get { return graphQLMap["nullableEnumNullableList"] as! [TestEnum?]? @@ -4240,14 +4248,14 @@ public struct APISwift { } } } - + public enum TestEnum: RawRepresentable, Equatable, JSONDecodable, JSONEncodable { public typealias RawValue = String case valueOne case valueTwo /// Auto generated constant for unknown enum values case unknown(RawValue) - + public init?(rawValue: RawValue) { switch rawValue { case "VALUE_ONE": self = .valueOne @@ -4255,7 +4263,7 @@ public struct APISwift { default: self = .unknown(rawValue) } } - + public var rawValue: RawValue { switch self { case .valueOne: return "VALUE_ONE" @@ -4263,7 +4271,7 @@ public struct APISwift { case .unknown(let value): return value } } - + public static func == (lhs: TestEnum, rhs: TestEnum) -> Bool { switch (lhs, rhs) { case (.valueOne, .valueOne): return true @@ -4273,14 +4281,14 @@ public struct APISwift { } } } - + public struct ModelEnumTestModelConditionInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(enumVal: ModelTestEnumInput? = nil, nullableEnumVal: ModelTestEnumInput? = nil, enumList: ModelTestEnumListInput? = nil, enumNullableList: ModelTestEnumListInput? = nil, nullableEnumList: ModelTestEnumListInput? = nil, nullableEnumNullableList: ModelTestEnumListInput? = nil, and: [ModelEnumTestModelConditionInput?]? = nil, or: [ModelEnumTestModelConditionInput?]? = nil, not: ModelEnumTestModelConditionInput? = nil) { - graphQLMap = ["enumVal": enumVal, "nullableEnumVal": nullableEnumVal, "enumList": enumList, "enumNullableList": enumNullableList, "nullableEnumList": nullableEnumList, "nullableEnumNullableList": nullableEnumNullableList, "and": and, "or": or, "not": not] + self.graphQLMap = ["enumVal": enumVal, "nullableEnumVal": nullableEnumVal, "enumList": enumList, "enumNullableList": enumNullableList, "nullableEnumList": nullableEnumList, "nullableEnumNullableList": nullableEnumNullableList, "and": and, "or": or, "not": not] } - + public var enumVal: ModelTestEnumInput? { get { return graphQLMap["enumVal"] as! ModelTestEnumInput? @@ -4289,7 +4297,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "enumVal") } } - + public var nullableEnumVal: ModelTestEnumInput? { get { return graphQLMap["nullableEnumVal"] as! ModelTestEnumInput? @@ -4298,7 +4306,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableEnumVal") } } - + public var enumList: ModelTestEnumListInput? { get { return graphQLMap["enumList"] as! ModelTestEnumListInput? @@ -4307,7 +4315,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "enumList") } } - + public var enumNullableList: ModelTestEnumListInput? { get { return graphQLMap["enumNullableList"] as! ModelTestEnumListInput? @@ -4316,7 +4324,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "enumNullableList") } } - + public var nullableEnumList: ModelTestEnumListInput? { get { return graphQLMap["nullableEnumList"] as! ModelTestEnumListInput? @@ -4325,7 +4333,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableEnumList") } } - + public var nullableEnumNullableList: ModelTestEnumListInput? { get { return graphQLMap["nullableEnumNullableList"] as! ModelTestEnumListInput? @@ -4334,7 +4342,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableEnumNullableList") } } - + public var and: [ModelEnumTestModelConditionInput?]? { get { return graphQLMap["and"] as! [ModelEnumTestModelConditionInput?]? @@ -4343,7 +4351,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelEnumTestModelConditionInput?]? { get { return graphQLMap["or"] as! [ModelEnumTestModelConditionInput?]? @@ -4352,7 +4360,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelEnumTestModelConditionInput? { get { return graphQLMap["not"] as! ModelEnumTestModelConditionInput? @@ -4362,14 +4370,14 @@ public struct APISwift { } } } - + public struct ModelTestEnumInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(eq: TestEnum? = nil, ne: TestEnum? = nil) { - graphQLMap = ["eq": eq, "ne": ne] + self.graphQLMap = ["eq": eq, "ne": ne] } - + public var eq: TestEnum? { get { return graphQLMap["eq"] as! TestEnum? @@ -4378,7 +4386,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "eq") } } - + public var ne: TestEnum? { get { return graphQLMap["ne"] as! TestEnum? @@ -4388,14 +4396,14 @@ public struct APISwift { } } } - + public struct ModelTestEnumListInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(eq: [TestEnum?]? = nil, ne: [TestEnum?]? = nil, contains: TestEnum? = nil, notContains: TestEnum? = nil) { - graphQLMap = ["eq": eq, "ne": ne, "contains": contains, "notContains": notContains] + self.graphQLMap = ["eq": eq, "ne": ne, "contains": contains, "notContains": notContains] } - + public var eq: [TestEnum?]? { get { return graphQLMap["eq"] as! [TestEnum?]? @@ -4404,7 +4412,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "eq") } } - + public var ne: [TestEnum?]? { get { return graphQLMap["ne"] as! [TestEnum?]? @@ -4413,7 +4421,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "ne") } } - + public var contains: TestEnum? { get { return graphQLMap["contains"] as! TestEnum? @@ -4422,7 +4430,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "contains") } } - + public var notContains: TestEnum? { get { return graphQLMap["notContains"] as! TestEnum? @@ -4432,14 +4440,14 @@ public struct APISwift { } } } - + public struct UpdateEnumTestModelInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID, enumVal: TestEnum? = nil, nullableEnumVal: TestEnum? = nil, enumList: [TestEnum]? = nil, enumNullableList: [TestEnum]? = nil, nullableEnumList: [TestEnum?]? = nil, nullableEnumNullableList: [TestEnum?]? = nil) { - graphQLMap = ["id": id, "enumVal": enumVal, "nullableEnumVal": nullableEnumVal, "enumList": enumList, "enumNullableList": enumNullableList, "nullableEnumList": nullableEnumList, "nullableEnumNullableList": nullableEnumNullableList] + self.graphQLMap = ["id": id, "enumVal": enumVal, "nullableEnumVal": nullableEnumVal, "enumList": enumList, "enumNullableList": enumNullableList, "nullableEnumList": nullableEnumList, "nullableEnumNullableList": nullableEnumNullableList] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -4448,7 +4456,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var enumVal: TestEnum? { get { return graphQLMap["enumVal"] as! TestEnum? @@ -4457,7 +4465,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "enumVal") } } - + public var nullableEnumVal: TestEnum? { get { return graphQLMap["nullableEnumVal"] as! TestEnum? @@ -4466,7 +4474,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableEnumVal") } } - + public var enumList: [TestEnum]? { get { return graphQLMap["enumList"] as! [TestEnum]? @@ -4475,7 +4483,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "enumList") } } - + public var enumNullableList: [TestEnum]? { get { return graphQLMap["enumNullableList"] as! [TestEnum]? @@ -4484,7 +4492,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "enumNullableList") } } - + public var nullableEnumList: [TestEnum?]? { get { return graphQLMap["nullableEnumList"] as! [TestEnum?]? @@ -4493,7 +4501,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableEnumList") } } - + public var nullableEnumNullableList: [TestEnum?]? { get { return graphQLMap["nullableEnumNullableList"] as! [TestEnum?]? @@ -4503,14 +4511,14 @@ public struct APISwift { } } } - + public struct DeleteEnumTestModelInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID) { - graphQLMap = ["id": id] + self.graphQLMap = ["id": id] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -4520,14 +4528,14 @@ public struct APISwift { } } } - + public struct CreateNestedTypeTestModelInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID? = nil, nestedVal: NestedInput, nullableNestedVal: NestedInput? = nil, nestedList: [NestedInput], nestedNullableList: [NestedInput]? = nil, nullableNestedList: [NestedInput?], nullableNestedNullableList: [NestedInput?]? = nil) { - graphQLMap = ["id": id, "nestedVal": nestedVal, "nullableNestedVal": nullableNestedVal, "nestedList": nestedList, "nestedNullableList": nestedNullableList, "nullableNestedList": nullableNestedList, "nullableNestedNullableList": nullableNestedNullableList] + self.graphQLMap = ["id": id, "nestedVal": nestedVal, "nullableNestedVal": nullableNestedVal, "nestedList": nestedList, "nestedNullableList": nestedNullableList, "nullableNestedList": nullableNestedList, "nullableNestedNullableList": nullableNestedNullableList] } - + public var id: GraphQLID? { get { return graphQLMap["id"] as! GraphQLID? @@ -4536,7 +4544,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var nestedVal: NestedInput { get { return graphQLMap["nestedVal"] as! NestedInput @@ -4545,7 +4553,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nestedVal") } } - + public var nullableNestedVal: NestedInput? { get { return graphQLMap["nullableNestedVal"] as! NestedInput? @@ -4554,7 +4562,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableNestedVal") } } - + public var nestedList: [NestedInput] { get { return graphQLMap["nestedList"] as! [NestedInput] @@ -4563,7 +4571,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nestedList") } } - + public var nestedNullableList: [NestedInput]? { get { return graphQLMap["nestedNullableList"] as! [NestedInput]? @@ -4572,7 +4580,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nestedNullableList") } } - + public var nullableNestedList: [NestedInput?] { get { return graphQLMap["nullableNestedList"] as! [NestedInput?] @@ -4581,7 +4589,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableNestedList") } } - + public var nullableNestedNullableList: [NestedInput?]? { get { return graphQLMap["nullableNestedNullableList"] as! [NestedInput?]? @@ -4591,14 +4599,14 @@ public struct APISwift { } } } - + public struct NestedInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { - graphQLMap = ["valueOne": valueOne, "valueTwo": valueTwo] + self.graphQLMap = ["valueOne": valueOne, "valueTwo": valueTwo] } - + public var valueOne: Int? { get { return graphQLMap["valueOne"] as! Int? @@ -4607,7 +4615,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return graphQLMap["valueTwo"] as! String? @@ -4617,14 +4625,14 @@ public struct APISwift { } } } - + public struct ModelNestedTypeTestModelConditionInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(and: [ModelNestedTypeTestModelConditionInput?]? = nil, or: [ModelNestedTypeTestModelConditionInput?]? = nil, not: ModelNestedTypeTestModelConditionInput? = nil) { - graphQLMap = ["and": and, "or": or, "not": not] + self.graphQLMap = ["and": and, "or": or, "not": not] } - + public var and: [ModelNestedTypeTestModelConditionInput?]? { get { return graphQLMap["and"] as! [ModelNestedTypeTestModelConditionInput?]? @@ -4633,7 +4641,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelNestedTypeTestModelConditionInput?]? { get { return graphQLMap["or"] as! [ModelNestedTypeTestModelConditionInput?]? @@ -4642,7 +4650,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelNestedTypeTestModelConditionInput? { get { return graphQLMap["not"] as! ModelNestedTypeTestModelConditionInput? @@ -4652,14 +4660,14 @@ public struct APISwift { } } } - + public struct UpdateNestedTypeTestModelInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID, nestedVal: NestedInput? = nil, nullableNestedVal: NestedInput? = nil, nestedList: [NestedInput]? = nil, nestedNullableList: [NestedInput]? = nil, nullableNestedList: [NestedInput?]? = nil, nullableNestedNullableList: [NestedInput?]? = nil) { - graphQLMap = ["id": id, "nestedVal": nestedVal, "nullableNestedVal": nullableNestedVal, "nestedList": nestedList, "nestedNullableList": nestedNullableList, "nullableNestedList": nullableNestedList, "nullableNestedNullableList": nullableNestedNullableList] + self.graphQLMap = ["id": id, "nestedVal": nestedVal, "nullableNestedVal": nullableNestedVal, "nestedList": nestedList, "nestedNullableList": nestedNullableList, "nullableNestedList": nullableNestedList, "nullableNestedNullableList": nullableNestedNullableList] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -4668,7 +4676,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var nestedVal: NestedInput? { get { return graphQLMap["nestedVal"] as! NestedInput? @@ -4677,7 +4685,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nestedVal") } } - + public var nullableNestedVal: NestedInput? { get { return graphQLMap["nullableNestedVal"] as! NestedInput? @@ -4686,7 +4694,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableNestedVal") } } - + public var nestedList: [NestedInput]? { get { return graphQLMap["nestedList"] as! [NestedInput]? @@ -4695,7 +4703,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nestedList") } } - + public var nestedNullableList: [NestedInput]? { get { return graphQLMap["nestedNullableList"] as! [NestedInput]? @@ -4704,7 +4712,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nestedNullableList") } } - + public var nullableNestedList: [NestedInput?]? { get { return graphQLMap["nullableNestedList"] as! [NestedInput?]? @@ -4713,7 +4721,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableNestedList") } } - + public var nullableNestedNullableList: [NestedInput?]? { get { return graphQLMap["nullableNestedNullableList"] as! [NestedInput?]? @@ -4723,14 +4731,14 @@ public struct APISwift { } } } - + public struct DeleteNestedTypeTestModelInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID) { - graphQLMap = ["id": id] + self.graphQLMap = ["id": id] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -4740,14 +4748,14 @@ public struct APISwift { } } } - + public struct ModelPostFilterInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: ModelIDInput? = nil, title: ModelStringInput? = nil, content: ModelStringInput? = nil, createdAt: ModelStringInput? = nil, updatedAt: ModelStringInput? = nil, draft: ModelBooleanInput? = nil, rating: ModelFloatInput? = nil, status: ModelPostStatusInput? = nil, and: [ModelPostFilterInput?]? = nil, or: [ModelPostFilterInput?]? = nil, not: ModelPostFilterInput? = nil) { - graphQLMap = ["id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "and": and, "or": or, "not": not] + self.graphQLMap = ["id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "and": and, "or": or, "not": not] } - + public var id: ModelIDInput? { get { return graphQLMap["id"] as! ModelIDInput? @@ -4756,7 +4764,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var title: ModelStringInput? { get { return graphQLMap["title"] as! ModelStringInput? @@ -4765,7 +4773,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "title") } } - + public var content: ModelStringInput? { get { return graphQLMap["content"] as! ModelStringInput? @@ -4774,7 +4782,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "content") } } - + public var createdAt: ModelStringInput? { get { return graphQLMap["createdAt"] as! ModelStringInput? @@ -4783,7 +4791,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: ModelStringInput? { get { return graphQLMap["updatedAt"] as! ModelStringInput? @@ -4792,7 +4800,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "updatedAt") } } - + public var draft: ModelBooleanInput? { get { return graphQLMap["draft"] as! ModelBooleanInput? @@ -4801,7 +4809,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "draft") } } - + public var rating: ModelFloatInput? { get { return graphQLMap["rating"] as! ModelFloatInput? @@ -4810,7 +4818,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "rating") } } - + public var status: ModelPostStatusInput? { get { return graphQLMap["status"] as! ModelPostStatusInput? @@ -4819,7 +4827,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "status") } } - + public var and: [ModelPostFilterInput?]? { get { return graphQLMap["and"] as! [ModelPostFilterInput?]? @@ -4828,7 +4836,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelPostFilterInput?]? { get { return graphQLMap["or"] as! [ModelPostFilterInput?]? @@ -4837,7 +4845,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelPostFilterInput? { get { return graphQLMap["not"] as! ModelPostFilterInput? @@ -4847,14 +4855,14 @@ public struct APISwift { } } } - + public struct ModelCommentFilterInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: ModelIDInput? = nil, content: ModelStringInput? = nil, createdAt: ModelStringInput? = nil, and: [ModelCommentFilterInput?]? = nil, or: [ModelCommentFilterInput?]? = nil, not: ModelCommentFilterInput? = nil) { - graphQLMap = ["id": id, "content": content, "createdAt": createdAt, "and": and, "or": or, "not": not] + self.graphQLMap = ["id": id, "content": content, "createdAt": createdAt, "and": and, "or": or, "not": not] } - + public var id: ModelIDInput? { get { return graphQLMap["id"] as! ModelIDInput? @@ -4863,7 +4871,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var content: ModelStringInput? { get { return graphQLMap["content"] as! ModelStringInput? @@ -4872,7 +4880,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "content") } } - + public var createdAt: ModelStringInput? { get { return graphQLMap["createdAt"] as! ModelStringInput? @@ -4881,7 +4889,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "createdAt") } } - + public var and: [ModelCommentFilterInput?]? { get { return graphQLMap["and"] as! [ModelCommentFilterInput?]? @@ -4890,7 +4898,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelCommentFilterInput?]? { get { return graphQLMap["or"] as! [ModelCommentFilterInput?]? @@ -4899,7 +4907,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelCommentFilterInput? { get { return graphQLMap["not"] as! ModelCommentFilterInput? @@ -4909,14 +4917,14 @@ public struct APISwift { } } } - + public struct ModelProject1FilterInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: ModelIDInput? = nil, name: ModelStringInput? = nil, and: [ModelProject1FilterInput?]? = nil, or: [ModelProject1FilterInput?]? = nil, not: ModelProject1FilterInput? = nil) { - graphQLMap = ["id": id, "name": name, "and": and, "or": or, "not": not] + self.graphQLMap = ["id": id, "name": name, "and": and, "or": or, "not": not] } - + public var id: ModelIDInput? { get { return graphQLMap["id"] as! ModelIDInput? @@ -4925,7 +4933,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var name: ModelStringInput? { get { return graphQLMap["name"] as! ModelStringInput? @@ -4934,7 +4942,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "name") } } - + public var and: [ModelProject1FilterInput?]? { get { return graphQLMap["and"] as! [ModelProject1FilterInput?]? @@ -4943,7 +4951,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelProject1FilterInput?]? { get { return graphQLMap["or"] as! [ModelProject1FilterInput?]? @@ -4952,7 +4960,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelProject1FilterInput? { get { return graphQLMap["not"] as! ModelProject1FilterInput? @@ -4962,14 +4970,14 @@ public struct APISwift { } } } - + public struct ModelTeam1FilterInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: ModelIDInput? = nil, name: ModelStringInput? = nil, and: [ModelTeam1FilterInput?]? = nil, or: [ModelTeam1FilterInput?]? = nil, not: ModelTeam1FilterInput? = nil) { - graphQLMap = ["id": id, "name": name, "and": and, "or": or, "not": not] + self.graphQLMap = ["id": id, "name": name, "and": and, "or": or, "not": not] } - + public var id: ModelIDInput? { get { return graphQLMap["id"] as! ModelIDInput? @@ -4978,7 +4986,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var name: ModelStringInput? { get { return graphQLMap["name"] as! ModelStringInput? @@ -4987,7 +4995,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "name") } } - + public var and: [ModelTeam1FilterInput?]? { get { return graphQLMap["and"] as! [ModelTeam1FilterInput?]? @@ -4996,7 +5004,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelTeam1FilterInput?]? { get { return graphQLMap["or"] as! [ModelTeam1FilterInput?]? @@ -5005,7 +5013,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelTeam1FilterInput? { get { return graphQLMap["not"] as! ModelTeam1FilterInput? @@ -5015,14 +5023,14 @@ public struct APISwift { } } } - + public struct ModelProject2FilterInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: ModelIDInput? = nil, name: ModelStringInput? = nil, teamId: ModelIDInput? = nil, and: [ModelProject2FilterInput?]? = nil, or: [ModelProject2FilterInput?]? = nil, not: ModelProject2FilterInput? = nil) { - graphQLMap = ["id": id, "name": name, "teamID": teamId, "and": and, "or": or, "not": not] + self.graphQLMap = ["id": id, "name": name, "teamID": teamId, "and": and, "or": or, "not": not] } - + public var id: ModelIDInput? { get { return graphQLMap["id"] as! ModelIDInput? @@ -5031,7 +5039,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var name: ModelStringInput? { get { return graphQLMap["name"] as! ModelStringInput? @@ -5040,7 +5048,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "name") } } - + public var teamId: ModelIDInput? { get { return graphQLMap["teamID"] as! ModelIDInput? @@ -5049,7 +5057,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "teamID") } } - + public var and: [ModelProject2FilterInput?]? { get { return graphQLMap["and"] as! [ModelProject2FilterInput?]? @@ -5058,7 +5066,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelProject2FilterInput?]? { get { return graphQLMap["or"] as! [ModelProject2FilterInput?]? @@ -5067,7 +5075,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelProject2FilterInput? { get { return graphQLMap["not"] as! ModelProject2FilterInput? @@ -5077,14 +5085,14 @@ public struct APISwift { } } } - + public struct ModelTeam2FilterInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: ModelIDInput? = nil, name: ModelStringInput? = nil, and: [ModelTeam2FilterInput?]? = nil, or: [ModelTeam2FilterInput?]? = nil, not: ModelTeam2FilterInput? = nil) { - graphQLMap = ["id": id, "name": name, "and": and, "or": or, "not": not] + self.graphQLMap = ["id": id, "name": name, "and": and, "or": or, "not": not] } - + public var id: ModelIDInput? { get { return graphQLMap["id"] as! ModelIDInput? @@ -5093,7 +5101,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var name: ModelStringInput? { get { return graphQLMap["name"] as! ModelStringInput? @@ -5102,7 +5110,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "name") } } - + public var and: [ModelTeam2FilterInput?]? { get { return graphQLMap["and"] as! [ModelTeam2FilterInput?]? @@ -5111,7 +5119,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelTeam2FilterInput?]? { get { return graphQLMap["or"] as! [ModelTeam2FilterInput?]? @@ -5120,7 +5128,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelTeam2FilterInput? { get { return graphQLMap["not"] as! ModelTeam2FilterInput? @@ -5130,14 +5138,14 @@ public struct APISwift { } } } - + public struct ModelPost3FilterInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: ModelIDInput? = nil, title: ModelStringInput? = nil, and: [ModelPost3FilterInput?]? = nil, or: [ModelPost3FilterInput?]? = nil, not: ModelPost3FilterInput? = nil) { - graphQLMap = ["id": id, "title": title, "and": and, "or": or, "not": not] + self.graphQLMap = ["id": id, "title": title, "and": and, "or": or, "not": not] } - + public var id: ModelIDInput? { get { return graphQLMap["id"] as! ModelIDInput? @@ -5146,7 +5154,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var title: ModelStringInput? { get { return graphQLMap["title"] as! ModelStringInput? @@ -5155,7 +5163,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "title") } } - + public var and: [ModelPost3FilterInput?]? { get { return graphQLMap["and"] as! [ModelPost3FilterInput?]? @@ -5164,7 +5172,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelPost3FilterInput?]? { get { return graphQLMap["or"] as! [ModelPost3FilterInput?]? @@ -5173,7 +5181,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelPost3FilterInput? { get { return graphQLMap["not"] as! ModelPost3FilterInput? @@ -5183,14 +5191,14 @@ public struct APISwift { } } } - + public struct ModelComment3FilterInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: ModelIDInput? = nil, postId: ModelIDInput? = nil, content: ModelStringInput? = nil, and: [ModelComment3FilterInput?]? = nil, or: [ModelComment3FilterInput?]? = nil, not: ModelComment3FilterInput? = nil) { - graphQLMap = ["id": id, "postID": postId, "content": content, "and": and, "or": or, "not": not] + self.graphQLMap = ["id": id, "postID": postId, "content": content, "and": and, "or": or, "not": not] } - + public var id: ModelIDInput? { get { return graphQLMap["id"] as! ModelIDInput? @@ -5199,7 +5207,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var postId: ModelIDInput? { get { return graphQLMap["postID"] as! ModelIDInput? @@ -5208,7 +5216,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "postID") } } - + public var content: ModelStringInput? { get { return graphQLMap["content"] as! ModelStringInput? @@ -5217,7 +5225,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "content") } } - + public var and: [ModelComment3FilterInput?]? { get { return graphQLMap["and"] as! [ModelComment3FilterInput?]? @@ -5226,7 +5234,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelComment3FilterInput?]? { get { return graphQLMap["or"] as! [ModelComment3FilterInput?]? @@ -5235,7 +5243,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelComment3FilterInput? { get { return graphQLMap["not"] as! ModelComment3FilterInput? @@ -5245,14 +5253,14 @@ public struct APISwift { } } } - + public struct ModelPost4FilterInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: ModelIDInput? = nil, title: ModelStringInput? = nil, and: [ModelPost4FilterInput?]? = nil, or: [ModelPost4FilterInput?]? = nil, not: ModelPost4FilterInput? = nil) { - graphQLMap = ["id": id, "title": title, "and": and, "or": or, "not": not] + self.graphQLMap = ["id": id, "title": title, "and": and, "or": or, "not": not] } - + public var id: ModelIDInput? { get { return graphQLMap["id"] as! ModelIDInput? @@ -5261,7 +5269,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var title: ModelStringInput? { get { return graphQLMap["title"] as! ModelStringInput? @@ -5270,7 +5278,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "title") } } - + public var and: [ModelPost4FilterInput?]? { get { return graphQLMap["and"] as! [ModelPost4FilterInput?]? @@ -5279,7 +5287,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelPost4FilterInput?]? { get { return graphQLMap["or"] as! [ModelPost4FilterInput?]? @@ -5288,7 +5296,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelPost4FilterInput? { get { return graphQLMap["not"] as! ModelPost4FilterInput? @@ -5298,14 +5306,14 @@ public struct APISwift { } } } - + public struct ModelComment4FilterInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: ModelIDInput? = nil, postId: ModelIDInput? = nil, content: ModelStringInput? = nil, and: [ModelComment4FilterInput?]? = nil, or: [ModelComment4FilterInput?]? = nil, not: ModelComment4FilterInput? = nil) { - graphQLMap = ["id": id, "postID": postId, "content": content, "and": and, "or": or, "not": not] + self.graphQLMap = ["id": id, "postID": postId, "content": content, "and": and, "or": or, "not": not] } - + public var id: ModelIDInput? { get { return graphQLMap["id"] as! ModelIDInput? @@ -5314,7 +5322,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var postId: ModelIDInput? { get { return graphQLMap["postID"] as! ModelIDInput? @@ -5323,7 +5331,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "postID") } } - + public var content: ModelStringInput? { get { return graphQLMap["content"] as! ModelStringInput? @@ -5332,7 +5340,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "content") } } - + public var and: [ModelComment4FilterInput?]? { get { return graphQLMap["and"] as! [ModelComment4FilterInput?]? @@ -5341,7 +5349,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelComment4FilterInput?]? { get { return graphQLMap["or"] as! [ModelComment4FilterInput?]? @@ -5350,7 +5358,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelComment4FilterInput? { get { return graphQLMap["not"] as! ModelComment4FilterInput? @@ -5360,14 +5368,14 @@ public struct APISwift { } } } - + public struct ModelPost5FilterInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: ModelIDInput? = nil, title: ModelStringInput? = nil, and: [ModelPost5FilterInput?]? = nil, or: [ModelPost5FilterInput?]? = nil, not: ModelPost5FilterInput? = nil) { - graphQLMap = ["id": id, "title": title, "and": and, "or": or, "not": not] + self.graphQLMap = ["id": id, "title": title, "and": and, "or": or, "not": not] } - + public var id: ModelIDInput? { get { return graphQLMap["id"] as! ModelIDInput? @@ -5376,7 +5384,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var title: ModelStringInput? { get { return graphQLMap["title"] as! ModelStringInput? @@ -5385,7 +5393,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "title") } } - + public var and: [ModelPost5FilterInput?]? { get { return graphQLMap["and"] as! [ModelPost5FilterInput?]? @@ -5394,7 +5402,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelPost5FilterInput?]? { get { return graphQLMap["or"] as! [ModelPost5FilterInput?]? @@ -5403,7 +5411,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelPost5FilterInput? { get { return graphQLMap["not"] as! ModelPost5FilterInput? @@ -5413,14 +5421,14 @@ public struct APISwift { } } } - + public struct ModelPostEditor5FilterInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: ModelIDInput? = nil, postId: ModelIDInput? = nil, editorId: ModelIDInput? = nil, and: [ModelPostEditor5FilterInput?]? = nil, or: [ModelPostEditor5FilterInput?]? = nil, not: ModelPostEditor5FilterInput? = nil) { - graphQLMap = ["id": id, "postID": postId, "editorID": editorId, "and": and, "or": or, "not": not] + self.graphQLMap = ["id": id, "postID": postId, "editorID": editorId, "and": and, "or": or, "not": not] } - + public var id: ModelIDInput? { get { return graphQLMap["id"] as! ModelIDInput? @@ -5429,7 +5437,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var postId: ModelIDInput? { get { return graphQLMap["postID"] as! ModelIDInput? @@ -5438,7 +5446,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "postID") } } - + public var editorId: ModelIDInput? { get { return graphQLMap["editorID"] as! ModelIDInput? @@ -5447,7 +5455,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "editorID") } } - + public var and: [ModelPostEditor5FilterInput?]? { get { return graphQLMap["and"] as! [ModelPostEditor5FilterInput?]? @@ -5456,7 +5464,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelPostEditor5FilterInput?]? { get { return graphQLMap["or"] as! [ModelPostEditor5FilterInput?]? @@ -5465,7 +5473,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelPostEditor5FilterInput? { get { return graphQLMap["not"] as! ModelPostEditor5FilterInput? @@ -5475,14 +5483,14 @@ public struct APISwift { } } } - + public struct ModelUser5FilterInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: ModelIDInput? = nil, username: ModelStringInput? = nil, and: [ModelUser5FilterInput?]? = nil, or: [ModelUser5FilterInput?]? = nil, not: ModelUser5FilterInput? = nil) { - graphQLMap = ["id": id, "username": username, "and": and, "or": or, "not": not] + self.graphQLMap = ["id": id, "username": username, "and": and, "or": or, "not": not] } - + public var id: ModelIDInput? { get { return graphQLMap["id"] as! ModelIDInput? @@ -5491,7 +5499,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var username: ModelStringInput? { get { return graphQLMap["username"] as! ModelStringInput? @@ -5500,7 +5508,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "username") } } - + public var and: [ModelUser5FilterInput?]? { get { return graphQLMap["and"] as! [ModelUser5FilterInput?]? @@ -5509,7 +5517,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelUser5FilterInput?]? { get { return graphQLMap["or"] as! [ModelUser5FilterInput?]? @@ -5518,7 +5526,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelUser5FilterInput? { get { return graphQLMap["not"] as! ModelUser5FilterInput? @@ -5528,14 +5536,14 @@ public struct APISwift { } } } - + public struct ModelBlog6FilterInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: ModelIDInput? = nil, name: ModelStringInput? = nil, and: [ModelBlog6FilterInput?]? = nil, or: [ModelBlog6FilterInput?]? = nil, not: ModelBlog6FilterInput? = nil) { - graphQLMap = ["id": id, "name": name, "and": and, "or": or, "not": not] + self.graphQLMap = ["id": id, "name": name, "and": and, "or": or, "not": not] } - + public var id: ModelIDInput? { get { return graphQLMap["id"] as! ModelIDInput? @@ -5544,7 +5552,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var name: ModelStringInput? { get { return graphQLMap["name"] as! ModelStringInput? @@ -5553,7 +5561,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "name") } } - + public var and: [ModelBlog6FilterInput?]? { get { return graphQLMap["and"] as! [ModelBlog6FilterInput?]? @@ -5562,7 +5570,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelBlog6FilterInput?]? { get { return graphQLMap["or"] as! [ModelBlog6FilterInput?]? @@ -5571,7 +5579,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelBlog6FilterInput? { get { return graphQLMap["not"] as! ModelBlog6FilterInput? @@ -5581,14 +5589,14 @@ public struct APISwift { } } } - + public struct ModelPost6FilterInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: ModelIDInput? = nil, title: ModelStringInput? = nil, blogId: ModelIDInput? = nil, and: [ModelPost6FilterInput?]? = nil, or: [ModelPost6FilterInput?]? = nil, not: ModelPost6FilterInput? = nil) { - graphQLMap = ["id": id, "title": title, "blogID": blogId, "and": and, "or": or, "not": not] + self.graphQLMap = ["id": id, "title": title, "blogID": blogId, "and": and, "or": or, "not": not] } - + public var id: ModelIDInput? { get { return graphQLMap["id"] as! ModelIDInput? @@ -5597,7 +5605,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var title: ModelStringInput? { get { return graphQLMap["title"] as! ModelStringInput? @@ -5606,7 +5614,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "title") } } - + public var blogId: ModelIDInput? { get { return graphQLMap["blogID"] as! ModelIDInput? @@ -5615,7 +5623,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "blogID") } } - + public var and: [ModelPost6FilterInput?]? { get { return graphQLMap["and"] as! [ModelPost6FilterInput?]? @@ -5624,7 +5632,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelPost6FilterInput?]? { get { return graphQLMap["or"] as! [ModelPost6FilterInput?]? @@ -5633,7 +5641,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelPost6FilterInput? { get { return graphQLMap["not"] as! ModelPost6FilterInput? @@ -5643,14 +5651,14 @@ public struct APISwift { } } } - + public struct ModelComment6FilterInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: ModelIDInput? = nil, postId: ModelIDInput? = nil, content: ModelStringInput? = nil, and: [ModelComment6FilterInput?]? = nil, or: [ModelComment6FilterInput?]? = nil, not: ModelComment6FilterInput? = nil) { - graphQLMap = ["id": id, "postID": postId, "content": content, "and": and, "or": or, "not": not] + self.graphQLMap = ["id": id, "postID": postId, "content": content, "and": and, "or": or, "not": not] } - + public var id: ModelIDInput? { get { return graphQLMap["id"] as! ModelIDInput? @@ -5659,7 +5667,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var postId: ModelIDInput? { get { return graphQLMap["postID"] as! ModelIDInput? @@ -5668,7 +5676,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "postID") } } - + public var content: ModelStringInput? { get { return graphQLMap["content"] as! ModelStringInput? @@ -5677,7 +5685,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "content") } } - + public var and: [ModelComment6FilterInput?]? { get { return graphQLMap["and"] as! [ModelComment6FilterInput?]? @@ -5686,7 +5694,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelComment6FilterInput?]? { get { return graphQLMap["or"] as! [ModelComment6FilterInput?]? @@ -5695,7 +5703,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelComment6FilterInput? { get { return graphQLMap["not"] as! ModelComment6FilterInput? @@ -5705,14 +5713,14 @@ public struct APISwift { } } } - + public struct ModelScalarContainerFilterInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: ModelIDInput? = nil, myString: ModelStringInput? = nil, myInt: ModelIntInput? = nil, myDouble: ModelFloatInput? = nil, myBool: ModelBooleanInput? = nil, myDate: ModelStringInput? = nil, myTime: ModelStringInput? = nil, myDateTime: ModelStringInput? = nil, myTimeStamp: ModelIntInput? = nil, myEmail: ModelStringInput? = nil, myJson: ModelStringInput? = nil, myPhone: ModelStringInput? = nil, myUrl: ModelStringInput? = nil, myIpAddress: ModelStringInput? = nil, and: [ModelScalarContainerFilterInput?]? = nil, or: [ModelScalarContainerFilterInput?]? = nil, not: ModelScalarContainerFilterInput? = nil) { - graphQLMap = ["id": id, "myString": myString, "myInt": myInt, "myDouble": myDouble, "myBool": myBool, "myDate": myDate, "myTime": myTime, "myDateTime": myDateTime, "myTimeStamp": myTimeStamp, "myEmail": myEmail, "myJSON": myJson, "myPhone": myPhone, "myURL": myUrl, "myIPAddress": myIpAddress, "and": and, "or": or, "not": not] + self.graphQLMap = ["id": id, "myString": myString, "myInt": myInt, "myDouble": myDouble, "myBool": myBool, "myDate": myDate, "myTime": myTime, "myDateTime": myDateTime, "myTimeStamp": myTimeStamp, "myEmail": myEmail, "myJSON": myJson, "myPhone": myPhone, "myURL": myUrl, "myIPAddress": myIpAddress, "and": and, "or": or, "not": not] } - + public var id: ModelIDInput? { get { return graphQLMap["id"] as! ModelIDInput? @@ -5721,7 +5729,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var myString: ModelStringInput? { get { return graphQLMap["myString"] as! ModelStringInput? @@ -5730,7 +5738,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myString") } } - + public var myInt: ModelIntInput? { get { return graphQLMap["myInt"] as! ModelIntInput? @@ -5739,7 +5747,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myInt") } } - + public var myDouble: ModelFloatInput? { get { return graphQLMap["myDouble"] as! ModelFloatInput? @@ -5748,7 +5756,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myDouble") } } - + public var myBool: ModelBooleanInput? { get { return graphQLMap["myBool"] as! ModelBooleanInput? @@ -5757,7 +5765,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myBool") } } - + public var myDate: ModelStringInput? { get { return graphQLMap["myDate"] as! ModelStringInput? @@ -5766,7 +5774,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myDate") } } - + public var myTime: ModelStringInput? { get { return graphQLMap["myTime"] as! ModelStringInput? @@ -5775,7 +5783,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myTime") } } - + public var myDateTime: ModelStringInput? { get { return graphQLMap["myDateTime"] as! ModelStringInput? @@ -5784,7 +5792,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myDateTime") } } - + public var myTimeStamp: ModelIntInput? { get { return graphQLMap["myTimeStamp"] as! ModelIntInput? @@ -5793,7 +5801,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myTimeStamp") } } - + public var myEmail: ModelStringInput? { get { return graphQLMap["myEmail"] as! ModelStringInput? @@ -5802,7 +5810,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myEmail") } } - + public var myJson: ModelStringInput? { get { return graphQLMap["myJSON"] as! ModelStringInput? @@ -5811,7 +5819,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myJSON") } } - + public var myPhone: ModelStringInput? { get { return graphQLMap["myPhone"] as! ModelStringInput? @@ -5820,7 +5828,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myPhone") } } - + public var myUrl: ModelStringInput? { get { return graphQLMap["myURL"] as! ModelStringInput? @@ -5829,7 +5837,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myURL") } } - + public var myIpAddress: ModelStringInput? { get { return graphQLMap["myIPAddress"] as! ModelStringInput? @@ -5838,7 +5846,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "myIPAddress") } } - + public var and: [ModelScalarContainerFilterInput?]? { get { return graphQLMap["and"] as! [ModelScalarContainerFilterInput?]? @@ -5847,7 +5855,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelScalarContainerFilterInput?]? { get { return graphQLMap["or"] as! [ModelScalarContainerFilterInput?]? @@ -5856,7 +5864,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelScalarContainerFilterInput? { get { return graphQLMap["not"] as! ModelScalarContainerFilterInput? @@ -5866,14 +5874,14 @@ public struct APISwift { } } } - + public struct ModelListIntContainerFilterInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: ModelIDInput? = nil, test: ModelIntInput? = nil, nullableInt: ModelIntInput? = nil, intList: ModelIntInput? = nil, intNullableList: ModelIntInput? = nil, nullableIntList: ModelIntInput? = nil, nullableIntNullableList: ModelIntInput? = nil, and: [ModelListIntContainerFilterInput?]? = nil, or: [ModelListIntContainerFilterInput?]? = nil, not: ModelListIntContainerFilterInput? = nil) { - graphQLMap = ["id": id, "test": test, "nullableInt": nullableInt, "intList": intList, "intNullableList": intNullableList, "nullableIntList": nullableIntList, "nullableIntNullableList": nullableIntNullableList, "and": and, "or": or, "not": not] + self.graphQLMap = ["id": id, "test": test, "nullableInt": nullableInt, "intList": intList, "intNullableList": intNullableList, "nullableIntList": nullableIntList, "nullableIntNullableList": nullableIntNullableList, "and": and, "or": or, "not": not] } - + public var id: ModelIDInput? { get { return graphQLMap["id"] as! ModelIDInput? @@ -5882,7 +5890,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var test: ModelIntInput? { get { return graphQLMap["test"] as! ModelIntInput? @@ -5891,7 +5899,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "test") } } - + public var nullableInt: ModelIntInput? { get { return graphQLMap["nullableInt"] as! ModelIntInput? @@ -5900,7 +5908,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableInt") } } - + public var intList: ModelIntInput? { get { return graphQLMap["intList"] as! ModelIntInput? @@ -5909,7 +5917,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "intList") } } - + public var intNullableList: ModelIntInput? { get { return graphQLMap["intNullableList"] as! ModelIntInput? @@ -5918,7 +5926,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "intNullableList") } } - + public var nullableIntList: ModelIntInput? { get { return graphQLMap["nullableIntList"] as! ModelIntInput? @@ -5927,7 +5935,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableIntList") } } - + public var nullableIntNullableList: ModelIntInput? { get { return graphQLMap["nullableIntNullableList"] as! ModelIntInput? @@ -5936,7 +5944,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableIntNullableList") } } - + public var and: [ModelListIntContainerFilterInput?]? { get { return graphQLMap["and"] as! [ModelListIntContainerFilterInput?]? @@ -5945,7 +5953,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelListIntContainerFilterInput?]? { get { return graphQLMap["or"] as! [ModelListIntContainerFilterInput?]? @@ -5954,7 +5962,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelListIntContainerFilterInput? { get { return graphQLMap["not"] as! ModelListIntContainerFilterInput? @@ -5964,14 +5972,14 @@ public struct APISwift { } } } - + public struct ModelListStringContainerFilterInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: ModelIDInput? = nil, test: ModelStringInput? = nil, nullableString: ModelStringInput? = nil, stringList: ModelStringInput? = nil, stringNullableList: ModelStringInput? = nil, nullableStringList: ModelStringInput? = nil, nullableStringNullableList: ModelStringInput? = nil, and: [ModelListStringContainerFilterInput?]? = nil, or: [ModelListStringContainerFilterInput?]? = nil, not: ModelListStringContainerFilterInput? = nil) { - graphQLMap = ["id": id, "test": test, "nullableString": nullableString, "stringList": stringList, "stringNullableList": stringNullableList, "nullableStringList": nullableStringList, "nullableStringNullableList": nullableStringNullableList, "and": and, "or": or, "not": not] + self.graphQLMap = ["id": id, "test": test, "nullableString": nullableString, "stringList": stringList, "stringNullableList": stringNullableList, "nullableStringList": nullableStringList, "nullableStringNullableList": nullableStringNullableList, "and": and, "or": or, "not": not] } - + public var id: ModelIDInput? { get { return graphQLMap["id"] as! ModelIDInput? @@ -5980,7 +5988,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var test: ModelStringInput? { get { return graphQLMap["test"] as! ModelStringInput? @@ -5989,7 +5997,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "test") } } - + public var nullableString: ModelStringInput? { get { return graphQLMap["nullableString"] as! ModelStringInput? @@ -5998,7 +6006,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableString") } } - + public var stringList: ModelStringInput? { get { return graphQLMap["stringList"] as! ModelStringInput? @@ -6007,7 +6015,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "stringList") } } - + public var stringNullableList: ModelStringInput? { get { return graphQLMap["stringNullableList"] as! ModelStringInput? @@ -6016,7 +6024,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "stringNullableList") } } - + public var nullableStringList: ModelStringInput? { get { return graphQLMap["nullableStringList"] as! ModelStringInput? @@ -6025,7 +6033,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableStringList") } } - + public var nullableStringNullableList: ModelStringInput? { get { return graphQLMap["nullableStringNullableList"] as! ModelStringInput? @@ -6034,7 +6042,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableStringNullableList") } } - + public var and: [ModelListStringContainerFilterInput?]? { get { return graphQLMap["and"] as! [ModelListStringContainerFilterInput?]? @@ -6043,7 +6051,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelListStringContainerFilterInput?]? { get { return graphQLMap["or"] as! [ModelListStringContainerFilterInput?]? @@ -6052,7 +6060,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelListStringContainerFilterInput? { get { return graphQLMap["not"] as! ModelListStringContainerFilterInput? @@ -6062,14 +6070,14 @@ public struct APISwift { } } } - + public struct ModelEnumTestModelFilterInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: ModelIDInput? = nil, enumVal: ModelTestEnumInput? = nil, nullableEnumVal: ModelTestEnumInput? = nil, enumList: ModelTestEnumListInput? = nil, enumNullableList: ModelTestEnumListInput? = nil, nullableEnumList: ModelTestEnumListInput? = nil, nullableEnumNullableList: ModelTestEnumListInput? = nil, and: [ModelEnumTestModelFilterInput?]? = nil, or: [ModelEnumTestModelFilterInput?]? = nil, not: ModelEnumTestModelFilterInput? = nil) { - graphQLMap = ["id": id, "enumVal": enumVal, "nullableEnumVal": nullableEnumVal, "enumList": enumList, "enumNullableList": enumNullableList, "nullableEnumList": nullableEnumList, "nullableEnumNullableList": nullableEnumNullableList, "and": and, "or": or, "not": not] + self.graphQLMap = ["id": id, "enumVal": enumVal, "nullableEnumVal": nullableEnumVal, "enumList": enumList, "enumNullableList": enumNullableList, "nullableEnumList": nullableEnumList, "nullableEnumNullableList": nullableEnumNullableList, "and": and, "or": or, "not": not] } - + public var id: ModelIDInput? { get { return graphQLMap["id"] as! ModelIDInput? @@ -6078,7 +6086,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var enumVal: ModelTestEnumInput? { get { return graphQLMap["enumVal"] as! ModelTestEnumInput? @@ -6087,7 +6095,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "enumVal") } } - + public var nullableEnumVal: ModelTestEnumInput? { get { return graphQLMap["nullableEnumVal"] as! ModelTestEnumInput? @@ -6096,7 +6104,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableEnumVal") } } - + public var enumList: ModelTestEnumListInput? { get { return graphQLMap["enumList"] as! ModelTestEnumListInput? @@ -6105,7 +6113,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "enumList") } } - + public var enumNullableList: ModelTestEnumListInput? { get { return graphQLMap["enumNullableList"] as! ModelTestEnumListInput? @@ -6114,7 +6122,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "enumNullableList") } } - + public var nullableEnumList: ModelTestEnumListInput? { get { return graphQLMap["nullableEnumList"] as! ModelTestEnumListInput? @@ -6123,7 +6131,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableEnumList") } } - + public var nullableEnumNullableList: ModelTestEnumListInput? { get { return graphQLMap["nullableEnumNullableList"] as! ModelTestEnumListInput? @@ -6132,7 +6140,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "nullableEnumNullableList") } } - + public var and: [ModelEnumTestModelFilterInput?]? { get { return graphQLMap["and"] as! [ModelEnumTestModelFilterInput?]? @@ -6141,7 +6149,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelEnumTestModelFilterInput?]? { get { return graphQLMap["or"] as! [ModelEnumTestModelFilterInput?]? @@ -6150,7 +6158,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelEnumTestModelFilterInput? { get { return graphQLMap["not"] as! ModelEnumTestModelFilterInput? @@ -6160,14 +6168,14 @@ public struct APISwift { } } } - + public struct ModelNestedTypeTestModelFilterInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: ModelIDInput? = nil, and: [ModelNestedTypeTestModelFilterInput?]? = nil, or: [ModelNestedTypeTestModelFilterInput?]? = nil, not: ModelNestedTypeTestModelFilterInput? = nil) { - graphQLMap = ["id": id, "and": and, "or": or, "not": not] + self.graphQLMap = ["id": id, "and": and, "or": or, "not": not] } - + public var id: ModelIDInput? { get { return graphQLMap["id"] as! ModelIDInput? @@ -6176,7 +6184,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var and: [ModelNestedTypeTestModelFilterInput?]? { get { return graphQLMap["and"] as! [ModelNestedTypeTestModelFilterInput?]? @@ -6185,7 +6193,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelNestedTypeTestModelFilterInput?]? { get { return graphQLMap["or"] as! [ModelNestedTypeTestModelFilterInput?]? @@ -6194,7 +6202,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelNestedTypeTestModelFilterInput? { get { return graphQLMap["not"] as! ModelNestedTypeTestModelFilterInput? @@ -6204,40 +6212,40 @@ public struct APISwift { } } } - + public final class CreatePostMutation: GraphQLMutation { public static let operationString = "mutation CreatePost($input: CreatePostInput!, $condition: ModelPostConditionInput) {\n createPost(input: $input, condition: $condition) {\n __typename\n id\n title\n content\n createdAt\n updatedAt\n draft\n rating\n status\n comments {\n __typename\n items {\n __typename\n id\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n }\n}" - + public var input: CreatePostInput public var condition: ModelPostConditionInput? - + public init(input: CreatePostInput, condition: ModelPostConditionInput? = 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("createPost", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(CreatePost.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(createPost: CreatePost? = nil) { - self.init(snapshot: ["__typename": "Mutation", "createPost": createPost.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "createPost": createPost.flatMap(\.snapshot)]) } - + public var createPost: CreatePost? { get { return (snapshot["createPost"] as? Snapshot).flatMap { CreatePost(snapshot: $0) } @@ -6246,10 +6254,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "createPost") } } - + public struct CreatePost: GraphQLSelectionSet { public static let possibleTypes = ["Post"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -6262,17 +6270,17 @@ public struct APISwift { GraphQLField("status", type: .scalar(PostStatus.self)), GraphQLField("comments", type: .object(Comment.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(id: GraphQLID, title: String, content: String, createdAt: String, updatedAt: String? = nil, draft: Bool? = nil, rating: Double? = nil, status: PostStatus? = nil, comments: Comment? = nil) { - self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap(\.snapshot)]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -6281,7 +6289,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -6290,7 +6298,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -6299,7 +6307,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -6308,7 +6316,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -6317,7 +6325,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String? { get { return snapshot["updatedAt"] as? String @@ -6326,7 +6334,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public var draft: Bool? { get { return snapshot["draft"] as? Bool @@ -6335,7 +6343,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "draft") } } - + public var rating: Double? { get { return snapshot["rating"] as? Double @@ -6344,7 +6352,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "rating") } } - + public var status: PostStatus? { get { return snapshot["status"] as? PostStatus @@ -6353,7 +6361,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "status") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -6362,26 +6370,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelCommentConnection"] - + 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": "ModelCommentConnection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelCommentConnection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -6390,16 +6398,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -6408,10 +6416,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -6419,17 +6427,17 @@ public struct APISwift { 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, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment", "id": id, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -6438,7 +6446,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -6447,7 +6455,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -6456,7 +6464,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -6465,7 +6473,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -6479,40 +6487,40 @@ public struct APISwift { } } } - + public final class UpdatePostMutation: GraphQLMutation { public static let operationString = "mutation UpdatePost($input: UpdatePostInput!, $condition: ModelPostConditionInput) {\n updatePost(input: $input, condition: $condition) {\n __typename\n id\n title\n content\n createdAt\n updatedAt\n draft\n rating\n status\n comments {\n __typename\n items {\n __typename\n id\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n }\n}" - + public var input: UpdatePostInput public var condition: ModelPostConditionInput? - + public init(input: UpdatePostInput, condition: ModelPostConditionInput? = 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("updatePost", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(UpdatePost.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(updatePost: UpdatePost? = nil) { - self.init(snapshot: ["__typename": "Mutation", "updatePost": updatePost.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "updatePost": updatePost.flatMap(\.snapshot)]) } - + public var updatePost: UpdatePost? { get { return (snapshot["updatePost"] as? Snapshot).flatMap { UpdatePost(snapshot: $0) } @@ -6521,10 +6529,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "updatePost") } } - + public struct UpdatePost: GraphQLSelectionSet { public static let possibleTypes = ["Post"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -6537,17 +6545,17 @@ public struct APISwift { GraphQLField("status", type: .scalar(PostStatus.self)), GraphQLField("comments", type: .object(Comment.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(id: GraphQLID, title: String, content: String, createdAt: String, updatedAt: String? = nil, draft: Bool? = nil, rating: Double? = nil, status: PostStatus? = nil, comments: Comment? = nil) { - self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap(\.snapshot)]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -6556,7 +6564,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -6565,7 +6573,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -6574,7 +6582,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -6583,7 +6591,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -6592,7 +6600,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String? { get { return snapshot["updatedAt"] as? String @@ -6601,7 +6609,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public var draft: Bool? { get { return snapshot["draft"] as? Bool @@ -6610,7 +6618,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "draft") } } - + public var rating: Double? { get { return snapshot["rating"] as? Double @@ -6619,7 +6627,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "rating") } } - + public var status: PostStatus? { get { return snapshot["status"] as? PostStatus @@ -6628,7 +6636,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "status") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -6637,26 +6645,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelCommentConnection"] - + 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": "ModelCommentConnection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelCommentConnection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -6665,16 +6673,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -6683,10 +6691,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -6694,17 +6702,17 @@ public struct APISwift { 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, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment", "id": id, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -6713,7 +6721,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -6722,7 +6730,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -6731,7 +6739,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -6740,7 +6748,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -6754,40 +6762,40 @@ public struct APISwift { } } } - + public final class DeletePostMutation: GraphQLMutation { public static let operationString = "mutation DeletePost($input: DeletePostInput!, $condition: ModelPostConditionInput) {\n deletePost(input: $input, condition: $condition) {\n __typename\n id\n title\n content\n createdAt\n updatedAt\n draft\n rating\n status\n comments {\n __typename\n items {\n __typename\n id\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n }\n}" - + public var input: DeletePostInput public var condition: ModelPostConditionInput? - + public init(input: DeletePostInput, condition: ModelPostConditionInput? = 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("deletePost", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(DeletePost.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(deletePost: DeletePost? = nil) { - self.init(snapshot: ["__typename": "Mutation", "deletePost": deletePost.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "deletePost": deletePost.flatMap(\.snapshot)]) } - + public var deletePost: DeletePost? { get { return (snapshot["deletePost"] as? Snapshot).flatMap { DeletePost(snapshot: $0) } @@ -6796,10 +6804,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "deletePost") } } - + public struct DeletePost: GraphQLSelectionSet { public static let possibleTypes = ["Post"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -6812,17 +6820,17 @@ public struct APISwift { GraphQLField("status", type: .scalar(PostStatus.self)), GraphQLField("comments", type: .object(Comment.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(id: GraphQLID, title: String, content: String, createdAt: String, updatedAt: String? = nil, draft: Bool? = nil, rating: Double? = nil, status: PostStatus? = nil, comments: Comment? = nil) { - self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap(\.snapshot)]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -6831,7 +6839,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -6840,7 +6848,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -6849,7 +6857,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -6858,7 +6866,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -6867,7 +6875,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String? { get { return snapshot["updatedAt"] as? String @@ -6876,7 +6884,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public var draft: Bool? { get { return snapshot["draft"] as? Bool @@ -6885,7 +6893,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "draft") } } - + public var rating: Double? { get { return snapshot["rating"] as? Double @@ -6894,7 +6902,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "rating") } } - + public var status: PostStatus? { get { return snapshot["status"] as? PostStatus @@ -6903,7 +6911,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "status") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -6912,26 +6920,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelCommentConnection"] - + 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": "ModelCommentConnection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelCommentConnection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -6940,16 +6948,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -6958,10 +6966,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -6969,17 +6977,17 @@ public struct APISwift { 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, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment", "id": id, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -6988,7 +6996,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -6997,7 +7005,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -7006,7 +7014,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -7015,7 +7023,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -7029,40 +7037,40 @@ public struct APISwift { } } } - + public final class CreateCommentMutation: GraphQLMutation { public static let operationString = "mutation CreateComment($input: CreateCommentInput!, $condition: ModelCommentConditionInput) {\n createComment(input: $input, condition: $condition) {\n __typename\n id\n content\n createdAt\n post {\n __typename\n id\n title\n content\n createdAt\n updatedAt\n draft\n rating\n status\n comments {\n __typename\n nextToken\n }\n }\n updatedAt\n }\n}" - + public var input: CreateCommentInput public var condition: ModelCommentConditionInput? - + public init(input: CreateCommentInput, condition: ModelCommentConditionInput? = 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("createComment", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(CreateComment.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(createComment: CreateComment? = nil) { - self.init(snapshot: ["__typename": "Mutation", "createComment": createComment.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "createComment": createComment.flatMap(\.snapshot)]) } - + public var createComment: CreateComment? { get { return (snapshot["createComment"] as? Snapshot).flatMap { CreateComment(snapshot: $0) } @@ -7071,10 +7079,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "createComment") } } - + public struct CreateComment: GraphQLSelectionSet { public static let possibleTypes = ["Comment"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -7083,17 +7091,17 @@ public struct APISwift { GraphQLField("post", type: .object(Post.selections)), GraphQLField("updatedAt", type: .nonNull(.scalar(String.self))), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(id: GraphQLID, content: String, createdAt: String, post: Post? = nil, updatedAt: String) { - self.init(snapshot: ["__typename": "Comment", "id": id, "content": content, "createdAt": createdAt, "post": post.flatMap { $0.snapshot }, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Comment", "id": id, "content": content, "createdAt": createdAt, "post": post.flatMap(\.snapshot), "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -7102,7 +7110,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -7111,7 +7119,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -7120,7 +7128,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -7129,7 +7137,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var post: Post? { get { return (snapshot["post"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -7138,7 +7146,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "post") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -7147,10 +7155,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -7163,17 +7171,17 @@ public struct APISwift { GraphQLField("status", type: .scalar(PostStatus.self)), GraphQLField("comments", type: .object(Comment.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(id: GraphQLID, title: String, content: String, createdAt: String, updatedAt: String? = nil, draft: Bool? = nil, rating: Double? = nil, status: PostStatus? = nil, comments: Comment? = nil) { - self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap(\.snapshot)]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -7182,7 +7190,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -7191,7 +7199,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -7200,7 +7208,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -7209,7 +7217,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -7218,7 +7226,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String? { get { return snapshot["updatedAt"] as? String @@ -7227,7 +7235,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public var draft: Bool? { get { return snapshot["draft"] as? Bool @@ -7236,7 +7244,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "draft") } } - + public var rating: Double? { get { return snapshot["rating"] as? Double @@ -7245,7 +7253,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "rating") } } - + public var status: PostStatus? { get { return snapshot["status"] as? PostStatus @@ -7254,7 +7262,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "status") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -7263,25 +7271,25 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelCommentConnection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelCommentConnection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -7290,7 +7298,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -7304,40 +7312,40 @@ public struct APISwift { } } } - + public final class UpdateCommentMutation: GraphQLMutation { public static let operationString = "mutation UpdateComment($input: UpdateCommentInput!, $condition: ModelCommentConditionInput) {\n updateComment(input: $input, condition: $condition) {\n __typename\n id\n content\n createdAt\n post {\n __typename\n id\n title\n content\n createdAt\n updatedAt\n draft\n rating\n status\n comments {\n __typename\n nextToken\n }\n }\n updatedAt\n }\n}" - + public var input: UpdateCommentInput public var condition: ModelCommentConditionInput? - + public init(input: UpdateCommentInput, condition: ModelCommentConditionInput? = 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("updateComment", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(UpdateComment.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(updateComment: UpdateComment? = nil) { - self.init(snapshot: ["__typename": "Mutation", "updateComment": updateComment.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "updateComment": updateComment.flatMap(\.snapshot)]) } - + public var updateComment: UpdateComment? { get { return (snapshot["updateComment"] as? Snapshot).flatMap { UpdateComment(snapshot: $0) } @@ -7346,10 +7354,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "updateComment") } } - + public struct UpdateComment: GraphQLSelectionSet { public static let possibleTypes = ["Comment"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -7358,17 +7366,17 @@ public struct APISwift { GraphQLField("post", type: .object(Post.selections)), GraphQLField("updatedAt", type: .nonNull(.scalar(String.self))), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(id: GraphQLID, content: String, createdAt: String, post: Post? = nil, updatedAt: String) { - self.init(snapshot: ["__typename": "Comment", "id": id, "content": content, "createdAt": createdAt, "post": post.flatMap { $0.snapshot }, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Comment", "id": id, "content": content, "createdAt": createdAt, "post": post.flatMap(\.snapshot), "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -7377,7 +7385,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -7386,7 +7394,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -7395,7 +7403,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -7404,7 +7412,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var post: Post? { get { return (snapshot["post"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -7413,7 +7421,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "post") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -7422,10 +7430,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -7438,17 +7446,17 @@ public struct APISwift { GraphQLField("status", type: .scalar(PostStatus.self)), GraphQLField("comments", type: .object(Comment.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(id: GraphQLID, title: String, content: String, createdAt: String, updatedAt: String? = nil, draft: Bool? = nil, rating: Double? = nil, status: PostStatus? = nil, comments: Comment? = nil) { - self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap(\.snapshot)]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -7457,7 +7465,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -7466,7 +7474,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -7475,7 +7483,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -7484,7 +7492,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -7493,7 +7501,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String? { get { return snapshot["updatedAt"] as? String @@ -7502,7 +7510,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public var draft: Bool? { get { return snapshot["draft"] as? Bool @@ -7511,7 +7519,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "draft") } } - + public var rating: Double? { get { return snapshot["rating"] as? Double @@ -7520,7 +7528,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "rating") } } - + public var status: PostStatus? { get { return snapshot["status"] as? PostStatus @@ -7529,7 +7537,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "status") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -7538,25 +7546,25 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelCommentConnection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelCommentConnection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -7565,7 +7573,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -7579,40 +7587,40 @@ public struct APISwift { } } } - + public final class DeleteCommentMutation: GraphQLMutation { public static let operationString = "mutation DeleteComment($input: DeleteCommentInput!, $condition: ModelCommentConditionInput) {\n deleteComment(input: $input, condition: $condition) {\n __typename\n id\n content\n createdAt\n post {\n __typename\n id\n title\n content\n createdAt\n updatedAt\n draft\n rating\n status\n comments {\n __typename\n nextToken\n }\n }\n updatedAt\n }\n}" - + public var input: DeleteCommentInput public var condition: ModelCommentConditionInput? - + public init(input: DeleteCommentInput, condition: ModelCommentConditionInput? = 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("deleteComment", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(DeleteComment.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(deleteComment: DeleteComment? = nil) { - self.init(snapshot: ["__typename": "Mutation", "deleteComment": deleteComment.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "deleteComment": deleteComment.flatMap(\.snapshot)]) } - + public var deleteComment: DeleteComment? { get { return (snapshot["deleteComment"] as? Snapshot).flatMap { DeleteComment(snapshot: $0) } @@ -7621,10 +7629,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "deleteComment") } } - + public struct DeleteComment: GraphQLSelectionSet { public static let possibleTypes = ["Comment"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -7633,17 +7641,17 @@ public struct APISwift { GraphQLField("post", type: .object(Post.selections)), GraphQLField("updatedAt", type: .nonNull(.scalar(String.self))), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(id: GraphQLID, content: String, createdAt: String, post: Post? = nil, updatedAt: String) { - self.init(snapshot: ["__typename": "Comment", "id": id, "content": content, "createdAt": createdAt, "post": post.flatMap { $0.snapshot }, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Comment", "id": id, "content": content, "createdAt": createdAt, "post": post.flatMap(\.snapshot), "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -7652,7 +7660,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -7661,7 +7669,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -7670,7 +7678,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -7679,7 +7687,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var post: Post? { get { return (snapshot["post"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -7688,7 +7696,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "post") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -7697,10 +7705,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -7713,17 +7721,17 @@ public struct APISwift { GraphQLField("status", type: .scalar(PostStatus.self)), GraphQLField("comments", type: .object(Comment.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(id: GraphQLID, title: String, content: String, createdAt: String, updatedAt: String? = nil, draft: Bool? = nil, rating: Double? = nil, status: PostStatus? = nil, comments: Comment? = nil) { - self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap(\.snapshot)]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -7732,7 +7740,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -7741,7 +7749,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -7750,7 +7758,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -7759,7 +7767,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -7768,7 +7776,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String? { get { return snapshot["updatedAt"] as? String @@ -7777,7 +7785,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public var draft: Bool? { get { return snapshot["draft"] as? Bool @@ -7786,7 +7794,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "draft") } } - + public var rating: Double? { get { return snapshot["rating"] as? Double @@ -7795,7 +7803,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "rating") } } - + public var status: PostStatus? { get { return snapshot["status"] as? PostStatus @@ -7804,7 +7812,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "status") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -7813,25 +7821,25 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelCommentConnection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelCommentConnection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -7840,7 +7848,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -7854,40 +7862,40 @@ public struct APISwift { } } } - + public final class CreateProject1Mutation: GraphQLMutation { public static let operationString = "mutation CreateProject1($input: CreateProject1Input!, $condition: ModelProject1ConditionInput) {\n createProject1(input: $input, condition: $condition) {\n __typename\n id\n name\n team {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n}" - + public var input: CreateProject1Input public var condition: ModelProject1ConditionInput? - + public init(input: CreateProject1Input, condition: ModelProject1ConditionInput? = 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("createProject1", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(CreateProject1.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(createProject1: CreateProject1? = nil) { - self.init(snapshot: ["__typename": "Mutation", "createProject1": createProject1.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "createProject1": createProject1.flatMap(\.snapshot)]) } - + public var createProject1: CreateProject1? { get { return (snapshot["createProject1"] as? Snapshot).flatMap { CreateProject1(snapshot: $0) } @@ -7896,10 +7904,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "createProject1") } } - + public struct CreateProject1: GraphQLSelectionSet { public static let possibleTypes = ["Project1"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -7908,17 +7916,17 @@ public struct APISwift { 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? = nil, team: Team? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Project1", "id": id, "name": name, "team": team.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Project1", "id": id, "name": name, "team": team.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -7927,7 +7935,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -7936,7 +7944,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return snapshot["name"] as? String @@ -7945,7 +7953,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var team: Team? { get { return (snapshot["team"] as? Snapshot).flatMap { Team(snapshot: $0) } @@ -7954,7 +7962,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "team") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -7963,7 +7971,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -7972,10 +7980,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Team: GraphQLSelectionSet { public static let possibleTypes = ["Team1"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -7983,17 +7991,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team1", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -8002,7 +8010,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -8011,7 +8019,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -8020,7 +8028,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -8029,7 +8037,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -8042,40 +8050,40 @@ public struct APISwift { } } } - + public final class UpdateProject1Mutation: GraphQLMutation { public static let operationString = "mutation UpdateProject1($input: UpdateProject1Input!, $condition: ModelProject1ConditionInput) {\n updateProject1(input: $input, condition: $condition) {\n __typename\n id\n name\n team {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n}" - + public var input: UpdateProject1Input public var condition: ModelProject1ConditionInput? - + public init(input: UpdateProject1Input, condition: ModelProject1ConditionInput? = 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("updateProject1", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(UpdateProject1.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(updateProject1: UpdateProject1? = nil) { - self.init(snapshot: ["__typename": "Mutation", "updateProject1": updateProject1.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "updateProject1": updateProject1.flatMap(\.snapshot)]) } - + public var updateProject1: UpdateProject1? { get { return (snapshot["updateProject1"] as? Snapshot).flatMap { UpdateProject1(snapshot: $0) } @@ -8084,10 +8092,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "updateProject1") } } - + public struct UpdateProject1: GraphQLSelectionSet { public static let possibleTypes = ["Project1"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -8096,17 +8104,17 @@ public struct APISwift { 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? = nil, team: Team? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Project1", "id": id, "name": name, "team": team.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Project1", "id": id, "name": name, "team": team.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -8115,7 +8123,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -8124,7 +8132,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return snapshot["name"] as? String @@ -8133,7 +8141,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var team: Team? { get { return (snapshot["team"] as? Snapshot).flatMap { Team(snapshot: $0) } @@ -8142,7 +8150,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "team") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -8151,7 +8159,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -8160,10 +8168,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Team: GraphQLSelectionSet { public static let possibleTypes = ["Team1"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -8171,17 +8179,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team1", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -8190,7 +8198,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -8199,7 +8207,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -8208,7 +8216,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -8217,7 +8225,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -8230,40 +8238,40 @@ public struct APISwift { } } } - + public final class DeleteProject1Mutation: GraphQLMutation { public static let operationString = "mutation DeleteProject1($input: DeleteProject1Input!, $condition: ModelProject1ConditionInput) {\n deleteProject1(input: $input, condition: $condition) {\n __typename\n id\n name\n team {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n}" - + public var input: DeleteProject1Input public var condition: ModelProject1ConditionInput? - + public init(input: DeleteProject1Input, condition: ModelProject1ConditionInput? = 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("deleteProject1", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(DeleteProject1.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(deleteProject1: DeleteProject1? = nil) { - self.init(snapshot: ["__typename": "Mutation", "deleteProject1": deleteProject1.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "deleteProject1": deleteProject1.flatMap(\.snapshot)]) } - + public var deleteProject1: DeleteProject1? { get { return (snapshot["deleteProject1"] as? Snapshot).flatMap { DeleteProject1(snapshot: $0) } @@ -8272,10 +8280,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "deleteProject1") } } - + public struct DeleteProject1: GraphQLSelectionSet { public static let possibleTypes = ["Project1"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -8284,17 +8292,17 @@ public struct APISwift { 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? = nil, team: Team? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Project1", "id": id, "name": name, "team": team.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Project1", "id": id, "name": name, "team": team.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -8303,7 +8311,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -8312,7 +8320,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return snapshot["name"] as? String @@ -8321,7 +8329,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var team: Team? { get { return (snapshot["team"] as? Snapshot).flatMap { Team(snapshot: $0) } @@ -8330,7 +8338,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "team") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -8339,7 +8347,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -8348,10 +8356,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Team: GraphQLSelectionSet { public static let possibleTypes = ["Team1"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -8359,17 +8367,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team1", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -8378,7 +8386,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -8387,7 +8395,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -8396,7 +8404,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -8405,7 +8413,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -8418,40 +8426,40 @@ public struct APISwift { } } } - + public final class CreateTeam1Mutation: GraphQLMutation { public static let operationString = "mutation CreateTeam1($input: CreateTeam1Input!, $condition: ModelTeam1ConditionInput) {\n createTeam1(input: $input, condition: $condition) {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n}" - + public var input: CreateTeam1Input public var condition: ModelTeam1ConditionInput? - + public init(input: CreateTeam1Input, condition: ModelTeam1ConditionInput? = 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("createTeam1", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(CreateTeam1.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(createTeam1: CreateTeam1? = nil) { - self.init(snapshot: ["__typename": "Mutation", "createTeam1": createTeam1.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "createTeam1": createTeam1.flatMap(\.snapshot)]) } - + public var createTeam1: CreateTeam1? { get { return (snapshot["createTeam1"] as? Snapshot).flatMap { CreateTeam1(snapshot: $0) } @@ -8460,10 +8468,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "createTeam1") } } - + public struct CreateTeam1: GraphQLSelectionSet { public static let possibleTypes = ["Team1"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -8471,17 +8479,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team1", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -8490,7 +8498,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -8499,7 +8507,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -8508,7 +8516,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -8517,7 +8525,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -8529,40 +8537,40 @@ public struct APISwift { } } } - + public final class UpdateTeam1Mutation: GraphQLMutation { public static let operationString = "mutation UpdateTeam1($input: UpdateTeam1Input!, $condition: ModelTeam1ConditionInput) {\n updateTeam1(input: $input, condition: $condition) {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n}" - + public var input: UpdateTeam1Input public var condition: ModelTeam1ConditionInput? - + public init(input: UpdateTeam1Input, condition: ModelTeam1ConditionInput? = 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("updateTeam1", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(UpdateTeam1.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(updateTeam1: UpdateTeam1? = nil) { - self.init(snapshot: ["__typename": "Mutation", "updateTeam1": updateTeam1.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "updateTeam1": updateTeam1.flatMap(\.snapshot)]) } - + public var updateTeam1: UpdateTeam1? { get { return (snapshot["updateTeam1"] as? Snapshot).flatMap { UpdateTeam1(snapshot: $0) } @@ -8571,10 +8579,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "updateTeam1") } } - + public struct UpdateTeam1: GraphQLSelectionSet { public static let possibleTypes = ["Team1"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -8582,17 +8590,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team1", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -8601,7 +8609,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -8610,7 +8618,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -8619,7 +8627,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -8628,7 +8636,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -8640,40 +8648,40 @@ public struct APISwift { } } } - + public final class DeleteTeam1Mutation: GraphQLMutation { public static let operationString = "mutation DeleteTeam1($input: DeleteTeam1Input!, $condition: ModelTeam1ConditionInput) {\n deleteTeam1(input: $input, condition: $condition) {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n}" - + public var input: DeleteTeam1Input public var condition: ModelTeam1ConditionInput? - + public init(input: DeleteTeam1Input, condition: ModelTeam1ConditionInput? = 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("deleteTeam1", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(DeleteTeam1.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(deleteTeam1: DeleteTeam1? = nil) { - self.init(snapshot: ["__typename": "Mutation", "deleteTeam1": deleteTeam1.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "deleteTeam1": deleteTeam1.flatMap(\.snapshot)]) } - + public var deleteTeam1: DeleteTeam1? { get { return (snapshot["deleteTeam1"] as? Snapshot).flatMap { DeleteTeam1(snapshot: $0) } @@ -8682,10 +8690,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "deleteTeam1") } } - + public struct DeleteTeam1: GraphQLSelectionSet { public static let possibleTypes = ["Team1"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -8693,17 +8701,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team1", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -8712,7 +8720,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -8721,7 +8729,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -8730,7 +8738,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -8739,7 +8747,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -8751,40 +8759,40 @@ public struct APISwift { } } } - + public final class CreateProject2Mutation: GraphQLMutation { public static let operationString = "mutation CreateProject2($input: CreateProject2Input!, $condition: ModelProject2ConditionInput) {\n createProject2(input: $input, condition: $condition) {\n __typename\n id\n name\n teamID\n team {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n}" - + public var input: CreateProject2Input public var condition: ModelProject2ConditionInput? - + public init(input: CreateProject2Input, condition: ModelProject2ConditionInput? = 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("createProject2", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(CreateProject2.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(createProject2: CreateProject2? = nil) { - self.init(snapshot: ["__typename": "Mutation", "createProject2": createProject2.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "createProject2": createProject2.flatMap(\.snapshot)]) } - + public var createProject2: CreateProject2? { get { return (snapshot["createProject2"] as? Snapshot).flatMap { CreateProject2(snapshot: $0) } @@ -8793,10 +8801,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "createProject2") } } - + public struct CreateProject2: GraphQLSelectionSet { public static let possibleTypes = ["Project2"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -8806,17 +8814,17 @@ public struct APISwift { 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? = nil, teamId: GraphQLID, team: Team? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Project2", "id": id, "name": name, "teamID": teamId, "team": team.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Project2", "id": id, "name": name, "teamID": teamId, "team": team.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -8825,7 +8833,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -8834,7 +8842,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return snapshot["name"] as? String @@ -8843,7 +8851,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var teamId: GraphQLID { get { return snapshot["teamID"]! as! GraphQLID @@ -8852,7 +8860,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "teamID") } } - + public var team: Team? { get { return (snapshot["team"] as? Snapshot).flatMap { Team(snapshot: $0) } @@ -8861,7 +8869,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "team") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -8870,7 +8878,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -8879,10 +8887,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Team: GraphQLSelectionSet { public static let possibleTypes = ["Team2"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -8890,17 +8898,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team2", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -8909,7 +8917,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -8918,7 +8926,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -8927,7 +8935,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -8936,7 +8944,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -8949,40 +8957,40 @@ public struct APISwift { } } } - + public final class UpdateProject2Mutation: GraphQLMutation { public static let operationString = "mutation UpdateProject2($input: UpdateProject2Input!, $condition: ModelProject2ConditionInput) {\n updateProject2(input: $input, condition: $condition) {\n __typename\n id\n name\n teamID\n team {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n}" - + public var input: UpdateProject2Input public var condition: ModelProject2ConditionInput? - + public init(input: UpdateProject2Input, condition: ModelProject2ConditionInput? = 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("updateProject2", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(UpdateProject2.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(updateProject2: UpdateProject2? = nil) { - self.init(snapshot: ["__typename": "Mutation", "updateProject2": updateProject2.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "updateProject2": updateProject2.flatMap(\.snapshot)]) } - + public var updateProject2: UpdateProject2? { get { return (snapshot["updateProject2"] as? Snapshot).flatMap { UpdateProject2(snapshot: $0) } @@ -8991,10 +8999,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "updateProject2") } } - + public struct UpdateProject2: GraphQLSelectionSet { public static let possibleTypes = ["Project2"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -9004,17 +9012,17 @@ public struct APISwift { 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? = nil, teamId: GraphQLID, team: Team? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Project2", "id": id, "name": name, "teamID": teamId, "team": team.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Project2", "id": id, "name": name, "teamID": teamId, "team": team.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -9023,7 +9031,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -9032,7 +9040,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return snapshot["name"] as? String @@ -9041,7 +9049,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var teamId: GraphQLID { get { return snapshot["teamID"]! as! GraphQLID @@ -9050,7 +9058,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "teamID") } } - + public var team: Team? { get { return (snapshot["team"] as? Snapshot).flatMap { Team(snapshot: $0) } @@ -9059,7 +9067,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "team") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -9068,7 +9076,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -9077,10 +9085,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Team: GraphQLSelectionSet { public static let possibleTypes = ["Team2"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -9088,17 +9096,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team2", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -9107,7 +9115,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -9116,7 +9124,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -9125,7 +9133,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -9134,7 +9142,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -9147,40 +9155,40 @@ public struct APISwift { } } } - + public final class DeleteProject2Mutation: GraphQLMutation { public static let operationString = "mutation DeleteProject2($input: DeleteProject2Input!, $condition: ModelProject2ConditionInput) {\n deleteProject2(input: $input, condition: $condition) {\n __typename\n id\n name\n teamID\n team {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n}" - + public var input: DeleteProject2Input public var condition: ModelProject2ConditionInput? - + public init(input: DeleteProject2Input, condition: ModelProject2ConditionInput? = 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("deleteProject2", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(DeleteProject2.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(deleteProject2: DeleteProject2? = nil) { - self.init(snapshot: ["__typename": "Mutation", "deleteProject2": deleteProject2.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "deleteProject2": deleteProject2.flatMap(\.snapshot)]) } - + public var deleteProject2: DeleteProject2? { get { return (snapshot["deleteProject2"] as? Snapshot).flatMap { DeleteProject2(snapshot: $0) } @@ -9189,10 +9197,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "deleteProject2") } } - + public struct DeleteProject2: GraphQLSelectionSet { public static let possibleTypes = ["Project2"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -9202,17 +9210,17 @@ public struct APISwift { 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? = nil, teamId: GraphQLID, team: Team? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Project2", "id": id, "name": name, "teamID": teamId, "team": team.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Project2", "id": id, "name": name, "teamID": teamId, "team": team.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -9221,7 +9229,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -9230,7 +9238,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return snapshot["name"] as? String @@ -9239,7 +9247,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var teamId: GraphQLID { get { return snapshot["teamID"]! as! GraphQLID @@ -9248,7 +9256,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "teamID") } } - + public var team: Team? { get { return (snapshot["team"] as? Snapshot).flatMap { Team(snapshot: $0) } @@ -9257,7 +9265,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "team") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -9266,7 +9274,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -9275,10 +9283,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Team: GraphQLSelectionSet { public static let possibleTypes = ["Team2"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -9286,17 +9294,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team2", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -9305,7 +9313,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -9314,7 +9322,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -9323,7 +9331,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -9332,7 +9340,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -9345,40 +9353,40 @@ public struct APISwift { } } } - + public final class CreateTeam2Mutation: GraphQLMutation { public static let operationString = "mutation CreateTeam2($input: CreateTeam2Input!, $condition: ModelTeam2ConditionInput) {\n createTeam2(input: $input, condition: $condition) {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n}" - + public var input: CreateTeam2Input public var condition: ModelTeam2ConditionInput? - + public init(input: CreateTeam2Input, condition: ModelTeam2ConditionInput? = 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("createTeam2", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(CreateTeam2.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(createTeam2: CreateTeam2? = nil) { - self.init(snapshot: ["__typename": "Mutation", "createTeam2": createTeam2.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "createTeam2": createTeam2.flatMap(\.snapshot)]) } - + public var createTeam2: CreateTeam2? { get { return (snapshot["createTeam2"] as? Snapshot).flatMap { CreateTeam2(snapshot: $0) } @@ -9387,10 +9395,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "createTeam2") } } - + public struct CreateTeam2: GraphQLSelectionSet { public static let possibleTypes = ["Team2"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -9398,17 +9406,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team2", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -9417,7 +9425,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -9426,7 +9434,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -9435,7 +9443,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -9444,7 +9452,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -9456,40 +9464,40 @@ public struct APISwift { } } } - + public final class UpdateTeam2Mutation: GraphQLMutation { public static let operationString = "mutation UpdateTeam2($input: UpdateTeam2Input!, $condition: ModelTeam2ConditionInput) {\n updateTeam2(input: $input, condition: $condition) {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n}" - + public var input: UpdateTeam2Input public var condition: ModelTeam2ConditionInput? - + public init(input: UpdateTeam2Input, condition: ModelTeam2ConditionInput? = 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("updateTeam2", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(UpdateTeam2.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(updateTeam2: UpdateTeam2? = nil) { - self.init(snapshot: ["__typename": "Mutation", "updateTeam2": updateTeam2.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "updateTeam2": updateTeam2.flatMap(\.snapshot)]) } - + public var updateTeam2: UpdateTeam2? { get { return (snapshot["updateTeam2"] as? Snapshot).flatMap { UpdateTeam2(snapshot: $0) } @@ -9498,10 +9506,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "updateTeam2") } } - + public struct UpdateTeam2: GraphQLSelectionSet { public static let possibleTypes = ["Team2"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -9509,17 +9517,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team2", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -9528,7 +9536,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -9537,7 +9545,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -9546,7 +9554,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -9555,7 +9563,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -9567,40 +9575,40 @@ public struct APISwift { } } } - + public final class DeleteTeam2Mutation: GraphQLMutation { public static let operationString = "mutation DeleteTeam2($input: DeleteTeam2Input!, $condition: ModelTeam2ConditionInput) {\n deleteTeam2(input: $input, condition: $condition) {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n}" - + public var input: DeleteTeam2Input public var condition: ModelTeam2ConditionInput? - + public init(input: DeleteTeam2Input, condition: ModelTeam2ConditionInput? = 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("deleteTeam2", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(DeleteTeam2.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(deleteTeam2: DeleteTeam2? = nil) { - self.init(snapshot: ["__typename": "Mutation", "deleteTeam2": deleteTeam2.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "deleteTeam2": deleteTeam2.flatMap(\.snapshot)]) } - + public var deleteTeam2: DeleteTeam2? { get { return (snapshot["deleteTeam2"] as? Snapshot).flatMap { DeleteTeam2(snapshot: $0) } @@ -9609,10 +9617,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "deleteTeam2") } } - + public struct DeleteTeam2: GraphQLSelectionSet { public static let possibleTypes = ["Team2"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -9620,17 +9628,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team2", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -9639,7 +9647,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -9648,7 +9656,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -9657,7 +9665,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -9666,7 +9674,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -9678,40 +9686,40 @@ public struct APISwift { } } } - + public final class CreatePost3Mutation: GraphQLMutation { public static let operationString = "mutation CreatePost3($input: CreatePost3Input!, $condition: ModelPost3ConditionInput) {\n createPost3(input: $input, condition: $condition) {\n __typename\n id\n title\n comments {\n __typename\n items {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public var input: CreatePost3Input public var condition: ModelPost3ConditionInput? - + public init(input: CreatePost3Input, condition: ModelPost3ConditionInput? = 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("createPost3", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(CreatePost3.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(createPost3: CreatePost3? = nil) { - self.init(snapshot: ["__typename": "Mutation", "createPost3": createPost3.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "createPost3": createPost3.flatMap(\.snapshot)]) } - + public var createPost3: CreatePost3? { get { return (snapshot["createPost3"] as? Snapshot).flatMap { CreatePost3(snapshot: $0) } @@ -9720,10 +9728,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "createPost3") } } - + public struct CreatePost3: GraphQLSelectionSet { public static let possibleTypes = ["Post3"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -9732,17 +9740,17 @@ public struct APISwift { 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, title: String, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post3", "id": id, "title": title, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post3", "id": id, "title": title, "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -9751,7 +9759,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -9760,7 +9768,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -9769,7 +9777,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -9778,7 +9786,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -9787,7 +9795,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -9796,26 +9804,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment3Connection"] - + 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": "ModelComment3Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelComment3Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -9824,16 +9832,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -9842,10 +9850,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment3"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -9854,17 +9862,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment3", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -9873,7 +9881,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -9882,7 +9890,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -9891,7 +9899,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -9900,7 +9908,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -9909,7 +9917,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -9923,40 +9931,40 @@ public struct APISwift { } } } - + public final class UpdatePost3Mutation: GraphQLMutation { public static let operationString = "mutation UpdatePost3($input: UpdatePost3Input!, $condition: ModelPost3ConditionInput) {\n updatePost3(input: $input, condition: $condition) {\n __typename\n id\n title\n comments {\n __typename\n items {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public var input: UpdatePost3Input public var condition: ModelPost3ConditionInput? - + public init(input: UpdatePost3Input, condition: ModelPost3ConditionInput? = 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("updatePost3", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(UpdatePost3.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(updatePost3: UpdatePost3? = nil) { - self.init(snapshot: ["__typename": "Mutation", "updatePost3": updatePost3.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "updatePost3": updatePost3.flatMap(\.snapshot)]) } - + public var updatePost3: UpdatePost3? { get { return (snapshot["updatePost3"] as? Snapshot).flatMap { UpdatePost3(snapshot: $0) } @@ -9965,10 +9973,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "updatePost3") } } - + public struct UpdatePost3: GraphQLSelectionSet { public static let possibleTypes = ["Post3"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -9977,17 +9985,17 @@ public struct APISwift { 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, title: String, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post3", "id": id, "title": title, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post3", "id": id, "title": title, "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -9996,7 +10004,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -10005,7 +10013,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -10014,7 +10022,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -10023,7 +10031,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -10032,7 +10040,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -10041,26 +10049,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment3Connection"] - + 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": "ModelComment3Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelComment3Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -10069,16 +10077,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -10087,10 +10095,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment3"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -10099,17 +10107,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment3", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -10118,7 +10126,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -10127,7 +10135,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -10136,7 +10144,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -10145,7 +10153,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -10154,7 +10162,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -10168,40 +10176,40 @@ public struct APISwift { } } } - + public final class DeletePost3Mutation: GraphQLMutation { public static let operationString = "mutation DeletePost3($input: DeletePost3Input!, $condition: ModelPost3ConditionInput) {\n deletePost3(input: $input, condition: $condition) {\n __typename\n id\n title\n comments {\n __typename\n items {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public var input: DeletePost3Input public var condition: ModelPost3ConditionInput? - + public init(input: DeletePost3Input, condition: ModelPost3ConditionInput? = 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("deletePost3", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(DeletePost3.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(deletePost3: DeletePost3? = nil) { - self.init(snapshot: ["__typename": "Mutation", "deletePost3": deletePost3.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "deletePost3": deletePost3.flatMap(\.snapshot)]) } - + public var deletePost3: DeletePost3? { get { return (snapshot["deletePost3"] as? Snapshot).flatMap { DeletePost3(snapshot: $0) } @@ -10210,10 +10218,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "deletePost3") } } - + public struct DeletePost3: GraphQLSelectionSet { public static let possibleTypes = ["Post3"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -10222,17 +10230,17 @@ public struct APISwift { 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, title: String, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post3", "id": id, "title": title, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post3", "id": id, "title": title, "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -10241,7 +10249,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -10250,7 +10258,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -10259,7 +10267,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -10268,7 +10276,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -10277,7 +10285,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -10286,26 +10294,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment3Connection"] - + 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": "ModelComment3Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelComment3Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -10314,16 +10322,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -10332,10 +10340,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment3"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -10344,17 +10352,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment3", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -10363,7 +10371,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -10372,7 +10380,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -10381,7 +10389,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -10390,7 +10398,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -10399,7 +10407,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -10413,40 +10421,40 @@ public struct APISwift { } } } - + public final class CreateComment3Mutation: GraphQLMutation { public static let operationString = "mutation CreateComment3($input: CreateComment3Input!, $condition: ModelComment3ConditionInput) {\n createComment3(input: $input, condition: $condition) {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n}" - + public var input: CreateComment3Input public var condition: ModelComment3ConditionInput? - + public init(input: CreateComment3Input, condition: ModelComment3ConditionInput? = 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("createComment3", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(CreateComment3.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(createComment3: CreateComment3? = nil) { - self.init(snapshot: ["__typename": "Mutation", "createComment3": createComment3.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "createComment3": createComment3.flatMap(\.snapshot)]) } - + public var createComment3: CreateComment3? { get { return (snapshot["createComment3"] as? Snapshot).flatMap { CreateComment3(snapshot: $0) } @@ -10455,10 +10463,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "createComment3") } } - + public struct CreateComment3: GraphQLSelectionSet { public static let possibleTypes = ["Comment3"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -10467,17 +10475,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment3", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -10486,7 +10494,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -10495,7 +10503,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -10504,7 +10512,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -10513,7 +10521,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -10522,7 +10530,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -10534,40 +10542,40 @@ public struct APISwift { } } } - + public final class UpdateComment3Mutation: GraphQLMutation { public static let operationString = "mutation UpdateComment3($input: UpdateComment3Input!, $condition: ModelComment3ConditionInput) {\n updateComment3(input: $input, condition: $condition) {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n}" - + public var input: UpdateComment3Input public var condition: ModelComment3ConditionInput? - + public init(input: UpdateComment3Input, condition: ModelComment3ConditionInput? = 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("updateComment3", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(UpdateComment3.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(updateComment3: UpdateComment3? = nil) { - self.init(snapshot: ["__typename": "Mutation", "updateComment3": updateComment3.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "updateComment3": updateComment3.flatMap(\.snapshot)]) } - + public var updateComment3: UpdateComment3? { get { return (snapshot["updateComment3"] as? Snapshot).flatMap { UpdateComment3(snapshot: $0) } @@ -10576,10 +10584,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "updateComment3") } } - + public struct UpdateComment3: GraphQLSelectionSet { public static let possibleTypes = ["Comment3"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -10588,17 +10596,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment3", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -10607,7 +10615,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -10616,7 +10624,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -10625,7 +10633,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -10634,7 +10642,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -10643,7 +10651,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -10655,40 +10663,40 @@ public struct APISwift { } } } - + public final class DeleteComment3Mutation: GraphQLMutation { public static let operationString = "mutation DeleteComment3($input: DeleteComment3Input!, $condition: ModelComment3ConditionInput) {\n deleteComment3(input: $input, condition: $condition) {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n}" - + public var input: DeleteComment3Input public var condition: ModelComment3ConditionInput? - + public init(input: DeleteComment3Input, condition: ModelComment3ConditionInput? = 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("deleteComment3", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(DeleteComment3.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(deleteComment3: DeleteComment3? = nil) { - self.init(snapshot: ["__typename": "Mutation", "deleteComment3": deleteComment3.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "deleteComment3": deleteComment3.flatMap(\.snapshot)]) } - + public var deleteComment3: DeleteComment3? { get { return (snapshot["deleteComment3"] as? Snapshot).flatMap { DeleteComment3(snapshot: $0) } @@ -10697,10 +10705,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "deleteComment3") } } - + public struct DeleteComment3: GraphQLSelectionSet { public static let possibleTypes = ["Comment3"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -10709,17 +10717,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment3", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -10728,7 +10736,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -10737,7 +10745,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -10746,7 +10754,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -10755,7 +10763,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -10764,7 +10772,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -10776,40 +10784,40 @@ public struct APISwift { } } } - + public final class CreatePost4Mutation: GraphQLMutation { public static let operationString = "mutation CreatePost4($input: CreatePost4Input!, $condition: ModelPost4ConditionInput) {\n createPost4(input: $input, condition: $condition) {\n __typename\n id\n title\n comments {\n __typename\n items {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public var input: CreatePost4Input public var condition: ModelPost4ConditionInput? - + public init(input: CreatePost4Input, condition: ModelPost4ConditionInput? = 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("createPost4", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(CreatePost4.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(createPost4: CreatePost4? = nil) { - self.init(snapshot: ["__typename": "Mutation", "createPost4": createPost4.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "createPost4": createPost4.flatMap(\.snapshot)]) } - + public var createPost4: CreatePost4? { get { return (snapshot["createPost4"] as? Snapshot).flatMap { CreatePost4(snapshot: $0) } @@ -10818,10 +10826,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "createPost4") } } - + public struct CreatePost4: GraphQLSelectionSet { public static let possibleTypes = ["Post4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -10830,17 +10838,17 @@ public struct APISwift { 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, title: String, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -10849,7 +10857,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -10858,7 +10866,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -10867,7 +10875,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -10876,7 +10884,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -10885,7 +10893,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -10894,26 +10902,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment4Connection"] - + 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": "ModelComment4Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelComment4Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -10922,16 +10930,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -10940,10 +10948,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -10952,17 +10960,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment4", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -10971,7 +10979,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -10980,7 +10988,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -10989,7 +10997,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -10998,7 +11006,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -11007,7 +11015,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -11021,40 +11029,40 @@ public struct APISwift { } } } - + public final class UpdatePost4Mutation: GraphQLMutation { public static let operationString = "mutation UpdatePost4($input: UpdatePost4Input!, $condition: ModelPost4ConditionInput) {\n updatePost4(input: $input, condition: $condition) {\n __typename\n id\n title\n comments {\n __typename\n items {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public var input: UpdatePost4Input public var condition: ModelPost4ConditionInput? - + public init(input: UpdatePost4Input, condition: ModelPost4ConditionInput? = 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("updatePost4", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(UpdatePost4.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(updatePost4: UpdatePost4? = nil) { - self.init(snapshot: ["__typename": "Mutation", "updatePost4": updatePost4.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "updatePost4": updatePost4.flatMap(\.snapshot)]) } - + public var updatePost4: UpdatePost4? { get { return (snapshot["updatePost4"] as? Snapshot).flatMap { UpdatePost4(snapshot: $0) } @@ -11063,10 +11071,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "updatePost4") } } - + public struct UpdatePost4: GraphQLSelectionSet { public static let possibleTypes = ["Post4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -11075,17 +11083,17 @@ public struct APISwift { 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, title: String, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -11094,7 +11102,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -11103,7 +11111,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -11112,7 +11120,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -11121,7 +11129,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -11130,7 +11138,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -11139,26 +11147,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment4Connection"] - + 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": "ModelComment4Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelComment4Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -11167,16 +11175,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -11185,10 +11193,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -11197,17 +11205,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment4", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -11216,7 +11224,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -11225,7 +11233,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -11234,7 +11242,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -11243,7 +11251,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -11252,7 +11260,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -11266,40 +11274,40 @@ public struct APISwift { } } } - + public final class DeletePost4Mutation: GraphQLMutation { public static let operationString = "mutation DeletePost4($input: DeletePost4Input!, $condition: ModelPost4ConditionInput) {\n deletePost4(input: $input, condition: $condition) {\n __typename\n id\n title\n comments {\n __typename\n items {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public var input: DeletePost4Input public var condition: ModelPost4ConditionInput? - + public init(input: DeletePost4Input, condition: ModelPost4ConditionInput? = 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("deletePost4", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(DeletePost4.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(deletePost4: DeletePost4? = nil) { - self.init(snapshot: ["__typename": "Mutation", "deletePost4": deletePost4.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "deletePost4": deletePost4.flatMap(\.snapshot)]) } - + public var deletePost4: DeletePost4? { get { return (snapshot["deletePost4"] as? Snapshot).flatMap { DeletePost4(snapshot: $0) } @@ -11308,10 +11316,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "deletePost4") } } - + public struct DeletePost4: GraphQLSelectionSet { public static let possibleTypes = ["Post4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -11320,17 +11328,17 @@ public struct APISwift { 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, title: String, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -11339,7 +11347,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -11348,7 +11356,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -11357,7 +11365,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -11366,7 +11374,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -11375,7 +11383,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -11384,26 +11392,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment4Connection"] - + 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": "ModelComment4Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelComment4Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -11412,16 +11420,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -11430,10 +11438,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -11442,17 +11450,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment4", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -11461,7 +11469,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -11470,7 +11478,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -11479,7 +11487,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -11488,7 +11496,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -11497,7 +11505,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -11511,40 +11519,40 @@ public struct APISwift { } } } - + public final class CreateComment4Mutation: GraphQLMutation { public static let operationString = "mutation CreateComment4($input: CreateComment4Input!, $condition: ModelComment4ConditionInput) {\n createComment4(input: $input, condition: $condition) {\n __typename\n id\n postID\n content\n post {\n __typename\n id\n title\n comments {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n}" - + public var input: CreateComment4Input public var condition: ModelComment4ConditionInput? - + public init(input: CreateComment4Input, condition: ModelComment4ConditionInput? = 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("createComment4", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(CreateComment4.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(createComment4: CreateComment4? = nil) { - self.init(snapshot: ["__typename": "Mutation", "createComment4": createComment4.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "createComment4": createComment4.flatMap(\.snapshot)]) } - + public var createComment4: CreateComment4? { get { return (snapshot["createComment4"] as? Snapshot).flatMap { CreateComment4(snapshot: $0) } @@ -11553,10 +11561,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "createComment4") } } - + public struct CreateComment4: GraphQLSelectionSet { public static let possibleTypes = ["Comment4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -11566,17 +11574,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, post: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Comment4", "id": id, "postID": postId, "content": content, "post": post.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Comment4", "id": id, "postID": postId, "content": content, "post": post.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -11585,7 +11593,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -11594,7 +11602,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -11603,7 +11611,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -11612,7 +11620,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var post: Post? { get { return (snapshot["post"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -11621,7 +11629,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "post") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -11630,7 +11638,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -11639,10 +11647,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -11651,17 +11659,17 @@ public struct APISwift { 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, title: String, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -11670,7 +11678,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -11679,7 +11687,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -11688,7 +11696,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -11697,7 +11705,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -11706,7 +11714,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -11715,25 +11723,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment4Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelComment4Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -11742,7 +11750,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -11756,40 +11764,40 @@ public struct APISwift { } } } - + public final class UpdateComment4Mutation: GraphQLMutation { public static let operationString = "mutation UpdateComment4($input: UpdateComment4Input!, $condition: ModelComment4ConditionInput) {\n updateComment4(input: $input, condition: $condition) {\n __typename\n id\n postID\n content\n post {\n __typename\n id\n title\n comments {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n}" - + public var input: UpdateComment4Input public var condition: ModelComment4ConditionInput? - + public init(input: UpdateComment4Input, condition: ModelComment4ConditionInput? = 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("updateComment4", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(UpdateComment4.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(updateComment4: UpdateComment4? = nil) { - self.init(snapshot: ["__typename": "Mutation", "updateComment4": updateComment4.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "updateComment4": updateComment4.flatMap(\.snapshot)]) } - + public var updateComment4: UpdateComment4? { get { return (snapshot["updateComment4"] as? Snapshot).flatMap { UpdateComment4(snapshot: $0) } @@ -11798,10 +11806,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "updateComment4") } } - + public struct UpdateComment4: GraphQLSelectionSet { public static let possibleTypes = ["Comment4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -11811,17 +11819,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, post: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Comment4", "id": id, "postID": postId, "content": content, "post": post.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Comment4", "id": id, "postID": postId, "content": content, "post": post.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -11830,7 +11838,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -11839,7 +11847,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -11848,7 +11856,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -11857,7 +11865,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var post: Post? { get { return (snapshot["post"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -11866,7 +11874,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "post") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -11875,7 +11883,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -11884,10 +11892,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -11896,17 +11904,17 @@ public struct APISwift { 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, title: String, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -11915,7 +11923,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -11924,7 +11932,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -11933,7 +11941,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -11942,7 +11950,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -11951,7 +11959,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -11960,25 +11968,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment4Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelComment4Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -11987,7 +11995,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -12001,40 +12009,40 @@ public struct APISwift { } } } - + public final class DeleteComment4Mutation: GraphQLMutation { public static let operationString = "mutation DeleteComment4($input: DeleteComment4Input!, $condition: ModelComment4ConditionInput) {\n deleteComment4(input: $input, condition: $condition) {\n __typename\n id\n postID\n content\n post {\n __typename\n id\n title\n comments {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n}" - + public var input: DeleteComment4Input public var condition: ModelComment4ConditionInput? - + public init(input: DeleteComment4Input, condition: ModelComment4ConditionInput? = 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("deleteComment4", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(DeleteComment4.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(deleteComment4: DeleteComment4? = nil) { - self.init(snapshot: ["__typename": "Mutation", "deleteComment4": deleteComment4.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "deleteComment4": deleteComment4.flatMap(\.snapshot)]) } - + public var deleteComment4: DeleteComment4? { get { return (snapshot["deleteComment4"] as? Snapshot).flatMap { DeleteComment4(snapshot: $0) } @@ -12043,10 +12051,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "deleteComment4") } } - + public struct DeleteComment4: GraphQLSelectionSet { public static let possibleTypes = ["Comment4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -12056,17 +12064,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, post: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Comment4", "id": id, "postID": postId, "content": content, "post": post.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Comment4", "id": id, "postID": postId, "content": content, "post": post.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -12075,7 +12083,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -12084,7 +12092,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -12093,7 +12101,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -12102,7 +12110,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var post: Post? { get { return (snapshot["post"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -12111,7 +12119,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "post") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -12120,7 +12128,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -12129,10 +12137,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -12141,17 +12149,17 @@ public struct APISwift { 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, title: String, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -12160,7 +12168,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -12169,7 +12177,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -12178,7 +12186,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -12187,7 +12195,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -12196,7 +12204,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -12205,25 +12213,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment4Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelComment4Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -12232,7 +12240,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -12246,40 +12254,40 @@ public struct APISwift { } } } - + public final class CreatePost5Mutation: GraphQLMutation { public static let operationString = "mutation CreatePost5($input: CreatePost5Input!, $condition: ModelPost5ConditionInput) {\n createPost5(input: $input, condition: $condition) {\n __typename\n id\n title\n editors {\n __typename\n items {\n __typename\n id\n postID\n editorID\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public var input: CreatePost5Input public var condition: ModelPost5ConditionInput? - + public init(input: CreatePost5Input, condition: ModelPost5ConditionInput? = 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("createPost5", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(CreatePost5.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(createPost5: CreatePost5? = nil) { - self.init(snapshot: ["__typename": "Mutation", "createPost5": createPost5.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "createPost5": createPost5.flatMap(\.snapshot)]) } - + public var createPost5: CreatePost5? { get { return (snapshot["createPost5"] as? Snapshot).flatMap { CreatePost5(snapshot: $0) } @@ -12288,10 +12296,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "createPost5") } } - + public struct CreatePost5: GraphQLSelectionSet { public static let possibleTypes = ["Post5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -12300,17 +12308,17 @@ public struct APISwift { 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, title: String, editors: Editor? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -12319,7 +12327,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -12328,7 +12336,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -12337,7 +12345,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var editors: Editor? { get { return (snapshot["editors"] as? Snapshot).flatMap { Editor(snapshot: $0) } @@ -12346,7 +12354,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "editors") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -12355,7 +12363,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -12364,26 +12372,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Editor: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + 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": "ModelPostEditor5Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -12392,16 +12400,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -12410,10 +12418,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["PostEditor5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -12422,17 +12430,17 @@ public struct APISwift { 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, postId: GraphQLID, editorId: GraphQLID, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "PostEditor5", "id": id, "postID": postId, "editorID": editorId, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -12441,7 +12449,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -12450,7 +12458,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -12459,7 +12467,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var editorId: GraphQLID { get { return snapshot["editorID"]! as! GraphQLID @@ -12468,7 +12476,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "editorID") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -12477,7 +12485,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -12491,40 +12499,40 @@ public struct APISwift { } } } - + public final class UpdatePost5Mutation: GraphQLMutation { public static let operationString = "mutation UpdatePost5($input: UpdatePost5Input!, $condition: ModelPost5ConditionInput) {\n updatePost5(input: $input, condition: $condition) {\n __typename\n id\n title\n editors {\n __typename\n items {\n __typename\n id\n postID\n editorID\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public var input: UpdatePost5Input public var condition: ModelPost5ConditionInput? - + public init(input: UpdatePost5Input, condition: ModelPost5ConditionInput? = 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("updatePost5", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(UpdatePost5.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(updatePost5: UpdatePost5? = nil) { - self.init(snapshot: ["__typename": "Mutation", "updatePost5": updatePost5.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "updatePost5": updatePost5.flatMap(\.snapshot)]) } - + public var updatePost5: UpdatePost5? { get { return (snapshot["updatePost5"] as? Snapshot).flatMap { UpdatePost5(snapshot: $0) } @@ -12533,10 +12541,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "updatePost5") } } - + public struct UpdatePost5: GraphQLSelectionSet { public static let possibleTypes = ["Post5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -12545,17 +12553,17 @@ public struct APISwift { 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, title: String, editors: Editor? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -12564,7 +12572,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -12573,7 +12581,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -12582,7 +12590,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var editors: Editor? { get { return (snapshot["editors"] as? Snapshot).flatMap { Editor(snapshot: $0) } @@ -12591,7 +12599,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "editors") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -12600,7 +12608,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -12609,26 +12617,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Editor: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + 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": "ModelPostEditor5Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -12637,16 +12645,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -12655,10 +12663,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["PostEditor5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -12667,17 +12675,17 @@ public struct APISwift { 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, postId: GraphQLID, editorId: GraphQLID, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "PostEditor5", "id": id, "postID": postId, "editorID": editorId, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -12686,7 +12694,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -12695,7 +12703,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -12704,7 +12712,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var editorId: GraphQLID { get { return snapshot["editorID"]! as! GraphQLID @@ -12713,7 +12721,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "editorID") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -12722,7 +12730,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -12736,40 +12744,40 @@ public struct APISwift { } } } - + public final class DeletePost5Mutation: GraphQLMutation { public static let operationString = "mutation DeletePost5($input: DeletePost5Input!, $condition: ModelPost5ConditionInput) {\n deletePost5(input: $input, condition: $condition) {\n __typename\n id\n title\n editors {\n __typename\n items {\n __typename\n id\n postID\n editorID\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public var input: DeletePost5Input public var condition: ModelPost5ConditionInput? - + public init(input: DeletePost5Input, condition: ModelPost5ConditionInput? = 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("deletePost5", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(DeletePost5.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(deletePost5: DeletePost5? = nil) { - self.init(snapshot: ["__typename": "Mutation", "deletePost5": deletePost5.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "deletePost5": deletePost5.flatMap(\.snapshot)]) } - + public var deletePost5: DeletePost5? { get { return (snapshot["deletePost5"] as? Snapshot).flatMap { DeletePost5(snapshot: $0) } @@ -12778,10 +12786,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "deletePost5") } } - + public struct DeletePost5: GraphQLSelectionSet { public static let possibleTypes = ["Post5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -12790,17 +12798,17 @@ public struct APISwift { 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, title: String, editors: Editor? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -12809,7 +12817,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -12818,7 +12826,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -12827,7 +12835,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var editors: Editor? { get { return (snapshot["editors"] as? Snapshot).flatMap { Editor(snapshot: $0) } @@ -12836,7 +12844,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "editors") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -12845,7 +12853,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -12854,26 +12862,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Editor: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + 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": "ModelPostEditor5Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -12882,16 +12890,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -12900,10 +12908,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["PostEditor5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -12912,17 +12920,17 @@ public struct APISwift { 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, postId: GraphQLID, editorId: GraphQLID, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "PostEditor5", "id": id, "postID": postId, "editorID": editorId, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -12931,7 +12939,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -12940,7 +12948,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -12949,7 +12957,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var editorId: GraphQLID { get { return snapshot["editorID"]! as! GraphQLID @@ -12958,7 +12966,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "editorID") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -12967,7 +12975,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -12981,40 +12989,40 @@ public struct APISwift { } } } - + public final class CreatePostEditor5Mutation: GraphQLMutation { public static let operationString = "mutation CreatePostEditor5($input: CreatePostEditor5Input!, $condition: ModelPostEditor5ConditionInput) {\n createPostEditor5(input: $input, condition: $condition) {\n __typename\n id\n postID\n editorID\n post {\n __typename\n id\n title\n editors {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n editor {\n __typename\n id\n username\n posts {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n}" - + public var input: CreatePostEditor5Input public var condition: ModelPostEditor5ConditionInput? - + public init(input: CreatePostEditor5Input, condition: ModelPostEditor5ConditionInput? = 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("createPostEditor5", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(CreatePostEditor5.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(createPostEditor5: CreatePostEditor5? = nil) { - self.init(snapshot: ["__typename": "Mutation", "createPostEditor5": createPostEditor5.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "createPostEditor5": createPostEditor5.flatMap(\.snapshot)]) } - + public var createPostEditor5: CreatePostEditor5? { get { return (snapshot["createPostEditor5"] as? Snapshot).flatMap { CreatePostEditor5(snapshot: $0) } @@ -13023,10 +13031,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "createPostEditor5") } } - + public struct CreatePostEditor5: GraphQLSelectionSet { public static let possibleTypes = ["PostEditor5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -13037,17 +13045,17 @@ public struct APISwift { 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, postId: GraphQLID, editorId: GraphQLID, post: Post, editor: Editor, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "PostEditor5", "id": id, "postID": postId, "editorID": editorId, "post": post.snapshot, "editor": editor.snapshot, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -13056,7 +13064,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -13065,7 +13073,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -13074,7 +13082,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var editorId: GraphQLID { get { return snapshot["editorID"]! as! GraphQLID @@ -13083,7 +13091,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "editorID") } } - + public var post: Post { get { return Post(snapshot: snapshot["post"]! as! Snapshot) @@ -13092,7 +13100,7 @@ public struct APISwift { snapshot.updateValue(newValue.snapshot, forKey: "post") } } - + public var editor: Editor { get { return Editor(snapshot: snapshot["editor"]! as! Snapshot) @@ -13101,7 +13109,7 @@ public struct APISwift { snapshot.updateValue(newValue.snapshot, forKey: "editor") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -13110,7 +13118,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -13119,10 +13127,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -13131,17 +13139,17 @@ public struct APISwift { 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, title: String, editors: Editor? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -13150,7 +13158,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -13159,7 +13167,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -13168,7 +13176,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var editors: Editor? { get { return (snapshot["editors"] as? Snapshot).flatMap { Editor(snapshot: $0) } @@ -13177,7 +13185,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "editors") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -13186,7 +13194,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -13195,25 +13203,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Editor: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -13222,7 +13230,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -13233,10 +13241,10 @@ public struct APISwift { } } } - + public struct Editor: GraphQLSelectionSet { public static let possibleTypes = ["User5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -13245,17 +13253,17 @@ public struct APISwift { 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, username: String, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -13264,7 +13272,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -13273,7 +13281,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var username: String { get { return snapshot["username"]! as! String @@ -13282,7 +13290,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "username") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -13291,7 +13299,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -13300,7 +13308,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -13309,25 +13317,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -13336,7 +13344,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -13350,40 +13358,40 @@ public struct APISwift { } } } - + public final class UpdatePostEditor5Mutation: GraphQLMutation { public static let operationString = "mutation UpdatePostEditor5($input: UpdatePostEditor5Input!, $condition: ModelPostEditor5ConditionInput) {\n updatePostEditor5(input: $input, condition: $condition) {\n __typename\n id\n postID\n editorID\n post {\n __typename\n id\n title\n editors {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n editor {\n __typename\n id\n username\n posts {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n}" - + public var input: UpdatePostEditor5Input public var condition: ModelPostEditor5ConditionInput? - + public init(input: UpdatePostEditor5Input, condition: ModelPostEditor5ConditionInput? = 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("updatePostEditor5", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(UpdatePostEditor5.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(updatePostEditor5: UpdatePostEditor5? = nil) { - self.init(snapshot: ["__typename": "Mutation", "updatePostEditor5": updatePostEditor5.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "updatePostEditor5": updatePostEditor5.flatMap(\.snapshot)]) } - + public var updatePostEditor5: UpdatePostEditor5? { get { return (snapshot["updatePostEditor5"] as? Snapshot).flatMap { UpdatePostEditor5(snapshot: $0) } @@ -13392,10 +13400,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "updatePostEditor5") } } - + public struct UpdatePostEditor5: GraphQLSelectionSet { public static let possibleTypes = ["PostEditor5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -13406,17 +13414,17 @@ public struct APISwift { 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, postId: GraphQLID, editorId: GraphQLID, post: Post, editor: Editor, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "PostEditor5", "id": id, "postID": postId, "editorID": editorId, "post": post.snapshot, "editor": editor.snapshot, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -13425,7 +13433,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -13434,7 +13442,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -13443,7 +13451,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var editorId: GraphQLID { get { return snapshot["editorID"]! as! GraphQLID @@ -13452,7 +13460,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "editorID") } } - + public var post: Post { get { return Post(snapshot: snapshot["post"]! as! Snapshot) @@ -13461,7 +13469,7 @@ public struct APISwift { snapshot.updateValue(newValue.snapshot, forKey: "post") } } - + public var editor: Editor { get { return Editor(snapshot: snapshot["editor"]! as! Snapshot) @@ -13470,7 +13478,7 @@ public struct APISwift { snapshot.updateValue(newValue.snapshot, forKey: "editor") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -13479,7 +13487,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -13488,10 +13496,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -13500,17 +13508,17 @@ public struct APISwift { 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, title: String, editors: Editor? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -13519,7 +13527,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -13528,7 +13536,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -13537,7 +13545,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var editors: Editor? { get { return (snapshot["editors"] as? Snapshot).flatMap { Editor(snapshot: $0) } @@ -13546,7 +13554,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "editors") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -13555,7 +13563,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -13564,25 +13572,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Editor: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -13591,7 +13599,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -13602,10 +13610,10 @@ public struct APISwift { } } } - + public struct Editor: GraphQLSelectionSet { public static let possibleTypes = ["User5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -13614,17 +13622,17 @@ public struct APISwift { 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, username: String, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -13633,7 +13641,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -13642,7 +13650,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var username: String { get { return snapshot["username"]! as! String @@ -13651,7 +13659,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "username") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -13660,7 +13668,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -13669,7 +13677,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -13678,25 +13686,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -13705,7 +13713,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -13719,40 +13727,40 @@ public struct APISwift { } } } - + public final class DeletePostEditor5Mutation: GraphQLMutation { public static let operationString = "mutation DeletePostEditor5($input: DeletePostEditor5Input!, $condition: ModelPostEditor5ConditionInput) {\n deletePostEditor5(input: $input, condition: $condition) {\n __typename\n id\n postID\n editorID\n post {\n __typename\n id\n title\n editors {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n editor {\n __typename\n id\n username\n posts {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n}" - + public var input: DeletePostEditor5Input public var condition: ModelPostEditor5ConditionInput? - + public init(input: DeletePostEditor5Input, condition: ModelPostEditor5ConditionInput? = 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("deletePostEditor5", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(DeletePostEditor5.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(deletePostEditor5: DeletePostEditor5? = nil) { - self.init(snapshot: ["__typename": "Mutation", "deletePostEditor5": deletePostEditor5.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "deletePostEditor5": deletePostEditor5.flatMap(\.snapshot)]) } - + public var deletePostEditor5: DeletePostEditor5? { get { return (snapshot["deletePostEditor5"] as? Snapshot).flatMap { DeletePostEditor5(snapshot: $0) } @@ -13761,10 +13769,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "deletePostEditor5") } } - + public struct DeletePostEditor5: GraphQLSelectionSet { public static let possibleTypes = ["PostEditor5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -13775,17 +13783,17 @@ public struct APISwift { 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, postId: GraphQLID, editorId: GraphQLID, post: Post, editor: Editor, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "PostEditor5", "id": id, "postID": postId, "editorID": editorId, "post": post.snapshot, "editor": editor.snapshot, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -13794,7 +13802,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -13803,7 +13811,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -13812,7 +13820,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var editorId: GraphQLID { get { return snapshot["editorID"]! as! GraphQLID @@ -13821,7 +13829,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "editorID") } } - + public var post: Post { get { return Post(snapshot: snapshot["post"]! as! Snapshot) @@ -13830,7 +13838,7 @@ public struct APISwift { snapshot.updateValue(newValue.snapshot, forKey: "post") } } - + public var editor: Editor { get { return Editor(snapshot: snapshot["editor"]! as! Snapshot) @@ -13839,7 +13847,7 @@ public struct APISwift { snapshot.updateValue(newValue.snapshot, forKey: "editor") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -13848,7 +13856,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -13857,10 +13865,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -13869,17 +13877,17 @@ public struct APISwift { 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, title: String, editors: Editor? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -13888,7 +13896,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -13897,7 +13905,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -13906,7 +13914,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var editors: Editor? { get { return (snapshot["editors"] as? Snapshot).flatMap { Editor(snapshot: $0) } @@ -13915,7 +13923,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "editors") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -13924,7 +13932,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -13933,25 +13941,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Editor: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -13960,7 +13968,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -13971,10 +13979,10 @@ public struct APISwift { } } } - + public struct Editor: GraphQLSelectionSet { public static let possibleTypes = ["User5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -13983,17 +13991,17 @@ public struct APISwift { 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, username: String, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -14002,7 +14010,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -14011,7 +14019,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var username: String { get { return snapshot["username"]! as! String @@ -14020,7 +14028,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "username") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -14029,7 +14037,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -14038,7 +14046,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -14047,25 +14055,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -14074,7 +14082,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -14088,40 +14096,40 @@ public struct APISwift { } } } - + public final class CreateUser5Mutation: GraphQLMutation { public static let operationString = "mutation CreateUser5($input: CreateUser5Input!, $condition: ModelUser5ConditionInput) {\n createUser5(input: $input, condition: $condition) {\n __typename\n id\n username\n posts {\n __typename\n items {\n __typename\n id\n postID\n editorID\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public var input: CreateUser5Input public var condition: ModelUser5ConditionInput? - + public init(input: CreateUser5Input, condition: ModelUser5ConditionInput? = 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("createUser5", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(CreateUser5.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(createUser5: CreateUser5? = nil) { - self.init(snapshot: ["__typename": "Mutation", "createUser5": createUser5.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "createUser5": createUser5.flatMap(\.snapshot)]) } - + public var createUser5: CreateUser5? { get { return (snapshot["createUser5"] as? Snapshot).flatMap { CreateUser5(snapshot: $0) } @@ -14130,10 +14138,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "createUser5") } } - + public struct CreateUser5: GraphQLSelectionSet { public static let possibleTypes = ["User5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -14142,17 +14150,17 @@ public struct APISwift { 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, username: String, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -14161,7 +14169,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -14170,7 +14178,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var username: String { get { return snapshot["username"]! as! String @@ -14179,7 +14187,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "username") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -14188,7 +14196,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -14197,7 +14205,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -14206,26 +14214,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + 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": "ModelPostEditor5Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -14234,16 +14242,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -14252,10 +14260,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["PostEditor5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -14264,17 +14272,17 @@ public struct APISwift { 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, postId: GraphQLID, editorId: GraphQLID, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "PostEditor5", "id": id, "postID": postId, "editorID": editorId, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -14283,7 +14291,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -14292,7 +14300,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -14301,7 +14309,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var editorId: GraphQLID { get { return snapshot["editorID"]! as! GraphQLID @@ -14310,7 +14318,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "editorID") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -14319,7 +14327,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -14333,40 +14341,40 @@ public struct APISwift { } } } - + public final class UpdateUser5Mutation: GraphQLMutation { public static let operationString = "mutation UpdateUser5($input: UpdateUser5Input!, $condition: ModelUser5ConditionInput) {\n updateUser5(input: $input, condition: $condition) {\n __typename\n id\n username\n posts {\n __typename\n items {\n __typename\n id\n postID\n editorID\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public var input: UpdateUser5Input public var condition: ModelUser5ConditionInput? - + public init(input: UpdateUser5Input, condition: ModelUser5ConditionInput? = 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("updateUser5", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(UpdateUser5.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(updateUser5: UpdateUser5? = nil) { - self.init(snapshot: ["__typename": "Mutation", "updateUser5": updateUser5.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "updateUser5": updateUser5.flatMap(\.snapshot)]) } - + public var updateUser5: UpdateUser5? { get { return (snapshot["updateUser5"] as? Snapshot).flatMap { UpdateUser5(snapshot: $0) } @@ -14375,10 +14383,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "updateUser5") } } - + public struct UpdateUser5: GraphQLSelectionSet { public static let possibleTypes = ["User5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -14387,17 +14395,17 @@ public struct APISwift { 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, username: String, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -14406,7 +14414,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -14415,7 +14423,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var username: String { get { return snapshot["username"]! as! String @@ -14424,7 +14432,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "username") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -14433,7 +14441,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -14442,7 +14450,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -14451,26 +14459,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + 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": "ModelPostEditor5Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -14479,16 +14487,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -14497,10 +14505,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["PostEditor5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -14509,17 +14517,17 @@ public struct APISwift { 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, postId: GraphQLID, editorId: GraphQLID, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "PostEditor5", "id": id, "postID": postId, "editorID": editorId, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -14528,7 +14536,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -14537,7 +14545,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -14546,7 +14554,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var editorId: GraphQLID { get { return snapshot["editorID"]! as! GraphQLID @@ -14555,7 +14563,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "editorID") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -14564,7 +14572,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -14578,40 +14586,40 @@ public struct APISwift { } } } - + public final class DeleteUser5Mutation: GraphQLMutation { public static let operationString = "mutation DeleteUser5($input: DeleteUser5Input!, $condition: ModelUser5ConditionInput) {\n deleteUser5(input: $input, condition: $condition) {\n __typename\n id\n username\n posts {\n __typename\n items {\n __typename\n id\n postID\n editorID\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public var input: DeleteUser5Input public var condition: ModelUser5ConditionInput? - + public init(input: DeleteUser5Input, condition: ModelUser5ConditionInput? = 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("deleteUser5", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(DeleteUser5.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(deleteUser5: DeleteUser5? = nil) { - self.init(snapshot: ["__typename": "Mutation", "deleteUser5": deleteUser5.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "deleteUser5": deleteUser5.flatMap(\.snapshot)]) } - + public var deleteUser5: DeleteUser5? { get { return (snapshot["deleteUser5"] as? Snapshot).flatMap { DeleteUser5(snapshot: $0) } @@ -14620,10 +14628,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "deleteUser5") } } - + public struct DeleteUser5: GraphQLSelectionSet { public static let possibleTypes = ["User5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -14632,17 +14640,17 @@ public struct APISwift { 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, username: String, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -14651,7 +14659,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -14660,7 +14668,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var username: String { get { return snapshot["username"]! as! String @@ -14669,7 +14677,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "username") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -14678,7 +14686,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -14687,7 +14695,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -14696,26 +14704,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + 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": "ModelPostEditor5Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -14724,16 +14732,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -14742,10 +14750,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["PostEditor5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -14754,17 +14762,17 @@ public struct APISwift { 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, postId: GraphQLID, editorId: GraphQLID, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "PostEditor5", "id": id, "postID": postId, "editorID": editorId, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -14773,7 +14781,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -14782,7 +14790,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -14791,7 +14799,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var editorId: GraphQLID { get { return snapshot["editorID"]! as! GraphQLID @@ -14800,7 +14808,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "editorID") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -14809,7 +14817,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -14823,40 +14831,40 @@ public struct APISwift { } } } - + public final class CreateBlog6Mutation: GraphQLMutation { public static let operationString = "mutation CreateBlog6($input: CreateBlog6Input!, $condition: ModelBlog6ConditionInput) {\n createBlog6(input: $input, condition: $condition) {\n __typename\n id\n name\n posts {\n __typename\n items {\n __typename\n id\n title\n blogID\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public var input: CreateBlog6Input public var condition: ModelBlog6ConditionInput? - + public init(input: CreateBlog6Input, condition: ModelBlog6ConditionInput? = 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("createBlog6", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(CreateBlog6.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(createBlog6: CreateBlog6? = nil) { - self.init(snapshot: ["__typename": "Mutation", "createBlog6": createBlog6.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "createBlog6": createBlog6.flatMap(\.snapshot)]) } - + public var createBlog6: CreateBlog6? { get { return (snapshot["createBlog6"] as? Snapshot).flatMap { CreateBlog6(snapshot: $0) } @@ -14865,10 +14873,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "createBlog6") } } - + public struct CreateBlog6: GraphQLSelectionSet { public static let possibleTypes = ["Blog6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -14877,17 +14885,17 @@ public struct APISwift { 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, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -14896,7 +14904,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -14905,7 +14913,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -14914,7 +14922,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -14923,7 +14931,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -14932,7 +14940,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -14941,26 +14949,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPost6Connection"] - + 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": "ModelPost6Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPost6Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -14969,16 +14977,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -14987,10 +14995,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Post6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -14999,17 +15007,17 @@ public struct APISwift { 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, title: String, blogId: GraphQLID, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -15018,7 +15026,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -15027,7 +15035,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -15036,7 +15044,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID { get { return snapshot["blogID"]! as! GraphQLID @@ -15045,7 +15053,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "blogID") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -15054,7 +15062,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -15068,40 +15076,40 @@ public struct APISwift { } } } - + public final class UpdateBlog6Mutation: GraphQLMutation { public static let operationString = "mutation UpdateBlog6($input: UpdateBlog6Input!, $condition: ModelBlog6ConditionInput) {\n updateBlog6(input: $input, condition: $condition) {\n __typename\n id\n name\n posts {\n __typename\n items {\n __typename\n id\n title\n blogID\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public var input: UpdateBlog6Input public var condition: ModelBlog6ConditionInput? - + public init(input: UpdateBlog6Input, condition: ModelBlog6ConditionInput? = 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("updateBlog6", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(UpdateBlog6.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(updateBlog6: UpdateBlog6? = nil) { - self.init(snapshot: ["__typename": "Mutation", "updateBlog6": updateBlog6.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "updateBlog6": updateBlog6.flatMap(\.snapshot)]) } - + public var updateBlog6: UpdateBlog6? { get { return (snapshot["updateBlog6"] as? Snapshot).flatMap { UpdateBlog6(snapshot: $0) } @@ -15110,10 +15118,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "updateBlog6") } } - + public struct UpdateBlog6: GraphQLSelectionSet { public static let possibleTypes = ["Blog6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -15122,17 +15130,17 @@ public struct APISwift { 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, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -15141,7 +15149,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -15150,7 +15158,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -15159,7 +15167,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -15168,7 +15176,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -15177,7 +15185,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -15186,26 +15194,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPost6Connection"] - + 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": "ModelPost6Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPost6Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -15214,16 +15222,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -15232,10 +15240,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Post6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -15244,17 +15252,17 @@ public struct APISwift { 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, title: String, blogId: GraphQLID, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -15263,7 +15271,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -15272,7 +15280,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -15281,7 +15289,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID { get { return snapshot["blogID"]! as! GraphQLID @@ -15290,7 +15298,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "blogID") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -15299,7 +15307,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -15313,40 +15321,40 @@ public struct APISwift { } } } - + public final class DeleteBlog6Mutation: GraphQLMutation { public static let operationString = "mutation DeleteBlog6($input: DeleteBlog6Input!, $condition: ModelBlog6ConditionInput) {\n deleteBlog6(input: $input, condition: $condition) {\n __typename\n id\n name\n posts {\n __typename\n items {\n __typename\n id\n title\n blogID\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public var input: DeleteBlog6Input public var condition: ModelBlog6ConditionInput? - + public init(input: DeleteBlog6Input, condition: ModelBlog6ConditionInput? = 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("deleteBlog6", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(DeleteBlog6.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(deleteBlog6: DeleteBlog6? = nil) { - self.init(snapshot: ["__typename": "Mutation", "deleteBlog6": deleteBlog6.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "deleteBlog6": deleteBlog6.flatMap(\.snapshot)]) } - + public var deleteBlog6: DeleteBlog6? { get { return (snapshot["deleteBlog6"] as? Snapshot).flatMap { DeleteBlog6(snapshot: $0) } @@ -15355,10 +15363,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "deleteBlog6") } } - + public struct DeleteBlog6: GraphQLSelectionSet { public static let possibleTypes = ["Blog6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -15367,17 +15375,17 @@ public struct APISwift { 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, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -15386,7 +15394,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -15395,7 +15403,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -15404,7 +15412,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -15413,7 +15421,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -15422,7 +15430,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -15431,26 +15439,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPost6Connection"] - + 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": "ModelPost6Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPost6Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -15459,16 +15467,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -15477,10 +15485,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Post6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -15489,17 +15497,17 @@ public struct APISwift { 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, title: String, blogId: GraphQLID, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -15508,7 +15516,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -15517,7 +15525,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -15526,7 +15534,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID { get { return snapshot["blogID"]! as! GraphQLID @@ -15535,7 +15543,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "blogID") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -15544,7 +15552,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -15558,40 +15566,40 @@ public struct APISwift { } } } - + public final class CreatePost6Mutation: GraphQLMutation { public static let operationString = "mutation CreatePost6($input: CreatePost6Input!, $condition: ModelPost6ConditionInput) {\n createPost6(input: $input, condition: $condition) {\n __typename\n id\n title\n blogID\n blog {\n __typename\n id\n name\n posts {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n comments {\n __typename\n items {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public var input: CreatePost6Input public var condition: ModelPost6ConditionInput? - + public init(input: CreatePost6Input, condition: ModelPost6ConditionInput? = 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("createPost6", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(CreatePost6.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(createPost6: CreatePost6? = nil) { - self.init(snapshot: ["__typename": "Mutation", "createPost6": createPost6.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "createPost6": createPost6.flatMap(\.snapshot)]) } - + public var createPost6: CreatePost6? { get { return (snapshot["createPost6"] as? Snapshot).flatMap { CreatePost6(snapshot: $0) } @@ -15600,10 +15608,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "createPost6") } } - + public struct CreatePost6: GraphQLSelectionSet { public static let possibleTypes = ["Post6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -15614,17 +15622,17 @@ public struct APISwift { 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, title: String, blogId: GraphQLID, blog: Blog? = nil, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap { $0.snapshot }, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap(\.snapshot), "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -15633,7 +15641,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -15642,7 +15650,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -15651,7 +15659,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID { get { return snapshot["blogID"]! as! GraphQLID @@ -15660,7 +15668,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "blogID") } } - + public var blog: Blog? { get { return (snapshot["blog"] as? Snapshot).flatMap { Blog(snapshot: $0) } @@ -15669,7 +15677,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "blog") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -15678,7 +15686,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -15687,7 +15695,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -15696,10 +15704,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Blog: GraphQLSelectionSet { public static let possibleTypes = ["Blog6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -15708,17 +15716,17 @@ public struct APISwift { 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, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -15727,7 +15735,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -15736,7 +15744,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -15745,7 +15753,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -15754,7 +15762,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -15763,7 +15771,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -15772,25 +15780,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPost6Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelPost6Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -15799,7 +15807,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -15810,26 +15818,26 @@ public struct APISwift { } } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment6Connection"] - + 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": "ModelComment6Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelComment6Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -15838,16 +15846,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -15856,10 +15864,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -15868,17 +15876,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment6", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -15887,7 +15895,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -15896,7 +15904,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -15905,7 +15913,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -15914,7 +15922,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -15923,7 +15931,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -15937,40 +15945,40 @@ public struct APISwift { } } } - + public final class UpdatePost6Mutation: GraphQLMutation { public static let operationString = "mutation UpdatePost6($input: UpdatePost6Input!, $condition: ModelPost6ConditionInput) {\n updatePost6(input: $input, condition: $condition) {\n __typename\n id\n title\n blogID\n blog {\n __typename\n id\n name\n posts {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n comments {\n __typename\n items {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public var input: UpdatePost6Input public var condition: ModelPost6ConditionInput? - + public init(input: UpdatePost6Input, condition: ModelPost6ConditionInput? = 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("updatePost6", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(UpdatePost6.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(updatePost6: UpdatePost6? = nil) { - self.init(snapshot: ["__typename": "Mutation", "updatePost6": updatePost6.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "updatePost6": updatePost6.flatMap(\.snapshot)]) } - + public var updatePost6: UpdatePost6? { get { return (snapshot["updatePost6"] as? Snapshot).flatMap { UpdatePost6(snapshot: $0) } @@ -15979,10 +15987,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "updatePost6") } } - + public struct UpdatePost6: GraphQLSelectionSet { public static let possibleTypes = ["Post6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -15993,17 +16001,17 @@ public struct APISwift { 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, title: String, blogId: GraphQLID, blog: Blog? = nil, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap { $0.snapshot }, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap(\.snapshot), "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -16012,7 +16020,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -16021,7 +16029,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -16030,7 +16038,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID { get { return snapshot["blogID"]! as! GraphQLID @@ -16039,7 +16047,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "blogID") } } - + public var blog: Blog? { get { return (snapshot["blog"] as? Snapshot).flatMap { Blog(snapshot: $0) } @@ -16048,7 +16056,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "blog") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -16057,7 +16065,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -16066,7 +16074,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -16075,10 +16083,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Blog: GraphQLSelectionSet { public static let possibleTypes = ["Blog6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -16087,17 +16095,17 @@ public struct APISwift { 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, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -16106,7 +16114,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -16115,7 +16123,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -16124,7 +16132,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -16133,7 +16141,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -16142,7 +16150,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -16151,25 +16159,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPost6Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelPost6Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -16178,7 +16186,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -16189,26 +16197,26 @@ public struct APISwift { } } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment6Connection"] - + 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": "ModelComment6Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelComment6Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -16217,16 +16225,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -16235,10 +16243,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -16247,17 +16255,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment6", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -16266,7 +16274,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -16275,7 +16283,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -16284,7 +16292,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -16293,7 +16301,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -16302,7 +16310,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -16316,40 +16324,40 @@ public struct APISwift { } } } - + public final class DeletePost6Mutation: GraphQLMutation { public static let operationString = "mutation DeletePost6($input: DeletePost6Input!, $condition: ModelPost6ConditionInput) {\n deletePost6(input: $input, condition: $condition) {\n __typename\n id\n title\n blogID\n blog {\n __typename\n id\n name\n posts {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n comments {\n __typename\n items {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public var input: DeletePost6Input public var condition: ModelPost6ConditionInput? - + public init(input: DeletePost6Input, condition: ModelPost6ConditionInput? = 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("deletePost6", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(DeletePost6.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(deletePost6: DeletePost6? = nil) { - self.init(snapshot: ["__typename": "Mutation", "deletePost6": deletePost6.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "deletePost6": deletePost6.flatMap(\.snapshot)]) } - + public var deletePost6: DeletePost6? { get { return (snapshot["deletePost6"] as? Snapshot).flatMap { DeletePost6(snapshot: $0) } @@ -16358,10 +16366,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "deletePost6") } } - + public struct DeletePost6: GraphQLSelectionSet { public static let possibleTypes = ["Post6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -16372,17 +16380,17 @@ public struct APISwift { 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, title: String, blogId: GraphQLID, blog: Blog? = nil, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap { $0.snapshot }, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap(\.snapshot), "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -16391,7 +16399,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -16400,7 +16408,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -16409,7 +16417,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID { get { return snapshot["blogID"]! as! GraphQLID @@ -16418,7 +16426,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "blogID") } } - + public var blog: Blog? { get { return (snapshot["blog"] as? Snapshot).flatMap { Blog(snapshot: $0) } @@ -16427,7 +16435,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "blog") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -16436,7 +16444,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -16445,7 +16453,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -16454,10 +16462,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Blog: GraphQLSelectionSet { public static let possibleTypes = ["Blog6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -16466,17 +16474,17 @@ public struct APISwift { 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, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -16485,7 +16493,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -16494,7 +16502,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -16503,7 +16511,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -16512,7 +16520,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -16521,7 +16529,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -16530,25 +16538,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPost6Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelPost6Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -16557,7 +16565,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -16568,26 +16576,26 @@ public struct APISwift { } } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment6Connection"] - + 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": "ModelComment6Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelComment6Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -16596,16 +16604,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -16614,10 +16622,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -16626,17 +16634,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment6", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -16645,7 +16653,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -16654,7 +16662,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -16663,7 +16671,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -16672,7 +16680,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -16681,7 +16689,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -16695,40 +16703,40 @@ public struct APISwift { } } } - + public final class CreateComment6Mutation: GraphQLMutation { public static let operationString = "mutation CreateComment6($input: CreateComment6Input!, $condition: ModelComment6ConditionInput) {\n createComment6(input: $input, condition: $condition) {\n __typename\n id\n postID\n post {\n __typename\n id\n title\n blogID\n blog {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n comments {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n content\n createdAt\n updatedAt\n }\n}" - + public var input: CreateComment6Input public var condition: ModelComment6ConditionInput? - + public init(input: CreateComment6Input, condition: ModelComment6ConditionInput? = 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("createComment6", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(CreateComment6.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(createComment6: CreateComment6? = nil) { - self.init(snapshot: ["__typename": "Mutation", "createComment6": createComment6.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "createComment6": createComment6.flatMap(\.snapshot)]) } - + public var createComment6: CreateComment6? { get { return (snapshot["createComment6"] as? Snapshot).flatMap { CreateComment6(snapshot: $0) } @@ -16737,10 +16745,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "createComment6") } } - + public struct CreateComment6: GraphQLSelectionSet { public static let possibleTypes = ["Comment6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -16750,17 +16758,17 @@ public struct APISwift { 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, postId: GraphQLID, post: Post? = nil, content: String, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Comment6", "id": id, "postID": postId, "post": post.flatMap { $0.snapshot }, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Comment6", "id": id, "postID": postId, "post": post.flatMap(\.snapshot), "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -16769,7 +16777,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -16778,7 +16786,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -16787,7 +16795,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var post: Post? { get { return (snapshot["post"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -16796,7 +16804,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "post") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -16805,7 +16813,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -16814,7 +16822,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -16823,10 +16831,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -16837,17 +16845,17 @@ public struct APISwift { 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, title: String, blogId: GraphQLID, blog: Blog? = nil, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap { $0.snapshot }, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap(\.snapshot), "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -16856,7 +16864,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -16865,7 +16873,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -16874,7 +16882,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID { get { return snapshot["blogID"]! as! GraphQLID @@ -16883,7 +16891,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "blogID") } } - + public var blog: Blog? { get { return (snapshot["blog"] as? Snapshot).flatMap { Blog(snapshot: $0) } @@ -16892,7 +16900,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "blog") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -16901,7 +16909,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -16910,7 +16918,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -16919,10 +16927,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Blog: GraphQLSelectionSet { public static let possibleTypes = ["Blog6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -16930,17 +16938,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -16949,7 +16957,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -16958,7 +16966,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -16967,7 +16975,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -16976,7 +16984,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -16986,25 +16994,25 @@ public struct APISwift { } } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment6Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelComment6Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -17013,7 +17021,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -17027,40 +17035,40 @@ public struct APISwift { } } } - + public final class UpdateComment6Mutation: GraphQLMutation { public static let operationString = "mutation UpdateComment6($input: UpdateComment6Input!, $condition: ModelComment6ConditionInput) {\n updateComment6(input: $input, condition: $condition) {\n __typename\n id\n postID\n post {\n __typename\n id\n title\n blogID\n blog {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n comments {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n content\n createdAt\n updatedAt\n }\n}" - + public var input: UpdateComment6Input public var condition: ModelComment6ConditionInput? - + public init(input: UpdateComment6Input, condition: ModelComment6ConditionInput? = 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("updateComment6", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(UpdateComment6.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(updateComment6: UpdateComment6? = nil) { - self.init(snapshot: ["__typename": "Mutation", "updateComment6": updateComment6.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "updateComment6": updateComment6.flatMap(\.snapshot)]) } - + public var updateComment6: UpdateComment6? { get { return (snapshot["updateComment6"] as? Snapshot).flatMap { UpdateComment6(snapshot: $0) } @@ -17069,10 +17077,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "updateComment6") } } - + public struct UpdateComment6: GraphQLSelectionSet { public static let possibleTypes = ["Comment6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -17082,17 +17090,17 @@ public struct APISwift { 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, postId: GraphQLID, post: Post? = nil, content: String, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Comment6", "id": id, "postID": postId, "post": post.flatMap { $0.snapshot }, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Comment6", "id": id, "postID": postId, "post": post.flatMap(\.snapshot), "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -17101,7 +17109,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -17110,7 +17118,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -17119,7 +17127,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var post: Post? { get { return (snapshot["post"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -17128,7 +17136,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "post") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -17137,7 +17145,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -17146,7 +17154,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -17155,10 +17163,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -17169,17 +17177,17 @@ public struct APISwift { 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, title: String, blogId: GraphQLID, blog: Blog? = nil, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap { $0.snapshot }, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap(\.snapshot), "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -17188,7 +17196,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -17197,7 +17205,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -17206,7 +17214,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID { get { return snapshot["blogID"]! as! GraphQLID @@ -17215,7 +17223,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "blogID") } } - + public var blog: Blog? { get { return (snapshot["blog"] as? Snapshot).flatMap { Blog(snapshot: $0) } @@ -17224,7 +17232,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "blog") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -17233,7 +17241,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -17242,7 +17250,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -17251,10 +17259,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Blog: GraphQLSelectionSet { public static let possibleTypes = ["Blog6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -17262,17 +17270,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -17281,7 +17289,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -17290,7 +17298,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -17299,7 +17307,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -17308,7 +17316,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -17318,25 +17326,25 @@ public struct APISwift { } } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment6Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelComment6Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -17345,7 +17353,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -17359,40 +17367,40 @@ public struct APISwift { } } } - + public final class DeleteComment6Mutation: GraphQLMutation { public static let operationString = "mutation DeleteComment6($input: DeleteComment6Input!, $condition: ModelComment6ConditionInput) {\n deleteComment6(input: $input, condition: $condition) {\n __typename\n id\n postID\n post {\n __typename\n id\n title\n blogID\n blog {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n comments {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n content\n createdAt\n updatedAt\n }\n}" - + public var input: DeleteComment6Input public var condition: ModelComment6ConditionInput? - + public init(input: DeleteComment6Input, condition: ModelComment6ConditionInput? = 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("deleteComment6", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(DeleteComment6.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(deleteComment6: DeleteComment6? = nil) { - self.init(snapshot: ["__typename": "Mutation", "deleteComment6": deleteComment6.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "deleteComment6": deleteComment6.flatMap(\.snapshot)]) } - + public var deleteComment6: DeleteComment6? { get { return (snapshot["deleteComment6"] as? Snapshot).flatMap { DeleteComment6(snapshot: $0) } @@ -17401,10 +17409,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "deleteComment6") } } - + public struct DeleteComment6: GraphQLSelectionSet { public static let possibleTypes = ["Comment6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -17414,17 +17422,17 @@ public struct APISwift { 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, postId: GraphQLID, post: Post? = nil, content: String, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Comment6", "id": id, "postID": postId, "post": post.flatMap { $0.snapshot }, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Comment6", "id": id, "postID": postId, "post": post.flatMap(\.snapshot), "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -17433,7 +17441,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -17442,7 +17450,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -17451,7 +17459,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var post: Post? { get { return (snapshot["post"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -17460,7 +17468,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "post") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -17469,7 +17477,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -17478,7 +17486,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -17487,10 +17495,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -17501,17 +17509,17 @@ public struct APISwift { 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, title: String, blogId: GraphQLID, blog: Blog? = nil, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap { $0.snapshot }, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap(\.snapshot), "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -17520,7 +17528,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -17529,7 +17537,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -17538,7 +17546,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID { get { return snapshot["blogID"]! as! GraphQLID @@ -17547,7 +17555,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "blogID") } } - + public var blog: Blog? { get { return (snapshot["blog"] as? Snapshot).flatMap { Blog(snapshot: $0) } @@ -17556,7 +17564,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "blog") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -17565,7 +17573,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -17574,7 +17582,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -17583,10 +17591,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Blog: GraphQLSelectionSet { public static let possibleTypes = ["Blog6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -17594,17 +17602,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -17613,7 +17621,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -17622,7 +17630,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -17631,7 +17639,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -17640,7 +17648,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -17650,25 +17658,25 @@ public struct APISwift { } } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment6Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelComment6Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -17677,7 +17685,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -17691,40 +17699,40 @@ public struct APISwift { } } } - + public final class CreateScalarContainerMutation: GraphQLMutation { public static let operationString = "mutation CreateScalarContainer($input: CreateScalarContainerInput!, $condition: ModelScalarContainerConditionInput) {\n createScalarContainer(input: $input, condition: $condition) {\n __typename\n id\n myString\n myInt\n myDouble\n myBool\n myDate\n myTime\n myDateTime\n myTimeStamp\n myEmail\n myJSON\n myPhone\n myURL\n myIPAddress\n createdAt\n updatedAt\n }\n}" - + public var input: CreateScalarContainerInput public var condition: ModelScalarContainerConditionInput? - + public init(input: CreateScalarContainerInput, condition: ModelScalarContainerConditionInput? = 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("createScalarContainer", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(CreateScalarContainer.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(createScalarContainer: CreateScalarContainer? = nil) { - self.init(snapshot: ["__typename": "Mutation", "createScalarContainer": createScalarContainer.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "createScalarContainer": createScalarContainer.flatMap(\.snapshot)]) } - + public var createScalarContainer: CreateScalarContainer? { get { return (snapshot["createScalarContainer"] as? Snapshot).flatMap { CreateScalarContainer(snapshot: $0) } @@ -17733,10 +17741,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "createScalarContainer") } } - + public struct CreateScalarContainer: GraphQLSelectionSet { public static let possibleTypes = ["ScalarContainer"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -17756,17 +17764,17 @@ public struct APISwift { 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, myString: String? = nil, myInt: Int? = nil, myDouble: Double? = nil, myBool: Bool? = nil, myDate: String? = nil, myTime: String? = nil, myDateTime: String? = nil, myTimeStamp: Int? = nil, myEmail: String? = nil, myJson: String? = nil, myPhone: String? = nil, myUrl: String? = nil, myIpAddress: String? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "ScalarContainer", "id": id, "myString": myString, "myInt": myInt, "myDouble": myDouble, "myBool": myBool, "myDate": myDate, "myTime": myTime, "myDateTime": myDateTime, "myTimeStamp": myTimeStamp, "myEmail": myEmail, "myJSON": myJson, "myPhone": myPhone, "myURL": myUrl, "myIPAddress": myIpAddress, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -17775,7 +17783,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -17784,7 +17792,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var myString: String? { get { return snapshot["myString"] as? String @@ -17793,7 +17801,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myString") } } - + public var myInt: Int? { get { return snapshot["myInt"] as? Int @@ -17802,7 +17810,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myInt") } } - + public var myDouble: Double? { get { return snapshot["myDouble"] as? Double @@ -17811,7 +17819,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myDouble") } } - + public var myBool: Bool? { get { return snapshot["myBool"] as? Bool @@ -17820,7 +17828,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myBool") } } - + public var myDate: String? { get { return snapshot["myDate"] as? String @@ -17829,7 +17837,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myDate") } } - + public var myTime: String? { get { return snapshot["myTime"] as? String @@ -17838,7 +17846,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myTime") } } - + public var myDateTime: String? { get { return snapshot["myDateTime"] as? String @@ -17847,7 +17855,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myDateTime") } } - + public var myTimeStamp: Int? { get { return snapshot["myTimeStamp"] as? Int @@ -17856,7 +17864,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myTimeStamp") } } - + public var myEmail: String? { get { return snapshot["myEmail"] as? String @@ -17865,7 +17873,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myEmail") } } - + public var myJson: String? { get { return snapshot["myJSON"] as? String @@ -17874,7 +17882,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myJSON") } } - + public var myPhone: String? { get { return snapshot["myPhone"] as? String @@ -17883,7 +17891,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myPhone") } } - + public var myUrl: String? { get { return snapshot["myURL"] as? String @@ -17892,7 +17900,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myURL") } } - + public var myIpAddress: String? { get { return snapshot["myIPAddress"] as? String @@ -17901,7 +17909,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myIPAddress") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -17910,7 +17918,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -17922,40 +17930,40 @@ public struct APISwift { } } } - + public final class UpdateScalarContainerMutation: GraphQLMutation { public static let operationString = "mutation UpdateScalarContainer($input: UpdateScalarContainerInput!, $condition: ModelScalarContainerConditionInput) {\n updateScalarContainer(input: $input, condition: $condition) {\n __typename\n id\n myString\n myInt\n myDouble\n myBool\n myDate\n myTime\n myDateTime\n myTimeStamp\n myEmail\n myJSON\n myPhone\n myURL\n myIPAddress\n createdAt\n updatedAt\n }\n}" - + public var input: UpdateScalarContainerInput public var condition: ModelScalarContainerConditionInput? - + public init(input: UpdateScalarContainerInput, condition: ModelScalarContainerConditionInput? = 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("updateScalarContainer", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(UpdateScalarContainer.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(updateScalarContainer: UpdateScalarContainer? = nil) { - self.init(snapshot: ["__typename": "Mutation", "updateScalarContainer": updateScalarContainer.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "updateScalarContainer": updateScalarContainer.flatMap(\.snapshot)]) } - + public var updateScalarContainer: UpdateScalarContainer? { get { return (snapshot["updateScalarContainer"] as? Snapshot).flatMap { UpdateScalarContainer(snapshot: $0) } @@ -17964,10 +17972,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "updateScalarContainer") } } - + public struct UpdateScalarContainer: GraphQLSelectionSet { public static let possibleTypes = ["ScalarContainer"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -17987,17 +17995,17 @@ public struct APISwift { 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, myString: String? = nil, myInt: Int? = nil, myDouble: Double? = nil, myBool: Bool? = nil, myDate: String? = nil, myTime: String? = nil, myDateTime: String? = nil, myTimeStamp: Int? = nil, myEmail: String? = nil, myJson: String? = nil, myPhone: String? = nil, myUrl: String? = nil, myIpAddress: String? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "ScalarContainer", "id": id, "myString": myString, "myInt": myInt, "myDouble": myDouble, "myBool": myBool, "myDate": myDate, "myTime": myTime, "myDateTime": myDateTime, "myTimeStamp": myTimeStamp, "myEmail": myEmail, "myJSON": myJson, "myPhone": myPhone, "myURL": myUrl, "myIPAddress": myIpAddress, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -18006,7 +18014,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -18015,7 +18023,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var myString: String? { get { return snapshot["myString"] as? String @@ -18024,7 +18032,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myString") } } - + public var myInt: Int? { get { return snapshot["myInt"] as? Int @@ -18033,7 +18041,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myInt") } } - + public var myDouble: Double? { get { return snapshot["myDouble"] as? Double @@ -18042,7 +18050,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myDouble") } } - + public var myBool: Bool? { get { return snapshot["myBool"] as? Bool @@ -18051,7 +18059,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myBool") } } - + public var myDate: String? { get { return snapshot["myDate"] as? String @@ -18060,7 +18068,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myDate") } } - + public var myTime: String? { get { return snapshot["myTime"] as? String @@ -18069,7 +18077,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myTime") } } - + public var myDateTime: String? { get { return snapshot["myDateTime"] as? String @@ -18078,7 +18086,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myDateTime") } } - + public var myTimeStamp: Int? { get { return snapshot["myTimeStamp"] as? Int @@ -18087,7 +18095,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myTimeStamp") } } - + public var myEmail: String? { get { return snapshot["myEmail"] as? String @@ -18096,7 +18104,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myEmail") } } - + public var myJson: String? { get { return snapshot["myJSON"] as? String @@ -18105,7 +18113,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myJSON") } } - + public var myPhone: String? { get { return snapshot["myPhone"] as? String @@ -18114,7 +18122,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myPhone") } } - + public var myUrl: String? { get { return snapshot["myURL"] as? String @@ -18123,7 +18131,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myURL") } } - + public var myIpAddress: String? { get { return snapshot["myIPAddress"] as? String @@ -18132,7 +18140,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myIPAddress") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -18141,7 +18149,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -18153,40 +18161,40 @@ public struct APISwift { } } } - + public final class DeleteScalarContainerMutation: GraphQLMutation { public static let operationString = "mutation DeleteScalarContainer($input: DeleteScalarContainerInput!, $condition: ModelScalarContainerConditionInput) {\n deleteScalarContainer(input: $input, condition: $condition) {\n __typename\n id\n myString\n myInt\n myDouble\n myBool\n myDate\n myTime\n myDateTime\n myTimeStamp\n myEmail\n myJSON\n myPhone\n myURL\n myIPAddress\n createdAt\n updatedAt\n }\n}" - + public var input: DeleteScalarContainerInput public var condition: ModelScalarContainerConditionInput? - + public init(input: DeleteScalarContainerInput, condition: ModelScalarContainerConditionInput? = 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("deleteScalarContainer", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(DeleteScalarContainer.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(deleteScalarContainer: DeleteScalarContainer? = nil) { - self.init(snapshot: ["__typename": "Mutation", "deleteScalarContainer": deleteScalarContainer.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "deleteScalarContainer": deleteScalarContainer.flatMap(\.snapshot)]) } - + public var deleteScalarContainer: DeleteScalarContainer? { get { return (snapshot["deleteScalarContainer"] as? Snapshot).flatMap { DeleteScalarContainer(snapshot: $0) } @@ -18195,10 +18203,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "deleteScalarContainer") } } - + public struct DeleteScalarContainer: GraphQLSelectionSet { public static let possibleTypes = ["ScalarContainer"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -18218,17 +18226,17 @@ public struct APISwift { 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, myString: String? = nil, myInt: Int? = nil, myDouble: Double? = nil, myBool: Bool? = nil, myDate: String? = nil, myTime: String? = nil, myDateTime: String? = nil, myTimeStamp: Int? = nil, myEmail: String? = nil, myJson: String? = nil, myPhone: String? = nil, myUrl: String? = nil, myIpAddress: String? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "ScalarContainer", "id": id, "myString": myString, "myInt": myInt, "myDouble": myDouble, "myBool": myBool, "myDate": myDate, "myTime": myTime, "myDateTime": myDateTime, "myTimeStamp": myTimeStamp, "myEmail": myEmail, "myJSON": myJson, "myPhone": myPhone, "myURL": myUrl, "myIPAddress": myIpAddress, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -18237,7 +18245,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -18246,7 +18254,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var myString: String? { get { return snapshot["myString"] as? String @@ -18255,7 +18263,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myString") } } - + public var myInt: Int? { get { return snapshot["myInt"] as? Int @@ -18264,7 +18272,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myInt") } } - + public var myDouble: Double? { get { return snapshot["myDouble"] as? Double @@ -18273,7 +18281,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myDouble") } } - + public var myBool: Bool? { get { return snapshot["myBool"] as? Bool @@ -18282,7 +18290,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myBool") } } - + public var myDate: String? { get { return snapshot["myDate"] as? String @@ -18291,7 +18299,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myDate") } } - + public var myTime: String? { get { return snapshot["myTime"] as? String @@ -18300,7 +18308,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myTime") } } - + public var myDateTime: String? { get { return snapshot["myDateTime"] as? String @@ -18309,7 +18317,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myDateTime") } } - + public var myTimeStamp: Int? { get { return snapshot["myTimeStamp"] as? Int @@ -18318,7 +18326,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myTimeStamp") } } - + public var myEmail: String? { get { return snapshot["myEmail"] as? String @@ -18327,7 +18335,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myEmail") } } - + public var myJson: String? { get { return snapshot["myJSON"] as? String @@ -18336,7 +18344,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myJSON") } } - + public var myPhone: String? { get { return snapshot["myPhone"] as? String @@ -18345,7 +18353,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myPhone") } } - + public var myUrl: String? { get { return snapshot["myURL"] as? String @@ -18354,7 +18362,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myURL") } } - + public var myIpAddress: String? { get { return snapshot["myIPAddress"] as? String @@ -18363,7 +18371,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myIPAddress") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -18372,7 +18380,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -18384,40 +18392,40 @@ public struct APISwift { } } } - + public final class CreateListIntContainerMutation: GraphQLMutation { public static let operationString = "mutation CreateListIntContainer($input: CreateListIntContainerInput!, $condition: ModelListIntContainerConditionInput) {\n createListIntContainer(input: $input, condition: $condition) {\n __typename\n id\n test\n nullableInt\n intList\n intNullableList\n nullableIntList\n nullableIntNullableList\n createdAt\n updatedAt\n }\n}" - + public var input: CreateListIntContainerInput public var condition: ModelListIntContainerConditionInput? - + public init(input: CreateListIntContainerInput, condition: ModelListIntContainerConditionInput? = 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("createListIntContainer", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(CreateListIntContainer.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(createListIntContainer: CreateListIntContainer? = nil) { - self.init(snapshot: ["__typename": "Mutation", "createListIntContainer": createListIntContainer.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "createListIntContainer": createListIntContainer.flatMap(\.snapshot)]) } - + public var createListIntContainer: CreateListIntContainer? { get { return (snapshot["createListIntContainer"] as? Snapshot).flatMap { CreateListIntContainer(snapshot: $0) } @@ -18426,10 +18434,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "createListIntContainer") } } - + public struct CreateListIntContainer: GraphQLSelectionSet { public static let possibleTypes = ["ListIntContainer"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -18442,17 +18450,17 @@ public struct APISwift { 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, test: Int, nullableInt: Int? = nil, intList: [Int], intNullableList: [Int]? = nil, nullableIntList: [Int?], nullableIntNullableList: [Int?]? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "ListIntContainer", "id": id, "test": test, "nullableInt": nullableInt, "intList": intList, "intNullableList": intNullableList, "nullableIntList": nullableIntList, "nullableIntNullableList": nullableIntNullableList, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -18461,7 +18469,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -18470,7 +18478,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var test: Int { get { return snapshot["test"]! as! Int @@ -18479,7 +18487,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "test") } } - + public var nullableInt: Int? { get { return snapshot["nullableInt"] as? Int @@ -18488,7 +18496,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableInt") } } - + public var intList: [Int] { get { return snapshot["intList"]! as! [Int] @@ -18497,7 +18505,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "intList") } } - + public var intNullableList: [Int]? { get { return snapshot["intNullableList"] as? [Int] @@ -18506,7 +18514,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "intNullableList") } } - + public var nullableIntList: [Int?] { get { return snapshot["nullableIntList"]! as! [Int?] @@ -18515,7 +18523,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableIntList") } } - + public var nullableIntNullableList: [Int?]? { get { return snapshot["nullableIntNullableList"] as? [Int?] @@ -18524,7 +18532,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableIntNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -18533,7 +18541,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -18545,40 +18553,40 @@ public struct APISwift { } } } - + public final class UpdateListIntContainerMutation: GraphQLMutation { public static let operationString = "mutation UpdateListIntContainer($input: UpdateListIntContainerInput!, $condition: ModelListIntContainerConditionInput) {\n updateListIntContainer(input: $input, condition: $condition) {\n __typename\n id\n test\n nullableInt\n intList\n intNullableList\n nullableIntList\n nullableIntNullableList\n createdAt\n updatedAt\n }\n}" - + public var input: UpdateListIntContainerInput public var condition: ModelListIntContainerConditionInput? - + public init(input: UpdateListIntContainerInput, condition: ModelListIntContainerConditionInput? = 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("updateListIntContainer", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(UpdateListIntContainer.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(updateListIntContainer: UpdateListIntContainer? = nil) { - self.init(snapshot: ["__typename": "Mutation", "updateListIntContainer": updateListIntContainer.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "updateListIntContainer": updateListIntContainer.flatMap(\.snapshot)]) } - + public var updateListIntContainer: UpdateListIntContainer? { get { return (snapshot["updateListIntContainer"] as? Snapshot).flatMap { UpdateListIntContainer(snapshot: $0) } @@ -18587,10 +18595,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "updateListIntContainer") } } - + public struct UpdateListIntContainer: GraphQLSelectionSet { public static let possibleTypes = ["ListIntContainer"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -18603,17 +18611,17 @@ public struct APISwift { 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, test: Int, nullableInt: Int? = nil, intList: [Int], intNullableList: [Int]? = nil, nullableIntList: [Int?], nullableIntNullableList: [Int?]? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "ListIntContainer", "id": id, "test": test, "nullableInt": nullableInt, "intList": intList, "intNullableList": intNullableList, "nullableIntList": nullableIntList, "nullableIntNullableList": nullableIntNullableList, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -18622,7 +18630,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -18631,7 +18639,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var test: Int { get { return snapshot["test"]! as! Int @@ -18640,7 +18648,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "test") } } - + public var nullableInt: Int? { get { return snapshot["nullableInt"] as? Int @@ -18649,7 +18657,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableInt") } } - + public var intList: [Int] { get { return snapshot["intList"]! as! [Int] @@ -18658,7 +18666,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "intList") } } - + public var intNullableList: [Int]? { get { return snapshot["intNullableList"] as? [Int] @@ -18667,7 +18675,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "intNullableList") } } - + public var nullableIntList: [Int?] { get { return snapshot["nullableIntList"]! as! [Int?] @@ -18676,7 +18684,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableIntList") } } - + public var nullableIntNullableList: [Int?]? { get { return snapshot["nullableIntNullableList"] as? [Int?] @@ -18685,7 +18693,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableIntNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -18694,7 +18702,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -18706,40 +18714,40 @@ public struct APISwift { } } } - + public final class DeleteListIntContainerMutation: GraphQLMutation { public static let operationString = "mutation DeleteListIntContainer($input: DeleteListIntContainerInput!, $condition: ModelListIntContainerConditionInput) {\n deleteListIntContainer(input: $input, condition: $condition) {\n __typename\n id\n test\n nullableInt\n intList\n intNullableList\n nullableIntList\n nullableIntNullableList\n createdAt\n updatedAt\n }\n}" - + public var input: DeleteListIntContainerInput public var condition: ModelListIntContainerConditionInput? - + public init(input: DeleteListIntContainerInput, condition: ModelListIntContainerConditionInput? = 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("deleteListIntContainer", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(DeleteListIntContainer.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(deleteListIntContainer: DeleteListIntContainer? = nil) { - self.init(snapshot: ["__typename": "Mutation", "deleteListIntContainer": deleteListIntContainer.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "deleteListIntContainer": deleteListIntContainer.flatMap(\.snapshot)]) } - + public var deleteListIntContainer: DeleteListIntContainer? { get { return (snapshot["deleteListIntContainer"] as? Snapshot).flatMap { DeleteListIntContainer(snapshot: $0) } @@ -18748,10 +18756,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "deleteListIntContainer") } } - + public struct DeleteListIntContainer: GraphQLSelectionSet { public static let possibleTypes = ["ListIntContainer"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -18764,17 +18772,17 @@ public struct APISwift { 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, test: Int, nullableInt: Int? = nil, intList: [Int], intNullableList: [Int]? = nil, nullableIntList: [Int?], nullableIntNullableList: [Int?]? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "ListIntContainer", "id": id, "test": test, "nullableInt": nullableInt, "intList": intList, "intNullableList": intNullableList, "nullableIntList": nullableIntList, "nullableIntNullableList": nullableIntNullableList, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -18783,7 +18791,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -18792,7 +18800,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var test: Int { get { return snapshot["test"]! as! Int @@ -18801,7 +18809,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "test") } } - + public var nullableInt: Int? { get { return snapshot["nullableInt"] as? Int @@ -18810,7 +18818,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableInt") } } - + public var intList: [Int] { get { return snapshot["intList"]! as! [Int] @@ -18819,7 +18827,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "intList") } } - + public var intNullableList: [Int]? { get { return snapshot["intNullableList"] as? [Int] @@ -18828,7 +18836,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "intNullableList") } } - + public var nullableIntList: [Int?] { get { return snapshot["nullableIntList"]! as! [Int?] @@ -18837,7 +18845,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableIntList") } } - + public var nullableIntNullableList: [Int?]? { get { return snapshot["nullableIntNullableList"] as? [Int?] @@ -18846,7 +18854,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableIntNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -18855,7 +18863,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -18867,40 +18875,40 @@ public struct APISwift { } } } - + public final class CreateListStringContainerMutation: GraphQLMutation { public static let operationString = "mutation CreateListStringContainer($input: CreateListStringContainerInput!, $condition: ModelListStringContainerConditionInput) {\n createListStringContainer(input: $input, condition: $condition) {\n __typename\n id\n test\n nullableString\n stringList\n stringNullableList\n nullableStringList\n nullableStringNullableList\n createdAt\n updatedAt\n }\n}" - + public var input: CreateListStringContainerInput public var condition: ModelListStringContainerConditionInput? - + public init(input: CreateListStringContainerInput, condition: ModelListStringContainerConditionInput? = 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("createListStringContainer", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(CreateListStringContainer.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(createListStringContainer: CreateListStringContainer? = nil) { - self.init(snapshot: ["__typename": "Mutation", "createListStringContainer": createListStringContainer.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "createListStringContainer": createListStringContainer.flatMap(\.snapshot)]) } - + public var createListStringContainer: CreateListStringContainer? { get { return (snapshot["createListStringContainer"] as? Snapshot).flatMap { CreateListStringContainer(snapshot: $0) } @@ -18909,10 +18917,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "createListStringContainer") } } - + public struct CreateListStringContainer: GraphQLSelectionSet { public static let possibleTypes = ["ListStringContainer"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -18925,17 +18933,17 @@ public struct APISwift { 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, test: String, nullableString: String? = nil, stringList: [String], stringNullableList: [String]? = nil, nullableStringList: [String?], nullableStringNullableList: [String?]? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "ListStringContainer", "id": id, "test": test, "nullableString": nullableString, "stringList": stringList, "stringNullableList": stringNullableList, "nullableStringList": nullableStringList, "nullableStringNullableList": nullableStringNullableList, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -18944,7 +18952,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -18953,7 +18961,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var test: String { get { return snapshot["test"]! as! String @@ -18962,7 +18970,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "test") } } - + public var nullableString: String? { get { return snapshot["nullableString"] as? String @@ -18971,7 +18979,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableString") } } - + public var stringList: [String] { get { return snapshot["stringList"]! as! [String] @@ -18980,7 +18988,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "stringList") } } - + public var stringNullableList: [String]? { get { return snapshot["stringNullableList"] as? [String] @@ -18989,7 +18997,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "stringNullableList") } } - + public var nullableStringList: [String?] { get { return snapshot["nullableStringList"]! as! [String?] @@ -18998,7 +19006,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableStringList") } } - + public var nullableStringNullableList: [String?]? { get { return snapshot["nullableStringNullableList"] as? [String?] @@ -19007,7 +19015,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableStringNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -19016,7 +19024,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -19028,40 +19036,40 @@ public struct APISwift { } } } - + public final class UpdateListStringContainerMutation: GraphQLMutation { public static let operationString = "mutation UpdateListStringContainer($input: UpdateListStringContainerInput!, $condition: ModelListStringContainerConditionInput) {\n updateListStringContainer(input: $input, condition: $condition) {\n __typename\n id\n test\n nullableString\n stringList\n stringNullableList\n nullableStringList\n nullableStringNullableList\n createdAt\n updatedAt\n }\n}" - + public var input: UpdateListStringContainerInput public var condition: ModelListStringContainerConditionInput? - + public init(input: UpdateListStringContainerInput, condition: ModelListStringContainerConditionInput? = 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("updateListStringContainer", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(UpdateListStringContainer.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(updateListStringContainer: UpdateListStringContainer? = nil) { - self.init(snapshot: ["__typename": "Mutation", "updateListStringContainer": updateListStringContainer.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "updateListStringContainer": updateListStringContainer.flatMap(\.snapshot)]) } - + public var updateListStringContainer: UpdateListStringContainer? { get { return (snapshot["updateListStringContainer"] as? Snapshot).flatMap { UpdateListStringContainer(snapshot: $0) } @@ -19070,10 +19078,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "updateListStringContainer") } } - + public struct UpdateListStringContainer: GraphQLSelectionSet { public static let possibleTypes = ["ListStringContainer"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -19086,17 +19094,17 @@ public struct APISwift { 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, test: String, nullableString: String? = nil, stringList: [String], stringNullableList: [String]? = nil, nullableStringList: [String?], nullableStringNullableList: [String?]? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "ListStringContainer", "id": id, "test": test, "nullableString": nullableString, "stringList": stringList, "stringNullableList": stringNullableList, "nullableStringList": nullableStringList, "nullableStringNullableList": nullableStringNullableList, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -19105,7 +19113,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -19114,7 +19122,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var test: String { get { return snapshot["test"]! as! String @@ -19123,7 +19131,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "test") } } - + public var nullableString: String? { get { return snapshot["nullableString"] as? String @@ -19132,7 +19140,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableString") } } - + public var stringList: [String] { get { return snapshot["stringList"]! as! [String] @@ -19141,7 +19149,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "stringList") } } - + public var stringNullableList: [String]? { get { return snapshot["stringNullableList"] as? [String] @@ -19150,7 +19158,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "stringNullableList") } } - + public var nullableStringList: [String?] { get { return snapshot["nullableStringList"]! as! [String?] @@ -19159,7 +19167,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableStringList") } } - + public var nullableStringNullableList: [String?]? { get { return snapshot["nullableStringNullableList"] as? [String?] @@ -19168,7 +19176,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableStringNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -19177,7 +19185,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -19189,40 +19197,40 @@ public struct APISwift { } } } - + public final class DeleteListStringContainerMutation: GraphQLMutation { public static let operationString = "mutation DeleteListStringContainer($input: DeleteListStringContainerInput!, $condition: ModelListStringContainerConditionInput) {\n deleteListStringContainer(input: $input, condition: $condition) {\n __typename\n id\n test\n nullableString\n stringList\n stringNullableList\n nullableStringList\n nullableStringNullableList\n createdAt\n updatedAt\n }\n}" - + public var input: DeleteListStringContainerInput public var condition: ModelListStringContainerConditionInput? - + public init(input: DeleteListStringContainerInput, condition: ModelListStringContainerConditionInput? = 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("deleteListStringContainer", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(DeleteListStringContainer.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(deleteListStringContainer: DeleteListStringContainer? = nil) { - self.init(snapshot: ["__typename": "Mutation", "deleteListStringContainer": deleteListStringContainer.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "deleteListStringContainer": deleteListStringContainer.flatMap(\.snapshot)]) } - + public var deleteListStringContainer: DeleteListStringContainer? { get { return (snapshot["deleteListStringContainer"] as? Snapshot).flatMap { DeleteListStringContainer(snapshot: $0) } @@ -19231,10 +19239,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "deleteListStringContainer") } } - + public struct DeleteListStringContainer: GraphQLSelectionSet { public static let possibleTypes = ["ListStringContainer"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -19247,17 +19255,17 @@ public struct APISwift { 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, test: String, nullableString: String? = nil, stringList: [String], stringNullableList: [String]? = nil, nullableStringList: [String?], nullableStringNullableList: [String?]? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "ListStringContainer", "id": id, "test": test, "nullableString": nullableString, "stringList": stringList, "stringNullableList": stringNullableList, "nullableStringList": nullableStringList, "nullableStringNullableList": nullableStringNullableList, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -19266,7 +19274,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -19275,7 +19283,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var test: String { get { return snapshot["test"]! as! String @@ -19284,7 +19292,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "test") } } - + public var nullableString: String? { get { return snapshot["nullableString"] as? String @@ -19293,7 +19301,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableString") } } - + public var stringList: [String] { get { return snapshot["stringList"]! as! [String] @@ -19302,7 +19310,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "stringList") } } - + public var stringNullableList: [String]? { get { return snapshot["stringNullableList"] as? [String] @@ -19311,7 +19319,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "stringNullableList") } } - + public var nullableStringList: [String?] { get { return snapshot["nullableStringList"]! as! [String?] @@ -19320,7 +19328,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableStringList") } } - + public var nullableStringNullableList: [String?]? { get { return snapshot["nullableStringNullableList"] as? [String?] @@ -19329,7 +19337,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableStringNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -19338,7 +19346,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -19350,40 +19358,40 @@ public struct APISwift { } } } - + public final class CreateEnumTestModelMutation: GraphQLMutation { public static let operationString = "mutation CreateEnumTestModel($input: CreateEnumTestModelInput!, $condition: ModelEnumTestModelConditionInput) {\n createEnumTestModel(input: $input, condition: $condition) {\n __typename\n id\n enumVal\n nullableEnumVal\n enumList\n enumNullableList\n nullableEnumList\n nullableEnumNullableList\n createdAt\n updatedAt\n }\n}" - + public var input: CreateEnumTestModelInput public var condition: ModelEnumTestModelConditionInput? - + public init(input: CreateEnumTestModelInput, condition: ModelEnumTestModelConditionInput? = 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("createEnumTestModel", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(CreateEnumTestModel.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(createEnumTestModel: CreateEnumTestModel? = nil) { - self.init(snapshot: ["__typename": "Mutation", "createEnumTestModel": createEnumTestModel.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "createEnumTestModel": createEnumTestModel.flatMap(\.snapshot)]) } - + public var createEnumTestModel: CreateEnumTestModel? { get { return (snapshot["createEnumTestModel"] as? Snapshot).flatMap { CreateEnumTestModel(snapshot: $0) } @@ -19392,10 +19400,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "createEnumTestModel") } } - + public struct CreateEnumTestModel: GraphQLSelectionSet { public static let possibleTypes = ["EnumTestModel"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -19408,17 +19416,17 @@ public struct APISwift { 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, enumVal: TestEnum, nullableEnumVal: TestEnum? = nil, enumList: [TestEnum], enumNullableList: [TestEnum]? = nil, nullableEnumList: [TestEnum?], nullableEnumNullableList: [TestEnum?]? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "EnumTestModel", "id": id, "enumVal": enumVal, "nullableEnumVal": nullableEnumVal, "enumList": enumList, "enumNullableList": enumNullableList, "nullableEnumList": nullableEnumList, "nullableEnumNullableList": nullableEnumNullableList, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -19427,7 +19435,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -19436,7 +19444,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var enumVal: TestEnum { get { return snapshot["enumVal"]! as! TestEnum @@ -19445,7 +19453,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "enumVal") } } - + public var nullableEnumVal: TestEnum? { get { return snapshot["nullableEnumVal"] as? TestEnum @@ -19454,7 +19462,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableEnumVal") } } - + public var enumList: [TestEnum] { get { return snapshot["enumList"]! as! [TestEnum] @@ -19463,7 +19471,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "enumList") } } - + public var enumNullableList: [TestEnum]? { get { return snapshot["enumNullableList"] as? [TestEnum] @@ -19472,7 +19480,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "enumNullableList") } } - + public var nullableEnumList: [TestEnum?] { get { return snapshot["nullableEnumList"]! as! [TestEnum?] @@ -19481,7 +19489,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableEnumList") } } - + public var nullableEnumNullableList: [TestEnum?]? { get { return snapshot["nullableEnumNullableList"] as? [TestEnum?] @@ -19490,7 +19498,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableEnumNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -19499,7 +19507,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -19511,40 +19519,40 @@ public struct APISwift { } } } - + public final class UpdateEnumTestModelMutation: GraphQLMutation { public static let operationString = "mutation UpdateEnumTestModel($input: UpdateEnumTestModelInput!, $condition: ModelEnumTestModelConditionInput) {\n updateEnumTestModel(input: $input, condition: $condition) {\n __typename\n id\n enumVal\n nullableEnumVal\n enumList\n enumNullableList\n nullableEnumList\n nullableEnumNullableList\n createdAt\n updatedAt\n }\n}" - + public var input: UpdateEnumTestModelInput public var condition: ModelEnumTestModelConditionInput? - + public init(input: UpdateEnumTestModelInput, condition: ModelEnumTestModelConditionInput? = 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("updateEnumTestModel", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(UpdateEnumTestModel.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(updateEnumTestModel: UpdateEnumTestModel? = nil) { - self.init(snapshot: ["__typename": "Mutation", "updateEnumTestModel": updateEnumTestModel.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "updateEnumTestModel": updateEnumTestModel.flatMap(\.snapshot)]) } - + public var updateEnumTestModel: UpdateEnumTestModel? { get { return (snapshot["updateEnumTestModel"] as? Snapshot).flatMap { UpdateEnumTestModel(snapshot: $0) } @@ -19553,10 +19561,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "updateEnumTestModel") } } - + public struct UpdateEnumTestModel: GraphQLSelectionSet { public static let possibleTypes = ["EnumTestModel"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -19569,17 +19577,17 @@ public struct APISwift { 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, enumVal: TestEnum, nullableEnumVal: TestEnum? = nil, enumList: [TestEnum], enumNullableList: [TestEnum]? = nil, nullableEnumList: [TestEnum?], nullableEnumNullableList: [TestEnum?]? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "EnumTestModel", "id": id, "enumVal": enumVal, "nullableEnumVal": nullableEnumVal, "enumList": enumList, "enumNullableList": enumNullableList, "nullableEnumList": nullableEnumList, "nullableEnumNullableList": nullableEnumNullableList, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -19588,7 +19596,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -19597,7 +19605,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var enumVal: TestEnum { get { return snapshot["enumVal"]! as! TestEnum @@ -19606,7 +19614,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "enumVal") } } - + public var nullableEnumVal: TestEnum? { get { return snapshot["nullableEnumVal"] as? TestEnum @@ -19615,7 +19623,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableEnumVal") } } - + public var enumList: [TestEnum] { get { return snapshot["enumList"]! as! [TestEnum] @@ -19624,7 +19632,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "enumList") } } - + public var enumNullableList: [TestEnum]? { get { return snapshot["enumNullableList"] as? [TestEnum] @@ -19633,7 +19641,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "enumNullableList") } } - + public var nullableEnumList: [TestEnum?] { get { return snapshot["nullableEnumList"]! as! [TestEnum?] @@ -19642,7 +19650,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableEnumList") } } - + public var nullableEnumNullableList: [TestEnum?]? { get { return snapshot["nullableEnumNullableList"] as? [TestEnum?] @@ -19651,7 +19659,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableEnumNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -19660,7 +19668,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -19672,40 +19680,40 @@ public struct APISwift { } } } - + public final class DeleteEnumTestModelMutation: GraphQLMutation { public static let operationString = "mutation DeleteEnumTestModel($input: DeleteEnumTestModelInput!, $condition: ModelEnumTestModelConditionInput) {\n deleteEnumTestModel(input: $input, condition: $condition) {\n __typename\n id\n enumVal\n nullableEnumVal\n enumList\n enumNullableList\n nullableEnumList\n nullableEnumNullableList\n createdAt\n updatedAt\n }\n}" - + public var input: DeleteEnumTestModelInput public var condition: ModelEnumTestModelConditionInput? - + public init(input: DeleteEnumTestModelInput, condition: ModelEnumTestModelConditionInput? = 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("deleteEnumTestModel", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(DeleteEnumTestModel.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(deleteEnumTestModel: DeleteEnumTestModel? = nil) { - self.init(snapshot: ["__typename": "Mutation", "deleteEnumTestModel": deleteEnumTestModel.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "deleteEnumTestModel": deleteEnumTestModel.flatMap(\.snapshot)]) } - + public var deleteEnumTestModel: DeleteEnumTestModel? { get { return (snapshot["deleteEnumTestModel"] as? Snapshot).flatMap { DeleteEnumTestModel(snapshot: $0) } @@ -19714,10 +19722,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "deleteEnumTestModel") } } - + public struct DeleteEnumTestModel: GraphQLSelectionSet { public static let possibleTypes = ["EnumTestModel"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -19730,17 +19738,17 @@ public struct APISwift { 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, enumVal: TestEnum, nullableEnumVal: TestEnum? = nil, enumList: [TestEnum], enumNullableList: [TestEnum]? = nil, nullableEnumList: [TestEnum?], nullableEnumNullableList: [TestEnum?]? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "EnumTestModel", "id": id, "enumVal": enumVal, "nullableEnumVal": nullableEnumVal, "enumList": enumList, "enumNullableList": enumNullableList, "nullableEnumList": nullableEnumList, "nullableEnumNullableList": nullableEnumNullableList, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -19749,7 +19757,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -19758,7 +19766,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var enumVal: TestEnum { get { return snapshot["enumVal"]! as! TestEnum @@ -19767,7 +19775,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "enumVal") } } - + public var nullableEnumVal: TestEnum? { get { return snapshot["nullableEnumVal"] as? TestEnum @@ -19776,7 +19784,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableEnumVal") } } - + public var enumList: [TestEnum] { get { return snapshot["enumList"]! as! [TestEnum] @@ -19785,7 +19793,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "enumList") } } - + public var enumNullableList: [TestEnum]? { get { return snapshot["enumNullableList"] as? [TestEnum] @@ -19794,7 +19802,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "enumNullableList") } } - + public var nullableEnumList: [TestEnum?] { get { return snapshot["nullableEnumList"]! as! [TestEnum?] @@ -19803,7 +19811,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableEnumList") } } - + public var nullableEnumNullableList: [TestEnum?]? { get { return snapshot["nullableEnumNullableList"] as? [TestEnum?] @@ -19812,7 +19820,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableEnumNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -19821,7 +19829,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -19833,40 +19841,40 @@ public struct APISwift { } } } - + public final class CreateNestedTypeTestModelMutation: GraphQLMutation { public static let operationString = "mutation CreateNestedTypeTestModel($input: CreateNestedTypeTestModelInput!, $condition: ModelNestedTypeTestModelConditionInput) {\n createNestedTypeTestModel(input: $input, condition: $condition) {\n __typename\n id\n nestedVal {\n __typename\n valueOne\n valueTwo\n }\n nullableNestedVal {\n __typename\n valueOne\n valueTwo\n }\n nestedList {\n __typename\n valueOne\n valueTwo\n }\n nestedNullableList {\n __typename\n valueOne\n valueTwo\n }\n nullableNestedList {\n __typename\n valueOne\n valueTwo\n }\n nullableNestedNullableList {\n __typename\n valueOne\n valueTwo\n }\n createdAt\n updatedAt\n }\n}" - + public var input: CreateNestedTypeTestModelInput public var condition: ModelNestedTypeTestModelConditionInput? - + public init(input: CreateNestedTypeTestModelInput, condition: ModelNestedTypeTestModelConditionInput? = 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("createNestedTypeTestModel", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(CreateNestedTypeTestModel.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(createNestedTypeTestModel: CreateNestedTypeTestModel? = nil) { - self.init(snapshot: ["__typename": "Mutation", "createNestedTypeTestModel": createNestedTypeTestModel.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "createNestedTypeTestModel": createNestedTypeTestModel.flatMap(\.snapshot)]) } - + public var createNestedTypeTestModel: CreateNestedTypeTestModel? { get { return (snapshot["createNestedTypeTestModel"] as? Snapshot).flatMap { CreateNestedTypeTestModel(snapshot: $0) } @@ -19875,10 +19883,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "createNestedTypeTestModel") } } - + public struct CreateNestedTypeTestModel: GraphQLSelectionSet { public static let possibleTypes = ["NestedTypeTestModel"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -19891,17 +19899,17 @@ public struct APISwift { 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, nestedVal: NestedVal, nullableNestedVal: NullableNestedVal? = nil, nestedList: [NestedList], nestedNullableList: [NestedNullableList]? = nil, nullableNestedList: [NullableNestedList?], nullableNestedNullableList: [NullableNestedNullableList?]? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "NestedTypeTestModel", "id": id, "nestedVal": nestedVal.snapshot, "nullableNestedVal": nullableNestedVal.flatMap { $0.snapshot }, "nestedList": nestedList.map { $0.snapshot }, "nestedNullableList": nestedNullableList.flatMap { $0.map { $0.snapshot } }, "nullableNestedList": nullableNestedList.map { $0.flatMap { $0.snapshot } }, "nullableNestedNullableList": nullableNestedNullableList.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "NestedTypeTestModel", "id": id, "nestedVal": nestedVal.snapshot, "nullableNestedVal": nullableNestedVal.flatMap(\.snapshot), "nestedList": nestedList.map(\.snapshot), "nestedNullableList": nestedNullableList.flatMap { $0.map(\.snapshot) }, "nullableNestedList": nullableNestedList.map { $0.flatMap(\.snapshot) }, "nullableNestedNullableList": nullableNestedNullableList.flatMap { $0.map { $0.flatMap(\.snapshot) } }, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -19910,7 +19918,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -19919,7 +19927,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var nestedVal: NestedVal { get { return NestedVal(snapshot: snapshot["nestedVal"]! as! Snapshot) @@ -19928,7 +19936,7 @@ public struct APISwift { snapshot.updateValue(newValue.snapshot, forKey: "nestedVal") } } - + public var nullableNestedVal: NullableNestedVal? { get { return (snapshot["nullableNestedVal"] as? Snapshot).flatMap { NullableNestedVal(snapshot: $0) } @@ -19937,43 +19945,43 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "nullableNestedVal") } } - + public var nestedList: [NestedList] { get { return (snapshot["nestedList"] as! [Snapshot]).map { NestedList(snapshot: $0) } } set { - snapshot.updateValue(newValue.map { $0.snapshot }, forKey: "nestedList") + snapshot.updateValue(newValue.map(\.snapshot), forKey: "nestedList") } } - + public var nestedNullableList: [NestedNullableList]? { get { return (snapshot["nestedNullableList"] as? [Snapshot]).flatMap { $0.map { NestedNullableList(snapshot: $0) } } } set { - snapshot.updateValue(newValue.flatMap { $0.map { $0.snapshot } }, forKey: "nestedNullableList") + snapshot.updateValue(newValue.flatMap { $0.map(\.snapshot) }, forKey: "nestedNullableList") } } - + public var nullableNestedList: [NullableNestedList?] { get { return (snapshot["nullableNestedList"] as! [Snapshot?]).map { $0.flatMap { NullableNestedList(snapshot: $0) } } } set { - snapshot.updateValue(newValue.map { $0.flatMap { $0.snapshot } }, forKey: "nullableNestedList") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "nullableNestedList") } } - + public var nullableNestedNullableList: [NullableNestedNullableList?]? { get { return (snapshot["nullableNestedNullableList"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { NullableNestedNullableList(snapshot: $0) } } } } set { - snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "nullableNestedNullableList") + snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap(\.snapshot) } }, forKey: "nullableNestedNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -19982,7 +19990,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -19991,26 +19999,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct NestedVal: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -20019,7 +20027,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -20028,7 +20036,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -20038,26 +20046,26 @@ public struct APISwift { } } } - + public struct NullableNestedVal: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -20066,7 +20074,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -20075,7 +20083,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -20085,26 +20093,26 @@ public struct APISwift { } } } - + public struct NestedList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -20113,7 +20121,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -20122,7 +20130,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -20132,26 +20140,26 @@ public struct APISwift { } } } - + public struct NestedNullableList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -20160,7 +20168,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -20169,7 +20177,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -20179,26 +20187,26 @@ public struct APISwift { } } } - + public struct NullableNestedList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -20207,7 +20215,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -20216,7 +20224,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -20226,26 +20234,26 @@ public struct APISwift { } } } - + public struct NullableNestedNullableList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -20254,7 +20262,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -20263,7 +20271,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -20276,40 +20284,40 @@ public struct APISwift { } } } - + public final class UpdateNestedTypeTestModelMutation: GraphQLMutation { public static let operationString = "mutation UpdateNestedTypeTestModel($input: UpdateNestedTypeTestModelInput!, $condition: ModelNestedTypeTestModelConditionInput) {\n updateNestedTypeTestModel(input: $input, condition: $condition) {\n __typename\n id\n nestedVal {\n __typename\n valueOne\n valueTwo\n }\n nullableNestedVal {\n __typename\n valueOne\n valueTwo\n }\n nestedList {\n __typename\n valueOne\n valueTwo\n }\n nestedNullableList {\n __typename\n valueOne\n valueTwo\n }\n nullableNestedList {\n __typename\n valueOne\n valueTwo\n }\n nullableNestedNullableList {\n __typename\n valueOne\n valueTwo\n }\n createdAt\n updatedAt\n }\n}" - + public var input: UpdateNestedTypeTestModelInput public var condition: ModelNestedTypeTestModelConditionInput? - + public init(input: UpdateNestedTypeTestModelInput, condition: ModelNestedTypeTestModelConditionInput? = 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("updateNestedTypeTestModel", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(UpdateNestedTypeTestModel.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(updateNestedTypeTestModel: UpdateNestedTypeTestModel? = nil) { - self.init(snapshot: ["__typename": "Mutation", "updateNestedTypeTestModel": updateNestedTypeTestModel.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "updateNestedTypeTestModel": updateNestedTypeTestModel.flatMap(\.snapshot)]) } - + public var updateNestedTypeTestModel: UpdateNestedTypeTestModel? { get { return (snapshot["updateNestedTypeTestModel"] as? Snapshot).flatMap { UpdateNestedTypeTestModel(snapshot: $0) } @@ -20318,10 +20326,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "updateNestedTypeTestModel") } } - + public struct UpdateNestedTypeTestModel: GraphQLSelectionSet { public static let possibleTypes = ["NestedTypeTestModel"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -20334,17 +20342,17 @@ public struct APISwift { 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, nestedVal: NestedVal, nullableNestedVal: NullableNestedVal? = nil, nestedList: [NestedList], nestedNullableList: [NestedNullableList]? = nil, nullableNestedList: [NullableNestedList?], nullableNestedNullableList: [NullableNestedNullableList?]? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "NestedTypeTestModel", "id": id, "nestedVal": nestedVal.snapshot, "nullableNestedVal": nullableNestedVal.flatMap { $0.snapshot }, "nestedList": nestedList.map { $0.snapshot }, "nestedNullableList": nestedNullableList.flatMap { $0.map { $0.snapshot } }, "nullableNestedList": nullableNestedList.map { $0.flatMap { $0.snapshot } }, "nullableNestedNullableList": nullableNestedNullableList.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "NestedTypeTestModel", "id": id, "nestedVal": nestedVal.snapshot, "nullableNestedVal": nullableNestedVal.flatMap(\.snapshot), "nestedList": nestedList.map(\.snapshot), "nestedNullableList": nestedNullableList.flatMap { $0.map(\.snapshot) }, "nullableNestedList": nullableNestedList.map { $0.flatMap(\.snapshot) }, "nullableNestedNullableList": nullableNestedNullableList.flatMap { $0.map { $0.flatMap(\.snapshot) } }, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -20353,7 +20361,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -20362,7 +20370,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var nestedVal: NestedVal { get { return NestedVal(snapshot: snapshot["nestedVal"]! as! Snapshot) @@ -20371,7 +20379,7 @@ public struct APISwift { snapshot.updateValue(newValue.snapshot, forKey: "nestedVal") } } - + public var nullableNestedVal: NullableNestedVal? { get { return (snapshot["nullableNestedVal"] as? Snapshot).flatMap { NullableNestedVal(snapshot: $0) } @@ -20380,43 +20388,43 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "nullableNestedVal") } } - + public var nestedList: [NestedList] { get { return (snapshot["nestedList"] as! [Snapshot]).map { NestedList(snapshot: $0) } } set { - snapshot.updateValue(newValue.map { $0.snapshot }, forKey: "nestedList") + snapshot.updateValue(newValue.map(\.snapshot), forKey: "nestedList") } } - + public var nestedNullableList: [NestedNullableList]? { get { return (snapshot["nestedNullableList"] as? [Snapshot]).flatMap { $0.map { NestedNullableList(snapshot: $0) } } } set { - snapshot.updateValue(newValue.flatMap { $0.map { $0.snapshot } }, forKey: "nestedNullableList") + snapshot.updateValue(newValue.flatMap { $0.map(\.snapshot) }, forKey: "nestedNullableList") } } - + public var nullableNestedList: [NullableNestedList?] { get { return (snapshot["nullableNestedList"] as! [Snapshot?]).map { $0.flatMap { NullableNestedList(snapshot: $0) } } } set { - snapshot.updateValue(newValue.map { $0.flatMap { $0.snapshot } }, forKey: "nullableNestedList") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "nullableNestedList") } } - + public var nullableNestedNullableList: [NullableNestedNullableList?]? { get { return (snapshot["nullableNestedNullableList"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { NullableNestedNullableList(snapshot: $0) } } } } set { - snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "nullableNestedNullableList") + snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap(\.snapshot) } }, forKey: "nullableNestedNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -20425,7 +20433,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -20434,26 +20442,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct NestedVal: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -20462,7 +20470,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -20471,7 +20479,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -20481,26 +20489,26 @@ public struct APISwift { } } } - + public struct NullableNestedVal: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -20509,7 +20517,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -20518,7 +20526,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -20528,26 +20536,26 @@ public struct APISwift { } } } - + public struct NestedList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -20556,7 +20564,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -20565,7 +20573,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -20575,26 +20583,26 @@ public struct APISwift { } } } - + public struct NestedNullableList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -20603,7 +20611,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -20612,7 +20620,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -20622,26 +20630,26 @@ public struct APISwift { } } } - + public struct NullableNestedList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -20650,7 +20658,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -20659,7 +20667,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -20669,26 +20677,26 @@ public struct APISwift { } } } - + public struct NullableNestedNullableList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -20697,7 +20705,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -20706,7 +20714,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -20719,40 +20727,40 @@ public struct APISwift { } } } - + public final class DeleteNestedTypeTestModelMutation: GraphQLMutation { public static let operationString = "mutation DeleteNestedTypeTestModel($input: DeleteNestedTypeTestModelInput!, $condition: ModelNestedTypeTestModelConditionInput) {\n deleteNestedTypeTestModel(input: $input, condition: $condition) {\n __typename\n id\n nestedVal {\n __typename\n valueOne\n valueTwo\n }\n nullableNestedVal {\n __typename\n valueOne\n valueTwo\n }\n nestedList {\n __typename\n valueOne\n valueTwo\n }\n nestedNullableList {\n __typename\n valueOne\n valueTwo\n }\n nullableNestedList {\n __typename\n valueOne\n valueTwo\n }\n nullableNestedNullableList {\n __typename\n valueOne\n valueTwo\n }\n createdAt\n updatedAt\n }\n}" - + public var input: DeleteNestedTypeTestModelInput public var condition: ModelNestedTypeTestModelConditionInput? - + public init(input: DeleteNestedTypeTestModelInput, condition: ModelNestedTypeTestModelConditionInput? = 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("deleteNestedTypeTestModel", arguments: ["input": GraphQLVariable("input"), "condition": GraphQLVariable("condition")], type: .object(DeleteNestedTypeTestModel.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(deleteNestedTypeTestModel: DeleteNestedTypeTestModel? = nil) { - self.init(snapshot: ["__typename": "Mutation", "deleteNestedTypeTestModel": deleteNestedTypeTestModel.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Mutation", "deleteNestedTypeTestModel": deleteNestedTypeTestModel.flatMap(\.snapshot)]) } - + public var deleteNestedTypeTestModel: DeleteNestedTypeTestModel? { get { return (snapshot["deleteNestedTypeTestModel"] as? Snapshot).flatMap { DeleteNestedTypeTestModel(snapshot: $0) } @@ -20761,10 +20769,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "deleteNestedTypeTestModel") } } - + public struct DeleteNestedTypeTestModel: GraphQLSelectionSet { public static let possibleTypes = ["NestedTypeTestModel"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -20777,17 +20785,17 @@ public struct APISwift { 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, nestedVal: NestedVal, nullableNestedVal: NullableNestedVal? = nil, nestedList: [NestedList], nestedNullableList: [NestedNullableList]? = nil, nullableNestedList: [NullableNestedList?], nullableNestedNullableList: [NullableNestedNullableList?]? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "NestedTypeTestModel", "id": id, "nestedVal": nestedVal.snapshot, "nullableNestedVal": nullableNestedVal.flatMap { $0.snapshot }, "nestedList": nestedList.map { $0.snapshot }, "nestedNullableList": nestedNullableList.flatMap { $0.map { $0.snapshot } }, "nullableNestedList": nullableNestedList.map { $0.flatMap { $0.snapshot } }, "nullableNestedNullableList": nullableNestedNullableList.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "NestedTypeTestModel", "id": id, "nestedVal": nestedVal.snapshot, "nullableNestedVal": nullableNestedVal.flatMap(\.snapshot), "nestedList": nestedList.map(\.snapshot), "nestedNullableList": nestedNullableList.flatMap { $0.map(\.snapshot) }, "nullableNestedList": nullableNestedList.map { $0.flatMap(\.snapshot) }, "nullableNestedNullableList": nullableNestedNullableList.flatMap { $0.map { $0.flatMap(\.snapshot) } }, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -20796,7 +20804,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -20805,7 +20813,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var nestedVal: NestedVal { get { return NestedVal(snapshot: snapshot["nestedVal"]! as! Snapshot) @@ -20814,7 +20822,7 @@ public struct APISwift { snapshot.updateValue(newValue.snapshot, forKey: "nestedVal") } } - + public var nullableNestedVal: NullableNestedVal? { get { return (snapshot["nullableNestedVal"] as? Snapshot).flatMap { NullableNestedVal(snapshot: $0) } @@ -20823,43 +20831,43 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "nullableNestedVal") } } - + public var nestedList: [NestedList] { get { return (snapshot["nestedList"] as! [Snapshot]).map { NestedList(snapshot: $0) } } set { - snapshot.updateValue(newValue.map { $0.snapshot }, forKey: "nestedList") + snapshot.updateValue(newValue.map(\.snapshot), forKey: "nestedList") } } - + public var nestedNullableList: [NestedNullableList]? { get { return (snapshot["nestedNullableList"] as? [Snapshot]).flatMap { $0.map { NestedNullableList(snapshot: $0) } } } set { - snapshot.updateValue(newValue.flatMap { $0.map { $0.snapshot } }, forKey: "nestedNullableList") + snapshot.updateValue(newValue.flatMap { $0.map(\.snapshot) }, forKey: "nestedNullableList") } } - + public var nullableNestedList: [NullableNestedList?] { get { return (snapshot["nullableNestedList"] as! [Snapshot?]).map { $0.flatMap { NullableNestedList(snapshot: $0) } } } set { - snapshot.updateValue(newValue.map { $0.flatMap { $0.snapshot } }, forKey: "nullableNestedList") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "nullableNestedList") } } - + public var nullableNestedNullableList: [NullableNestedNullableList?]? { get { return (snapshot["nullableNestedNullableList"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { NullableNestedNullableList(snapshot: $0) } } } } set { - snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "nullableNestedNullableList") + snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap(\.snapshot) } }, forKey: "nullableNestedNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -20868,7 +20876,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -20877,26 +20885,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct NestedVal: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -20905,7 +20913,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -20914,7 +20922,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -20924,26 +20932,26 @@ public struct APISwift { } } } - + public struct NullableNestedVal: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -20952,7 +20960,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -20961,7 +20969,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -20971,26 +20979,26 @@ public struct APISwift { } } } - + public struct NestedList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -20999,7 +21007,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -21008,7 +21016,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -21018,26 +21026,26 @@ public struct APISwift { } } } - + public struct NestedNullableList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -21046,7 +21054,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -21055,7 +21063,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -21065,26 +21073,26 @@ public struct APISwift { } } } - + public struct NullableNestedList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -21093,7 +21101,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -21102,7 +21110,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -21112,26 +21120,26 @@ public struct APISwift { } } } - + public struct NullableNestedNullableList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -21140,7 +21148,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -21149,7 +21157,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -21162,38 +21170,38 @@ public struct APISwift { } } } - + public final class GetPostQuery: GraphQLQuery { public static let operationString = "query GetPost($id: ID!) {\n getPost(id: $id) {\n __typename\n id\n title\n content\n createdAt\n updatedAt\n draft\n rating\n status\n comments {\n __typename\n items {\n __typename\n id\n content\n createdAt\n updatedAt\n }\n nextToken\n }\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("getPost", arguments: ["id": GraphQLVariable("id")], type: .object(GetPost.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(getPost: GetPost? = nil) { - self.init(snapshot: ["__typename": "Query", "getPost": getPost.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "getPost": getPost.flatMap(\.snapshot)]) } - + public var getPost: GetPost? { get { return (snapshot["getPost"] as? Snapshot).flatMap { GetPost(snapshot: $0) } @@ -21202,10 +21210,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "getPost") } } - + public struct GetPost: GraphQLSelectionSet { public static let possibleTypes = ["Post"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -21218,17 +21226,17 @@ public struct APISwift { GraphQLField("status", type: .scalar(PostStatus.self)), GraphQLField("comments", type: .object(Comment.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(id: GraphQLID, title: String, content: String, createdAt: String, updatedAt: String? = nil, draft: Bool? = nil, rating: Double? = nil, status: PostStatus? = nil, comments: Comment? = nil) { - self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap(\.snapshot)]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -21237,7 +21245,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -21246,7 +21254,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -21255,7 +21263,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -21264,7 +21272,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -21273,7 +21281,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String? { get { return snapshot["updatedAt"] as? String @@ -21282,7 +21290,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public var draft: Bool? { get { return snapshot["draft"] as? Bool @@ -21291,7 +21299,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "draft") } } - + public var rating: Double? { get { return snapshot["rating"] as? Double @@ -21300,7 +21308,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "rating") } } - + public var status: PostStatus? { get { return snapshot["status"] as? PostStatus @@ -21309,7 +21317,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "status") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -21318,26 +21326,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelCommentConnection"] - + 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": "ModelCommentConnection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelCommentConnection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -21346,16 +21354,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -21364,10 +21372,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -21375,17 +21383,17 @@ public struct APISwift { 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, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment", "id": id, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -21394,7 +21402,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -21403,7 +21411,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -21412,7 +21420,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -21421,7 +21429,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -21435,42 +21443,42 @@ public struct APISwift { } } } - + public final class ListPostsQuery: GraphQLQuery { public static let operationString = "query ListPosts($filter: ModelPostFilterInput, $limit: Int, $nextToken: String) {\n listPosts(filter: $filter, limit: $limit, nextToken: $nextToken) {\n __typename\n items {\n __typename\n id\n title\n content\n createdAt\n updatedAt\n draft\n rating\n status\n comments {\n __typename\n nextToken\n }\n }\n nextToken\n }\n}" - + public var filter: ModelPostFilterInput? public var limit: Int? public var nextToken: String? - + public init(filter: ModelPostFilterInput? = 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("listPosts", arguments: ["filter": GraphQLVariable("filter"), "limit": GraphQLVariable("limit"), "nextToken": GraphQLVariable("nextToken")], type: .object(ListPost.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(listPosts: ListPost? = nil) { - self.init(snapshot: ["__typename": "Query", "listPosts": listPosts.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "listPosts": listPosts.flatMap(\.snapshot)]) } - + public var listPosts: ListPost? { get { return (snapshot["listPosts"] as? Snapshot).flatMap { ListPost(snapshot: $0) } @@ -21479,26 +21487,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "listPosts") } } - + public struct ListPost: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostConnection"] - + 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": "ModelPostConnection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPostConnection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -21507,16 +21515,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -21525,10 +21533,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Post"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -21541,17 +21549,17 @@ public struct APISwift { GraphQLField("status", type: .scalar(PostStatus.self)), GraphQLField("comments", type: .object(Comment.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(id: GraphQLID, title: String, content: String, createdAt: String, updatedAt: String? = nil, draft: Bool? = nil, rating: Double? = nil, status: PostStatus? = nil, comments: Comment? = nil) { - self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap(\.snapshot)]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -21560,7 +21568,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -21569,7 +21577,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -21578,7 +21586,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -21587,7 +21595,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -21596,7 +21604,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String? { get { return snapshot["updatedAt"] as? String @@ -21605,7 +21613,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public var draft: Bool? { get { return snapshot["draft"] as? Bool @@ -21614,7 +21622,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "draft") } } - + public var rating: Double? { get { return snapshot["rating"] as? Double @@ -21623,7 +21631,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "rating") } } - + public var status: PostStatus? { get { return snapshot["status"] as? PostStatus @@ -21632,7 +21640,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "status") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -21641,25 +21649,25 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelCommentConnection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelCommentConnection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -21668,7 +21676,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -21682,38 +21690,38 @@ public struct APISwift { } } } - + public final class GetCommentQuery: GraphQLQuery { public static let operationString = "query GetComment($id: ID!) {\n getComment(id: $id) {\n __typename\n id\n content\n createdAt\n post {\n __typename\n id\n title\n content\n createdAt\n updatedAt\n draft\n rating\n status\n comments {\n __typename\n nextToken\n }\n }\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("getComment", arguments: ["id": GraphQLVariable("id")], type: .object(GetComment.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(getComment: GetComment? = nil) { - self.init(snapshot: ["__typename": "Query", "getComment": getComment.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "getComment": getComment.flatMap(\.snapshot)]) } - + public var getComment: GetComment? { get { return (snapshot["getComment"] as? Snapshot).flatMap { GetComment(snapshot: $0) } @@ -21722,10 +21730,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "getComment") } } - + public struct GetComment: GraphQLSelectionSet { public static let possibleTypes = ["Comment"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -21734,17 +21742,17 @@ public struct APISwift { GraphQLField("post", type: .object(Post.selections)), GraphQLField("updatedAt", type: .nonNull(.scalar(String.self))), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(id: GraphQLID, content: String, createdAt: String, post: Post? = nil, updatedAt: String) { - self.init(snapshot: ["__typename": "Comment", "id": id, "content": content, "createdAt": createdAt, "post": post.flatMap { $0.snapshot }, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Comment", "id": id, "content": content, "createdAt": createdAt, "post": post.flatMap(\.snapshot), "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -21753,7 +21761,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -21762,7 +21770,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -21771,7 +21779,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -21780,7 +21788,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var post: Post? { get { return (snapshot["post"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -21789,7 +21797,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "post") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -21798,10 +21806,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -21814,17 +21822,17 @@ public struct APISwift { GraphQLField("status", type: .scalar(PostStatus.self)), GraphQLField("comments", type: .object(Comment.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(id: GraphQLID, title: String, content: String, createdAt: String, updatedAt: String? = nil, draft: Bool? = nil, rating: Double? = nil, status: PostStatus? = nil, comments: Comment? = nil) { - self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap(\.snapshot)]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -21833,7 +21841,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -21842,7 +21850,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -21851,7 +21859,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -21860,7 +21868,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -21869,7 +21877,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String? { get { return snapshot["updatedAt"] as? String @@ -21878,7 +21886,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public var draft: Bool? { get { return snapshot["draft"] as? Bool @@ -21887,7 +21895,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "draft") } } - + public var rating: Double? { get { return snapshot["rating"] as? Double @@ -21896,7 +21904,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "rating") } } - + public var status: PostStatus? { get { return snapshot["status"] as? PostStatus @@ -21905,7 +21913,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "status") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -21914,25 +21922,25 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelCommentConnection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelCommentConnection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -21941,7 +21949,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -21955,42 +21963,42 @@ public struct APISwift { } } } - + public final class ListCommentsQuery: GraphQLQuery { public static let operationString = "query ListComments($filter: ModelCommentFilterInput, $limit: Int, $nextToken: String) {\n listComments(filter: $filter, limit: $limit, nextToken: $nextToken) {\n __typename\n items {\n __typename\n id\n content\n createdAt\n post {\n __typename\n id\n title\n content\n createdAt\n updatedAt\n draft\n rating\n status\n }\n updatedAt\n }\n nextToken\n }\n}" - + public var filter: ModelCommentFilterInput? public var limit: Int? public var nextToken: String? - + public init(filter: ModelCommentFilterInput? = 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("listComments", arguments: ["filter": GraphQLVariable("filter"), "limit": GraphQLVariable("limit"), "nextToken": GraphQLVariable("nextToken")], type: .object(ListComment.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(listComments: ListComment? = nil) { - self.init(snapshot: ["__typename": "Query", "listComments": listComments.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "listComments": listComments.flatMap(\.snapshot)]) } - + public var listComments: ListComment? { get { return (snapshot["listComments"] as? Snapshot).flatMap { ListComment(snapshot: $0) } @@ -21999,26 +22007,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "listComments") } } - + public struct ListComment: GraphQLSelectionSet { public static let possibleTypes = ["ModelCommentConnection"] - + 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": "ModelCommentConnection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelCommentConnection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -22027,16 +22035,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -22045,10 +22053,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -22057,17 +22065,17 @@ public struct APISwift { GraphQLField("post", type: .object(Post.selections)), GraphQLField("updatedAt", type: .nonNull(.scalar(String.self))), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(id: GraphQLID, content: String, createdAt: String, post: Post? = nil, updatedAt: String) { - self.init(snapshot: ["__typename": "Comment", "id": id, "content": content, "createdAt": createdAt, "post": post.flatMap { $0.snapshot }, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Comment", "id": id, "content": content, "createdAt": createdAt, "post": post.flatMap(\.snapshot), "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -22076,7 +22084,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -22085,7 +22093,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -22094,7 +22102,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -22103,7 +22111,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var post: Post? { get { return (snapshot["post"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -22112,7 +22120,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "post") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -22121,10 +22129,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -22136,17 +22144,17 @@ public struct APISwift { GraphQLField("rating", type: .scalar(Double.self)), GraphQLField("status", type: .scalar(PostStatus.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(id: GraphQLID, title: String, content: String, createdAt: String, updatedAt: String? = nil, draft: Bool? = nil, rating: Double? = nil, status: PostStatus? = nil) { self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -22155,7 +22163,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -22164,7 +22172,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -22173,7 +22181,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -22182,7 +22190,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -22191,7 +22199,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String? { get { return snapshot["updatedAt"] as? String @@ -22200,7 +22208,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public var draft: Bool? { get { return snapshot["draft"] as? Bool @@ -22209,7 +22217,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "draft") } } - + public var rating: Double? { get { return snapshot["rating"] as? Double @@ -22218,7 +22226,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "rating") } } - + public var status: PostStatus? { get { return snapshot["status"] as? PostStatus @@ -22232,38 +22240,38 @@ public struct APISwift { } } } - + public final class GetProject1Query: GraphQLQuery { public static let operationString = "query GetProject1($id: ID!) {\n getProject1(id: $id) {\n __typename\n id\n name\n team {\n __typename\n id\n name\n createdAt\n updatedAt\n }\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("getProject1", arguments: ["id": GraphQLVariable("id")], type: .object(GetProject1.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(getProject1: GetProject1? = nil) { - self.init(snapshot: ["__typename": "Query", "getProject1": getProject1.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "getProject1": getProject1.flatMap(\.snapshot)]) } - + public var getProject1: GetProject1? { get { return (snapshot["getProject1"] as? Snapshot).flatMap { GetProject1(snapshot: $0) } @@ -22272,10 +22280,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "getProject1") } } - + public struct GetProject1: GraphQLSelectionSet { public static let possibleTypes = ["Project1"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -22284,17 +22292,17 @@ public struct APISwift { 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? = nil, team: Team? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Project1", "id": id, "name": name, "team": team.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Project1", "id": id, "name": name, "team": team.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -22303,7 +22311,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -22312,7 +22320,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return snapshot["name"] as? String @@ -22321,7 +22329,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var team: Team? { get { return (snapshot["team"] as? Snapshot).flatMap { Team(snapshot: $0) } @@ -22330,7 +22338,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "team") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -22339,7 +22347,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -22348,10 +22356,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Team: GraphQLSelectionSet { public static let possibleTypes = ["Team1"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -22359,17 +22367,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team1", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -22378,7 +22386,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -22387,7 +22395,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -22396,7 +22404,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -22405,7 +22413,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -22418,42 +22426,42 @@ public struct APISwift { } } } - + public final class ListProject1sQuery: GraphQLQuery { public static let operationString = "query ListProject1s($filter: ModelProject1FilterInput, $limit: Int, $nextToken: String) {\n listProject1s(filter: $filter, limit: $limit, nextToken: $nextToken) {\n __typename\n items {\n __typename\n id\n name\n team {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n nextToken\n }\n}" - + public var filter: ModelProject1FilterInput? public var limit: Int? public var nextToken: String? - + public init(filter: ModelProject1FilterInput? = 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("listProject1s", arguments: ["filter": GraphQLVariable("filter"), "limit": GraphQLVariable("limit"), "nextToken": GraphQLVariable("nextToken")], type: .object(ListProject1.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(listProject1s: ListProject1? = nil) { - self.init(snapshot: ["__typename": "Query", "listProject1s": listProject1s.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "listProject1s": listProject1s.flatMap(\.snapshot)]) } - + public var listProject1s: ListProject1? { get { return (snapshot["listProject1s"] as? Snapshot).flatMap { ListProject1(snapshot: $0) } @@ -22462,26 +22470,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "listProject1s") } } - + public struct ListProject1: GraphQLSelectionSet { public static let possibleTypes = ["ModelProject1Connection"] - + 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": "ModelProject1Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelProject1Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -22490,16 +22498,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -22508,10 +22516,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Project1"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -22520,17 +22528,17 @@ public struct APISwift { 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? = nil, team: Team? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Project1", "id": id, "name": name, "team": team.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Project1", "id": id, "name": name, "team": team.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -22539,7 +22547,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -22548,7 +22556,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return snapshot["name"] as? String @@ -22557,7 +22565,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var team: Team? { get { return (snapshot["team"] as? Snapshot).flatMap { Team(snapshot: $0) } @@ -22566,7 +22574,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "team") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -22575,7 +22583,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -22584,10 +22592,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Team: GraphQLSelectionSet { public static let possibleTypes = ["Team1"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -22595,17 +22603,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team1", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -22614,7 +22622,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -22623,7 +22631,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -22632,7 +22640,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -22641,7 +22649,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -22655,38 +22663,38 @@ public struct APISwift { } } } - + public final class GetTeam1Query: GraphQLQuery { public static let operationString = "query GetTeam1($id: ID!) {\n getTeam1(id: $id) {\n __typename\n id\n name\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("getTeam1", arguments: ["id": GraphQLVariable("id")], type: .object(GetTeam1.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(getTeam1: GetTeam1? = nil) { - self.init(snapshot: ["__typename": "Query", "getTeam1": getTeam1.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "getTeam1": getTeam1.flatMap(\.snapshot)]) } - + public var getTeam1: GetTeam1? { get { return (snapshot["getTeam1"] as? Snapshot).flatMap { GetTeam1(snapshot: $0) } @@ -22695,10 +22703,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "getTeam1") } } - + public struct GetTeam1: GraphQLSelectionSet { public static let possibleTypes = ["Team1"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -22706,17 +22714,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team1", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -22725,7 +22733,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -22734,7 +22742,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -22743,7 +22751,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -22752,7 +22760,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -22764,42 +22772,42 @@ public struct APISwift { } } } - + public final class ListTeam1sQuery: GraphQLQuery { public static let operationString = "query ListTeam1s($filter: ModelTeam1FilterInput, $limit: Int, $nextToken: String) {\n listTeam1s(filter: $filter, limit: $limit, nextToken: $nextToken) {\n __typename\n items {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n nextToken\n }\n}" - + public var filter: ModelTeam1FilterInput? public var limit: Int? public var nextToken: String? - + public init(filter: ModelTeam1FilterInput? = 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("listTeam1s", arguments: ["filter": GraphQLVariable("filter"), "limit": GraphQLVariable("limit"), "nextToken": GraphQLVariable("nextToken")], type: .object(ListTeam1.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(listTeam1s: ListTeam1? = nil) { - self.init(snapshot: ["__typename": "Query", "listTeam1s": listTeam1s.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "listTeam1s": listTeam1s.flatMap(\.snapshot)]) } - + public var listTeam1s: ListTeam1? { get { return (snapshot["listTeam1s"] as? Snapshot).flatMap { ListTeam1(snapshot: $0) } @@ -22808,26 +22816,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "listTeam1s") } } - + public struct ListTeam1: GraphQLSelectionSet { public static let possibleTypes = ["ModelTeam1Connection"] - + 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": "ModelTeam1Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelTeam1Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -22836,16 +22844,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -22854,10 +22862,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Team1"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -22865,17 +22873,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team1", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -22884,7 +22892,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -22893,7 +22901,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -22902,7 +22910,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -22911,7 +22919,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -22924,38 +22932,38 @@ public struct APISwift { } } } - + public final class GetProject2Query: GraphQLQuery { public static let operationString = "query GetProject2($id: ID!) {\n getProject2(id: $id) {\n __typename\n id\n name\n teamID\n team {\n __typename\n id\n name\n createdAt\n updatedAt\n }\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("getProject2", arguments: ["id": GraphQLVariable("id")], type: .object(GetProject2.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(getProject2: GetProject2? = nil) { - self.init(snapshot: ["__typename": "Query", "getProject2": getProject2.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "getProject2": getProject2.flatMap(\.snapshot)]) } - + public var getProject2: GetProject2? { get { return (snapshot["getProject2"] as? Snapshot).flatMap { GetProject2(snapshot: $0) } @@ -22964,10 +22972,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "getProject2") } } - + public struct GetProject2: GraphQLSelectionSet { public static let possibleTypes = ["Project2"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -22977,17 +22985,17 @@ public struct APISwift { 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? = nil, teamId: GraphQLID, team: Team? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Project2", "id": id, "name": name, "teamID": teamId, "team": team.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Project2", "id": id, "name": name, "teamID": teamId, "team": team.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -22996,7 +23004,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -23005,7 +23013,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return snapshot["name"] as? String @@ -23014,7 +23022,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var teamId: GraphQLID { get { return snapshot["teamID"]! as! GraphQLID @@ -23023,7 +23031,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "teamID") } } - + public var team: Team? { get { return (snapshot["team"] as? Snapshot).flatMap { Team(snapshot: $0) } @@ -23032,7 +23040,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "team") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -23041,7 +23049,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -23050,10 +23058,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Team: GraphQLSelectionSet { public static let possibleTypes = ["Team2"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -23061,17 +23069,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team2", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -23080,7 +23088,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -23089,7 +23097,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -23098,7 +23106,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -23107,7 +23115,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -23120,42 +23128,42 @@ public struct APISwift { } } } - + public final class ListProject2sQuery: GraphQLQuery { public static let operationString = "query ListProject2s($filter: ModelProject2FilterInput, $limit: Int, $nextToken: String) {\n listProject2s(filter: $filter, limit: $limit, nextToken: $nextToken) {\n __typename\n items {\n __typename\n id\n name\n teamID\n team {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n nextToken\n }\n}" - + public var filter: ModelProject2FilterInput? public var limit: Int? public var nextToken: String? - + public init(filter: ModelProject2FilterInput? = 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("listProject2s", arguments: ["filter": GraphQLVariable("filter"), "limit": GraphQLVariable("limit"), "nextToken": GraphQLVariable("nextToken")], type: .object(ListProject2.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(listProject2s: ListProject2? = nil) { - self.init(snapshot: ["__typename": "Query", "listProject2s": listProject2s.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "listProject2s": listProject2s.flatMap(\.snapshot)]) } - + public var listProject2s: ListProject2? { get { return (snapshot["listProject2s"] as? Snapshot).flatMap { ListProject2(snapshot: $0) } @@ -23164,26 +23172,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "listProject2s") } } - + public struct ListProject2: GraphQLSelectionSet { public static let possibleTypes = ["ModelProject2Connection"] - + 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": "ModelProject2Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelProject2Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -23192,16 +23200,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -23210,10 +23218,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Project2"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -23223,17 +23231,17 @@ public struct APISwift { 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? = nil, teamId: GraphQLID, team: Team? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Project2", "id": id, "name": name, "teamID": teamId, "team": team.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Project2", "id": id, "name": name, "teamID": teamId, "team": team.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -23242,7 +23250,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -23251,7 +23259,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return snapshot["name"] as? String @@ -23260,7 +23268,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var teamId: GraphQLID { get { return snapshot["teamID"]! as! GraphQLID @@ -23269,7 +23277,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "teamID") } } - + public var team: Team? { get { return (snapshot["team"] as? Snapshot).flatMap { Team(snapshot: $0) } @@ -23278,7 +23286,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "team") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -23287,7 +23295,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -23296,10 +23304,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Team: GraphQLSelectionSet { public static let possibleTypes = ["Team2"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -23307,17 +23315,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team2", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -23326,7 +23334,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -23335,7 +23343,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -23344,7 +23352,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -23353,7 +23361,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -23367,38 +23375,38 @@ public struct APISwift { } } } - + public final class GetTeam2Query: GraphQLQuery { public static let operationString = "query GetTeam2($id: ID!) {\n getTeam2(id: $id) {\n __typename\n id\n name\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("getTeam2", arguments: ["id": GraphQLVariable("id")], type: .object(GetTeam2.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(getTeam2: GetTeam2? = nil) { - self.init(snapshot: ["__typename": "Query", "getTeam2": getTeam2.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "getTeam2": getTeam2.flatMap(\.snapshot)]) } - + public var getTeam2: GetTeam2? { get { return (snapshot["getTeam2"] as? Snapshot).flatMap { GetTeam2(snapshot: $0) } @@ -23407,10 +23415,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "getTeam2") } } - + public struct GetTeam2: GraphQLSelectionSet { public static let possibleTypes = ["Team2"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -23418,17 +23426,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team2", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -23437,7 +23445,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -23446,7 +23454,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -23455,7 +23463,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -23464,7 +23472,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -23476,42 +23484,42 @@ public struct APISwift { } } } - + public final class ListTeam2sQuery: GraphQLQuery { public static let operationString = "query ListTeam2s($filter: ModelTeam2FilterInput, $limit: Int, $nextToken: String) {\n listTeam2s(filter: $filter, limit: $limit, nextToken: $nextToken) {\n __typename\n items {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n nextToken\n }\n}" - + public var filter: ModelTeam2FilterInput? public var limit: Int? public var nextToken: String? - + public init(filter: ModelTeam2FilterInput? = 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("listTeam2s", arguments: ["filter": GraphQLVariable("filter"), "limit": GraphQLVariable("limit"), "nextToken": GraphQLVariable("nextToken")], type: .object(ListTeam2.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(listTeam2s: ListTeam2? = nil) { - self.init(snapshot: ["__typename": "Query", "listTeam2s": listTeam2s.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "listTeam2s": listTeam2s.flatMap(\.snapshot)]) } - + public var listTeam2s: ListTeam2? { get { return (snapshot["listTeam2s"] as? Snapshot).flatMap { ListTeam2(snapshot: $0) } @@ -23520,26 +23528,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "listTeam2s") } } - + public struct ListTeam2: GraphQLSelectionSet { public static let possibleTypes = ["ModelTeam2Connection"] - + 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": "ModelTeam2Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelTeam2Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -23548,16 +23556,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -23566,10 +23574,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Team2"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -23577,17 +23585,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team2", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -23596,7 +23604,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -23605,7 +23613,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -23614,7 +23622,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -23623,7 +23631,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -23636,38 +23644,38 @@ public struct APISwift { } } } - + public final class GetPost3Query: GraphQLQuery { public static let operationString = "query GetPost3($id: ID!) {\n getPost3(id: $id) {\n __typename\n id\n title\n comments {\n __typename\n items {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n nextToken\n }\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("getPost3", arguments: ["id": GraphQLVariable("id")], type: .object(GetPost3.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(getPost3: GetPost3? = nil) { - self.init(snapshot: ["__typename": "Query", "getPost3": getPost3.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "getPost3": getPost3.flatMap(\.snapshot)]) } - + public var getPost3: GetPost3? { get { return (snapshot["getPost3"] as? Snapshot).flatMap { GetPost3(snapshot: $0) } @@ -23676,10 +23684,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "getPost3") } } - + public struct GetPost3: GraphQLSelectionSet { public static let possibleTypes = ["Post3"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -23688,17 +23696,17 @@ public struct APISwift { 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, title: String, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post3", "id": id, "title": title, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post3", "id": id, "title": title, "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -23707,7 +23715,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -23716,7 +23724,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -23725,7 +23733,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -23734,7 +23742,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -23743,7 +23751,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -23752,26 +23760,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment3Connection"] - + 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": "ModelComment3Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelComment3Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -23780,16 +23788,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -23798,10 +23806,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment3"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -23810,17 +23818,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment3", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -23829,7 +23837,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -23838,7 +23846,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -23847,7 +23855,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -23856,7 +23864,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -23865,7 +23873,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -23879,42 +23887,42 @@ public struct APISwift { } } } - + public final class ListPost3sQuery: GraphQLQuery { public static let operationString = "query ListPost3s($filter: ModelPost3FilterInput, $limit: Int, $nextToken: String) {\n listPost3s(filter: $filter, limit: $limit, nextToken: $nextToken) {\n __typename\n items {\n __typename\n id\n title\n comments {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n nextToken\n }\n}" - + public var filter: ModelPost3FilterInput? public var limit: Int? public var nextToken: String? - + public init(filter: ModelPost3FilterInput? = 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("listPost3s", arguments: ["filter": GraphQLVariable("filter"), "limit": GraphQLVariable("limit"), "nextToken": GraphQLVariable("nextToken")], type: .object(ListPost3.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(listPost3s: ListPost3? = nil) { - self.init(snapshot: ["__typename": "Query", "listPost3s": listPost3s.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "listPost3s": listPost3s.flatMap(\.snapshot)]) } - + public var listPost3s: ListPost3? { get { return (snapshot["listPost3s"] as? Snapshot).flatMap { ListPost3(snapshot: $0) } @@ -23923,26 +23931,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "listPost3s") } } - + public struct ListPost3: GraphQLSelectionSet { public static let possibleTypes = ["ModelPost3Connection"] - + 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": "ModelPost3Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPost3Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -23951,16 +23959,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -23969,10 +23977,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Post3"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -23981,17 +23989,17 @@ public struct APISwift { 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, title: String, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post3", "id": id, "title": title, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post3", "id": id, "title": title, "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -24000,7 +24008,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -24009,7 +24017,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -24018,7 +24026,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -24027,7 +24035,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -24036,7 +24044,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -24045,25 +24053,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment3Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelComment3Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -24072,7 +24080,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -24086,38 +24094,38 @@ public struct APISwift { } } } - + public final class GetComment3Query: GraphQLQuery { public static let operationString = "query GetComment3($id: ID!) {\n getComment3(id: $id) {\n __typename\n id\n postID\n content\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("getComment3", arguments: ["id": GraphQLVariable("id")], type: .object(GetComment3.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(getComment3: GetComment3? = nil) { - self.init(snapshot: ["__typename": "Query", "getComment3": getComment3.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "getComment3": getComment3.flatMap(\.snapshot)]) } - + public var getComment3: GetComment3? { get { return (snapshot["getComment3"] as? Snapshot).flatMap { GetComment3(snapshot: $0) } @@ -24126,10 +24134,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "getComment3") } } - + public struct GetComment3: GraphQLSelectionSet { public static let possibleTypes = ["Comment3"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -24138,17 +24146,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment3", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -24157,7 +24165,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -24166,7 +24174,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -24175,7 +24183,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -24184,7 +24192,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -24193,7 +24201,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -24205,42 +24213,42 @@ public struct APISwift { } } } - + public final class ListComment3sQuery: GraphQLQuery { public static let operationString = "query ListComment3s($filter: ModelComment3FilterInput, $limit: Int, $nextToken: String) {\n listComment3s(filter: $filter, limit: $limit, nextToken: $nextToken) {\n __typename\n items {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n}" - + public var filter: ModelComment3FilterInput? public var limit: Int? public var nextToken: String? - + public init(filter: ModelComment3FilterInput? = 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("listComment3s", arguments: ["filter": GraphQLVariable("filter"), "limit": GraphQLVariable("limit"), "nextToken": GraphQLVariable("nextToken")], type: .object(ListComment3.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(listComment3s: ListComment3? = nil) { - self.init(snapshot: ["__typename": "Query", "listComment3s": listComment3s.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "listComment3s": listComment3s.flatMap(\.snapshot)]) } - + public var listComment3s: ListComment3? { get { return (snapshot["listComment3s"] as? Snapshot).flatMap { ListComment3(snapshot: $0) } @@ -24249,26 +24257,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "listComment3s") } } - + public struct ListComment3: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment3Connection"] - + 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": "ModelComment3Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelComment3Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -24277,16 +24285,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -24295,10 +24303,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment3"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -24307,17 +24315,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment3", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -24326,7 +24334,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -24335,7 +24343,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -24344,7 +24352,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -24353,7 +24361,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -24362,7 +24370,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -24375,38 +24383,38 @@ public struct APISwift { } } } - + public final class GetPost4Query: GraphQLQuery { public static let operationString = "query GetPost4($id: ID!) {\n getPost4(id: $id) {\n __typename\n id\n title\n comments {\n __typename\n items {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n nextToken\n }\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("getPost4", arguments: ["id": GraphQLVariable("id")], type: .object(GetPost4.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(getPost4: GetPost4? = nil) { - self.init(snapshot: ["__typename": "Query", "getPost4": getPost4.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "getPost4": getPost4.flatMap(\.snapshot)]) } - + public var getPost4: GetPost4? { get { return (snapshot["getPost4"] as? Snapshot).flatMap { GetPost4(snapshot: $0) } @@ -24415,10 +24423,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "getPost4") } } - + public struct GetPost4: GraphQLSelectionSet { public static let possibleTypes = ["Post4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -24427,17 +24435,17 @@ public struct APISwift { 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, title: String, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -24446,7 +24454,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -24455,7 +24463,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -24464,7 +24472,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -24473,7 +24481,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -24482,7 +24490,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -24491,26 +24499,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment4Connection"] - + 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": "ModelComment4Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelComment4Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -24519,16 +24527,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -24537,10 +24545,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -24549,17 +24557,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment4", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -24568,7 +24576,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -24577,7 +24585,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -24586,7 +24594,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -24595,7 +24603,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -24604,7 +24612,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -24618,42 +24626,42 @@ public struct APISwift { } } } - + public final class ListPost4sQuery: GraphQLQuery { public static let operationString = "query ListPost4s($filter: ModelPost4FilterInput, $limit: Int, $nextToken: String) {\n listPost4s(filter: $filter, limit: $limit, nextToken: $nextToken) {\n __typename\n items {\n __typename\n id\n title\n comments {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n nextToken\n }\n}" - + public var filter: ModelPost4FilterInput? public var limit: Int? public var nextToken: String? - + public init(filter: ModelPost4FilterInput? = 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("listPost4s", arguments: ["filter": GraphQLVariable("filter"), "limit": GraphQLVariable("limit"), "nextToken": GraphQLVariable("nextToken")], type: .object(ListPost4.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(listPost4s: ListPost4? = nil) { - self.init(snapshot: ["__typename": "Query", "listPost4s": listPost4s.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "listPost4s": listPost4s.flatMap(\.snapshot)]) } - + public var listPost4s: ListPost4? { get { return (snapshot["listPost4s"] as? Snapshot).flatMap { ListPost4(snapshot: $0) } @@ -24662,26 +24670,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "listPost4s") } } - + public struct ListPost4: GraphQLSelectionSet { public static let possibleTypes = ["ModelPost4Connection"] - + 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": "ModelPost4Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPost4Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -24690,16 +24698,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -24708,10 +24716,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Post4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -24720,17 +24728,17 @@ public struct APISwift { 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, title: String, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -24739,7 +24747,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -24748,7 +24756,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -24757,7 +24765,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -24766,7 +24774,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -24775,7 +24783,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -24784,25 +24792,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment4Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelComment4Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -24811,7 +24819,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -24825,38 +24833,38 @@ public struct APISwift { } } } - + public final class GetComment4Query: GraphQLQuery { public static let operationString = "query GetComment4($id: ID!) {\n getComment4(id: $id) {\n __typename\n id\n postID\n content\n post {\n __typename\n id\n title\n comments {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\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("getComment4", arguments: ["id": GraphQLVariable("id")], type: .object(GetComment4.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(getComment4: GetComment4? = nil) { - self.init(snapshot: ["__typename": "Query", "getComment4": getComment4.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "getComment4": getComment4.flatMap(\.snapshot)]) } - + public var getComment4: GetComment4? { get { return (snapshot["getComment4"] as? Snapshot).flatMap { GetComment4(snapshot: $0) } @@ -24865,10 +24873,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "getComment4") } } - + public struct GetComment4: GraphQLSelectionSet { public static let possibleTypes = ["Comment4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -24878,17 +24886,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, post: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Comment4", "id": id, "postID": postId, "content": content, "post": post.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Comment4", "id": id, "postID": postId, "content": content, "post": post.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -24897,7 +24905,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -24906,7 +24914,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -24915,7 +24923,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -24924,7 +24932,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var post: Post? { get { return (snapshot["post"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -24933,7 +24941,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "post") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -24942,7 +24950,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -24951,10 +24959,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -24963,17 +24971,17 @@ public struct APISwift { 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, title: String, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -24982,7 +24990,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -24991,7 +24999,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -25000,7 +25008,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -25009,7 +25017,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -25018,7 +25026,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -25027,25 +25035,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment4Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelComment4Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -25054,7 +25062,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -25068,42 +25076,42 @@ public struct APISwift { } } } - + public final class ListComment4sQuery: GraphQLQuery { public static let operationString = "query ListComment4s($filter: ModelComment4FilterInput, $limit: Int, $nextToken: String) {\n listComment4s(filter: $filter, limit: $limit, nextToken: $nextToken) {\n __typename\n items {\n __typename\n id\n postID\n content\n post {\n __typename\n id\n title\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n nextToken\n }\n}" - + public var filter: ModelComment4FilterInput? public var limit: Int? public var nextToken: String? - + public init(filter: ModelComment4FilterInput? = 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("listComment4s", arguments: ["filter": GraphQLVariable("filter"), "limit": GraphQLVariable("limit"), "nextToken": GraphQLVariable("nextToken")], type: .object(ListComment4.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(listComment4s: ListComment4? = nil) { - self.init(snapshot: ["__typename": "Query", "listComment4s": listComment4s.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "listComment4s": listComment4s.flatMap(\.snapshot)]) } - + public var listComment4s: ListComment4? { get { return (snapshot["listComment4s"] as? Snapshot).flatMap { ListComment4(snapshot: $0) } @@ -25112,26 +25120,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "listComment4s") } } - + public struct ListComment4: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment4Connection"] - + 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": "ModelComment4Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelComment4Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -25140,16 +25148,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -25158,10 +25166,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -25171,17 +25179,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, post: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Comment4", "id": id, "postID": postId, "content": content, "post": post.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Comment4", "id": id, "postID": postId, "content": content, "post": post.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -25190,7 +25198,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -25199,7 +25207,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -25208,7 +25216,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -25217,7 +25225,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var post: Post? { get { return (snapshot["post"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -25226,7 +25234,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "post") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -25235,7 +25243,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -25244,10 +25252,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -25255,17 +25263,17 @@ public struct APISwift { 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, title: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -25274,7 +25282,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -25283,7 +25291,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -25292,7 +25300,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -25301,7 +25309,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -25315,38 +25323,38 @@ public struct APISwift { } } } - + public final class GetPost5Query: GraphQLQuery { public static let operationString = "query GetPost5($id: ID!) {\n getPost5(id: $id) {\n __typename\n id\n title\n editors {\n __typename\n items {\n __typename\n id\n postID\n editorID\n createdAt\n updatedAt\n }\n nextToken\n }\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("getPost5", arguments: ["id": GraphQLVariable("id")], type: .object(GetPost5.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(getPost5: GetPost5? = nil) { - self.init(snapshot: ["__typename": "Query", "getPost5": getPost5.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "getPost5": getPost5.flatMap(\.snapshot)]) } - + public var getPost5: GetPost5? { get { return (snapshot["getPost5"] as? Snapshot).flatMap { GetPost5(snapshot: $0) } @@ -25355,10 +25363,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "getPost5") } } - + public struct GetPost5: GraphQLSelectionSet { public static let possibleTypes = ["Post5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -25367,17 +25375,17 @@ public struct APISwift { 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, title: String, editors: Editor? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -25386,7 +25394,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -25395,7 +25403,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -25404,7 +25412,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var editors: Editor? { get { return (snapshot["editors"] as? Snapshot).flatMap { Editor(snapshot: $0) } @@ -25413,7 +25421,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "editors") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -25422,7 +25430,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -25431,26 +25439,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Editor: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + 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": "ModelPostEditor5Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -25459,16 +25467,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -25477,10 +25485,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["PostEditor5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -25489,17 +25497,17 @@ public struct APISwift { 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, postId: GraphQLID, editorId: GraphQLID, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "PostEditor5", "id": id, "postID": postId, "editorID": editorId, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -25508,7 +25516,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -25517,7 +25525,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -25526,7 +25534,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var editorId: GraphQLID { get { return snapshot["editorID"]! as! GraphQLID @@ -25535,7 +25543,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "editorID") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -25544,7 +25552,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -25558,42 +25566,42 @@ public struct APISwift { } } } - + public final class ListPost5sQuery: GraphQLQuery { public static let operationString = "query ListPost5s($filter: ModelPost5FilterInput, $limit: Int, $nextToken: String) {\n listPost5s(filter: $filter, limit: $limit, nextToken: $nextToken) {\n __typename\n items {\n __typename\n id\n title\n editors {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n nextToken\n }\n}" - + public var filter: ModelPost5FilterInput? public var limit: Int? public var nextToken: String? - + public init(filter: ModelPost5FilterInput? = 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("listPost5s", arguments: ["filter": GraphQLVariable("filter"), "limit": GraphQLVariable("limit"), "nextToken": GraphQLVariable("nextToken")], type: .object(ListPost5.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(listPost5s: ListPost5? = nil) { - self.init(snapshot: ["__typename": "Query", "listPost5s": listPost5s.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "listPost5s": listPost5s.flatMap(\.snapshot)]) } - + public var listPost5s: ListPost5? { get { return (snapshot["listPost5s"] as? Snapshot).flatMap { ListPost5(snapshot: $0) } @@ -25602,26 +25610,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "listPost5s") } } - + public struct ListPost5: GraphQLSelectionSet { public static let possibleTypes = ["ModelPost5Connection"] - + 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": "ModelPost5Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPost5Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -25630,16 +25638,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -25648,10 +25656,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Post5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -25660,17 +25668,17 @@ public struct APISwift { 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, title: String, editors: Editor? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -25679,7 +25687,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -25688,7 +25696,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -25697,7 +25705,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var editors: Editor? { get { return (snapshot["editors"] as? Snapshot).flatMap { Editor(snapshot: $0) } @@ -25706,7 +25714,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "editors") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -25715,7 +25723,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -25724,25 +25732,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Editor: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -25751,7 +25759,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -25765,38 +25773,38 @@ public struct APISwift { } } } - + public final class GetPostEditor5Query: GraphQLQuery { public static let operationString = "query GetPostEditor5($id: ID!) {\n getPostEditor5(id: $id) {\n __typename\n id\n postID\n editorID\n post {\n __typename\n id\n title\n editors {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n editor {\n __typename\n id\n username\n posts {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\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("getPostEditor5", arguments: ["id": GraphQLVariable("id")], type: .object(GetPostEditor5.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(getPostEditor5: GetPostEditor5? = nil) { - self.init(snapshot: ["__typename": "Query", "getPostEditor5": getPostEditor5.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "getPostEditor5": getPostEditor5.flatMap(\.snapshot)]) } - + public var getPostEditor5: GetPostEditor5? { get { return (snapshot["getPostEditor5"] as? Snapshot).flatMap { GetPostEditor5(snapshot: $0) } @@ -25805,10 +25813,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "getPostEditor5") } } - + public struct GetPostEditor5: GraphQLSelectionSet { public static let possibleTypes = ["PostEditor5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -25819,17 +25827,17 @@ public struct APISwift { 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, postId: GraphQLID, editorId: GraphQLID, post: Post, editor: Editor, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "PostEditor5", "id": id, "postID": postId, "editorID": editorId, "post": post.snapshot, "editor": editor.snapshot, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -25838,7 +25846,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -25847,7 +25855,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -25856,7 +25864,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var editorId: GraphQLID { get { return snapshot["editorID"]! as! GraphQLID @@ -25865,7 +25873,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "editorID") } } - + public var post: Post { get { return Post(snapshot: snapshot["post"]! as! Snapshot) @@ -25874,7 +25882,7 @@ public struct APISwift { snapshot.updateValue(newValue.snapshot, forKey: "post") } } - + public var editor: Editor { get { return Editor(snapshot: snapshot["editor"]! as! Snapshot) @@ -25883,7 +25891,7 @@ public struct APISwift { snapshot.updateValue(newValue.snapshot, forKey: "editor") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -25892,7 +25900,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -25901,10 +25909,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -25913,17 +25921,17 @@ public struct APISwift { 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, title: String, editors: Editor? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -25932,7 +25940,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -25941,7 +25949,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -25950,7 +25958,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var editors: Editor? { get { return (snapshot["editors"] as? Snapshot).flatMap { Editor(snapshot: $0) } @@ -25959,7 +25967,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "editors") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -25968,7 +25976,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -25977,25 +25985,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Editor: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -26004,7 +26012,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -26015,10 +26023,10 @@ public struct APISwift { } } } - + public struct Editor: GraphQLSelectionSet { public static let possibleTypes = ["User5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -26027,17 +26035,17 @@ public struct APISwift { 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, username: String, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -26046,7 +26054,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -26055,7 +26063,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var username: String { get { return snapshot["username"]! as! String @@ -26064,7 +26072,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "username") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -26073,7 +26081,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -26082,7 +26090,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -26091,25 +26099,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -26118,7 +26126,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -26132,42 +26140,42 @@ public struct APISwift { } } } - + public final class ListPostEditor5sQuery: GraphQLQuery { public static let operationString = "query ListPostEditor5s($filter: ModelPostEditor5FilterInput, $limit: Int, $nextToken: String) {\n listPostEditor5s(filter: $filter, limit: $limit, nextToken: $nextToken) {\n __typename\n items {\n __typename\n id\n postID\n editorID\n post {\n __typename\n id\n title\n createdAt\n updatedAt\n }\n editor {\n __typename\n id\n username\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n nextToken\n }\n}" - + public var filter: ModelPostEditor5FilterInput? public var limit: Int? public var nextToken: String? - + public init(filter: ModelPostEditor5FilterInput? = 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("listPostEditor5s", arguments: ["filter": GraphQLVariable("filter"), "limit": GraphQLVariable("limit"), "nextToken": GraphQLVariable("nextToken")], type: .object(ListPostEditor5.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(listPostEditor5s: ListPostEditor5? = nil) { - self.init(snapshot: ["__typename": "Query", "listPostEditor5s": listPostEditor5s.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "listPostEditor5s": listPostEditor5s.flatMap(\.snapshot)]) } - + public var listPostEditor5s: ListPostEditor5? { get { return (snapshot["listPostEditor5s"] as? Snapshot).flatMap { ListPostEditor5(snapshot: $0) } @@ -26176,26 +26184,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "listPostEditor5s") } } - + public struct ListPostEditor5: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + 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": "ModelPostEditor5Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -26204,16 +26212,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -26222,10 +26230,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["PostEditor5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -26236,17 +26244,17 @@ public struct APISwift { 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, postId: GraphQLID, editorId: GraphQLID, post: Post, editor: Editor, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "PostEditor5", "id": id, "postID": postId, "editorID": editorId, "post": post.snapshot, "editor": editor.snapshot, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -26255,7 +26263,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -26264,7 +26272,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -26273,7 +26281,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var editorId: GraphQLID { get { return snapshot["editorID"]! as! GraphQLID @@ -26282,7 +26290,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "editorID") } } - + public var post: Post { get { return Post(snapshot: snapshot["post"]! as! Snapshot) @@ -26291,7 +26299,7 @@ public struct APISwift { snapshot.updateValue(newValue.snapshot, forKey: "post") } } - + public var editor: Editor { get { return Editor(snapshot: snapshot["editor"]! as! Snapshot) @@ -26300,7 +26308,7 @@ public struct APISwift { snapshot.updateValue(newValue.snapshot, forKey: "editor") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -26309,7 +26317,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -26318,10 +26326,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -26329,17 +26337,17 @@ public struct APISwift { 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, title: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -26348,7 +26356,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -26357,7 +26365,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -26366,7 +26374,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -26375,7 +26383,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -26385,10 +26393,10 @@ public struct APISwift { } } } - + public struct Editor: GraphQLSelectionSet { public static let possibleTypes = ["User5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -26396,17 +26404,17 @@ public struct APISwift { 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, username: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -26415,7 +26423,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -26424,7 +26432,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var username: String { get { return snapshot["username"]! as! String @@ -26433,7 +26441,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "username") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -26442,7 +26450,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -26456,38 +26464,38 @@ public struct APISwift { } } } - + public final class GetUser5Query: GraphQLQuery { public static let operationString = "query GetUser5($id: ID!) {\n getUser5(id: $id) {\n __typename\n id\n username\n posts {\n __typename\n items {\n __typename\n id\n postID\n editorID\n createdAt\n updatedAt\n }\n nextToken\n }\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("getUser5", arguments: ["id": GraphQLVariable("id")], type: .object(GetUser5.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(getUser5: GetUser5? = nil) { - self.init(snapshot: ["__typename": "Query", "getUser5": getUser5.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "getUser5": getUser5.flatMap(\.snapshot)]) } - + public var getUser5: GetUser5? { get { return (snapshot["getUser5"] as? Snapshot).flatMap { GetUser5(snapshot: $0) } @@ -26496,10 +26504,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "getUser5") } } - + public struct GetUser5: GraphQLSelectionSet { public static let possibleTypes = ["User5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -26508,17 +26516,17 @@ public struct APISwift { 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, username: String, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -26527,7 +26535,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -26536,7 +26544,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var username: String { get { return snapshot["username"]! as! String @@ -26545,7 +26553,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "username") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -26554,7 +26562,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -26563,7 +26571,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -26572,26 +26580,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + 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": "ModelPostEditor5Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -26600,16 +26608,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -26618,10 +26626,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["PostEditor5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -26630,17 +26638,17 @@ public struct APISwift { 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, postId: GraphQLID, editorId: GraphQLID, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "PostEditor5", "id": id, "postID": postId, "editorID": editorId, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -26649,7 +26657,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -26658,7 +26666,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -26667,7 +26675,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var editorId: GraphQLID { get { return snapshot["editorID"]! as! GraphQLID @@ -26676,7 +26684,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "editorID") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -26685,7 +26693,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -26699,42 +26707,42 @@ public struct APISwift { } } } - + public final class ListUser5sQuery: GraphQLQuery { public static let operationString = "query ListUser5s($filter: ModelUser5FilterInput, $limit: Int, $nextToken: String) {\n listUser5s(filter: $filter, limit: $limit, nextToken: $nextToken) {\n __typename\n items {\n __typename\n id\n username\n posts {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n nextToken\n }\n}" - + public var filter: ModelUser5FilterInput? public var limit: Int? public var nextToken: String? - + public init(filter: ModelUser5FilterInput? = 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("listUser5s", arguments: ["filter": GraphQLVariable("filter"), "limit": GraphQLVariable("limit"), "nextToken": GraphQLVariable("nextToken")], type: .object(ListUser5.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(listUser5s: ListUser5? = nil) { - self.init(snapshot: ["__typename": "Query", "listUser5s": listUser5s.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "listUser5s": listUser5s.flatMap(\.snapshot)]) } - + public var listUser5s: ListUser5? { get { return (snapshot["listUser5s"] as? Snapshot).flatMap { ListUser5(snapshot: $0) } @@ -26743,26 +26751,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "listUser5s") } } - + public struct ListUser5: GraphQLSelectionSet { public static let possibleTypes = ["ModelUser5Connection"] - + 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": "ModelUser5Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelUser5Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -26771,16 +26779,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -26789,10 +26797,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["User5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -26801,17 +26809,17 @@ public struct APISwift { 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, username: String, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -26820,7 +26828,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -26829,7 +26837,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var username: String { get { return snapshot["username"]! as! String @@ -26838,7 +26846,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "username") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -26847,7 +26855,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -26856,7 +26864,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -26865,25 +26873,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -26892,7 +26900,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -26906,38 +26914,38 @@ public struct APISwift { } } } - + public final class GetBlog6Query: GraphQLQuery { public static let operationString = "query GetBlog6($id: ID!) {\n getBlog6(id: $id) {\n __typename\n id\n name\n posts {\n __typename\n items {\n __typename\n id\n title\n blogID\n createdAt\n updatedAt\n }\n nextToken\n }\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("getBlog6", arguments: ["id": GraphQLVariable("id")], type: .object(GetBlog6.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(getBlog6: GetBlog6? = nil) { - self.init(snapshot: ["__typename": "Query", "getBlog6": getBlog6.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "getBlog6": getBlog6.flatMap(\.snapshot)]) } - + public var getBlog6: GetBlog6? { get { return (snapshot["getBlog6"] as? Snapshot).flatMap { GetBlog6(snapshot: $0) } @@ -26946,10 +26954,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "getBlog6") } } - + public struct GetBlog6: GraphQLSelectionSet { public static let possibleTypes = ["Blog6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -26958,17 +26966,17 @@ public struct APISwift { 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, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -26977,7 +26985,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -26986,7 +26994,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -26995,7 +27003,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -27004,7 +27012,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -27013,7 +27021,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -27022,26 +27030,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPost6Connection"] - + 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": "ModelPost6Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPost6Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -27050,16 +27058,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -27068,10 +27076,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Post6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -27080,17 +27088,17 @@ public struct APISwift { 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, title: String, blogId: GraphQLID, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -27099,7 +27107,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -27108,7 +27116,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -27117,7 +27125,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID { get { return snapshot["blogID"]! as! GraphQLID @@ -27126,7 +27134,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "blogID") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -27135,7 +27143,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -27149,42 +27157,42 @@ public struct APISwift { } } } - + public final class ListBlog6sQuery: GraphQLQuery { public static let operationString = "query ListBlog6s($filter: ModelBlog6FilterInput, $limit: Int, $nextToken: String) {\n listBlog6s(filter: $filter, limit: $limit, nextToken: $nextToken) {\n __typename\n items {\n __typename\n id\n name\n posts {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n nextToken\n }\n}" - + public var filter: ModelBlog6FilterInput? public var limit: Int? public var nextToken: String? - + public init(filter: ModelBlog6FilterInput? = 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("listBlog6s", arguments: ["filter": GraphQLVariable("filter"), "limit": GraphQLVariable("limit"), "nextToken": GraphQLVariable("nextToken")], type: .object(ListBlog6.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(listBlog6s: ListBlog6? = nil) { - self.init(snapshot: ["__typename": "Query", "listBlog6s": listBlog6s.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "listBlog6s": listBlog6s.flatMap(\.snapshot)]) } - + public var listBlog6s: ListBlog6? { get { return (snapshot["listBlog6s"] as? Snapshot).flatMap { ListBlog6(snapshot: $0) } @@ -27193,26 +27201,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "listBlog6s") } } - + public struct ListBlog6: GraphQLSelectionSet { public static let possibleTypes = ["ModelBlog6Connection"] - + 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": "ModelBlog6Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelBlog6Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -27221,16 +27229,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -27239,10 +27247,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Blog6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -27251,17 +27259,17 @@ public struct APISwift { 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, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -27270,7 +27278,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -27279,7 +27287,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -27288,7 +27296,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -27297,7 +27305,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -27306,7 +27314,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -27315,25 +27323,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPost6Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelPost6Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -27342,7 +27350,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -27356,38 +27364,38 @@ public struct APISwift { } } } - + public final class GetPost6Query: GraphQLQuery { public static let operationString = "query GetPost6($id: ID!) {\n getPost6(id: $id) {\n __typename\n id\n title\n blogID\n blog {\n __typename\n id\n name\n posts {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n comments {\n __typename\n items {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n nextToken\n }\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("getPost6", arguments: ["id": GraphQLVariable("id")], type: .object(GetPost6.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(getPost6: GetPost6? = nil) { - self.init(snapshot: ["__typename": "Query", "getPost6": getPost6.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "getPost6": getPost6.flatMap(\.snapshot)]) } - + public var getPost6: GetPost6? { get { return (snapshot["getPost6"] as? Snapshot).flatMap { GetPost6(snapshot: $0) } @@ -27396,10 +27404,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "getPost6") } } - + public struct GetPost6: GraphQLSelectionSet { public static let possibleTypes = ["Post6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -27410,17 +27418,17 @@ public struct APISwift { 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, title: String, blogId: GraphQLID, blog: Blog? = nil, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap { $0.snapshot }, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap(\.snapshot), "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -27429,7 +27437,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -27438,7 +27446,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -27447,7 +27455,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID { get { return snapshot["blogID"]! as! GraphQLID @@ -27456,7 +27464,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "blogID") } } - + public var blog: Blog? { get { return (snapshot["blog"] as? Snapshot).flatMap { Blog(snapshot: $0) } @@ -27465,7 +27473,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "blog") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -27474,7 +27482,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -27483,7 +27491,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -27492,10 +27500,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Blog: GraphQLSelectionSet { public static let possibleTypes = ["Blog6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -27504,17 +27512,17 @@ public struct APISwift { 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, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -27523,7 +27531,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -27532,7 +27540,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -27541,7 +27549,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -27550,7 +27558,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -27559,7 +27567,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -27568,25 +27576,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPost6Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelPost6Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -27595,7 +27603,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -27606,26 +27614,26 @@ public struct APISwift { } } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment6Connection"] - + 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": "ModelComment6Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelComment6Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -27634,16 +27642,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -27652,10 +27660,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -27664,17 +27672,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment6", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -27683,7 +27691,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -27692,7 +27700,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -27701,7 +27709,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -27710,7 +27718,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -27719,7 +27727,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -27733,42 +27741,42 @@ public struct APISwift { } } } - + public final class ListPost6sQuery: GraphQLQuery { public static let operationString = "query ListPost6s($filter: ModelPost6FilterInput, $limit: Int, $nextToken: String) {\n listPost6s(filter: $filter, limit: $limit, nextToken: $nextToken) {\n __typename\n items {\n __typename\n id\n title\n blogID\n blog {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n comments {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n nextToken\n }\n}" - + public var filter: ModelPost6FilterInput? public var limit: Int? public var nextToken: String? - + public init(filter: ModelPost6FilterInput? = 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("listPost6s", arguments: ["filter": GraphQLVariable("filter"), "limit": GraphQLVariable("limit"), "nextToken": GraphQLVariable("nextToken")], type: .object(ListPost6.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(listPost6s: ListPost6? = nil) { - self.init(snapshot: ["__typename": "Query", "listPost6s": listPost6s.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "listPost6s": listPost6s.flatMap(\.snapshot)]) } - + public var listPost6s: ListPost6? { get { return (snapshot["listPost6s"] as? Snapshot).flatMap { ListPost6(snapshot: $0) } @@ -27777,26 +27785,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "listPost6s") } } - + public struct ListPost6: GraphQLSelectionSet { public static let possibleTypes = ["ModelPost6Connection"] - + 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": "ModelPost6Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPost6Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -27805,16 +27813,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -27823,10 +27831,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Post6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -27837,17 +27845,17 @@ public struct APISwift { 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, title: String, blogId: GraphQLID, blog: Blog? = nil, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap { $0.snapshot }, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap(\.snapshot), "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -27856,7 +27864,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -27865,7 +27873,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -27874,7 +27882,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID { get { return snapshot["blogID"]! as! GraphQLID @@ -27883,7 +27891,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "blogID") } } - + public var blog: Blog? { get { return (snapshot["blog"] as? Snapshot).flatMap { Blog(snapshot: $0) } @@ -27892,7 +27900,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "blog") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -27901,7 +27909,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -27910,7 +27918,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -27919,10 +27927,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Blog: GraphQLSelectionSet { public static let possibleTypes = ["Blog6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -27930,17 +27938,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -27949,7 +27957,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -27958,7 +27966,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -27967,7 +27975,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -27976,7 +27984,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -27986,25 +27994,25 @@ public struct APISwift { } } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment6Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelComment6Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -28013,7 +28021,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -28027,38 +28035,38 @@ public struct APISwift { } } } - + public final class GetComment6Query: GraphQLQuery { public static let operationString = "query GetComment6($id: ID!) {\n getComment6(id: $id) {\n __typename\n id\n postID\n post {\n __typename\n id\n title\n blogID\n blog {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n comments {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n content\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("getComment6", arguments: ["id": GraphQLVariable("id")], type: .object(GetComment6.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(getComment6: GetComment6? = nil) { - self.init(snapshot: ["__typename": "Query", "getComment6": getComment6.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "getComment6": getComment6.flatMap(\.snapshot)]) } - + public var getComment6: GetComment6? { get { return (snapshot["getComment6"] as? Snapshot).flatMap { GetComment6(snapshot: $0) } @@ -28067,10 +28075,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "getComment6") } } - + public struct GetComment6: GraphQLSelectionSet { public static let possibleTypes = ["Comment6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -28080,17 +28088,17 @@ public struct APISwift { 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, postId: GraphQLID, post: Post? = nil, content: String, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Comment6", "id": id, "postID": postId, "post": post.flatMap { $0.snapshot }, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Comment6", "id": id, "postID": postId, "post": post.flatMap(\.snapshot), "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -28099,7 +28107,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -28108,7 +28116,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -28117,7 +28125,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var post: Post? { get { return (snapshot["post"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -28126,7 +28134,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "post") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -28135,7 +28143,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -28144,7 +28152,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -28153,10 +28161,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -28167,17 +28175,17 @@ public struct APISwift { 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, title: String, blogId: GraphQLID, blog: Blog? = nil, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap { $0.snapshot }, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap(\.snapshot), "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -28186,7 +28194,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -28195,7 +28203,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -28204,7 +28212,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID { get { return snapshot["blogID"]! as! GraphQLID @@ -28213,7 +28221,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "blogID") } } - + public var blog: Blog? { get { return (snapshot["blog"] as? Snapshot).flatMap { Blog(snapshot: $0) } @@ -28222,7 +28230,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "blog") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -28231,7 +28239,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -28240,7 +28248,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -28249,10 +28257,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Blog: GraphQLSelectionSet { public static let possibleTypes = ["Blog6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -28260,17 +28268,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -28279,7 +28287,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -28288,7 +28296,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -28297,7 +28305,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -28306,7 +28314,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -28316,25 +28324,25 @@ public struct APISwift { } } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment6Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelComment6Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -28343,7 +28351,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -28357,42 +28365,42 @@ public struct APISwift { } } } - + public final class ListComment6sQuery: GraphQLQuery { public static let operationString = "query ListComment6s($filter: ModelComment6FilterInput, $limit: Int, $nextToken: String) {\n listComment6s(filter: $filter, limit: $limit, nextToken: $nextToken) {\n __typename\n items {\n __typename\n id\n postID\n post {\n __typename\n id\n title\n blogID\n createdAt\n updatedAt\n }\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n}" - + public var filter: ModelComment6FilterInput? public var limit: Int? public var nextToken: String? - + public init(filter: ModelComment6FilterInput? = 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("listComment6s", arguments: ["filter": GraphQLVariable("filter"), "limit": GraphQLVariable("limit"), "nextToken": GraphQLVariable("nextToken")], type: .object(ListComment6.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(listComment6s: ListComment6? = nil) { - self.init(snapshot: ["__typename": "Query", "listComment6s": listComment6s.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "listComment6s": listComment6s.flatMap(\.snapshot)]) } - + public var listComment6s: ListComment6? { get { return (snapshot["listComment6s"] as? Snapshot).flatMap { ListComment6(snapshot: $0) } @@ -28401,26 +28409,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "listComment6s") } } - + public struct ListComment6: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment6Connection"] - + 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": "ModelComment6Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelComment6Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -28429,16 +28437,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -28447,10 +28455,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -28460,17 +28468,17 @@ public struct APISwift { 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, postId: GraphQLID, post: Post? = nil, content: String, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Comment6", "id": id, "postID": postId, "post": post.flatMap { $0.snapshot }, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Comment6", "id": id, "postID": postId, "post": post.flatMap(\.snapshot), "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -28479,7 +28487,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -28488,7 +28496,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -28497,7 +28505,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var post: Post? { get { return (snapshot["post"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -28506,7 +28514,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "post") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -28515,7 +28523,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -28524,7 +28532,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -28533,10 +28541,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -28545,17 +28553,17 @@ public struct APISwift { 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, title: String, blogId: GraphQLID, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -28564,7 +28572,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -28573,7 +28581,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -28582,7 +28590,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID { get { return snapshot["blogID"]! as! GraphQLID @@ -28591,7 +28599,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "blogID") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -28600,7 +28608,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -28614,38 +28622,38 @@ public struct APISwift { } } } - + public final class GetScalarContainerQuery: GraphQLQuery { public static let operationString = "query GetScalarContainer($id: ID!) {\n getScalarContainer(id: $id) {\n __typename\n id\n myString\n myInt\n myDouble\n myBool\n myDate\n myTime\n myDateTime\n myTimeStamp\n myEmail\n myJSON\n myPhone\n myURL\n myIPAddress\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("getScalarContainer", arguments: ["id": GraphQLVariable("id")], type: .object(GetScalarContainer.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(getScalarContainer: GetScalarContainer? = nil) { - self.init(snapshot: ["__typename": "Query", "getScalarContainer": getScalarContainer.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "getScalarContainer": getScalarContainer.flatMap(\.snapshot)]) } - + public var getScalarContainer: GetScalarContainer? { get { return (snapshot["getScalarContainer"] as? Snapshot).flatMap { GetScalarContainer(snapshot: $0) } @@ -28654,10 +28662,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "getScalarContainer") } } - + public struct GetScalarContainer: GraphQLSelectionSet { public static let possibleTypes = ["ScalarContainer"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -28677,17 +28685,17 @@ public struct APISwift { 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, myString: String? = nil, myInt: Int? = nil, myDouble: Double? = nil, myBool: Bool? = nil, myDate: String? = nil, myTime: String? = nil, myDateTime: String? = nil, myTimeStamp: Int? = nil, myEmail: String? = nil, myJson: String? = nil, myPhone: String? = nil, myUrl: String? = nil, myIpAddress: String? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "ScalarContainer", "id": id, "myString": myString, "myInt": myInt, "myDouble": myDouble, "myBool": myBool, "myDate": myDate, "myTime": myTime, "myDateTime": myDateTime, "myTimeStamp": myTimeStamp, "myEmail": myEmail, "myJSON": myJson, "myPhone": myPhone, "myURL": myUrl, "myIPAddress": myIpAddress, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -28696,7 +28704,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -28705,7 +28713,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var myString: String? { get { return snapshot["myString"] as? String @@ -28714,7 +28722,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myString") } } - + public var myInt: Int? { get { return snapshot["myInt"] as? Int @@ -28723,7 +28731,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myInt") } } - + public var myDouble: Double? { get { return snapshot["myDouble"] as? Double @@ -28732,7 +28740,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myDouble") } } - + public var myBool: Bool? { get { return snapshot["myBool"] as? Bool @@ -28741,7 +28749,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myBool") } } - + public var myDate: String? { get { return snapshot["myDate"] as? String @@ -28750,7 +28758,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myDate") } } - + public var myTime: String? { get { return snapshot["myTime"] as? String @@ -28759,7 +28767,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myTime") } } - + public var myDateTime: String? { get { return snapshot["myDateTime"] as? String @@ -28768,7 +28776,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myDateTime") } } - + public var myTimeStamp: Int? { get { return snapshot["myTimeStamp"] as? Int @@ -28777,7 +28785,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myTimeStamp") } } - + public var myEmail: String? { get { return snapshot["myEmail"] as? String @@ -28786,7 +28794,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myEmail") } } - + public var myJson: String? { get { return snapshot["myJSON"] as? String @@ -28795,7 +28803,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myJSON") } } - + public var myPhone: String? { get { return snapshot["myPhone"] as? String @@ -28804,7 +28812,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myPhone") } } - + public var myUrl: String? { get { return snapshot["myURL"] as? String @@ -28813,7 +28821,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myURL") } } - + public var myIpAddress: String? { get { return snapshot["myIPAddress"] as? String @@ -28822,7 +28830,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myIPAddress") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -28831,7 +28839,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -28843,42 +28851,42 @@ public struct APISwift { } } } - + public final class ListScalarContainersQuery: GraphQLQuery { public static let operationString = "query ListScalarContainers($filter: ModelScalarContainerFilterInput, $limit: Int, $nextToken: String) {\n listScalarContainers(filter: $filter, limit: $limit, nextToken: $nextToken) {\n __typename\n items {\n __typename\n id\n myString\n myInt\n myDouble\n myBool\n myDate\n myTime\n myDateTime\n myTimeStamp\n myEmail\n myJSON\n myPhone\n myURL\n myIPAddress\n createdAt\n updatedAt\n }\n nextToken\n }\n}" - + public var filter: ModelScalarContainerFilterInput? public var limit: Int? public var nextToken: String? - + public init(filter: ModelScalarContainerFilterInput? = 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("listScalarContainers", arguments: ["filter": GraphQLVariable("filter"), "limit": GraphQLVariable("limit"), "nextToken": GraphQLVariable("nextToken")], type: .object(ListScalarContainer.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(listScalarContainers: ListScalarContainer? = nil) { - self.init(snapshot: ["__typename": "Query", "listScalarContainers": listScalarContainers.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "listScalarContainers": listScalarContainers.flatMap(\.snapshot)]) } - + public var listScalarContainers: ListScalarContainer? { get { return (snapshot["listScalarContainers"] as? Snapshot).flatMap { ListScalarContainer(snapshot: $0) } @@ -28887,26 +28895,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "listScalarContainers") } } - + public struct ListScalarContainer: GraphQLSelectionSet { public static let possibleTypes = ["ModelScalarContainerConnection"] - + 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": "ModelScalarContainerConnection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelScalarContainerConnection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -28915,16 +28923,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -28933,10 +28941,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["ScalarContainer"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -28956,17 +28964,17 @@ public struct APISwift { 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, myString: String? = nil, myInt: Int? = nil, myDouble: Double? = nil, myBool: Bool? = nil, myDate: String? = nil, myTime: String? = nil, myDateTime: String? = nil, myTimeStamp: Int? = nil, myEmail: String? = nil, myJson: String? = nil, myPhone: String? = nil, myUrl: String? = nil, myIpAddress: String? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "ScalarContainer", "id": id, "myString": myString, "myInt": myInt, "myDouble": myDouble, "myBool": myBool, "myDate": myDate, "myTime": myTime, "myDateTime": myDateTime, "myTimeStamp": myTimeStamp, "myEmail": myEmail, "myJSON": myJson, "myPhone": myPhone, "myURL": myUrl, "myIPAddress": myIpAddress, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -28975,7 +28983,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -28984,7 +28992,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var myString: String? { get { return snapshot["myString"] as? String @@ -28993,7 +29001,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myString") } } - + public var myInt: Int? { get { return snapshot["myInt"] as? Int @@ -29002,7 +29010,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myInt") } } - + public var myDouble: Double? { get { return snapshot["myDouble"] as? Double @@ -29011,7 +29019,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myDouble") } } - + public var myBool: Bool? { get { return snapshot["myBool"] as? Bool @@ -29020,7 +29028,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myBool") } } - + public var myDate: String? { get { return snapshot["myDate"] as? String @@ -29029,7 +29037,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myDate") } } - + public var myTime: String? { get { return snapshot["myTime"] as? String @@ -29038,7 +29046,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myTime") } } - + public var myDateTime: String? { get { return snapshot["myDateTime"] as? String @@ -29047,7 +29055,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myDateTime") } } - + public var myTimeStamp: Int? { get { return snapshot["myTimeStamp"] as? Int @@ -29056,7 +29064,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myTimeStamp") } } - + public var myEmail: String? { get { return snapshot["myEmail"] as? String @@ -29065,7 +29073,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myEmail") } } - + public var myJson: String? { get { return snapshot["myJSON"] as? String @@ -29074,7 +29082,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myJSON") } } - + public var myPhone: String? { get { return snapshot["myPhone"] as? String @@ -29083,7 +29091,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myPhone") } } - + public var myUrl: String? { get { return snapshot["myURL"] as? String @@ -29092,7 +29100,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myURL") } } - + public var myIpAddress: String? { get { return snapshot["myIPAddress"] as? String @@ -29101,7 +29109,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myIPAddress") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -29110,7 +29118,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -29123,38 +29131,38 @@ public struct APISwift { } } } - + public final class GetListIntContainerQuery: GraphQLQuery { public static let operationString = "query GetListIntContainer($id: ID!) {\n getListIntContainer(id: $id) {\n __typename\n id\n test\n nullableInt\n intList\n intNullableList\n nullableIntList\n nullableIntNullableList\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("getListIntContainer", arguments: ["id": GraphQLVariable("id")], type: .object(GetListIntContainer.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(getListIntContainer: GetListIntContainer? = nil) { - self.init(snapshot: ["__typename": "Query", "getListIntContainer": getListIntContainer.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "getListIntContainer": getListIntContainer.flatMap(\.snapshot)]) } - + public var getListIntContainer: GetListIntContainer? { get { return (snapshot["getListIntContainer"] as? Snapshot).flatMap { GetListIntContainer(snapshot: $0) } @@ -29163,10 +29171,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "getListIntContainer") } } - + public struct GetListIntContainer: GraphQLSelectionSet { public static let possibleTypes = ["ListIntContainer"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -29179,17 +29187,17 @@ public struct APISwift { 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, test: Int, nullableInt: Int? = nil, intList: [Int], intNullableList: [Int]? = nil, nullableIntList: [Int?], nullableIntNullableList: [Int?]? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "ListIntContainer", "id": id, "test": test, "nullableInt": nullableInt, "intList": intList, "intNullableList": intNullableList, "nullableIntList": nullableIntList, "nullableIntNullableList": nullableIntNullableList, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -29198,7 +29206,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -29207,7 +29215,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var test: Int { get { return snapshot["test"]! as! Int @@ -29216,7 +29224,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "test") } } - + public var nullableInt: Int? { get { return snapshot["nullableInt"] as? Int @@ -29225,7 +29233,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableInt") } } - + public var intList: [Int] { get { return snapshot["intList"]! as! [Int] @@ -29234,7 +29242,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "intList") } } - + public var intNullableList: [Int]? { get { return snapshot["intNullableList"] as? [Int] @@ -29243,7 +29251,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "intNullableList") } } - + public var nullableIntList: [Int?] { get { return snapshot["nullableIntList"]! as! [Int?] @@ -29252,7 +29260,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableIntList") } } - + public var nullableIntNullableList: [Int?]? { get { return snapshot["nullableIntNullableList"] as? [Int?] @@ -29261,7 +29269,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableIntNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -29270,7 +29278,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -29282,42 +29290,42 @@ public struct APISwift { } } } - + public final class ListListIntContainersQuery: GraphQLQuery { public static let operationString = "query ListListIntContainers($filter: ModelListIntContainerFilterInput, $limit: Int, $nextToken: String) {\n listListIntContainers(filter: $filter, limit: $limit, nextToken: $nextToken) {\n __typename\n items {\n __typename\n id\n test\n nullableInt\n intList\n intNullableList\n nullableIntList\n nullableIntNullableList\n createdAt\n updatedAt\n }\n nextToken\n }\n}" - + public var filter: ModelListIntContainerFilterInput? public var limit: Int? public var nextToken: String? - + public init(filter: ModelListIntContainerFilterInput? = 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("listListIntContainers", arguments: ["filter": GraphQLVariable("filter"), "limit": GraphQLVariable("limit"), "nextToken": GraphQLVariable("nextToken")], type: .object(ListListIntContainer.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(listListIntContainers: ListListIntContainer? = nil) { - self.init(snapshot: ["__typename": "Query", "listListIntContainers": listListIntContainers.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "listListIntContainers": listListIntContainers.flatMap(\.snapshot)]) } - + public var listListIntContainers: ListListIntContainer? { get { return (snapshot["listListIntContainers"] as? Snapshot).flatMap { ListListIntContainer(snapshot: $0) } @@ -29326,26 +29334,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "listListIntContainers") } } - + public struct ListListIntContainer: GraphQLSelectionSet { public static let possibleTypes = ["ModelListIntContainerConnection"] - + 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": "ModelListIntContainerConnection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelListIntContainerConnection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -29354,16 +29362,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -29372,10 +29380,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["ListIntContainer"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -29388,17 +29396,17 @@ public struct APISwift { 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, test: Int, nullableInt: Int? = nil, intList: [Int], intNullableList: [Int]? = nil, nullableIntList: [Int?], nullableIntNullableList: [Int?]? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "ListIntContainer", "id": id, "test": test, "nullableInt": nullableInt, "intList": intList, "intNullableList": intNullableList, "nullableIntList": nullableIntList, "nullableIntNullableList": nullableIntNullableList, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -29407,7 +29415,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -29416,7 +29424,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var test: Int { get { return snapshot["test"]! as! Int @@ -29425,7 +29433,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "test") } } - + public var nullableInt: Int? { get { return snapshot["nullableInt"] as? Int @@ -29434,7 +29442,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableInt") } } - + public var intList: [Int] { get { return snapshot["intList"]! as! [Int] @@ -29443,7 +29451,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "intList") } } - + public var intNullableList: [Int]? { get { return snapshot["intNullableList"] as? [Int] @@ -29452,7 +29460,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "intNullableList") } } - + public var nullableIntList: [Int?] { get { return snapshot["nullableIntList"]! as! [Int?] @@ -29461,7 +29469,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableIntList") } } - + public var nullableIntNullableList: [Int?]? { get { return snapshot["nullableIntNullableList"] as? [Int?] @@ -29470,7 +29478,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableIntNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -29479,7 +29487,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -29492,38 +29500,38 @@ public struct APISwift { } } } - + public final class GetListStringContainerQuery: GraphQLQuery { public static let operationString = "query GetListStringContainer($id: ID!) {\n getListStringContainer(id: $id) {\n __typename\n id\n test\n nullableString\n stringList\n stringNullableList\n nullableStringList\n nullableStringNullableList\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("getListStringContainer", arguments: ["id": GraphQLVariable("id")], type: .object(GetListStringContainer.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(getListStringContainer: GetListStringContainer? = nil) { - self.init(snapshot: ["__typename": "Query", "getListStringContainer": getListStringContainer.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "getListStringContainer": getListStringContainer.flatMap(\.snapshot)]) } - + public var getListStringContainer: GetListStringContainer? { get { return (snapshot["getListStringContainer"] as? Snapshot).flatMap { GetListStringContainer(snapshot: $0) } @@ -29532,10 +29540,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "getListStringContainer") } } - + public struct GetListStringContainer: GraphQLSelectionSet { public static let possibleTypes = ["ListStringContainer"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -29548,17 +29556,17 @@ public struct APISwift { 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, test: String, nullableString: String? = nil, stringList: [String], stringNullableList: [String]? = nil, nullableStringList: [String?], nullableStringNullableList: [String?]? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "ListStringContainer", "id": id, "test": test, "nullableString": nullableString, "stringList": stringList, "stringNullableList": stringNullableList, "nullableStringList": nullableStringList, "nullableStringNullableList": nullableStringNullableList, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -29567,7 +29575,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -29576,7 +29584,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var test: String { get { return snapshot["test"]! as! String @@ -29585,7 +29593,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "test") } } - + public var nullableString: String? { get { return snapshot["nullableString"] as? String @@ -29594,7 +29602,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableString") } } - + public var stringList: [String] { get { return snapshot["stringList"]! as! [String] @@ -29603,7 +29611,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "stringList") } } - + public var stringNullableList: [String]? { get { return snapshot["stringNullableList"] as? [String] @@ -29612,7 +29620,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "stringNullableList") } } - + public var nullableStringList: [String?] { get { return snapshot["nullableStringList"]! as! [String?] @@ -29621,7 +29629,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableStringList") } } - + public var nullableStringNullableList: [String?]? { get { return snapshot["nullableStringNullableList"] as? [String?] @@ -29630,7 +29638,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableStringNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -29639,7 +29647,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -29651,42 +29659,42 @@ public struct APISwift { } } } - + public final class ListListStringContainersQuery: GraphQLQuery { public static let operationString = "query ListListStringContainers($filter: ModelListStringContainerFilterInput, $limit: Int, $nextToken: String) {\n listListStringContainers(filter: $filter, limit: $limit, nextToken: $nextToken) {\n __typename\n items {\n __typename\n id\n test\n nullableString\n stringList\n stringNullableList\n nullableStringList\n nullableStringNullableList\n createdAt\n updatedAt\n }\n nextToken\n }\n}" - + public var filter: ModelListStringContainerFilterInput? public var limit: Int? public var nextToken: String? - + public init(filter: ModelListStringContainerFilterInput? = 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("listListStringContainers", arguments: ["filter": GraphQLVariable("filter"), "limit": GraphQLVariable("limit"), "nextToken": GraphQLVariable("nextToken")], type: .object(ListListStringContainer.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(listListStringContainers: ListListStringContainer? = nil) { - self.init(snapshot: ["__typename": "Query", "listListStringContainers": listListStringContainers.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "listListStringContainers": listListStringContainers.flatMap(\.snapshot)]) } - + public var listListStringContainers: ListListStringContainer? { get { return (snapshot["listListStringContainers"] as? Snapshot).flatMap { ListListStringContainer(snapshot: $0) } @@ -29695,26 +29703,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "listListStringContainers") } } - + public struct ListListStringContainer: GraphQLSelectionSet { public static let possibleTypes = ["ModelListStringContainerConnection"] - + 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": "ModelListStringContainerConnection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelListStringContainerConnection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -29723,16 +29731,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -29741,10 +29749,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["ListStringContainer"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -29757,17 +29765,17 @@ public struct APISwift { 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, test: String, nullableString: String? = nil, stringList: [String], stringNullableList: [String]? = nil, nullableStringList: [String?], nullableStringNullableList: [String?]? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "ListStringContainer", "id": id, "test": test, "nullableString": nullableString, "stringList": stringList, "stringNullableList": stringNullableList, "nullableStringList": nullableStringList, "nullableStringNullableList": nullableStringNullableList, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -29776,7 +29784,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -29785,7 +29793,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var test: String { get { return snapshot["test"]! as! String @@ -29794,7 +29802,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "test") } } - + public var nullableString: String? { get { return snapshot["nullableString"] as? String @@ -29803,7 +29811,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableString") } } - + public var stringList: [String] { get { return snapshot["stringList"]! as! [String] @@ -29812,7 +29820,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "stringList") } } - + public var stringNullableList: [String]? { get { return snapshot["stringNullableList"] as? [String] @@ -29821,7 +29829,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "stringNullableList") } } - + public var nullableStringList: [String?] { get { return snapshot["nullableStringList"]! as! [String?] @@ -29830,7 +29838,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableStringList") } } - + public var nullableStringNullableList: [String?]? { get { return snapshot["nullableStringNullableList"] as? [String?] @@ -29839,7 +29847,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableStringNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -29848,7 +29856,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -29861,38 +29869,38 @@ public struct APISwift { } } } - + public final class GetEnumTestModelQuery: GraphQLQuery { public static let operationString = "query GetEnumTestModel($id: ID!) {\n getEnumTestModel(id: $id) {\n __typename\n id\n enumVal\n nullableEnumVal\n enumList\n enumNullableList\n nullableEnumList\n nullableEnumNullableList\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("getEnumTestModel", arguments: ["id": GraphQLVariable("id")], type: .object(GetEnumTestModel.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(getEnumTestModel: GetEnumTestModel? = nil) { - self.init(snapshot: ["__typename": "Query", "getEnumTestModel": getEnumTestModel.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "getEnumTestModel": getEnumTestModel.flatMap(\.snapshot)]) } - + public var getEnumTestModel: GetEnumTestModel? { get { return (snapshot["getEnumTestModel"] as? Snapshot).flatMap { GetEnumTestModel(snapshot: $0) } @@ -29901,10 +29909,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "getEnumTestModel") } } - + public struct GetEnumTestModel: GraphQLSelectionSet { public static let possibleTypes = ["EnumTestModel"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -29917,17 +29925,17 @@ public struct APISwift { 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, enumVal: TestEnum, nullableEnumVal: TestEnum? = nil, enumList: [TestEnum], enumNullableList: [TestEnum]? = nil, nullableEnumList: [TestEnum?], nullableEnumNullableList: [TestEnum?]? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "EnumTestModel", "id": id, "enumVal": enumVal, "nullableEnumVal": nullableEnumVal, "enumList": enumList, "enumNullableList": enumNullableList, "nullableEnumList": nullableEnumList, "nullableEnumNullableList": nullableEnumNullableList, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -29936,7 +29944,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -29945,7 +29953,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var enumVal: TestEnum { get { return snapshot["enumVal"]! as! TestEnum @@ -29954,7 +29962,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "enumVal") } } - + public var nullableEnumVal: TestEnum? { get { return snapshot["nullableEnumVal"] as? TestEnum @@ -29963,7 +29971,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableEnumVal") } } - + public var enumList: [TestEnum] { get { return snapshot["enumList"]! as! [TestEnum] @@ -29972,7 +29980,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "enumList") } } - + public var enumNullableList: [TestEnum]? { get { return snapshot["enumNullableList"] as? [TestEnum] @@ -29981,7 +29989,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "enumNullableList") } } - + public var nullableEnumList: [TestEnum?] { get { return snapshot["nullableEnumList"]! as! [TestEnum?] @@ -29990,7 +29998,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableEnumList") } } - + public var nullableEnumNullableList: [TestEnum?]? { get { return snapshot["nullableEnumNullableList"] as? [TestEnum?] @@ -29999,7 +30007,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableEnumNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -30008,7 +30016,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -30020,42 +30028,42 @@ public struct APISwift { } } } - + public final class ListEnumTestModelsQuery: GraphQLQuery { public static let operationString = "query ListEnumTestModels($filter: ModelEnumTestModelFilterInput, $limit: Int, $nextToken: String) {\n listEnumTestModels(filter: $filter, limit: $limit, nextToken: $nextToken) {\n __typename\n items {\n __typename\n id\n enumVal\n nullableEnumVal\n enumList\n enumNullableList\n nullableEnumList\n nullableEnumNullableList\n createdAt\n updatedAt\n }\n nextToken\n }\n}" - + public var filter: ModelEnumTestModelFilterInput? public var limit: Int? public var nextToken: String? - + public init(filter: ModelEnumTestModelFilterInput? = 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("listEnumTestModels", arguments: ["filter": GraphQLVariable("filter"), "limit": GraphQLVariable("limit"), "nextToken": GraphQLVariable("nextToken")], type: .object(ListEnumTestModel.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(listEnumTestModels: ListEnumTestModel? = nil) { - self.init(snapshot: ["__typename": "Query", "listEnumTestModels": listEnumTestModels.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "listEnumTestModels": listEnumTestModels.flatMap(\.snapshot)]) } - + public var listEnumTestModels: ListEnumTestModel? { get { return (snapshot["listEnumTestModels"] as? Snapshot).flatMap { ListEnumTestModel(snapshot: $0) } @@ -30064,26 +30072,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "listEnumTestModels") } } - + public struct ListEnumTestModel: GraphQLSelectionSet { public static let possibleTypes = ["ModelEnumTestModelConnection"] - + 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": "ModelEnumTestModelConnection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelEnumTestModelConnection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -30092,16 +30100,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -30110,10 +30118,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["EnumTestModel"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -30126,17 +30134,17 @@ public struct APISwift { 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, enumVal: TestEnum, nullableEnumVal: TestEnum? = nil, enumList: [TestEnum], enumNullableList: [TestEnum]? = nil, nullableEnumList: [TestEnum?], nullableEnumNullableList: [TestEnum?]? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "EnumTestModel", "id": id, "enumVal": enumVal, "nullableEnumVal": nullableEnumVal, "enumList": enumList, "enumNullableList": enumNullableList, "nullableEnumList": nullableEnumList, "nullableEnumNullableList": nullableEnumNullableList, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -30145,7 +30153,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -30154,7 +30162,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var enumVal: TestEnum { get { return snapshot["enumVal"]! as! TestEnum @@ -30163,7 +30171,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "enumVal") } } - + public var nullableEnumVal: TestEnum? { get { return snapshot["nullableEnumVal"] as? TestEnum @@ -30172,7 +30180,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableEnumVal") } } - + public var enumList: [TestEnum] { get { return snapshot["enumList"]! as! [TestEnum] @@ -30181,7 +30189,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "enumList") } } - + public var enumNullableList: [TestEnum]? { get { return snapshot["enumNullableList"] as? [TestEnum] @@ -30190,7 +30198,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "enumNullableList") } } - + public var nullableEnumList: [TestEnum?] { get { return snapshot["nullableEnumList"]! as! [TestEnum?] @@ -30199,7 +30207,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableEnumList") } } - + public var nullableEnumNullableList: [TestEnum?]? { get { return snapshot["nullableEnumNullableList"] as? [TestEnum?] @@ -30208,7 +30216,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableEnumNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -30217,7 +30225,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -30230,38 +30238,38 @@ public struct APISwift { } } } - + public final class GetNestedTypeTestModelQuery: GraphQLQuery { public static let operationString = "query GetNestedTypeTestModel($id: ID!) {\n getNestedTypeTestModel(id: $id) {\n __typename\n id\n nestedVal {\n __typename\n valueOne\n valueTwo\n }\n nullableNestedVal {\n __typename\n valueOne\n valueTwo\n }\n nestedList {\n __typename\n valueOne\n valueTwo\n }\n nestedNullableList {\n __typename\n valueOne\n valueTwo\n }\n nullableNestedList {\n __typename\n valueOne\n valueTwo\n }\n nullableNestedNullableList {\n __typename\n valueOne\n valueTwo\n }\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("getNestedTypeTestModel", arguments: ["id": GraphQLVariable("id")], type: .object(GetNestedTypeTestModel.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(getNestedTypeTestModel: GetNestedTypeTestModel? = nil) { - self.init(snapshot: ["__typename": "Query", "getNestedTypeTestModel": getNestedTypeTestModel.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "getNestedTypeTestModel": getNestedTypeTestModel.flatMap(\.snapshot)]) } - + public var getNestedTypeTestModel: GetNestedTypeTestModel? { get { return (snapshot["getNestedTypeTestModel"] as? Snapshot).flatMap { GetNestedTypeTestModel(snapshot: $0) } @@ -30270,10 +30278,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "getNestedTypeTestModel") } } - + public struct GetNestedTypeTestModel: GraphQLSelectionSet { public static let possibleTypes = ["NestedTypeTestModel"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -30286,17 +30294,17 @@ public struct APISwift { 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, nestedVal: NestedVal, nullableNestedVal: NullableNestedVal? = nil, nestedList: [NestedList], nestedNullableList: [NestedNullableList]? = nil, nullableNestedList: [NullableNestedList?], nullableNestedNullableList: [NullableNestedNullableList?]? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "NestedTypeTestModel", "id": id, "nestedVal": nestedVal.snapshot, "nullableNestedVal": nullableNestedVal.flatMap { $0.snapshot }, "nestedList": nestedList.map { $0.snapshot }, "nestedNullableList": nestedNullableList.flatMap { $0.map { $0.snapshot } }, "nullableNestedList": nullableNestedList.map { $0.flatMap { $0.snapshot } }, "nullableNestedNullableList": nullableNestedNullableList.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "NestedTypeTestModel", "id": id, "nestedVal": nestedVal.snapshot, "nullableNestedVal": nullableNestedVal.flatMap(\.snapshot), "nestedList": nestedList.map(\.snapshot), "nestedNullableList": nestedNullableList.flatMap { $0.map(\.snapshot) }, "nullableNestedList": nullableNestedList.map { $0.flatMap(\.snapshot) }, "nullableNestedNullableList": nullableNestedNullableList.flatMap { $0.map { $0.flatMap(\.snapshot) } }, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -30305,7 +30313,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -30314,7 +30322,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var nestedVal: NestedVal { get { return NestedVal(snapshot: snapshot["nestedVal"]! as! Snapshot) @@ -30323,7 +30331,7 @@ public struct APISwift { snapshot.updateValue(newValue.snapshot, forKey: "nestedVal") } } - + public var nullableNestedVal: NullableNestedVal? { get { return (snapshot["nullableNestedVal"] as? Snapshot).flatMap { NullableNestedVal(snapshot: $0) } @@ -30332,43 +30340,43 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "nullableNestedVal") } } - + public var nestedList: [NestedList] { get { return (snapshot["nestedList"] as! [Snapshot]).map { NestedList(snapshot: $0) } } set { - snapshot.updateValue(newValue.map { $0.snapshot }, forKey: "nestedList") + snapshot.updateValue(newValue.map(\.snapshot), forKey: "nestedList") } } - + public var nestedNullableList: [NestedNullableList]? { get { return (snapshot["nestedNullableList"] as? [Snapshot]).flatMap { $0.map { NestedNullableList(snapshot: $0) } } } set { - snapshot.updateValue(newValue.flatMap { $0.map { $0.snapshot } }, forKey: "nestedNullableList") + snapshot.updateValue(newValue.flatMap { $0.map(\.snapshot) }, forKey: "nestedNullableList") } } - + public var nullableNestedList: [NullableNestedList?] { get { return (snapshot["nullableNestedList"] as! [Snapshot?]).map { $0.flatMap { NullableNestedList(snapshot: $0) } } } set { - snapshot.updateValue(newValue.map { $0.flatMap { $0.snapshot } }, forKey: "nullableNestedList") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "nullableNestedList") } } - + public var nullableNestedNullableList: [NullableNestedNullableList?]? { get { return (snapshot["nullableNestedNullableList"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { NullableNestedNullableList(snapshot: $0) } } } } set { - snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "nullableNestedNullableList") + snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap(\.snapshot) } }, forKey: "nullableNestedNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -30377,7 +30385,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -30386,26 +30394,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct NestedVal: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -30414,7 +30422,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -30423,7 +30431,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -30433,26 +30441,26 @@ public struct APISwift { } } } - + public struct NullableNestedVal: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -30461,7 +30469,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -30470,7 +30478,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -30480,26 +30488,26 @@ public struct APISwift { } } } - + public struct NestedList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -30508,7 +30516,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -30517,7 +30525,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -30527,26 +30535,26 @@ public struct APISwift { } } } - + public struct NestedNullableList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -30555,7 +30563,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -30564,7 +30572,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -30574,26 +30582,26 @@ public struct APISwift { } } } - + public struct NullableNestedList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -30602,7 +30610,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -30611,7 +30619,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -30621,26 +30629,26 @@ public struct APISwift { } } } - + public struct NullableNestedNullableList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -30649,7 +30657,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -30658,7 +30666,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -30671,42 +30679,42 @@ public struct APISwift { } } } - + public final class ListNestedTypeTestModelsQuery: GraphQLQuery { public static let operationString = "query ListNestedTypeTestModels($filter: ModelNestedTypeTestModelFilterInput, $limit: Int, $nextToken: String) {\n listNestedTypeTestModels(filter: $filter, limit: $limit, nextToken: $nextToken) {\n __typename\n items {\n __typename\n id\n nestedVal {\n __typename\n valueOne\n valueTwo\n }\n nullableNestedVal {\n __typename\n valueOne\n valueTwo\n }\n nestedList {\n __typename\n valueOne\n valueTwo\n }\n nestedNullableList {\n __typename\n valueOne\n valueTwo\n }\n nullableNestedList {\n __typename\n valueOne\n valueTwo\n }\n nullableNestedNullableList {\n __typename\n valueOne\n valueTwo\n }\n createdAt\n updatedAt\n }\n nextToken\n }\n}" - + public var filter: ModelNestedTypeTestModelFilterInput? public var limit: Int? public var nextToken: String? - + public init(filter: ModelNestedTypeTestModelFilterInput? = 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("listNestedTypeTestModels", arguments: ["filter": GraphQLVariable("filter"), "limit": GraphQLVariable("limit"), "nextToken": GraphQLVariable("nextToken")], type: .object(ListNestedTypeTestModel.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(listNestedTypeTestModels: ListNestedTypeTestModel? = nil) { - self.init(snapshot: ["__typename": "Query", "listNestedTypeTestModels": listNestedTypeTestModels.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Query", "listNestedTypeTestModels": listNestedTypeTestModels.flatMap(\.snapshot)]) } - + public var listNestedTypeTestModels: ListNestedTypeTestModel? { get { return (snapshot["listNestedTypeTestModels"] as? Snapshot).flatMap { ListNestedTypeTestModel(snapshot: $0) } @@ -30715,26 +30723,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "listNestedTypeTestModels") } } - + public struct ListNestedTypeTestModel: GraphQLSelectionSet { public static let possibleTypes = ["ModelNestedTypeTestModelConnection"] - + 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": "ModelNestedTypeTestModelConnection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelNestedTypeTestModelConnection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -30743,16 +30751,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -30761,10 +30769,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["NestedTypeTestModel"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -30777,17 +30785,17 @@ public struct APISwift { 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, nestedVal: NestedVal, nullableNestedVal: NullableNestedVal? = nil, nestedList: [NestedList], nestedNullableList: [NestedNullableList]? = nil, nullableNestedList: [NullableNestedList?], nullableNestedNullableList: [NullableNestedNullableList?]? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "NestedTypeTestModel", "id": id, "nestedVal": nestedVal.snapshot, "nullableNestedVal": nullableNestedVal.flatMap { $0.snapshot }, "nestedList": nestedList.map { $0.snapshot }, "nestedNullableList": nestedNullableList.flatMap { $0.map { $0.snapshot } }, "nullableNestedList": nullableNestedList.map { $0.flatMap { $0.snapshot } }, "nullableNestedNullableList": nullableNestedNullableList.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "NestedTypeTestModel", "id": id, "nestedVal": nestedVal.snapshot, "nullableNestedVal": nullableNestedVal.flatMap(\.snapshot), "nestedList": nestedList.map(\.snapshot), "nestedNullableList": nestedNullableList.flatMap { $0.map(\.snapshot) }, "nullableNestedList": nullableNestedList.map { $0.flatMap(\.snapshot) }, "nullableNestedNullableList": nullableNestedNullableList.flatMap { $0.map { $0.flatMap(\.snapshot) } }, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -30796,7 +30804,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -30805,7 +30813,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var nestedVal: NestedVal { get { return NestedVal(snapshot: snapshot["nestedVal"]! as! Snapshot) @@ -30814,7 +30822,7 @@ public struct APISwift { snapshot.updateValue(newValue.snapshot, forKey: "nestedVal") } } - + public var nullableNestedVal: NullableNestedVal? { get { return (snapshot["nullableNestedVal"] as? Snapshot).flatMap { NullableNestedVal(snapshot: $0) } @@ -30823,43 +30831,43 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "nullableNestedVal") } } - + public var nestedList: [NestedList] { get { return (snapshot["nestedList"] as! [Snapshot]).map { NestedList(snapshot: $0) } } set { - snapshot.updateValue(newValue.map { $0.snapshot }, forKey: "nestedList") + snapshot.updateValue(newValue.map(\.snapshot), forKey: "nestedList") } } - + public var nestedNullableList: [NestedNullableList]? { get { return (snapshot["nestedNullableList"] as? [Snapshot]).flatMap { $0.map { NestedNullableList(snapshot: $0) } } } set { - snapshot.updateValue(newValue.flatMap { $0.map { $0.snapshot } }, forKey: "nestedNullableList") + snapshot.updateValue(newValue.flatMap { $0.map(\.snapshot) }, forKey: "nestedNullableList") } } - + public var nullableNestedList: [NullableNestedList?] { get { return (snapshot["nullableNestedList"] as! [Snapshot?]).map { $0.flatMap { NullableNestedList(snapshot: $0) } } } set { - snapshot.updateValue(newValue.map { $0.flatMap { $0.snapshot } }, forKey: "nullableNestedList") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "nullableNestedList") } } - + public var nullableNestedNullableList: [NullableNestedNullableList?]? { get { return (snapshot["nullableNestedNullableList"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { NullableNestedNullableList(snapshot: $0) } } } } set { - snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "nullableNestedNullableList") + snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap(\.snapshot) } }, forKey: "nullableNestedNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -30868,7 +30876,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -30877,26 +30885,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct NestedVal: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -30905,7 +30913,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -30914,7 +30922,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -30924,26 +30932,26 @@ public struct APISwift { } } } - + public struct NullableNestedVal: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -30952,7 +30960,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -30961,7 +30969,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -30971,26 +30979,26 @@ public struct APISwift { } } } - + public struct NestedList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -30999,7 +31007,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -31008,7 +31016,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -31018,26 +31026,26 @@ public struct APISwift { } } } - + public struct NestedNullableList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -31046,7 +31054,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -31055,7 +31063,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -31065,26 +31073,26 @@ public struct APISwift { } } } - + public struct NullableNestedList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -31093,7 +31101,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -31102,7 +31110,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -31112,26 +31120,26 @@ public struct APISwift { } } } - + public struct NullableNestedNullableList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -31140,7 +31148,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -31149,7 +31157,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -31163,31 +31171,31 @@ public struct APISwift { } } } - + public final class OnCreatePostSubscription: GraphQLSubscription { public static let operationString = "subscription OnCreatePost {\n onCreatePost {\n __typename\n id\n title\n content\n createdAt\n updatedAt\n draft\n rating\n status\n comments {\n __typename\n items {\n __typename\n id\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onCreatePost", type: .object(OnCreatePost.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onCreatePost: OnCreatePost? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onCreatePost": onCreatePost.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onCreatePost": onCreatePost.flatMap(\.snapshot)]) } - + public var onCreatePost: OnCreatePost? { get { return (snapshot["onCreatePost"] as? Snapshot).flatMap { OnCreatePost(snapshot: $0) } @@ -31196,10 +31204,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onCreatePost") } } - + public struct OnCreatePost: GraphQLSelectionSet { public static let possibleTypes = ["Post"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -31212,17 +31220,17 @@ public struct APISwift { GraphQLField("status", type: .scalar(PostStatus.self)), GraphQLField("comments", type: .object(Comment.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(id: GraphQLID, title: String, content: String, createdAt: String, updatedAt: String? = nil, draft: Bool? = nil, rating: Double? = nil, status: PostStatus? = nil, comments: Comment? = nil) { - self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap(\.snapshot)]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -31231,7 +31239,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -31240,7 +31248,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -31249,7 +31257,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -31258,7 +31266,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -31267,7 +31275,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String? { get { return snapshot["updatedAt"] as? String @@ -31276,7 +31284,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public var draft: Bool? { get { return snapshot["draft"] as? Bool @@ -31285,7 +31293,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "draft") } } - + public var rating: Double? { get { return snapshot["rating"] as? Double @@ -31294,7 +31302,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "rating") } } - + public var status: PostStatus? { get { return snapshot["status"] as? PostStatus @@ -31303,7 +31311,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "status") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -31312,26 +31320,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelCommentConnection"] - + 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": "ModelCommentConnection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelCommentConnection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -31340,16 +31348,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -31358,10 +31366,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -31369,17 +31377,17 @@ public struct APISwift { 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, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment", "id": id, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -31388,7 +31396,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -31397,7 +31405,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -31406,7 +31414,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -31415,7 +31423,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -31429,31 +31437,31 @@ public struct APISwift { } } } - + public final class OnUpdatePostSubscription: GraphQLSubscription { public static let operationString = "subscription OnUpdatePost {\n onUpdatePost {\n __typename\n id\n title\n content\n createdAt\n updatedAt\n draft\n rating\n status\n comments {\n __typename\n items {\n __typename\n id\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onUpdatePost", type: .object(OnUpdatePost.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onUpdatePost: OnUpdatePost? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onUpdatePost": onUpdatePost.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onUpdatePost": onUpdatePost.flatMap(\.snapshot)]) } - + public var onUpdatePost: OnUpdatePost? { get { return (snapshot["onUpdatePost"] as? Snapshot).flatMap { OnUpdatePost(snapshot: $0) } @@ -31462,10 +31470,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onUpdatePost") } } - + public struct OnUpdatePost: GraphQLSelectionSet { public static let possibleTypes = ["Post"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -31478,17 +31486,17 @@ public struct APISwift { GraphQLField("status", type: .scalar(PostStatus.self)), GraphQLField("comments", type: .object(Comment.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(id: GraphQLID, title: String, content: String, createdAt: String, updatedAt: String? = nil, draft: Bool? = nil, rating: Double? = nil, status: PostStatus? = nil, comments: Comment? = nil) { - self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap(\.snapshot)]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -31497,7 +31505,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -31506,7 +31514,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -31515,7 +31523,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -31524,7 +31532,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -31533,7 +31541,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String? { get { return snapshot["updatedAt"] as? String @@ -31542,7 +31550,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public var draft: Bool? { get { return snapshot["draft"] as? Bool @@ -31551,7 +31559,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "draft") } } - + public var rating: Double? { get { return snapshot["rating"] as? Double @@ -31560,7 +31568,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "rating") } } - + public var status: PostStatus? { get { return snapshot["status"] as? PostStatus @@ -31569,7 +31577,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "status") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -31578,26 +31586,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelCommentConnection"] - + 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": "ModelCommentConnection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelCommentConnection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -31606,16 +31614,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -31624,10 +31632,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -31635,17 +31643,17 @@ public struct APISwift { 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, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment", "id": id, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -31654,7 +31662,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -31663,7 +31671,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -31672,7 +31680,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -31681,7 +31689,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -31695,31 +31703,31 @@ public struct APISwift { } } } - + public final class OnDeletePostSubscription: GraphQLSubscription { public static let operationString = "subscription OnDeletePost {\n onDeletePost {\n __typename\n id\n title\n content\n createdAt\n updatedAt\n draft\n rating\n status\n comments {\n __typename\n items {\n __typename\n id\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onDeletePost", type: .object(OnDeletePost.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onDeletePost: OnDeletePost? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onDeletePost": onDeletePost.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onDeletePost": onDeletePost.flatMap(\.snapshot)]) } - + public var onDeletePost: OnDeletePost? { get { return (snapshot["onDeletePost"] as? Snapshot).flatMap { OnDeletePost(snapshot: $0) } @@ -31728,10 +31736,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onDeletePost") } } - + public struct OnDeletePost: GraphQLSelectionSet { public static let possibleTypes = ["Post"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -31744,17 +31752,17 @@ public struct APISwift { GraphQLField("status", type: .scalar(PostStatus.self)), GraphQLField("comments", type: .object(Comment.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(id: GraphQLID, title: String, content: String, createdAt: String, updatedAt: String? = nil, draft: Bool? = nil, rating: Double? = nil, status: PostStatus? = nil, comments: Comment? = nil) { - self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap(\.snapshot)]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -31763,7 +31771,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -31772,7 +31780,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -31781,7 +31789,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -31790,7 +31798,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -31799,7 +31807,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String? { get { return snapshot["updatedAt"] as? String @@ -31808,7 +31816,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public var draft: Bool? { get { return snapshot["draft"] as? Bool @@ -31817,7 +31825,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "draft") } } - + public var rating: Double? { get { return snapshot["rating"] as? Double @@ -31826,7 +31834,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "rating") } } - + public var status: PostStatus? { get { return snapshot["status"] as? PostStatus @@ -31835,7 +31843,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "status") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -31844,26 +31852,26 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelCommentConnection"] - + 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": "ModelCommentConnection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelCommentConnection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -31872,16 +31880,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -31890,10 +31898,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -31901,17 +31909,17 @@ public struct APISwift { 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, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment", "id": id, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -31920,7 +31928,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -31929,7 +31937,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -31938,7 +31946,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -31947,7 +31955,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -31961,31 +31969,31 @@ public struct APISwift { } } } - + public final class OnCreateCommentSubscription: GraphQLSubscription { public static let operationString = "subscription OnCreateComment {\n onCreateComment {\n __typename\n id\n content\n createdAt\n post {\n __typename\n id\n title\n content\n createdAt\n updatedAt\n draft\n rating\n status\n comments {\n __typename\n nextToken\n }\n }\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onCreateComment", type: .object(OnCreateComment.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onCreateComment: OnCreateComment? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onCreateComment": onCreateComment.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onCreateComment": onCreateComment.flatMap(\.snapshot)]) } - + public var onCreateComment: OnCreateComment? { get { return (snapshot["onCreateComment"] as? Snapshot).flatMap { OnCreateComment(snapshot: $0) } @@ -31994,10 +32002,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onCreateComment") } } - + public struct OnCreateComment: GraphQLSelectionSet { public static let possibleTypes = ["Comment"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -32006,17 +32014,17 @@ public struct APISwift { GraphQLField("post", type: .object(Post.selections)), GraphQLField("updatedAt", type: .nonNull(.scalar(String.self))), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(id: GraphQLID, content: String, createdAt: String, post: Post? = nil, updatedAt: String) { - self.init(snapshot: ["__typename": "Comment", "id": id, "content": content, "createdAt": createdAt, "post": post.flatMap { $0.snapshot }, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Comment", "id": id, "content": content, "createdAt": createdAt, "post": post.flatMap(\.snapshot), "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -32025,7 +32033,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -32034,7 +32042,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -32043,7 +32051,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -32052,7 +32060,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var post: Post? { get { return (snapshot["post"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -32061,7 +32069,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "post") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -32070,10 +32078,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -32086,17 +32094,17 @@ public struct APISwift { GraphQLField("status", type: .scalar(PostStatus.self)), GraphQLField("comments", type: .object(Comment.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(id: GraphQLID, title: String, content: String, createdAt: String, updatedAt: String? = nil, draft: Bool? = nil, rating: Double? = nil, status: PostStatus? = nil, comments: Comment? = nil) { - self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap(\.snapshot)]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -32105,7 +32113,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -32114,7 +32122,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -32123,7 +32131,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -32132,7 +32140,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -32141,7 +32149,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String? { get { return snapshot["updatedAt"] as? String @@ -32150,7 +32158,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public var draft: Bool? { get { return snapshot["draft"] as? Bool @@ -32159,7 +32167,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "draft") } } - + public var rating: Double? { get { return snapshot["rating"] as? Double @@ -32168,7 +32176,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "rating") } } - + public var status: PostStatus? { get { return snapshot["status"] as? PostStatus @@ -32177,7 +32185,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "status") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -32186,25 +32194,25 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelCommentConnection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelCommentConnection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -32213,7 +32221,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -32227,31 +32235,31 @@ public struct APISwift { } } } - + public final class OnUpdateCommentSubscription: GraphQLSubscription { public static let operationString = "subscription OnUpdateComment {\n onUpdateComment {\n __typename\n id\n content\n createdAt\n post {\n __typename\n id\n title\n content\n createdAt\n updatedAt\n draft\n rating\n status\n comments {\n __typename\n nextToken\n }\n }\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onUpdateComment", type: .object(OnUpdateComment.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onUpdateComment: OnUpdateComment? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onUpdateComment": onUpdateComment.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onUpdateComment": onUpdateComment.flatMap(\.snapshot)]) } - + public var onUpdateComment: OnUpdateComment? { get { return (snapshot["onUpdateComment"] as? Snapshot).flatMap { OnUpdateComment(snapshot: $0) } @@ -32260,10 +32268,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onUpdateComment") } } - + public struct OnUpdateComment: GraphQLSelectionSet { public static let possibleTypes = ["Comment"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -32272,17 +32280,17 @@ public struct APISwift { GraphQLField("post", type: .object(Post.selections)), GraphQLField("updatedAt", type: .nonNull(.scalar(String.self))), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(id: GraphQLID, content: String, createdAt: String, post: Post? = nil, updatedAt: String) { - self.init(snapshot: ["__typename": "Comment", "id": id, "content": content, "createdAt": createdAt, "post": post.flatMap { $0.snapshot }, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Comment", "id": id, "content": content, "createdAt": createdAt, "post": post.flatMap(\.snapshot), "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -32291,7 +32299,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -32300,7 +32308,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -32309,7 +32317,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -32318,7 +32326,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var post: Post? { get { return (snapshot["post"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -32327,7 +32335,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "post") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -32336,10 +32344,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -32352,17 +32360,17 @@ public struct APISwift { GraphQLField("status", type: .scalar(PostStatus.self)), GraphQLField("comments", type: .object(Comment.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(id: GraphQLID, title: String, content: String, createdAt: String, updatedAt: String? = nil, draft: Bool? = nil, rating: Double? = nil, status: PostStatus? = nil, comments: Comment? = nil) { - self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap(\.snapshot)]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -32371,7 +32379,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -32380,7 +32388,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -32389,7 +32397,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -32398,7 +32406,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -32407,7 +32415,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String? { get { return snapshot["updatedAt"] as? String @@ -32416,7 +32424,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public var draft: Bool? { get { return snapshot["draft"] as? Bool @@ -32425,7 +32433,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "draft") } } - + public var rating: Double? { get { return snapshot["rating"] as? Double @@ -32434,7 +32442,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "rating") } } - + public var status: PostStatus? { get { return snapshot["status"] as? PostStatus @@ -32443,7 +32451,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "status") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -32452,25 +32460,25 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelCommentConnection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelCommentConnection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -32479,7 +32487,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -32493,31 +32501,31 @@ public struct APISwift { } } } - + public final class OnDeleteCommentSubscription: GraphQLSubscription { public static let operationString = "subscription OnDeleteComment {\n onDeleteComment {\n __typename\n id\n content\n createdAt\n post {\n __typename\n id\n title\n content\n createdAt\n updatedAt\n draft\n rating\n status\n comments {\n __typename\n nextToken\n }\n }\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onDeleteComment", type: .object(OnDeleteComment.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onDeleteComment: OnDeleteComment? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onDeleteComment": onDeleteComment.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onDeleteComment": onDeleteComment.flatMap(\.snapshot)]) } - + public var onDeleteComment: OnDeleteComment? { get { return (snapshot["onDeleteComment"] as? Snapshot).flatMap { OnDeleteComment(snapshot: $0) } @@ -32526,10 +32534,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onDeleteComment") } } - + public struct OnDeleteComment: GraphQLSelectionSet { public static let possibleTypes = ["Comment"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -32538,17 +32546,17 @@ public struct APISwift { GraphQLField("post", type: .object(Post.selections)), GraphQLField("updatedAt", type: .nonNull(.scalar(String.self))), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(id: GraphQLID, content: String, createdAt: String, post: Post? = nil, updatedAt: String) { - self.init(snapshot: ["__typename": "Comment", "id": id, "content": content, "createdAt": createdAt, "post": post.flatMap { $0.snapshot }, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Comment", "id": id, "content": content, "createdAt": createdAt, "post": post.flatMap(\.snapshot), "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -32557,7 +32565,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -32566,7 +32574,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -32575,7 +32583,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -32584,7 +32592,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var post: Post? { get { return (snapshot["post"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -32593,7 +32601,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "post") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -32602,10 +32610,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -32618,17 +32626,17 @@ public struct APISwift { GraphQLField("status", type: .scalar(PostStatus.self)), GraphQLField("comments", type: .object(Comment.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(id: GraphQLID, title: String, content: String, createdAt: String, updatedAt: String? = nil, draft: Bool? = nil, rating: Double? = nil, status: PostStatus? = nil, comments: Comment? = nil) { - self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Post", "id": id, "title": title, "content": content, "createdAt": createdAt, "updatedAt": updatedAt, "draft": draft, "rating": rating, "status": status, "comments": comments.flatMap(\.snapshot)]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -32637,7 +32645,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -32646,7 +32654,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -32655,7 +32663,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -32664,7 +32672,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -32673,7 +32681,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String? { get { return snapshot["updatedAt"] as? String @@ -32682,7 +32690,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public var draft: Bool? { get { return snapshot["draft"] as? Bool @@ -32691,7 +32699,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "draft") } } - + public var rating: Double? { get { return snapshot["rating"] as? Double @@ -32700,7 +32708,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "rating") } } - + public var status: PostStatus? { get { return snapshot["status"] as? PostStatus @@ -32709,7 +32717,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "status") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -32718,25 +32726,25 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelCommentConnection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelCommentConnection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -32745,7 +32753,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -32759,31 +32767,31 @@ public struct APISwift { } } } - + public final class OnCreateProject1Subscription: GraphQLSubscription { public static let operationString = "subscription OnCreateProject1 {\n onCreateProject1 {\n __typename\n id\n name\n team {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onCreateProject1", type: .object(OnCreateProject1.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onCreateProject1: OnCreateProject1? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onCreateProject1": onCreateProject1.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onCreateProject1": onCreateProject1.flatMap(\.snapshot)]) } - + public var onCreateProject1: OnCreateProject1? { get { return (snapshot["onCreateProject1"] as? Snapshot).flatMap { OnCreateProject1(snapshot: $0) } @@ -32792,10 +32800,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onCreateProject1") } } - + public struct OnCreateProject1: GraphQLSelectionSet { public static let possibleTypes = ["Project1"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -32804,17 +32812,17 @@ public struct APISwift { 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? = nil, team: Team? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Project1", "id": id, "name": name, "team": team.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Project1", "id": id, "name": name, "team": team.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -32823,7 +32831,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -32832,7 +32840,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return snapshot["name"] as? String @@ -32841,7 +32849,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var team: Team? { get { return (snapshot["team"] as? Snapshot).flatMap { Team(snapshot: $0) } @@ -32850,7 +32858,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "team") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -32859,7 +32867,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -32868,10 +32876,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Team: GraphQLSelectionSet { public static let possibleTypes = ["Team1"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -32879,17 +32887,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team1", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -32898,7 +32906,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -32907,7 +32915,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -32916,7 +32924,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -32925,7 +32933,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -32938,31 +32946,31 @@ public struct APISwift { } } } - + public final class OnUpdateProject1Subscription: GraphQLSubscription { public static let operationString = "subscription OnUpdateProject1 {\n onUpdateProject1 {\n __typename\n id\n name\n team {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onUpdateProject1", type: .object(OnUpdateProject1.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onUpdateProject1: OnUpdateProject1? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onUpdateProject1": onUpdateProject1.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onUpdateProject1": onUpdateProject1.flatMap(\.snapshot)]) } - + public var onUpdateProject1: OnUpdateProject1? { get { return (snapshot["onUpdateProject1"] as? Snapshot).flatMap { OnUpdateProject1(snapshot: $0) } @@ -32971,10 +32979,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onUpdateProject1") } } - + public struct OnUpdateProject1: GraphQLSelectionSet { public static let possibleTypes = ["Project1"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -32983,17 +32991,17 @@ public struct APISwift { 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? = nil, team: Team? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Project1", "id": id, "name": name, "team": team.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Project1", "id": id, "name": name, "team": team.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -33002,7 +33010,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -33011,7 +33019,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return snapshot["name"] as? String @@ -33020,7 +33028,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var team: Team? { get { return (snapshot["team"] as? Snapshot).flatMap { Team(snapshot: $0) } @@ -33029,7 +33037,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "team") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -33038,7 +33046,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -33047,10 +33055,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Team: GraphQLSelectionSet { public static let possibleTypes = ["Team1"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -33058,17 +33066,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team1", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -33077,7 +33085,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -33086,7 +33094,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -33095,7 +33103,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -33104,7 +33112,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -33117,31 +33125,31 @@ public struct APISwift { } } } - + public final class OnDeleteProject1Subscription: GraphQLSubscription { public static let operationString = "subscription OnDeleteProject1 {\n onDeleteProject1 {\n __typename\n id\n name\n team {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onDeleteProject1", type: .object(OnDeleteProject1.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onDeleteProject1: OnDeleteProject1? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onDeleteProject1": onDeleteProject1.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onDeleteProject1": onDeleteProject1.flatMap(\.snapshot)]) } - + public var onDeleteProject1: OnDeleteProject1? { get { return (snapshot["onDeleteProject1"] as? Snapshot).flatMap { OnDeleteProject1(snapshot: $0) } @@ -33150,10 +33158,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onDeleteProject1") } } - + public struct OnDeleteProject1: GraphQLSelectionSet { public static let possibleTypes = ["Project1"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -33162,17 +33170,17 @@ public struct APISwift { 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? = nil, team: Team? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Project1", "id": id, "name": name, "team": team.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Project1", "id": id, "name": name, "team": team.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -33181,7 +33189,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -33190,7 +33198,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return snapshot["name"] as? String @@ -33199,7 +33207,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var team: Team? { get { return (snapshot["team"] as? Snapshot).flatMap { Team(snapshot: $0) } @@ -33208,7 +33216,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "team") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -33217,7 +33225,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -33226,10 +33234,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Team: GraphQLSelectionSet { public static let possibleTypes = ["Team1"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -33237,17 +33245,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team1", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -33256,7 +33264,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -33265,7 +33273,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -33274,7 +33282,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -33283,7 +33291,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -33296,31 +33304,31 @@ public struct APISwift { } } } - + public final class OnCreateTeam1Subscription: GraphQLSubscription { public static let operationString = "subscription OnCreateTeam1 {\n onCreateTeam1 {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onCreateTeam1", type: .object(OnCreateTeam1.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onCreateTeam1: OnCreateTeam1? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onCreateTeam1": onCreateTeam1.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onCreateTeam1": onCreateTeam1.flatMap(\.snapshot)]) } - + public var onCreateTeam1: OnCreateTeam1? { get { return (snapshot["onCreateTeam1"] as? Snapshot).flatMap { OnCreateTeam1(snapshot: $0) } @@ -33329,10 +33337,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onCreateTeam1") } } - + public struct OnCreateTeam1: GraphQLSelectionSet { public static let possibleTypes = ["Team1"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -33340,17 +33348,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team1", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -33359,7 +33367,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -33368,7 +33376,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -33377,7 +33385,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -33386,7 +33394,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -33398,31 +33406,31 @@ public struct APISwift { } } } - + public final class OnUpdateTeam1Subscription: GraphQLSubscription { public static let operationString = "subscription OnUpdateTeam1 {\n onUpdateTeam1 {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onUpdateTeam1", type: .object(OnUpdateTeam1.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onUpdateTeam1: OnUpdateTeam1? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onUpdateTeam1": onUpdateTeam1.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onUpdateTeam1": onUpdateTeam1.flatMap(\.snapshot)]) } - + public var onUpdateTeam1: OnUpdateTeam1? { get { return (snapshot["onUpdateTeam1"] as? Snapshot).flatMap { OnUpdateTeam1(snapshot: $0) } @@ -33431,10 +33439,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onUpdateTeam1") } } - + public struct OnUpdateTeam1: GraphQLSelectionSet { public static let possibleTypes = ["Team1"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -33442,17 +33450,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team1", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -33461,7 +33469,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -33470,7 +33478,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -33479,7 +33487,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -33488,7 +33496,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -33500,31 +33508,31 @@ public struct APISwift { } } } - + public final class OnDeleteTeam1Subscription: GraphQLSubscription { public static let operationString = "subscription OnDeleteTeam1 {\n onDeleteTeam1 {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onDeleteTeam1", type: .object(OnDeleteTeam1.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onDeleteTeam1: OnDeleteTeam1? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onDeleteTeam1": onDeleteTeam1.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onDeleteTeam1": onDeleteTeam1.flatMap(\.snapshot)]) } - + public var onDeleteTeam1: OnDeleteTeam1? { get { return (snapshot["onDeleteTeam1"] as? Snapshot).flatMap { OnDeleteTeam1(snapshot: $0) } @@ -33533,10 +33541,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onDeleteTeam1") } } - + public struct OnDeleteTeam1: GraphQLSelectionSet { public static let possibleTypes = ["Team1"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -33544,17 +33552,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team1", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -33563,7 +33571,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -33572,7 +33580,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -33581,7 +33589,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -33590,7 +33598,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -33602,31 +33610,31 @@ public struct APISwift { } } } - + public final class OnCreateProject2Subscription: GraphQLSubscription { public static let operationString = "subscription OnCreateProject2 {\n onCreateProject2 {\n __typename\n id\n name\n teamID\n team {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onCreateProject2", type: .object(OnCreateProject2.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onCreateProject2: OnCreateProject2? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onCreateProject2": onCreateProject2.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onCreateProject2": onCreateProject2.flatMap(\.snapshot)]) } - + public var onCreateProject2: OnCreateProject2? { get { return (snapshot["onCreateProject2"] as? Snapshot).flatMap { OnCreateProject2(snapshot: $0) } @@ -33635,10 +33643,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onCreateProject2") } } - + public struct OnCreateProject2: GraphQLSelectionSet { public static let possibleTypes = ["Project2"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -33648,17 +33656,17 @@ public struct APISwift { 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? = nil, teamId: GraphQLID, team: Team? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Project2", "id": id, "name": name, "teamID": teamId, "team": team.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Project2", "id": id, "name": name, "teamID": teamId, "team": team.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -33667,7 +33675,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -33676,7 +33684,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return snapshot["name"] as? String @@ -33685,7 +33693,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var teamId: GraphQLID { get { return snapshot["teamID"]! as! GraphQLID @@ -33694,7 +33702,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "teamID") } } - + public var team: Team? { get { return (snapshot["team"] as? Snapshot).flatMap { Team(snapshot: $0) } @@ -33703,7 +33711,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "team") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -33712,7 +33720,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -33721,10 +33729,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Team: GraphQLSelectionSet { public static let possibleTypes = ["Team2"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -33732,17 +33740,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team2", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -33751,7 +33759,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -33760,7 +33768,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -33769,7 +33777,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -33778,7 +33786,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -33791,31 +33799,31 @@ public struct APISwift { } } } - + public final class OnUpdateProject2Subscription: GraphQLSubscription { public static let operationString = "subscription OnUpdateProject2 {\n onUpdateProject2 {\n __typename\n id\n name\n teamID\n team {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onUpdateProject2", type: .object(OnUpdateProject2.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onUpdateProject2: OnUpdateProject2? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onUpdateProject2": onUpdateProject2.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onUpdateProject2": onUpdateProject2.flatMap(\.snapshot)]) } - + public var onUpdateProject2: OnUpdateProject2? { get { return (snapshot["onUpdateProject2"] as? Snapshot).flatMap { OnUpdateProject2(snapshot: $0) } @@ -33824,10 +33832,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onUpdateProject2") } } - + public struct OnUpdateProject2: GraphQLSelectionSet { public static let possibleTypes = ["Project2"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -33837,17 +33845,17 @@ public struct APISwift { 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? = nil, teamId: GraphQLID, team: Team? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Project2", "id": id, "name": name, "teamID": teamId, "team": team.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Project2", "id": id, "name": name, "teamID": teamId, "team": team.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -33856,7 +33864,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -33865,7 +33873,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return snapshot["name"] as? String @@ -33874,7 +33882,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var teamId: GraphQLID { get { return snapshot["teamID"]! as! GraphQLID @@ -33883,7 +33891,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "teamID") } } - + public var team: Team? { get { return (snapshot["team"] as? Snapshot).flatMap { Team(snapshot: $0) } @@ -33892,7 +33900,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "team") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -33901,7 +33909,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -33910,10 +33918,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Team: GraphQLSelectionSet { public static let possibleTypes = ["Team2"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -33921,17 +33929,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team2", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -33940,7 +33948,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -33949,7 +33957,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -33958,7 +33966,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -33967,7 +33975,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -33980,31 +33988,31 @@ public struct APISwift { } } } - + public final class OnDeleteProject2Subscription: GraphQLSubscription { public static let operationString = "subscription OnDeleteProject2 {\n onDeleteProject2 {\n __typename\n id\n name\n teamID\n team {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onDeleteProject2", type: .object(OnDeleteProject2.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onDeleteProject2: OnDeleteProject2? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onDeleteProject2": onDeleteProject2.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onDeleteProject2": onDeleteProject2.flatMap(\.snapshot)]) } - + public var onDeleteProject2: OnDeleteProject2? { get { return (snapshot["onDeleteProject2"] as? Snapshot).flatMap { OnDeleteProject2(snapshot: $0) } @@ -34013,10 +34021,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onDeleteProject2") } } - + public struct OnDeleteProject2: GraphQLSelectionSet { public static let possibleTypes = ["Project2"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -34026,17 +34034,17 @@ public struct APISwift { 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? = nil, teamId: GraphQLID, team: Team? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Project2", "id": id, "name": name, "teamID": teamId, "team": team.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Project2", "id": id, "name": name, "teamID": teamId, "team": team.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -34045,7 +34053,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -34054,7 +34062,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return snapshot["name"] as? String @@ -34063,7 +34071,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var teamId: GraphQLID { get { return snapshot["teamID"]! as! GraphQLID @@ -34072,7 +34080,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "teamID") } } - + public var team: Team? { get { return (snapshot["team"] as? Snapshot).flatMap { Team(snapshot: $0) } @@ -34081,7 +34089,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "team") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -34090,7 +34098,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -34099,10 +34107,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Team: GraphQLSelectionSet { public static let possibleTypes = ["Team2"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -34110,17 +34118,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team2", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -34129,7 +34137,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -34138,7 +34146,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -34147,7 +34155,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -34156,7 +34164,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -34169,31 +34177,31 @@ public struct APISwift { } } } - + public final class OnCreateTeam2Subscription: GraphQLSubscription { public static let operationString = "subscription OnCreateTeam2 {\n onCreateTeam2 {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onCreateTeam2", type: .object(OnCreateTeam2.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onCreateTeam2: OnCreateTeam2? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onCreateTeam2": onCreateTeam2.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onCreateTeam2": onCreateTeam2.flatMap(\.snapshot)]) } - + public var onCreateTeam2: OnCreateTeam2? { get { return (snapshot["onCreateTeam2"] as? Snapshot).flatMap { OnCreateTeam2(snapshot: $0) } @@ -34202,10 +34210,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onCreateTeam2") } } - + public struct OnCreateTeam2: GraphQLSelectionSet { public static let possibleTypes = ["Team2"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -34213,17 +34221,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team2", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -34232,7 +34240,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -34241,7 +34249,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -34250,7 +34258,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -34259,7 +34267,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -34271,31 +34279,31 @@ public struct APISwift { } } } - + public final class OnUpdateTeam2Subscription: GraphQLSubscription { public static let operationString = "subscription OnUpdateTeam2 {\n onUpdateTeam2 {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onUpdateTeam2", type: .object(OnUpdateTeam2.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onUpdateTeam2: OnUpdateTeam2? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onUpdateTeam2": onUpdateTeam2.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onUpdateTeam2": onUpdateTeam2.flatMap(\.snapshot)]) } - + public var onUpdateTeam2: OnUpdateTeam2? { get { return (snapshot["onUpdateTeam2"] as? Snapshot).flatMap { OnUpdateTeam2(snapshot: $0) } @@ -34304,10 +34312,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onUpdateTeam2") } } - + public struct OnUpdateTeam2: GraphQLSelectionSet { public static let possibleTypes = ["Team2"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -34315,17 +34323,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team2", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -34334,7 +34342,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -34343,7 +34351,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -34352,7 +34360,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -34361,7 +34369,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -34373,31 +34381,31 @@ public struct APISwift { } } } - + public final class OnDeleteTeam2Subscription: GraphQLSubscription { public static let operationString = "subscription OnDeleteTeam2 {\n onDeleteTeam2 {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onDeleteTeam2", type: .object(OnDeleteTeam2.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onDeleteTeam2: OnDeleteTeam2? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onDeleteTeam2": onDeleteTeam2.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onDeleteTeam2": onDeleteTeam2.flatMap(\.snapshot)]) } - + public var onDeleteTeam2: OnDeleteTeam2? { get { return (snapshot["onDeleteTeam2"] as? Snapshot).flatMap { OnDeleteTeam2(snapshot: $0) } @@ -34406,10 +34414,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onDeleteTeam2") } } - + public struct OnDeleteTeam2: GraphQLSelectionSet { public static let possibleTypes = ["Team2"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -34417,17 +34425,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Team2", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -34436,7 +34444,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -34445,7 +34453,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -34454,7 +34462,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -34463,7 +34471,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -34475,31 +34483,31 @@ public struct APISwift { } } } - + public final class OnCreatePost3Subscription: GraphQLSubscription { public static let operationString = "subscription OnCreatePost3 {\n onCreatePost3 {\n __typename\n id\n title\n comments {\n __typename\n items {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onCreatePost3", type: .object(OnCreatePost3.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onCreatePost3: OnCreatePost3? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onCreatePost3": onCreatePost3.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onCreatePost3": onCreatePost3.flatMap(\.snapshot)]) } - + public var onCreatePost3: OnCreatePost3? { get { return (snapshot["onCreatePost3"] as? Snapshot).flatMap { OnCreatePost3(snapshot: $0) } @@ -34508,10 +34516,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onCreatePost3") } } - + public struct OnCreatePost3: GraphQLSelectionSet { public static let possibleTypes = ["Post3"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -34520,17 +34528,17 @@ public struct APISwift { 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, title: String, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post3", "id": id, "title": title, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post3", "id": id, "title": title, "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -34539,7 +34547,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -34548,7 +34556,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -34557,7 +34565,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -34566,7 +34574,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -34575,7 +34583,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -34584,26 +34592,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment3Connection"] - + 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": "ModelComment3Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelComment3Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -34612,16 +34620,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -34630,10 +34638,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment3"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -34642,17 +34650,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment3", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -34661,7 +34669,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -34670,7 +34678,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -34679,7 +34687,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -34688,7 +34696,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -34697,7 +34705,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -34711,31 +34719,31 @@ public struct APISwift { } } } - + public final class OnUpdatePost3Subscription: GraphQLSubscription { public static let operationString = "subscription OnUpdatePost3 {\n onUpdatePost3 {\n __typename\n id\n title\n comments {\n __typename\n items {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onUpdatePost3", type: .object(OnUpdatePost3.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onUpdatePost3: OnUpdatePost3? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onUpdatePost3": onUpdatePost3.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onUpdatePost3": onUpdatePost3.flatMap(\.snapshot)]) } - + public var onUpdatePost3: OnUpdatePost3? { get { return (snapshot["onUpdatePost3"] as? Snapshot).flatMap { OnUpdatePost3(snapshot: $0) } @@ -34744,10 +34752,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onUpdatePost3") } } - + public struct OnUpdatePost3: GraphQLSelectionSet { public static let possibleTypes = ["Post3"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -34756,17 +34764,17 @@ public struct APISwift { 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, title: String, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post3", "id": id, "title": title, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post3", "id": id, "title": title, "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -34775,7 +34783,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -34784,7 +34792,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -34793,7 +34801,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -34802,7 +34810,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -34811,7 +34819,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -34820,26 +34828,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment3Connection"] - + 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": "ModelComment3Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelComment3Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -34848,16 +34856,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -34866,10 +34874,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment3"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -34878,17 +34886,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment3", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -34897,7 +34905,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -34906,7 +34914,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -34915,7 +34923,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -34924,7 +34932,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -34933,7 +34941,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -34947,31 +34955,31 @@ public struct APISwift { } } } - + public final class OnDeletePost3Subscription: GraphQLSubscription { public static let operationString = "subscription OnDeletePost3 {\n onDeletePost3 {\n __typename\n id\n title\n comments {\n __typename\n items {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onDeletePost3", type: .object(OnDeletePost3.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onDeletePost3: OnDeletePost3? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onDeletePost3": onDeletePost3.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onDeletePost3": onDeletePost3.flatMap(\.snapshot)]) } - + public var onDeletePost3: OnDeletePost3? { get { return (snapshot["onDeletePost3"] as? Snapshot).flatMap { OnDeletePost3(snapshot: $0) } @@ -34980,10 +34988,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onDeletePost3") } } - + public struct OnDeletePost3: GraphQLSelectionSet { public static let possibleTypes = ["Post3"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -34992,17 +35000,17 @@ public struct APISwift { 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, title: String, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post3", "id": id, "title": title, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post3", "id": id, "title": title, "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -35011,7 +35019,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -35020,7 +35028,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -35029,7 +35037,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -35038,7 +35046,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -35047,7 +35055,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -35056,26 +35064,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment3Connection"] - + 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": "ModelComment3Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelComment3Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -35084,16 +35092,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -35102,10 +35110,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment3"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -35114,17 +35122,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment3", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -35133,7 +35141,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -35142,7 +35150,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -35151,7 +35159,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -35160,7 +35168,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -35169,7 +35177,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -35183,31 +35191,31 @@ public struct APISwift { } } } - + public final class OnCreateComment3Subscription: GraphQLSubscription { public static let operationString = "subscription OnCreateComment3 {\n onCreateComment3 {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onCreateComment3", type: .object(OnCreateComment3.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onCreateComment3: OnCreateComment3? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onCreateComment3": onCreateComment3.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onCreateComment3": onCreateComment3.flatMap(\.snapshot)]) } - + public var onCreateComment3: OnCreateComment3? { get { return (snapshot["onCreateComment3"] as? Snapshot).flatMap { OnCreateComment3(snapshot: $0) } @@ -35216,10 +35224,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onCreateComment3") } } - + public struct OnCreateComment3: GraphQLSelectionSet { public static let possibleTypes = ["Comment3"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -35228,17 +35236,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment3", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -35247,7 +35255,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -35256,7 +35264,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -35265,7 +35273,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -35274,7 +35282,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -35283,7 +35291,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -35295,31 +35303,31 @@ public struct APISwift { } } } - + public final class OnUpdateComment3Subscription: GraphQLSubscription { public static let operationString = "subscription OnUpdateComment3 {\n onUpdateComment3 {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onUpdateComment3", type: .object(OnUpdateComment3.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onUpdateComment3: OnUpdateComment3? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onUpdateComment3": onUpdateComment3.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onUpdateComment3": onUpdateComment3.flatMap(\.snapshot)]) } - + public var onUpdateComment3: OnUpdateComment3? { get { return (snapshot["onUpdateComment3"] as? Snapshot).flatMap { OnUpdateComment3(snapshot: $0) } @@ -35328,10 +35336,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onUpdateComment3") } } - + public struct OnUpdateComment3: GraphQLSelectionSet { public static let possibleTypes = ["Comment3"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -35340,17 +35348,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment3", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -35359,7 +35367,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -35368,7 +35376,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -35377,7 +35385,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -35386,7 +35394,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -35395,7 +35403,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -35407,31 +35415,31 @@ public struct APISwift { } } } - + public final class OnDeleteComment3Subscription: GraphQLSubscription { public static let operationString = "subscription OnDeleteComment3 {\n onDeleteComment3 {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onDeleteComment3", type: .object(OnDeleteComment3.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onDeleteComment3: OnDeleteComment3? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onDeleteComment3": onDeleteComment3.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onDeleteComment3": onDeleteComment3.flatMap(\.snapshot)]) } - + public var onDeleteComment3: OnDeleteComment3? { get { return (snapshot["onDeleteComment3"] as? Snapshot).flatMap { OnDeleteComment3(snapshot: $0) } @@ -35440,10 +35448,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onDeleteComment3") } } - + public struct OnDeleteComment3: GraphQLSelectionSet { public static let possibleTypes = ["Comment3"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -35452,17 +35460,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment3", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -35471,7 +35479,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -35480,7 +35488,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -35489,7 +35497,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -35498,7 +35506,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -35507,7 +35515,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -35519,31 +35527,31 @@ public struct APISwift { } } } - + public final class OnCreatePost4Subscription: GraphQLSubscription { public static let operationString = "subscription OnCreatePost4 {\n onCreatePost4 {\n __typename\n id\n title\n comments {\n __typename\n items {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onCreatePost4", type: .object(OnCreatePost4.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onCreatePost4: OnCreatePost4? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onCreatePost4": onCreatePost4.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onCreatePost4": onCreatePost4.flatMap(\.snapshot)]) } - + public var onCreatePost4: OnCreatePost4? { get { return (snapshot["onCreatePost4"] as? Snapshot).flatMap { OnCreatePost4(snapshot: $0) } @@ -35552,10 +35560,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onCreatePost4") } } - + public struct OnCreatePost4: GraphQLSelectionSet { public static let possibleTypes = ["Post4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -35564,17 +35572,17 @@ public struct APISwift { 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, title: String, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -35583,7 +35591,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -35592,7 +35600,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -35601,7 +35609,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -35610,7 +35618,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -35619,7 +35627,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -35628,26 +35636,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment4Connection"] - + 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": "ModelComment4Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelComment4Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -35656,16 +35664,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -35674,10 +35682,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -35686,17 +35694,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment4", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -35705,7 +35713,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -35714,7 +35722,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -35723,7 +35731,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -35732,7 +35740,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -35741,7 +35749,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -35755,31 +35763,31 @@ public struct APISwift { } } } - + public final class OnUpdatePost4Subscription: GraphQLSubscription { public static let operationString = "subscription OnUpdatePost4 {\n onUpdatePost4 {\n __typename\n id\n title\n comments {\n __typename\n items {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onUpdatePost4", type: .object(OnUpdatePost4.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onUpdatePost4: OnUpdatePost4? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onUpdatePost4": onUpdatePost4.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onUpdatePost4": onUpdatePost4.flatMap(\.snapshot)]) } - + public var onUpdatePost4: OnUpdatePost4? { get { return (snapshot["onUpdatePost4"] as? Snapshot).flatMap { OnUpdatePost4(snapshot: $0) } @@ -35788,10 +35796,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onUpdatePost4") } } - + public struct OnUpdatePost4: GraphQLSelectionSet { public static let possibleTypes = ["Post4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -35800,17 +35808,17 @@ public struct APISwift { 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, title: String, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -35819,7 +35827,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -35828,7 +35836,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -35837,7 +35845,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -35846,7 +35854,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -35855,7 +35863,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -35864,26 +35872,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment4Connection"] - + 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": "ModelComment4Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelComment4Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -35892,16 +35900,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -35910,10 +35918,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -35922,17 +35930,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment4", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -35941,7 +35949,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -35950,7 +35958,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -35959,7 +35967,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -35968,7 +35976,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -35977,7 +35985,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -35991,31 +35999,31 @@ public struct APISwift { } } } - + public final class OnDeletePost4Subscription: GraphQLSubscription { public static let operationString = "subscription OnDeletePost4 {\n onDeletePost4 {\n __typename\n id\n title\n comments {\n __typename\n items {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onDeletePost4", type: .object(OnDeletePost4.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onDeletePost4: OnDeletePost4? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onDeletePost4": onDeletePost4.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onDeletePost4": onDeletePost4.flatMap(\.snapshot)]) } - + public var onDeletePost4: OnDeletePost4? { get { return (snapshot["onDeletePost4"] as? Snapshot).flatMap { OnDeletePost4(snapshot: $0) } @@ -36024,10 +36032,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onDeletePost4") } } - + public struct OnDeletePost4: GraphQLSelectionSet { public static let possibleTypes = ["Post4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -36036,17 +36044,17 @@ public struct APISwift { 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, title: String, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -36055,7 +36063,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -36064,7 +36072,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -36073,7 +36081,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -36082,7 +36090,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -36091,7 +36099,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -36100,26 +36108,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment4Connection"] - + 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": "ModelComment4Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelComment4Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -36128,16 +36136,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -36146,10 +36154,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -36158,17 +36166,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment4", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -36177,7 +36185,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -36186,7 +36194,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -36195,7 +36203,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -36204,7 +36212,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -36213,7 +36221,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -36227,31 +36235,31 @@ public struct APISwift { } } } - + public final class OnCreateComment4Subscription: GraphQLSubscription { public static let operationString = "subscription OnCreateComment4 {\n onCreateComment4 {\n __typename\n id\n postID\n content\n post {\n __typename\n id\n title\n comments {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onCreateComment4", type: .object(OnCreateComment4.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onCreateComment4: OnCreateComment4? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onCreateComment4": onCreateComment4.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onCreateComment4": onCreateComment4.flatMap(\.snapshot)]) } - + public var onCreateComment4: OnCreateComment4? { get { return (snapshot["onCreateComment4"] as? Snapshot).flatMap { OnCreateComment4(snapshot: $0) } @@ -36260,10 +36268,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onCreateComment4") } } - + public struct OnCreateComment4: GraphQLSelectionSet { public static let possibleTypes = ["Comment4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -36273,17 +36281,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, post: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Comment4", "id": id, "postID": postId, "content": content, "post": post.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Comment4", "id": id, "postID": postId, "content": content, "post": post.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -36292,7 +36300,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -36301,7 +36309,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -36310,7 +36318,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -36319,7 +36327,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var post: Post? { get { return (snapshot["post"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -36328,7 +36336,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "post") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -36337,7 +36345,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -36346,10 +36354,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -36358,17 +36366,17 @@ public struct APISwift { 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, title: String, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -36377,7 +36385,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -36386,7 +36394,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -36395,7 +36403,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -36404,7 +36412,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -36413,7 +36421,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -36422,25 +36430,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment4Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelComment4Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -36449,7 +36457,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -36463,31 +36471,31 @@ public struct APISwift { } } } - + public final class OnUpdateComment4Subscription: GraphQLSubscription { public static let operationString = "subscription OnUpdateComment4 {\n onUpdateComment4 {\n __typename\n id\n postID\n content\n post {\n __typename\n id\n title\n comments {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onUpdateComment4", type: .object(OnUpdateComment4.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onUpdateComment4: OnUpdateComment4? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onUpdateComment4": onUpdateComment4.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onUpdateComment4": onUpdateComment4.flatMap(\.snapshot)]) } - + public var onUpdateComment4: OnUpdateComment4? { get { return (snapshot["onUpdateComment4"] as? Snapshot).flatMap { OnUpdateComment4(snapshot: $0) } @@ -36496,10 +36504,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onUpdateComment4") } } - + public struct OnUpdateComment4: GraphQLSelectionSet { public static let possibleTypes = ["Comment4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -36509,17 +36517,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, post: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Comment4", "id": id, "postID": postId, "content": content, "post": post.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Comment4", "id": id, "postID": postId, "content": content, "post": post.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -36528,7 +36536,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -36537,7 +36545,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -36546,7 +36554,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -36555,7 +36563,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var post: Post? { get { return (snapshot["post"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -36564,7 +36572,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "post") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -36573,7 +36581,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -36582,10 +36590,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -36594,17 +36602,17 @@ public struct APISwift { 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, title: String, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -36613,7 +36621,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -36622,7 +36630,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -36631,7 +36639,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -36640,7 +36648,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -36649,7 +36657,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -36658,25 +36666,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment4Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelComment4Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -36685,7 +36693,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -36699,31 +36707,31 @@ public struct APISwift { } } } - + public final class OnDeleteComment4Subscription: GraphQLSubscription { public static let operationString = "subscription OnDeleteComment4 {\n onDeleteComment4 {\n __typename\n id\n postID\n content\n post {\n __typename\n id\n title\n comments {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onDeleteComment4", type: .object(OnDeleteComment4.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onDeleteComment4: OnDeleteComment4? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onDeleteComment4": onDeleteComment4.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onDeleteComment4": onDeleteComment4.flatMap(\.snapshot)]) } - + public var onDeleteComment4: OnDeleteComment4? { get { return (snapshot["onDeleteComment4"] as? Snapshot).flatMap { OnDeleteComment4(snapshot: $0) } @@ -36732,10 +36740,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onDeleteComment4") } } - + public struct OnDeleteComment4: GraphQLSelectionSet { public static let possibleTypes = ["Comment4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -36745,17 +36753,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, post: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Comment4", "id": id, "postID": postId, "content": content, "post": post.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Comment4", "id": id, "postID": postId, "content": content, "post": post.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -36764,7 +36772,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -36773,7 +36781,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -36782,7 +36790,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -36791,7 +36799,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var post: Post? { get { return (snapshot["post"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -36800,7 +36808,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "post") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -36809,7 +36817,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -36818,10 +36826,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post4"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -36830,17 +36838,17 @@ public struct APISwift { 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, title: String, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post4", "id": id, "title": title, "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -36849,7 +36857,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -36858,7 +36866,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -36867,7 +36875,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -36876,7 +36884,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -36885,7 +36893,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -36894,25 +36902,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment4Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelComment4Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -36921,7 +36929,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -36935,31 +36943,31 @@ public struct APISwift { } } } - + public final class OnCreatePost5Subscription: GraphQLSubscription { public static let operationString = "subscription OnCreatePost5 {\n onCreatePost5 {\n __typename\n id\n title\n editors {\n __typename\n items {\n __typename\n id\n postID\n editorID\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onCreatePost5", type: .object(OnCreatePost5.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onCreatePost5: OnCreatePost5? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onCreatePost5": onCreatePost5.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onCreatePost5": onCreatePost5.flatMap(\.snapshot)]) } - + public var onCreatePost5: OnCreatePost5? { get { return (snapshot["onCreatePost5"] as? Snapshot).flatMap { OnCreatePost5(snapshot: $0) } @@ -36968,10 +36976,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onCreatePost5") } } - + public struct OnCreatePost5: GraphQLSelectionSet { public static let possibleTypes = ["Post5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -36980,17 +36988,17 @@ public struct APISwift { 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, title: String, editors: Editor? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -36999,7 +37007,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -37008,7 +37016,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -37017,7 +37025,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var editors: Editor? { get { return (snapshot["editors"] as? Snapshot).flatMap { Editor(snapshot: $0) } @@ -37026,7 +37034,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "editors") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -37035,7 +37043,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -37044,26 +37052,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Editor: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + 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": "ModelPostEditor5Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -37072,16 +37080,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -37090,10 +37098,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["PostEditor5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -37102,17 +37110,17 @@ public struct APISwift { 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, postId: GraphQLID, editorId: GraphQLID, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "PostEditor5", "id": id, "postID": postId, "editorID": editorId, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -37121,7 +37129,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -37130,7 +37138,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -37139,7 +37147,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var editorId: GraphQLID { get { return snapshot["editorID"]! as! GraphQLID @@ -37148,7 +37156,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "editorID") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -37157,7 +37165,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -37171,31 +37179,31 @@ public struct APISwift { } } } - + public final class OnUpdatePost5Subscription: GraphQLSubscription { public static let operationString = "subscription OnUpdatePost5 {\n onUpdatePost5 {\n __typename\n id\n title\n editors {\n __typename\n items {\n __typename\n id\n postID\n editorID\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onUpdatePost5", type: .object(OnUpdatePost5.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onUpdatePost5: OnUpdatePost5? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onUpdatePost5": onUpdatePost5.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onUpdatePost5": onUpdatePost5.flatMap(\.snapshot)]) } - + public var onUpdatePost5: OnUpdatePost5? { get { return (snapshot["onUpdatePost5"] as? Snapshot).flatMap { OnUpdatePost5(snapshot: $0) } @@ -37204,10 +37212,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onUpdatePost5") } } - + public struct OnUpdatePost5: GraphQLSelectionSet { public static let possibleTypes = ["Post5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -37216,17 +37224,17 @@ public struct APISwift { 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, title: String, editors: Editor? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -37235,7 +37243,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -37244,7 +37252,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -37253,7 +37261,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var editors: Editor? { get { return (snapshot["editors"] as? Snapshot).flatMap { Editor(snapshot: $0) } @@ -37262,7 +37270,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "editors") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -37271,7 +37279,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -37280,26 +37288,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Editor: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + 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": "ModelPostEditor5Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -37308,16 +37316,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -37326,10 +37334,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["PostEditor5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -37338,17 +37346,17 @@ public struct APISwift { 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, postId: GraphQLID, editorId: GraphQLID, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "PostEditor5", "id": id, "postID": postId, "editorID": editorId, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -37357,7 +37365,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -37366,7 +37374,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -37375,7 +37383,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var editorId: GraphQLID { get { return snapshot["editorID"]! as! GraphQLID @@ -37384,7 +37392,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "editorID") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -37393,7 +37401,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -37407,31 +37415,31 @@ public struct APISwift { } } } - + public final class OnDeletePost5Subscription: GraphQLSubscription { public static let operationString = "subscription OnDeletePost5 {\n onDeletePost5 {\n __typename\n id\n title\n editors {\n __typename\n items {\n __typename\n id\n postID\n editorID\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onDeletePost5", type: .object(OnDeletePost5.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onDeletePost5: OnDeletePost5? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onDeletePost5": onDeletePost5.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onDeletePost5": onDeletePost5.flatMap(\.snapshot)]) } - + public var onDeletePost5: OnDeletePost5? { get { return (snapshot["onDeletePost5"] as? Snapshot).flatMap { OnDeletePost5(snapshot: $0) } @@ -37440,10 +37448,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onDeletePost5") } } - + public struct OnDeletePost5: GraphQLSelectionSet { public static let possibleTypes = ["Post5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -37452,17 +37460,17 @@ public struct APISwift { 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, title: String, editors: Editor? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -37471,7 +37479,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -37480,7 +37488,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -37489,7 +37497,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var editors: Editor? { get { return (snapshot["editors"] as? Snapshot).flatMap { Editor(snapshot: $0) } @@ -37498,7 +37506,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "editors") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -37507,7 +37515,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -37516,26 +37524,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Editor: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + 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": "ModelPostEditor5Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -37544,16 +37552,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -37562,10 +37570,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["PostEditor5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -37574,17 +37582,17 @@ public struct APISwift { 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, postId: GraphQLID, editorId: GraphQLID, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "PostEditor5", "id": id, "postID": postId, "editorID": editorId, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -37593,7 +37601,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -37602,7 +37610,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -37611,7 +37619,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var editorId: GraphQLID { get { return snapshot["editorID"]! as! GraphQLID @@ -37620,7 +37628,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "editorID") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -37629,7 +37637,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -37643,31 +37651,31 @@ public struct APISwift { } } } - + public final class OnCreatePostEditor5Subscription: GraphQLSubscription { public static let operationString = "subscription OnCreatePostEditor5 {\n onCreatePostEditor5 {\n __typename\n id\n postID\n editorID\n post {\n __typename\n id\n title\n editors {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n editor {\n __typename\n id\n username\n posts {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onCreatePostEditor5", type: .object(OnCreatePostEditor5.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onCreatePostEditor5: OnCreatePostEditor5? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onCreatePostEditor5": onCreatePostEditor5.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onCreatePostEditor5": onCreatePostEditor5.flatMap(\.snapshot)]) } - + public var onCreatePostEditor5: OnCreatePostEditor5? { get { return (snapshot["onCreatePostEditor5"] as? Snapshot).flatMap { OnCreatePostEditor5(snapshot: $0) } @@ -37676,10 +37684,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onCreatePostEditor5") } } - + public struct OnCreatePostEditor5: GraphQLSelectionSet { public static let possibleTypes = ["PostEditor5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -37690,17 +37698,17 @@ public struct APISwift { 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, postId: GraphQLID, editorId: GraphQLID, post: Post, editor: Editor, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "PostEditor5", "id": id, "postID": postId, "editorID": editorId, "post": post.snapshot, "editor": editor.snapshot, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -37709,7 +37717,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -37718,7 +37726,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -37727,7 +37735,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var editorId: GraphQLID { get { return snapshot["editorID"]! as! GraphQLID @@ -37736,7 +37744,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "editorID") } } - + public var post: Post { get { return Post(snapshot: snapshot["post"]! as! Snapshot) @@ -37745,7 +37753,7 @@ public struct APISwift { snapshot.updateValue(newValue.snapshot, forKey: "post") } } - + public var editor: Editor { get { return Editor(snapshot: snapshot["editor"]! as! Snapshot) @@ -37754,7 +37762,7 @@ public struct APISwift { snapshot.updateValue(newValue.snapshot, forKey: "editor") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -37763,7 +37771,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -37772,10 +37780,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -37784,17 +37792,17 @@ public struct APISwift { 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, title: String, editors: Editor? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -37803,7 +37811,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -37812,7 +37820,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -37821,7 +37829,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var editors: Editor? { get { return (snapshot["editors"] as? Snapshot).flatMap { Editor(snapshot: $0) } @@ -37830,7 +37838,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "editors") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -37839,7 +37847,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -37848,25 +37856,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Editor: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -37875,7 +37883,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -37886,10 +37894,10 @@ public struct APISwift { } } } - + public struct Editor: GraphQLSelectionSet { public static let possibleTypes = ["User5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -37898,17 +37906,17 @@ public struct APISwift { 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, username: String, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -37917,7 +37925,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -37926,7 +37934,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var username: String { get { return snapshot["username"]! as! String @@ -37935,7 +37943,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "username") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -37944,7 +37952,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -37953,7 +37961,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -37962,25 +37970,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -37989,7 +37997,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -38003,31 +38011,31 @@ public struct APISwift { } } } - + public final class OnUpdatePostEditor5Subscription: GraphQLSubscription { public static let operationString = "subscription OnUpdatePostEditor5 {\n onUpdatePostEditor5 {\n __typename\n id\n postID\n editorID\n post {\n __typename\n id\n title\n editors {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n editor {\n __typename\n id\n username\n posts {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onUpdatePostEditor5", type: .object(OnUpdatePostEditor5.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onUpdatePostEditor5: OnUpdatePostEditor5? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onUpdatePostEditor5": onUpdatePostEditor5.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onUpdatePostEditor5": onUpdatePostEditor5.flatMap(\.snapshot)]) } - + public var onUpdatePostEditor5: OnUpdatePostEditor5? { get { return (snapshot["onUpdatePostEditor5"] as? Snapshot).flatMap { OnUpdatePostEditor5(snapshot: $0) } @@ -38036,10 +38044,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onUpdatePostEditor5") } } - + public struct OnUpdatePostEditor5: GraphQLSelectionSet { public static let possibleTypes = ["PostEditor5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -38050,17 +38058,17 @@ public struct APISwift { 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, postId: GraphQLID, editorId: GraphQLID, post: Post, editor: Editor, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "PostEditor5", "id": id, "postID": postId, "editorID": editorId, "post": post.snapshot, "editor": editor.snapshot, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -38069,7 +38077,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -38078,7 +38086,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -38087,7 +38095,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var editorId: GraphQLID { get { return snapshot["editorID"]! as! GraphQLID @@ -38096,7 +38104,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "editorID") } } - + public var post: Post { get { return Post(snapshot: snapshot["post"]! as! Snapshot) @@ -38105,7 +38113,7 @@ public struct APISwift { snapshot.updateValue(newValue.snapshot, forKey: "post") } } - + public var editor: Editor { get { return Editor(snapshot: snapshot["editor"]! as! Snapshot) @@ -38114,7 +38122,7 @@ public struct APISwift { snapshot.updateValue(newValue.snapshot, forKey: "editor") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -38123,7 +38131,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -38132,10 +38140,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -38144,17 +38152,17 @@ public struct APISwift { 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, title: String, editors: Editor? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -38163,7 +38171,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -38172,7 +38180,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -38181,7 +38189,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var editors: Editor? { get { return (snapshot["editors"] as? Snapshot).flatMap { Editor(snapshot: $0) } @@ -38190,7 +38198,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "editors") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -38199,7 +38207,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -38208,25 +38216,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Editor: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -38235,7 +38243,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -38246,10 +38254,10 @@ public struct APISwift { } } } - + public struct Editor: GraphQLSelectionSet { public static let possibleTypes = ["User5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -38258,17 +38266,17 @@ public struct APISwift { 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, username: String, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -38277,7 +38285,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -38286,7 +38294,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var username: String { get { return snapshot["username"]! as! String @@ -38295,7 +38303,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "username") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -38304,7 +38312,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -38313,7 +38321,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -38322,25 +38330,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -38349,7 +38357,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -38363,31 +38371,31 @@ public struct APISwift { } } } - + public final class OnDeletePostEditor5Subscription: GraphQLSubscription { public static let operationString = "subscription OnDeletePostEditor5 {\n onDeletePostEditor5 {\n __typename\n id\n postID\n editorID\n post {\n __typename\n id\n title\n editors {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n editor {\n __typename\n id\n username\n posts {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onDeletePostEditor5", type: .object(OnDeletePostEditor5.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onDeletePostEditor5: OnDeletePostEditor5? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onDeletePostEditor5": onDeletePostEditor5.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onDeletePostEditor5": onDeletePostEditor5.flatMap(\.snapshot)]) } - + public var onDeletePostEditor5: OnDeletePostEditor5? { get { return (snapshot["onDeletePostEditor5"] as? Snapshot).flatMap { OnDeletePostEditor5(snapshot: $0) } @@ -38396,10 +38404,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onDeletePostEditor5") } } - + public struct OnDeletePostEditor5: GraphQLSelectionSet { public static let possibleTypes = ["PostEditor5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -38410,17 +38418,17 @@ public struct APISwift { 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, postId: GraphQLID, editorId: GraphQLID, post: Post, editor: Editor, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "PostEditor5", "id": id, "postID": postId, "editorID": editorId, "post": post.snapshot, "editor": editor.snapshot, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -38429,7 +38437,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -38438,7 +38446,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -38447,7 +38455,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var editorId: GraphQLID { get { return snapshot["editorID"]! as! GraphQLID @@ -38456,7 +38464,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "editorID") } } - + public var post: Post { get { return Post(snapshot: snapshot["post"]! as! Snapshot) @@ -38465,7 +38473,7 @@ public struct APISwift { snapshot.updateValue(newValue.snapshot, forKey: "post") } } - + public var editor: Editor { get { return Editor(snapshot: snapshot["editor"]! as! Snapshot) @@ -38474,7 +38482,7 @@ public struct APISwift { snapshot.updateValue(newValue.snapshot, forKey: "editor") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -38483,7 +38491,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -38492,10 +38500,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -38504,17 +38512,17 @@ public struct APISwift { 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, title: String, editors: Editor? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post5", "id": id, "title": title, "editors": editors.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -38523,7 +38531,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -38532,7 +38540,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -38541,7 +38549,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var editors: Editor? { get { return (snapshot["editors"] as? Snapshot).flatMap { Editor(snapshot: $0) } @@ -38550,7 +38558,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "editors") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -38559,7 +38567,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -38568,25 +38576,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Editor: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -38595,7 +38603,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -38606,10 +38614,10 @@ public struct APISwift { } } } - + public struct Editor: GraphQLSelectionSet { public static let possibleTypes = ["User5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -38618,17 +38626,17 @@ public struct APISwift { 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, username: String, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -38637,7 +38645,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -38646,7 +38654,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var username: String { get { return snapshot["username"]! as! String @@ -38655,7 +38663,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "username") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -38664,7 +38672,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -38673,7 +38681,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -38682,25 +38690,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -38709,7 +38717,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -38723,31 +38731,31 @@ public struct APISwift { } } } - + public final class OnCreateUser5Subscription: GraphQLSubscription { public static let operationString = "subscription OnCreateUser5 {\n onCreateUser5 {\n __typename\n id\n username\n posts {\n __typename\n items {\n __typename\n id\n postID\n editorID\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onCreateUser5", type: .object(OnCreateUser5.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onCreateUser5: OnCreateUser5? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onCreateUser5": onCreateUser5.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onCreateUser5": onCreateUser5.flatMap(\.snapshot)]) } - + public var onCreateUser5: OnCreateUser5? { get { return (snapshot["onCreateUser5"] as? Snapshot).flatMap { OnCreateUser5(snapshot: $0) } @@ -38756,10 +38764,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onCreateUser5") } } - + public struct OnCreateUser5: GraphQLSelectionSet { public static let possibleTypes = ["User5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -38768,17 +38776,17 @@ public struct APISwift { 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, username: String, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -38787,7 +38795,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -38796,7 +38804,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var username: String { get { return snapshot["username"]! as! String @@ -38805,7 +38813,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "username") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -38814,7 +38822,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -38823,7 +38831,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -38832,26 +38840,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + 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": "ModelPostEditor5Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -38860,16 +38868,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -38878,10 +38886,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["PostEditor5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -38890,17 +38898,17 @@ public struct APISwift { 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, postId: GraphQLID, editorId: GraphQLID, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "PostEditor5", "id": id, "postID": postId, "editorID": editorId, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -38909,7 +38917,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -38918,7 +38926,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -38927,7 +38935,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var editorId: GraphQLID { get { return snapshot["editorID"]! as! GraphQLID @@ -38936,7 +38944,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "editorID") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -38945,7 +38953,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -38959,31 +38967,31 @@ public struct APISwift { } } } - + public final class OnUpdateUser5Subscription: GraphQLSubscription { public static let operationString = "subscription OnUpdateUser5 {\n onUpdateUser5 {\n __typename\n id\n username\n posts {\n __typename\n items {\n __typename\n id\n postID\n editorID\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onUpdateUser5", type: .object(OnUpdateUser5.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onUpdateUser5: OnUpdateUser5? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onUpdateUser5": onUpdateUser5.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onUpdateUser5": onUpdateUser5.flatMap(\.snapshot)]) } - + public var onUpdateUser5: OnUpdateUser5? { get { return (snapshot["onUpdateUser5"] as? Snapshot).flatMap { OnUpdateUser5(snapshot: $0) } @@ -38992,10 +39000,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onUpdateUser5") } } - + public struct OnUpdateUser5: GraphQLSelectionSet { public static let possibleTypes = ["User5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -39004,17 +39012,17 @@ public struct APISwift { 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, username: String, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -39023,7 +39031,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -39032,7 +39040,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var username: String { get { return snapshot["username"]! as! String @@ -39041,7 +39049,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "username") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -39050,7 +39058,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -39059,7 +39067,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -39068,26 +39076,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + 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": "ModelPostEditor5Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -39096,16 +39104,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -39114,10 +39122,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["PostEditor5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -39126,17 +39134,17 @@ public struct APISwift { 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, postId: GraphQLID, editorId: GraphQLID, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "PostEditor5", "id": id, "postID": postId, "editorID": editorId, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -39145,7 +39153,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -39154,7 +39162,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -39163,7 +39171,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var editorId: GraphQLID { get { return snapshot["editorID"]! as! GraphQLID @@ -39172,7 +39180,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "editorID") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -39181,7 +39189,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -39195,31 +39203,31 @@ public struct APISwift { } } } - + public final class OnDeleteUser5Subscription: GraphQLSubscription { public static let operationString = "subscription OnDeleteUser5 {\n onDeleteUser5 {\n __typename\n id\n username\n posts {\n __typename\n items {\n __typename\n id\n postID\n editorID\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onDeleteUser5", type: .object(OnDeleteUser5.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onDeleteUser5: OnDeleteUser5? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onDeleteUser5": onDeleteUser5.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onDeleteUser5": onDeleteUser5.flatMap(\.snapshot)]) } - + public var onDeleteUser5: OnDeleteUser5? { get { return (snapshot["onDeleteUser5"] as? Snapshot).flatMap { OnDeleteUser5(snapshot: $0) } @@ -39228,10 +39236,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onDeleteUser5") } } - + public struct OnDeleteUser5: GraphQLSelectionSet { public static let possibleTypes = ["User5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -39240,17 +39248,17 @@ public struct APISwift { 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, username: String, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "User5", "id": id, "username": username, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -39259,7 +39267,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -39268,7 +39276,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var username: String { get { return snapshot["username"]! as! String @@ -39277,7 +39285,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "username") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -39286,7 +39294,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -39295,7 +39303,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -39304,26 +39312,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPostEditor5Connection"] - + 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": "ModelPostEditor5Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPostEditor5Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -39332,16 +39340,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -39350,10 +39358,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["PostEditor5"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -39362,17 +39370,17 @@ public struct APISwift { 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, postId: GraphQLID, editorId: GraphQLID, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "PostEditor5", "id": id, "postID": postId, "editorID": editorId, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -39381,7 +39389,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -39390,7 +39398,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -39399,7 +39407,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var editorId: GraphQLID { get { return snapshot["editorID"]! as! GraphQLID @@ -39408,7 +39416,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "editorID") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -39417,7 +39425,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -39431,31 +39439,31 @@ public struct APISwift { } } } - + public final class OnCreateBlog6Subscription: GraphQLSubscription { public static let operationString = "subscription OnCreateBlog6 {\n onCreateBlog6 {\n __typename\n id\n name\n posts {\n __typename\n items {\n __typename\n id\n title\n blogID\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onCreateBlog6", type: .object(OnCreateBlog6.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onCreateBlog6: OnCreateBlog6? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onCreateBlog6": onCreateBlog6.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onCreateBlog6": onCreateBlog6.flatMap(\.snapshot)]) } - + public var onCreateBlog6: OnCreateBlog6? { get { return (snapshot["onCreateBlog6"] as? Snapshot).flatMap { OnCreateBlog6(snapshot: $0) } @@ -39464,10 +39472,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onCreateBlog6") } } - + public struct OnCreateBlog6: GraphQLSelectionSet { public static let possibleTypes = ["Blog6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -39476,17 +39484,17 @@ public struct APISwift { 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, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -39495,7 +39503,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -39504,7 +39512,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -39513,7 +39521,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -39522,7 +39530,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -39531,7 +39539,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -39540,26 +39548,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPost6Connection"] - + 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": "ModelPost6Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPost6Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -39568,16 +39576,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -39586,10 +39594,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Post6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -39598,17 +39606,17 @@ public struct APISwift { 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, title: String, blogId: GraphQLID, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -39617,7 +39625,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -39626,7 +39634,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -39635,7 +39643,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID { get { return snapshot["blogID"]! as! GraphQLID @@ -39644,7 +39652,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "blogID") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -39653,7 +39661,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -39667,31 +39675,31 @@ public struct APISwift { } } } - + public final class OnUpdateBlog6Subscription: GraphQLSubscription { public static let operationString = "subscription OnUpdateBlog6 {\n onUpdateBlog6 {\n __typename\n id\n name\n posts {\n __typename\n items {\n __typename\n id\n title\n blogID\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onUpdateBlog6", type: .object(OnUpdateBlog6.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onUpdateBlog6: OnUpdateBlog6? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onUpdateBlog6": onUpdateBlog6.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onUpdateBlog6": onUpdateBlog6.flatMap(\.snapshot)]) } - + public var onUpdateBlog6: OnUpdateBlog6? { get { return (snapshot["onUpdateBlog6"] as? Snapshot).flatMap { OnUpdateBlog6(snapshot: $0) } @@ -39700,10 +39708,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onUpdateBlog6") } } - + public struct OnUpdateBlog6: GraphQLSelectionSet { public static let possibleTypes = ["Blog6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -39712,17 +39720,17 @@ public struct APISwift { 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, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -39731,7 +39739,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -39740,7 +39748,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -39749,7 +39757,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -39758,7 +39766,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -39767,7 +39775,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -39776,26 +39784,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPost6Connection"] - + 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": "ModelPost6Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPost6Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -39804,16 +39812,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -39822,10 +39830,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Post6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -39834,17 +39842,17 @@ public struct APISwift { 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, title: String, blogId: GraphQLID, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -39853,7 +39861,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -39862,7 +39870,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -39871,7 +39879,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID { get { return snapshot["blogID"]! as! GraphQLID @@ -39880,7 +39888,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "blogID") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -39889,7 +39897,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -39903,31 +39911,31 @@ public struct APISwift { } } } - + public final class OnDeleteBlog6Subscription: GraphQLSubscription { public static let operationString = "subscription OnDeleteBlog6 {\n onDeleteBlog6 {\n __typename\n id\n name\n posts {\n __typename\n items {\n __typename\n id\n title\n blogID\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onDeleteBlog6", type: .object(OnDeleteBlog6.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onDeleteBlog6: OnDeleteBlog6? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onDeleteBlog6": onDeleteBlog6.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onDeleteBlog6": onDeleteBlog6.flatMap(\.snapshot)]) } - + public var onDeleteBlog6: OnDeleteBlog6? { get { return (snapshot["onDeleteBlog6"] as? Snapshot).flatMap { OnDeleteBlog6(snapshot: $0) } @@ -39936,10 +39944,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onDeleteBlog6") } } - + public struct OnDeleteBlog6: GraphQLSelectionSet { public static let possibleTypes = ["Blog6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -39948,17 +39956,17 @@ public struct APISwift { 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, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -39967,7 +39975,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -39976,7 +39984,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -39985,7 +39993,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -39994,7 +40002,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -40003,7 +40011,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -40012,26 +40020,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPost6Connection"] - + 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": "ModelPost6Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelPost6Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -40040,16 +40048,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -40058,10 +40066,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Post6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -40070,17 +40078,17 @@ public struct APISwift { 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, title: String, blogId: GraphQLID, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -40089,7 +40097,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -40098,7 +40106,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -40107,7 +40115,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID { get { return snapshot["blogID"]! as! GraphQLID @@ -40116,7 +40124,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "blogID") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -40125,7 +40133,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -40139,31 +40147,31 @@ public struct APISwift { } } } - + public final class OnCreatePost6Subscription: GraphQLSubscription { public static let operationString = "subscription OnCreatePost6 {\n onCreatePost6 {\n __typename\n id\n title\n blogID\n blog {\n __typename\n id\n name\n posts {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n comments {\n __typename\n items {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onCreatePost6", type: .object(OnCreatePost6.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onCreatePost6: OnCreatePost6? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onCreatePost6": onCreatePost6.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onCreatePost6": onCreatePost6.flatMap(\.snapshot)]) } - + public var onCreatePost6: OnCreatePost6? { get { return (snapshot["onCreatePost6"] as? Snapshot).flatMap { OnCreatePost6(snapshot: $0) } @@ -40172,10 +40180,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onCreatePost6") } } - + public struct OnCreatePost6: GraphQLSelectionSet { public static let possibleTypes = ["Post6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -40186,17 +40194,17 @@ public struct APISwift { 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, title: String, blogId: GraphQLID, blog: Blog? = nil, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap { $0.snapshot }, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap(\.snapshot), "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -40205,7 +40213,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -40214,7 +40222,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -40223,7 +40231,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID { get { return snapshot["blogID"]! as! GraphQLID @@ -40232,7 +40240,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "blogID") } } - + public var blog: Blog? { get { return (snapshot["blog"] as? Snapshot).flatMap { Blog(snapshot: $0) } @@ -40241,7 +40249,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "blog") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -40250,7 +40258,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -40259,7 +40267,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -40268,10 +40276,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Blog: GraphQLSelectionSet { public static let possibleTypes = ["Blog6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -40280,17 +40288,17 @@ public struct APISwift { 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, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -40299,7 +40307,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -40308,7 +40316,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -40317,7 +40325,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -40326,7 +40334,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -40335,7 +40343,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -40344,25 +40352,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPost6Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelPost6Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -40371,7 +40379,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -40382,26 +40390,26 @@ public struct APISwift { } } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment6Connection"] - + 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": "ModelComment6Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelComment6Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -40410,16 +40418,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -40428,10 +40436,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -40440,17 +40448,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment6", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -40459,7 +40467,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -40468,7 +40476,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -40477,7 +40485,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -40486,7 +40494,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -40495,7 +40503,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -40509,31 +40517,31 @@ public struct APISwift { } } } - + public final class OnUpdatePost6Subscription: GraphQLSubscription { public static let operationString = "subscription OnUpdatePost6 {\n onUpdatePost6 {\n __typename\n id\n title\n blogID\n blog {\n __typename\n id\n name\n posts {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n comments {\n __typename\n items {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onUpdatePost6", type: .object(OnUpdatePost6.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onUpdatePost6: OnUpdatePost6? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onUpdatePost6": onUpdatePost6.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onUpdatePost6": onUpdatePost6.flatMap(\.snapshot)]) } - + public var onUpdatePost6: OnUpdatePost6? { get { return (snapshot["onUpdatePost6"] as? Snapshot).flatMap { OnUpdatePost6(snapshot: $0) } @@ -40542,10 +40550,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onUpdatePost6") } } - + public struct OnUpdatePost6: GraphQLSelectionSet { public static let possibleTypes = ["Post6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -40556,17 +40564,17 @@ public struct APISwift { 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, title: String, blogId: GraphQLID, blog: Blog? = nil, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap { $0.snapshot }, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap(\.snapshot), "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -40575,7 +40583,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -40584,7 +40592,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -40593,7 +40601,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID { get { return snapshot["blogID"]! as! GraphQLID @@ -40602,7 +40610,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "blogID") } } - + public var blog: Blog? { get { return (snapshot["blog"] as? Snapshot).flatMap { Blog(snapshot: $0) } @@ -40611,7 +40619,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "blog") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -40620,7 +40628,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -40629,7 +40637,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -40638,10 +40646,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Blog: GraphQLSelectionSet { public static let possibleTypes = ["Blog6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -40650,17 +40658,17 @@ public struct APISwift { 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, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -40669,7 +40677,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -40678,7 +40686,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -40687,7 +40695,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -40696,7 +40704,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -40705,7 +40713,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -40714,25 +40722,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPost6Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelPost6Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -40741,7 +40749,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -40752,26 +40760,26 @@ public struct APISwift { } } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment6Connection"] - + 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": "ModelComment6Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelComment6Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -40780,16 +40788,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -40798,10 +40806,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -40810,17 +40818,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment6", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -40829,7 +40837,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -40838,7 +40846,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -40847,7 +40855,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -40856,7 +40864,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -40865,7 +40873,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -40879,31 +40887,31 @@ public struct APISwift { } } } - + public final class OnDeletePost6Subscription: GraphQLSubscription { public static let operationString = "subscription OnDeletePost6 {\n onDeletePost6 {\n __typename\n id\n title\n blogID\n blog {\n __typename\n id\n name\n posts {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n comments {\n __typename\n items {\n __typename\n id\n postID\n content\n createdAt\n updatedAt\n }\n nextToken\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onDeletePost6", type: .object(OnDeletePost6.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onDeletePost6: OnDeletePost6? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onDeletePost6": onDeletePost6.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onDeletePost6": onDeletePost6.flatMap(\.snapshot)]) } - + public var onDeletePost6: OnDeletePost6? { get { return (snapshot["onDeletePost6"] as? Snapshot).flatMap { OnDeletePost6(snapshot: $0) } @@ -40912,10 +40920,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onDeletePost6") } } - + public struct OnDeletePost6: GraphQLSelectionSet { public static let possibleTypes = ["Post6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -40926,17 +40934,17 @@ public struct APISwift { 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, title: String, blogId: GraphQLID, blog: Blog? = nil, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap { $0.snapshot }, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap(\.snapshot), "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -40945,7 +40953,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -40954,7 +40962,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -40963,7 +40971,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID { get { return snapshot["blogID"]! as! GraphQLID @@ -40972,7 +40980,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "blogID") } } - + public var blog: Blog? { get { return (snapshot["blog"] as? Snapshot).flatMap { Blog(snapshot: $0) } @@ -40981,7 +40989,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "blog") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -40990,7 +40998,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -40999,7 +41007,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -41008,10 +41016,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Blog: GraphQLSelectionSet { public static let possibleTypes = ["Blog6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -41020,17 +41028,17 @@ public struct APISwift { 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, posts: Post? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "posts": posts.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -41039,7 +41047,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -41048,7 +41056,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -41057,7 +41065,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var posts: Post? { get { return (snapshot["posts"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -41066,7 +41074,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "posts") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -41075,7 +41083,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -41084,25 +41092,25 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["ModelPost6Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelPost6Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -41111,7 +41119,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -41122,26 +41130,26 @@ public struct APISwift { } } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment6Connection"] - + 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": "ModelComment6Connection", "items": items.map { $0.flatMap { $0.snapshot } }, "nextToken": nextToken]) + self.init(snapshot: ["__typename": "ModelComment6Connection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -41150,16 +41158,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -41168,10 +41176,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nextToken") } } - + public struct Item: GraphQLSelectionSet { public static let possibleTypes = ["Comment6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -41180,17 +41188,17 @@ public struct APISwift { 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, postId: GraphQLID, content: String, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Comment6", "id": id, "postID": postId, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -41199,7 +41207,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -41208,7 +41216,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -41217,7 +41225,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -41226,7 +41234,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -41235,7 +41243,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -41249,31 +41257,31 @@ public struct APISwift { } } } - + public final class OnCreateComment6Subscription: GraphQLSubscription { public static let operationString = "subscription OnCreateComment6 {\n onCreateComment6 {\n __typename\n id\n postID\n post {\n __typename\n id\n title\n blogID\n blog {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n comments {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n content\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onCreateComment6", type: .object(OnCreateComment6.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onCreateComment6: OnCreateComment6? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onCreateComment6": onCreateComment6.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onCreateComment6": onCreateComment6.flatMap(\.snapshot)]) } - + public var onCreateComment6: OnCreateComment6? { get { return (snapshot["onCreateComment6"] as? Snapshot).flatMap { OnCreateComment6(snapshot: $0) } @@ -41282,10 +41290,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onCreateComment6") } } - + public struct OnCreateComment6: GraphQLSelectionSet { public static let possibleTypes = ["Comment6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -41295,17 +41303,17 @@ public struct APISwift { 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, postId: GraphQLID, post: Post? = nil, content: String, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Comment6", "id": id, "postID": postId, "post": post.flatMap { $0.snapshot }, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Comment6", "id": id, "postID": postId, "post": post.flatMap(\.snapshot), "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -41314,7 +41322,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -41323,7 +41331,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -41332,7 +41340,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var post: Post? { get { return (snapshot["post"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -41341,7 +41349,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "post") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -41350,7 +41358,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -41359,7 +41367,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -41368,10 +41376,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -41382,17 +41390,17 @@ public struct APISwift { 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, title: String, blogId: GraphQLID, blog: Blog? = nil, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap { $0.snapshot }, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap(\.snapshot), "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -41401,7 +41409,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -41410,7 +41418,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -41419,7 +41427,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID { get { return snapshot["blogID"]! as! GraphQLID @@ -41428,7 +41436,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "blogID") } } - + public var blog: Blog? { get { return (snapshot["blog"] as? Snapshot).flatMap { Blog(snapshot: $0) } @@ -41437,7 +41445,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "blog") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -41446,7 +41454,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -41455,7 +41463,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -41464,10 +41472,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Blog: GraphQLSelectionSet { public static let possibleTypes = ["Blog6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -41475,17 +41483,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -41494,7 +41502,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -41503,7 +41511,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -41512,7 +41520,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -41521,7 +41529,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -41531,25 +41539,25 @@ public struct APISwift { } } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment6Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelComment6Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -41558,7 +41566,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -41572,31 +41580,31 @@ public struct APISwift { } } } - + public final class OnUpdateComment6Subscription: GraphQLSubscription { public static let operationString = "subscription OnUpdateComment6 {\n onUpdateComment6 {\n __typename\n id\n postID\n post {\n __typename\n id\n title\n blogID\n blog {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n comments {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n content\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onUpdateComment6", type: .object(OnUpdateComment6.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onUpdateComment6: OnUpdateComment6? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onUpdateComment6": onUpdateComment6.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onUpdateComment6": onUpdateComment6.flatMap(\.snapshot)]) } - + public var onUpdateComment6: OnUpdateComment6? { get { return (snapshot["onUpdateComment6"] as? Snapshot).flatMap { OnUpdateComment6(snapshot: $0) } @@ -41605,10 +41613,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onUpdateComment6") } } - + public struct OnUpdateComment6: GraphQLSelectionSet { public static let possibleTypes = ["Comment6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -41618,17 +41626,17 @@ public struct APISwift { 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, postId: GraphQLID, post: Post? = nil, content: String, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Comment6", "id": id, "postID": postId, "post": post.flatMap { $0.snapshot }, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Comment6", "id": id, "postID": postId, "post": post.flatMap(\.snapshot), "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -41637,7 +41645,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -41646,7 +41654,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -41655,7 +41663,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var post: Post? { get { return (snapshot["post"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -41664,7 +41672,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "post") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -41673,7 +41681,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -41682,7 +41690,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -41691,10 +41699,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -41705,17 +41713,17 @@ public struct APISwift { 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, title: String, blogId: GraphQLID, blog: Blog? = nil, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap { $0.snapshot }, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap(\.snapshot), "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -41724,7 +41732,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -41733,7 +41741,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -41742,7 +41750,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID { get { return snapshot["blogID"]! as! GraphQLID @@ -41751,7 +41759,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "blogID") } } - + public var blog: Blog? { get { return (snapshot["blog"] as? Snapshot).flatMap { Blog(snapshot: $0) } @@ -41760,7 +41768,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "blog") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -41769,7 +41777,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -41778,7 +41786,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -41787,10 +41795,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Blog: GraphQLSelectionSet { public static let possibleTypes = ["Blog6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -41798,17 +41806,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -41817,7 +41825,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -41826,7 +41834,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -41835,7 +41843,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -41844,7 +41852,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -41854,25 +41862,25 @@ public struct APISwift { } } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment6Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelComment6Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -41881,7 +41889,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -41895,31 +41903,31 @@ public struct APISwift { } } } - + public final class OnDeleteComment6Subscription: GraphQLSubscription { public static let operationString = "subscription OnDeleteComment6 {\n onDeleteComment6 {\n __typename\n id\n postID\n post {\n __typename\n id\n title\n blogID\n blog {\n __typename\n id\n name\n createdAt\n updatedAt\n }\n comments {\n __typename\n nextToken\n }\n createdAt\n updatedAt\n }\n content\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onDeleteComment6", type: .object(OnDeleteComment6.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onDeleteComment6: OnDeleteComment6? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onDeleteComment6": onDeleteComment6.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onDeleteComment6": onDeleteComment6.flatMap(\.snapshot)]) } - + public var onDeleteComment6: OnDeleteComment6? { get { return (snapshot["onDeleteComment6"] as? Snapshot).flatMap { OnDeleteComment6(snapshot: $0) } @@ -41928,10 +41936,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onDeleteComment6") } } - + public struct OnDeleteComment6: GraphQLSelectionSet { public static let possibleTypes = ["Comment6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -41941,17 +41949,17 @@ public struct APISwift { 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, postId: GraphQLID, post: Post? = nil, content: String, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Comment6", "id": id, "postID": postId, "post": post.flatMap { $0.snapshot }, "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Comment6", "id": id, "postID": postId, "post": post.flatMap(\.snapshot), "content": content, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -41960,7 +41968,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -41969,7 +41977,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var postId: GraphQLID { get { return snapshot["postID"]! as! GraphQLID @@ -41978,7 +41986,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "postID") } } - + public var post: Post? { get { return (snapshot["post"] as? Snapshot).flatMap { Post(snapshot: $0) } @@ -41987,7 +41995,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "post") } } - + public var content: String { get { return snapshot["content"]! as! String @@ -41996,7 +42004,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "content") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -42005,7 +42013,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -42014,10 +42022,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Post: GraphQLSelectionSet { public static let possibleTypes = ["Post6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -42028,17 +42036,17 @@ public struct APISwift { 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, title: String, blogId: GraphQLID, blog: Blog? = nil, comments: Comment? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap { $0.snapshot }, "comments": comments.flatMap { $0.snapshot }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "Post6", "id": id, "title": title, "blogID": blogId, "blog": blog.flatMap(\.snapshot), "comments": comments.flatMap(\.snapshot), "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -42047,7 +42055,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -42056,7 +42064,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var title: String { get { return snapshot["title"]! as! String @@ -42065,7 +42073,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "title") } } - + public var blogId: GraphQLID { get { return snapshot["blogID"]! as! GraphQLID @@ -42074,7 +42082,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "blogID") } } - + public var blog: Blog? { get { return (snapshot["blog"] as? Snapshot).flatMap { Blog(snapshot: $0) } @@ -42083,7 +42091,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "blog") } } - + public var comments: Comment? { get { return (snapshot["comments"] as? Snapshot).flatMap { Comment(snapshot: $0) } @@ -42092,7 +42100,7 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "comments") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -42101,7 +42109,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -42110,10 +42118,10 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct Blog: GraphQLSelectionSet { public static let possibleTypes = ["Blog6"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -42121,17 +42129,17 @@ public struct APISwift { 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, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "Blog6", "id": id, "name": name, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -42140,7 +42148,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -42149,7 +42157,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -42158,7 +42166,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -42167,7 +42175,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -42177,25 +42185,25 @@ public struct APISwift { } } } - + public struct Comment: GraphQLSelectionSet { public static let possibleTypes = ["ModelComment6Connection"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("nextToken", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(nextToken: String? = nil) { self.init(snapshot: ["__typename": "ModelComment6Connection", "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -42204,7 +42212,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -42218,31 +42226,31 @@ public struct APISwift { } } } - + public final class OnCreateScalarContainerSubscription: GraphQLSubscription { public static let operationString = "subscription OnCreateScalarContainer {\n onCreateScalarContainer {\n __typename\n id\n myString\n myInt\n myDouble\n myBool\n myDate\n myTime\n myDateTime\n myTimeStamp\n myEmail\n myJSON\n myPhone\n myURL\n myIPAddress\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onCreateScalarContainer", type: .object(OnCreateScalarContainer.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onCreateScalarContainer: OnCreateScalarContainer? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onCreateScalarContainer": onCreateScalarContainer.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onCreateScalarContainer": onCreateScalarContainer.flatMap(\.snapshot)]) } - + public var onCreateScalarContainer: OnCreateScalarContainer? { get { return (snapshot["onCreateScalarContainer"] as? Snapshot).flatMap { OnCreateScalarContainer(snapshot: $0) } @@ -42251,10 +42259,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onCreateScalarContainer") } } - + public struct OnCreateScalarContainer: GraphQLSelectionSet { public static let possibleTypes = ["ScalarContainer"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -42274,17 +42282,17 @@ public struct APISwift { 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, myString: String? = nil, myInt: Int? = nil, myDouble: Double? = nil, myBool: Bool? = nil, myDate: String? = nil, myTime: String? = nil, myDateTime: String? = nil, myTimeStamp: Int? = nil, myEmail: String? = nil, myJson: String? = nil, myPhone: String? = nil, myUrl: String? = nil, myIpAddress: String? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "ScalarContainer", "id": id, "myString": myString, "myInt": myInt, "myDouble": myDouble, "myBool": myBool, "myDate": myDate, "myTime": myTime, "myDateTime": myDateTime, "myTimeStamp": myTimeStamp, "myEmail": myEmail, "myJSON": myJson, "myPhone": myPhone, "myURL": myUrl, "myIPAddress": myIpAddress, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -42293,7 +42301,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -42302,7 +42310,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var myString: String? { get { return snapshot["myString"] as? String @@ -42311,7 +42319,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myString") } } - + public var myInt: Int? { get { return snapshot["myInt"] as? Int @@ -42320,7 +42328,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myInt") } } - + public var myDouble: Double? { get { return snapshot["myDouble"] as? Double @@ -42329,7 +42337,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myDouble") } } - + public var myBool: Bool? { get { return snapshot["myBool"] as? Bool @@ -42338,7 +42346,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myBool") } } - + public var myDate: String? { get { return snapshot["myDate"] as? String @@ -42347,7 +42355,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myDate") } } - + public var myTime: String? { get { return snapshot["myTime"] as? String @@ -42356,7 +42364,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myTime") } } - + public var myDateTime: String? { get { return snapshot["myDateTime"] as? String @@ -42365,7 +42373,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myDateTime") } } - + public var myTimeStamp: Int? { get { return snapshot["myTimeStamp"] as? Int @@ -42374,7 +42382,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myTimeStamp") } } - + public var myEmail: String? { get { return snapshot["myEmail"] as? String @@ -42383,7 +42391,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myEmail") } } - + public var myJson: String? { get { return snapshot["myJSON"] as? String @@ -42392,7 +42400,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myJSON") } } - + public var myPhone: String? { get { return snapshot["myPhone"] as? String @@ -42401,7 +42409,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myPhone") } } - + public var myUrl: String? { get { return snapshot["myURL"] as? String @@ -42410,7 +42418,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myURL") } } - + public var myIpAddress: String? { get { return snapshot["myIPAddress"] as? String @@ -42419,7 +42427,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myIPAddress") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -42428,7 +42436,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -42440,31 +42448,31 @@ public struct APISwift { } } } - + public final class OnUpdateScalarContainerSubscription: GraphQLSubscription { public static let operationString = "subscription OnUpdateScalarContainer {\n onUpdateScalarContainer {\n __typename\n id\n myString\n myInt\n myDouble\n myBool\n myDate\n myTime\n myDateTime\n myTimeStamp\n myEmail\n myJSON\n myPhone\n myURL\n myIPAddress\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onUpdateScalarContainer", type: .object(OnUpdateScalarContainer.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onUpdateScalarContainer: OnUpdateScalarContainer? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onUpdateScalarContainer": onUpdateScalarContainer.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onUpdateScalarContainer": onUpdateScalarContainer.flatMap(\.snapshot)]) } - + public var onUpdateScalarContainer: OnUpdateScalarContainer? { get { return (snapshot["onUpdateScalarContainer"] as? Snapshot).flatMap { OnUpdateScalarContainer(snapshot: $0) } @@ -42473,10 +42481,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onUpdateScalarContainer") } } - + public struct OnUpdateScalarContainer: GraphQLSelectionSet { public static let possibleTypes = ["ScalarContainer"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -42496,17 +42504,17 @@ public struct APISwift { 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, myString: String? = nil, myInt: Int? = nil, myDouble: Double? = nil, myBool: Bool? = nil, myDate: String? = nil, myTime: String? = nil, myDateTime: String? = nil, myTimeStamp: Int? = nil, myEmail: String? = nil, myJson: String? = nil, myPhone: String? = nil, myUrl: String? = nil, myIpAddress: String? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "ScalarContainer", "id": id, "myString": myString, "myInt": myInt, "myDouble": myDouble, "myBool": myBool, "myDate": myDate, "myTime": myTime, "myDateTime": myDateTime, "myTimeStamp": myTimeStamp, "myEmail": myEmail, "myJSON": myJson, "myPhone": myPhone, "myURL": myUrl, "myIPAddress": myIpAddress, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -42515,7 +42523,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -42524,7 +42532,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var myString: String? { get { return snapshot["myString"] as? String @@ -42533,7 +42541,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myString") } } - + public var myInt: Int? { get { return snapshot["myInt"] as? Int @@ -42542,7 +42550,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myInt") } } - + public var myDouble: Double? { get { return snapshot["myDouble"] as? Double @@ -42551,7 +42559,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myDouble") } } - + public var myBool: Bool? { get { return snapshot["myBool"] as? Bool @@ -42560,7 +42568,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myBool") } } - + public var myDate: String? { get { return snapshot["myDate"] as? String @@ -42569,7 +42577,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myDate") } } - + public var myTime: String? { get { return snapshot["myTime"] as? String @@ -42578,7 +42586,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myTime") } } - + public var myDateTime: String? { get { return snapshot["myDateTime"] as? String @@ -42587,7 +42595,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myDateTime") } } - + public var myTimeStamp: Int? { get { return snapshot["myTimeStamp"] as? Int @@ -42596,7 +42604,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myTimeStamp") } } - + public var myEmail: String? { get { return snapshot["myEmail"] as? String @@ -42605,7 +42613,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myEmail") } } - + public var myJson: String? { get { return snapshot["myJSON"] as? String @@ -42614,7 +42622,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myJSON") } } - + public var myPhone: String? { get { return snapshot["myPhone"] as? String @@ -42623,7 +42631,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myPhone") } } - + public var myUrl: String? { get { return snapshot["myURL"] as? String @@ -42632,7 +42640,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myURL") } } - + public var myIpAddress: String? { get { return snapshot["myIPAddress"] as? String @@ -42641,7 +42649,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myIPAddress") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -42650,7 +42658,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -42662,31 +42670,31 @@ public struct APISwift { } } } - + public final class OnDeleteScalarContainerSubscription: GraphQLSubscription { public static let operationString = "subscription OnDeleteScalarContainer {\n onDeleteScalarContainer {\n __typename\n id\n myString\n myInt\n myDouble\n myBool\n myDate\n myTime\n myDateTime\n myTimeStamp\n myEmail\n myJSON\n myPhone\n myURL\n myIPAddress\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onDeleteScalarContainer", type: .object(OnDeleteScalarContainer.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onDeleteScalarContainer: OnDeleteScalarContainer? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onDeleteScalarContainer": onDeleteScalarContainer.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onDeleteScalarContainer": onDeleteScalarContainer.flatMap(\.snapshot)]) } - + public var onDeleteScalarContainer: OnDeleteScalarContainer? { get { return (snapshot["onDeleteScalarContainer"] as? Snapshot).flatMap { OnDeleteScalarContainer(snapshot: $0) } @@ -42695,10 +42703,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onDeleteScalarContainer") } } - + public struct OnDeleteScalarContainer: GraphQLSelectionSet { public static let possibleTypes = ["ScalarContainer"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -42718,17 +42726,17 @@ public struct APISwift { 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, myString: String? = nil, myInt: Int? = nil, myDouble: Double? = nil, myBool: Bool? = nil, myDate: String? = nil, myTime: String? = nil, myDateTime: String? = nil, myTimeStamp: Int? = nil, myEmail: String? = nil, myJson: String? = nil, myPhone: String? = nil, myUrl: String? = nil, myIpAddress: String? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "ScalarContainer", "id": id, "myString": myString, "myInt": myInt, "myDouble": myDouble, "myBool": myBool, "myDate": myDate, "myTime": myTime, "myDateTime": myDateTime, "myTimeStamp": myTimeStamp, "myEmail": myEmail, "myJSON": myJson, "myPhone": myPhone, "myURL": myUrl, "myIPAddress": myIpAddress, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -42737,7 +42745,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -42746,7 +42754,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var myString: String? { get { return snapshot["myString"] as? String @@ -42755,7 +42763,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myString") } } - + public var myInt: Int? { get { return snapshot["myInt"] as? Int @@ -42764,7 +42772,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myInt") } } - + public var myDouble: Double? { get { return snapshot["myDouble"] as? Double @@ -42773,7 +42781,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myDouble") } } - + public var myBool: Bool? { get { return snapshot["myBool"] as? Bool @@ -42782,7 +42790,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myBool") } } - + public var myDate: String? { get { return snapshot["myDate"] as? String @@ -42791,7 +42799,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myDate") } } - + public var myTime: String? { get { return snapshot["myTime"] as? String @@ -42800,7 +42808,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myTime") } } - + public var myDateTime: String? { get { return snapshot["myDateTime"] as? String @@ -42809,7 +42817,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myDateTime") } } - + public var myTimeStamp: Int? { get { return snapshot["myTimeStamp"] as? Int @@ -42818,7 +42826,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myTimeStamp") } } - + public var myEmail: String? { get { return snapshot["myEmail"] as? String @@ -42827,7 +42835,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myEmail") } } - + public var myJson: String? { get { return snapshot["myJSON"] as? String @@ -42836,7 +42844,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myJSON") } } - + public var myPhone: String? { get { return snapshot["myPhone"] as? String @@ -42845,7 +42853,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myPhone") } } - + public var myUrl: String? { get { return snapshot["myURL"] as? String @@ -42854,7 +42862,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myURL") } } - + public var myIpAddress: String? { get { return snapshot["myIPAddress"] as? String @@ -42863,7 +42871,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "myIPAddress") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -42872,7 +42880,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -42884,31 +42892,31 @@ public struct APISwift { } } } - + public final class OnCreateListIntContainerSubscription: GraphQLSubscription { public static let operationString = "subscription OnCreateListIntContainer {\n onCreateListIntContainer {\n __typename\n id\n test\n nullableInt\n intList\n intNullableList\n nullableIntList\n nullableIntNullableList\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onCreateListIntContainer", type: .object(OnCreateListIntContainer.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onCreateListIntContainer: OnCreateListIntContainer? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onCreateListIntContainer": onCreateListIntContainer.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onCreateListIntContainer": onCreateListIntContainer.flatMap(\.snapshot)]) } - + public var onCreateListIntContainer: OnCreateListIntContainer? { get { return (snapshot["onCreateListIntContainer"] as? Snapshot).flatMap { OnCreateListIntContainer(snapshot: $0) } @@ -42917,10 +42925,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onCreateListIntContainer") } } - + public struct OnCreateListIntContainer: GraphQLSelectionSet { public static let possibleTypes = ["ListIntContainer"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -42933,17 +42941,17 @@ public struct APISwift { 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, test: Int, nullableInt: Int? = nil, intList: [Int], intNullableList: [Int]? = nil, nullableIntList: [Int?], nullableIntNullableList: [Int?]? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "ListIntContainer", "id": id, "test": test, "nullableInt": nullableInt, "intList": intList, "intNullableList": intNullableList, "nullableIntList": nullableIntList, "nullableIntNullableList": nullableIntNullableList, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -42952,7 +42960,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -42961,7 +42969,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var test: Int { get { return snapshot["test"]! as! Int @@ -42970,7 +42978,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "test") } } - + public var nullableInt: Int? { get { return snapshot["nullableInt"] as? Int @@ -42979,7 +42987,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableInt") } } - + public var intList: [Int] { get { return snapshot["intList"]! as! [Int] @@ -42988,7 +42996,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "intList") } } - + public var intNullableList: [Int]? { get { return snapshot["intNullableList"] as? [Int] @@ -42997,7 +43005,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "intNullableList") } } - + public var nullableIntList: [Int?] { get { return snapshot["nullableIntList"]! as! [Int?] @@ -43006,7 +43014,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableIntList") } } - + public var nullableIntNullableList: [Int?]? { get { return snapshot["nullableIntNullableList"] as? [Int?] @@ -43015,7 +43023,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableIntNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -43024,7 +43032,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -43036,31 +43044,31 @@ public struct APISwift { } } } - + public final class OnUpdateListIntContainerSubscription: GraphQLSubscription { public static let operationString = "subscription OnUpdateListIntContainer {\n onUpdateListIntContainer {\n __typename\n id\n test\n nullableInt\n intList\n intNullableList\n nullableIntList\n nullableIntNullableList\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onUpdateListIntContainer", type: .object(OnUpdateListIntContainer.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onUpdateListIntContainer: OnUpdateListIntContainer? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onUpdateListIntContainer": onUpdateListIntContainer.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onUpdateListIntContainer": onUpdateListIntContainer.flatMap(\.snapshot)]) } - + public var onUpdateListIntContainer: OnUpdateListIntContainer? { get { return (snapshot["onUpdateListIntContainer"] as? Snapshot).flatMap { OnUpdateListIntContainer(snapshot: $0) } @@ -43069,10 +43077,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onUpdateListIntContainer") } } - + public struct OnUpdateListIntContainer: GraphQLSelectionSet { public static let possibleTypes = ["ListIntContainer"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -43085,17 +43093,17 @@ public struct APISwift { 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, test: Int, nullableInt: Int? = nil, intList: [Int], intNullableList: [Int]? = nil, nullableIntList: [Int?], nullableIntNullableList: [Int?]? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "ListIntContainer", "id": id, "test": test, "nullableInt": nullableInt, "intList": intList, "intNullableList": intNullableList, "nullableIntList": nullableIntList, "nullableIntNullableList": nullableIntNullableList, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -43104,7 +43112,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -43113,7 +43121,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var test: Int { get { return snapshot["test"]! as! Int @@ -43122,7 +43130,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "test") } } - + public var nullableInt: Int? { get { return snapshot["nullableInt"] as? Int @@ -43131,7 +43139,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableInt") } } - + public var intList: [Int] { get { return snapshot["intList"]! as! [Int] @@ -43140,7 +43148,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "intList") } } - + public var intNullableList: [Int]? { get { return snapshot["intNullableList"] as? [Int] @@ -43149,7 +43157,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "intNullableList") } } - + public var nullableIntList: [Int?] { get { return snapshot["nullableIntList"]! as! [Int?] @@ -43158,7 +43166,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableIntList") } } - + public var nullableIntNullableList: [Int?]? { get { return snapshot["nullableIntNullableList"] as? [Int?] @@ -43167,7 +43175,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableIntNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -43176,7 +43184,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -43188,31 +43196,31 @@ public struct APISwift { } } } - + public final class OnDeleteListIntContainerSubscription: GraphQLSubscription { public static let operationString = "subscription OnDeleteListIntContainer {\n onDeleteListIntContainer {\n __typename\n id\n test\n nullableInt\n intList\n intNullableList\n nullableIntList\n nullableIntNullableList\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onDeleteListIntContainer", type: .object(OnDeleteListIntContainer.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onDeleteListIntContainer: OnDeleteListIntContainer? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onDeleteListIntContainer": onDeleteListIntContainer.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onDeleteListIntContainer": onDeleteListIntContainer.flatMap(\.snapshot)]) } - + public var onDeleteListIntContainer: OnDeleteListIntContainer? { get { return (snapshot["onDeleteListIntContainer"] as? Snapshot).flatMap { OnDeleteListIntContainer(snapshot: $0) } @@ -43221,10 +43229,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onDeleteListIntContainer") } } - + public struct OnDeleteListIntContainer: GraphQLSelectionSet { public static let possibleTypes = ["ListIntContainer"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -43237,17 +43245,17 @@ public struct APISwift { 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, test: Int, nullableInt: Int? = nil, intList: [Int], intNullableList: [Int]? = nil, nullableIntList: [Int?], nullableIntNullableList: [Int?]? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "ListIntContainer", "id": id, "test": test, "nullableInt": nullableInt, "intList": intList, "intNullableList": intNullableList, "nullableIntList": nullableIntList, "nullableIntNullableList": nullableIntNullableList, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -43256,7 +43264,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -43265,7 +43273,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var test: Int { get { return snapshot["test"]! as! Int @@ -43274,7 +43282,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "test") } } - + public var nullableInt: Int? { get { return snapshot["nullableInt"] as? Int @@ -43283,7 +43291,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableInt") } } - + public var intList: [Int] { get { return snapshot["intList"]! as! [Int] @@ -43292,7 +43300,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "intList") } } - + public var intNullableList: [Int]? { get { return snapshot["intNullableList"] as? [Int] @@ -43301,7 +43309,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "intNullableList") } } - + public var nullableIntList: [Int?] { get { return snapshot["nullableIntList"]! as! [Int?] @@ -43310,7 +43318,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableIntList") } } - + public var nullableIntNullableList: [Int?]? { get { return snapshot["nullableIntNullableList"] as? [Int?] @@ -43319,7 +43327,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableIntNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -43328,7 +43336,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -43340,31 +43348,31 @@ public struct APISwift { } } } - + public final class OnCreateListStringContainerSubscription: GraphQLSubscription { public static let operationString = "subscription OnCreateListStringContainer {\n onCreateListStringContainer {\n __typename\n id\n test\n nullableString\n stringList\n stringNullableList\n nullableStringList\n nullableStringNullableList\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onCreateListStringContainer", type: .object(OnCreateListStringContainer.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onCreateListStringContainer: OnCreateListStringContainer? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onCreateListStringContainer": onCreateListStringContainer.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onCreateListStringContainer": onCreateListStringContainer.flatMap(\.snapshot)]) } - + public var onCreateListStringContainer: OnCreateListStringContainer? { get { return (snapshot["onCreateListStringContainer"] as? Snapshot).flatMap { OnCreateListStringContainer(snapshot: $0) } @@ -43373,10 +43381,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onCreateListStringContainer") } } - + public struct OnCreateListStringContainer: GraphQLSelectionSet { public static let possibleTypes = ["ListStringContainer"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -43389,17 +43397,17 @@ public struct APISwift { 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, test: String, nullableString: String? = nil, stringList: [String], stringNullableList: [String]? = nil, nullableStringList: [String?], nullableStringNullableList: [String?]? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "ListStringContainer", "id": id, "test": test, "nullableString": nullableString, "stringList": stringList, "stringNullableList": stringNullableList, "nullableStringList": nullableStringList, "nullableStringNullableList": nullableStringNullableList, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -43408,7 +43416,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -43417,7 +43425,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var test: String { get { return snapshot["test"]! as! String @@ -43426,7 +43434,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "test") } } - + public var nullableString: String? { get { return snapshot["nullableString"] as? String @@ -43435,7 +43443,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableString") } } - + public var stringList: [String] { get { return snapshot["stringList"]! as! [String] @@ -43444,7 +43452,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "stringList") } } - + public var stringNullableList: [String]? { get { return snapshot["stringNullableList"] as? [String] @@ -43453,7 +43461,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "stringNullableList") } } - + public var nullableStringList: [String?] { get { return snapshot["nullableStringList"]! as! [String?] @@ -43462,7 +43470,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableStringList") } } - + public var nullableStringNullableList: [String?]? { get { return snapshot["nullableStringNullableList"] as? [String?] @@ -43471,7 +43479,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableStringNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -43480,7 +43488,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -43492,31 +43500,31 @@ public struct APISwift { } } } - + public final class OnUpdateListStringContainerSubscription: GraphQLSubscription { public static let operationString = "subscription OnUpdateListStringContainer {\n onUpdateListStringContainer {\n __typename\n id\n test\n nullableString\n stringList\n stringNullableList\n nullableStringList\n nullableStringNullableList\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onUpdateListStringContainer", type: .object(OnUpdateListStringContainer.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onUpdateListStringContainer: OnUpdateListStringContainer? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onUpdateListStringContainer": onUpdateListStringContainer.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onUpdateListStringContainer": onUpdateListStringContainer.flatMap(\.snapshot)]) } - + public var onUpdateListStringContainer: OnUpdateListStringContainer? { get { return (snapshot["onUpdateListStringContainer"] as? Snapshot).flatMap { OnUpdateListStringContainer(snapshot: $0) } @@ -43525,10 +43533,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onUpdateListStringContainer") } } - + public struct OnUpdateListStringContainer: GraphQLSelectionSet { public static let possibleTypes = ["ListStringContainer"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -43541,17 +43549,17 @@ public struct APISwift { 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, test: String, nullableString: String? = nil, stringList: [String], stringNullableList: [String]? = nil, nullableStringList: [String?], nullableStringNullableList: [String?]? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "ListStringContainer", "id": id, "test": test, "nullableString": nullableString, "stringList": stringList, "stringNullableList": stringNullableList, "nullableStringList": nullableStringList, "nullableStringNullableList": nullableStringNullableList, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -43560,7 +43568,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -43569,7 +43577,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var test: String { get { return snapshot["test"]! as! String @@ -43578,7 +43586,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "test") } } - + public var nullableString: String? { get { return snapshot["nullableString"] as? String @@ -43587,7 +43595,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableString") } } - + public var stringList: [String] { get { return snapshot["stringList"]! as! [String] @@ -43596,7 +43604,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "stringList") } } - + public var stringNullableList: [String]? { get { return snapshot["stringNullableList"] as? [String] @@ -43605,7 +43613,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "stringNullableList") } } - + public var nullableStringList: [String?] { get { return snapshot["nullableStringList"]! as! [String?] @@ -43614,7 +43622,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableStringList") } } - + public var nullableStringNullableList: [String?]? { get { return snapshot["nullableStringNullableList"] as? [String?] @@ -43623,7 +43631,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableStringNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -43632,7 +43640,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -43644,31 +43652,31 @@ public struct APISwift { } } } - + public final class OnDeleteListStringContainerSubscription: GraphQLSubscription { public static let operationString = "subscription OnDeleteListStringContainer {\n onDeleteListStringContainer {\n __typename\n id\n test\n nullableString\n stringList\n stringNullableList\n nullableStringList\n nullableStringNullableList\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onDeleteListStringContainer", type: .object(OnDeleteListStringContainer.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onDeleteListStringContainer: OnDeleteListStringContainer? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onDeleteListStringContainer": onDeleteListStringContainer.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onDeleteListStringContainer": onDeleteListStringContainer.flatMap(\.snapshot)]) } - + public var onDeleteListStringContainer: OnDeleteListStringContainer? { get { return (snapshot["onDeleteListStringContainer"] as? Snapshot).flatMap { OnDeleteListStringContainer(snapshot: $0) } @@ -43677,10 +43685,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onDeleteListStringContainer") } } - + public struct OnDeleteListStringContainer: GraphQLSelectionSet { public static let possibleTypes = ["ListStringContainer"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -43693,17 +43701,17 @@ public struct APISwift { 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, test: String, nullableString: String? = nil, stringList: [String], stringNullableList: [String]? = nil, nullableStringList: [String?], nullableStringNullableList: [String?]? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "ListStringContainer", "id": id, "test": test, "nullableString": nullableString, "stringList": stringList, "stringNullableList": stringNullableList, "nullableStringList": nullableStringList, "nullableStringNullableList": nullableStringNullableList, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -43712,7 +43720,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -43721,7 +43729,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var test: String { get { return snapshot["test"]! as! String @@ -43730,7 +43738,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "test") } } - + public var nullableString: String? { get { return snapshot["nullableString"] as? String @@ -43739,7 +43747,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableString") } } - + public var stringList: [String] { get { return snapshot["stringList"]! as! [String] @@ -43748,7 +43756,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "stringList") } } - + public var stringNullableList: [String]? { get { return snapshot["stringNullableList"] as? [String] @@ -43757,7 +43765,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "stringNullableList") } } - + public var nullableStringList: [String?] { get { return snapshot["nullableStringList"]! as! [String?] @@ -43766,7 +43774,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableStringList") } } - + public var nullableStringNullableList: [String?]? { get { return snapshot["nullableStringNullableList"] as? [String?] @@ -43775,7 +43783,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableStringNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -43784,7 +43792,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -43796,31 +43804,31 @@ public struct APISwift { } } } - + public final class OnCreateEnumTestModelSubscription: GraphQLSubscription { public static let operationString = "subscription OnCreateEnumTestModel {\n onCreateEnumTestModel {\n __typename\n id\n enumVal\n nullableEnumVal\n enumList\n enumNullableList\n nullableEnumList\n nullableEnumNullableList\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onCreateEnumTestModel", type: .object(OnCreateEnumTestModel.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onCreateEnumTestModel: OnCreateEnumTestModel? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onCreateEnumTestModel": onCreateEnumTestModel.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onCreateEnumTestModel": onCreateEnumTestModel.flatMap(\.snapshot)]) } - + public var onCreateEnumTestModel: OnCreateEnumTestModel? { get { return (snapshot["onCreateEnumTestModel"] as? Snapshot).flatMap { OnCreateEnumTestModel(snapshot: $0) } @@ -43829,10 +43837,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onCreateEnumTestModel") } } - + public struct OnCreateEnumTestModel: GraphQLSelectionSet { public static let possibleTypes = ["EnumTestModel"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -43845,17 +43853,17 @@ public struct APISwift { 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, enumVal: TestEnum, nullableEnumVal: TestEnum? = nil, enumList: [TestEnum], enumNullableList: [TestEnum]? = nil, nullableEnumList: [TestEnum?], nullableEnumNullableList: [TestEnum?]? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "EnumTestModel", "id": id, "enumVal": enumVal, "nullableEnumVal": nullableEnumVal, "enumList": enumList, "enumNullableList": enumNullableList, "nullableEnumList": nullableEnumList, "nullableEnumNullableList": nullableEnumNullableList, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -43864,7 +43872,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -43873,7 +43881,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var enumVal: TestEnum { get { return snapshot["enumVal"]! as! TestEnum @@ -43882,7 +43890,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "enumVal") } } - + public var nullableEnumVal: TestEnum? { get { return snapshot["nullableEnumVal"] as? TestEnum @@ -43891,7 +43899,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableEnumVal") } } - + public var enumList: [TestEnum] { get { return snapshot["enumList"]! as! [TestEnum] @@ -43900,7 +43908,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "enumList") } } - + public var enumNullableList: [TestEnum]? { get { return snapshot["enumNullableList"] as? [TestEnum] @@ -43909,7 +43917,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "enumNullableList") } } - + public var nullableEnumList: [TestEnum?] { get { return snapshot["nullableEnumList"]! as! [TestEnum?] @@ -43918,7 +43926,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableEnumList") } } - + public var nullableEnumNullableList: [TestEnum?]? { get { return snapshot["nullableEnumNullableList"] as? [TestEnum?] @@ -43927,7 +43935,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableEnumNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -43936,7 +43944,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -43948,31 +43956,31 @@ public struct APISwift { } } } - + public final class OnUpdateEnumTestModelSubscription: GraphQLSubscription { public static let operationString = "subscription OnUpdateEnumTestModel {\n onUpdateEnumTestModel {\n __typename\n id\n enumVal\n nullableEnumVal\n enumList\n enumNullableList\n nullableEnumList\n nullableEnumNullableList\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onUpdateEnumTestModel", type: .object(OnUpdateEnumTestModel.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onUpdateEnumTestModel: OnUpdateEnumTestModel? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onUpdateEnumTestModel": onUpdateEnumTestModel.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onUpdateEnumTestModel": onUpdateEnumTestModel.flatMap(\.snapshot)]) } - + public var onUpdateEnumTestModel: OnUpdateEnumTestModel? { get { return (snapshot["onUpdateEnumTestModel"] as? Snapshot).flatMap { OnUpdateEnumTestModel(snapshot: $0) } @@ -43981,10 +43989,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onUpdateEnumTestModel") } } - + public struct OnUpdateEnumTestModel: GraphQLSelectionSet { public static let possibleTypes = ["EnumTestModel"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -43997,17 +44005,17 @@ public struct APISwift { 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, enumVal: TestEnum, nullableEnumVal: TestEnum? = nil, enumList: [TestEnum], enumNullableList: [TestEnum]? = nil, nullableEnumList: [TestEnum?], nullableEnumNullableList: [TestEnum?]? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "EnumTestModel", "id": id, "enumVal": enumVal, "nullableEnumVal": nullableEnumVal, "enumList": enumList, "enumNullableList": enumNullableList, "nullableEnumList": nullableEnumList, "nullableEnumNullableList": nullableEnumNullableList, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -44016,7 +44024,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -44025,7 +44033,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var enumVal: TestEnum { get { return snapshot["enumVal"]! as! TestEnum @@ -44034,7 +44042,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "enumVal") } } - + public var nullableEnumVal: TestEnum? { get { return snapshot["nullableEnumVal"] as? TestEnum @@ -44043,7 +44051,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableEnumVal") } } - + public var enumList: [TestEnum] { get { return snapshot["enumList"]! as! [TestEnum] @@ -44052,7 +44060,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "enumList") } } - + public var enumNullableList: [TestEnum]? { get { return snapshot["enumNullableList"] as? [TestEnum] @@ -44061,7 +44069,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "enumNullableList") } } - + public var nullableEnumList: [TestEnum?] { get { return snapshot["nullableEnumList"]! as! [TestEnum?] @@ -44070,7 +44078,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableEnumList") } } - + public var nullableEnumNullableList: [TestEnum?]? { get { return snapshot["nullableEnumNullableList"] as? [TestEnum?] @@ -44079,7 +44087,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableEnumNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -44088,7 +44096,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -44100,31 +44108,31 @@ public struct APISwift { } } } - + public final class OnDeleteEnumTestModelSubscription: GraphQLSubscription { public static let operationString = "subscription OnDeleteEnumTestModel {\n onDeleteEnumTestModel {\n __typename\n id\n enumVal\n nullableEnumVal\n enumList\n enumNullableList\n nullableEnumList\n nullableEnumNullableList\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onDeleteEnumTestModel", type: .object(OnDeleteEnumTestModel.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onDeleteEnumTestModel: OnDeleteEnumTestModel? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onDeleteEnumTestModel": onDeleteEnumTestModel.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onDeleteEnumTestModel": onDeleteEnumTestModel.flatMap(\.snapshot)]) } - + public var onDeleteEnumTestModel: OnDeleteEnumTestModel? { get { return (snapshot["onDeleteEnumTestModel"] as? Snapshot).flatMap { OnDeleteEnumTestModel(snapshot: $0) } @@ -44133,10 +44141,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onDeleteEnumTestModel") } } - + public struct OnDeleteEnumTestModel: GraphQLSelectionSet { public static let possibleTypes = ["EnumTestModel"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -44149,17 +44157,17 @@ public struct APISwift { 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, enumVal: TestEnum, nullableEnumVal: TestEnum? = nil, enumList: [TestEnum], enumNullableList: [TestEnum]? = nil, nullableEnumList: [TestEnum?], nullableEnumNullableList: [TestEnum?]? = nil, createdAt: String, updatedAt: String) { self.init(snapshot: ["__typename": "EnumTestModel", "id": id, "enumVal": enumVal, "nullableEnumVal": nullableEnumVal, "enumList": enumList, "enumNullableList": enumNullableList, "nullableEnumList": nullableEnumList, "nullableEnumNullableList": nullableEnumNullableList, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -44168,7 +44176,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -44177,7 +44185,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var enumVal: TestEnum { get { return snapshot["enumVal"]! as! TestEnum @@ -44186,7 +44194,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "enumVal") } } - + public var nullableEnumVal: TestEnum? { get { return snapshot["nullableEnumVal"] as? TestEnum @@ -44195,7 +44203,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableEnumVal") } } - + public var enumList: [TestEnum] { get { return snapshot["enumList"]! as! [TestEnum] @@ -44204,7 +44212,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "enumList") } } - + public var enumNullableList: [TestEnum]? { get { return snapshot["enumNullableList"] as? [TestEnum] @@ -44213,7 +44221,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "enumNullableList") } } - + public var nullableEnumList: [TestEnum?] { get { return snapshot["nullableEnumList"]! as! [TestEnum?] @@ -44222,7 +44230,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableEnumList") } } - + public var nullableEnumNullableList: [TestEnum?]? { get { return snapshot["nullableEnumNullableList"] as? [TestEnum?] @@ -44231,7 +44239,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "nullableEnumNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -44240,7 +44248,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -44252,31 +44260,31 @@ public struct APISwift { } } } - + public final class OnCreateNestedTypeTestModelSubscription: GraphQLSubscription { public static let operationString = "subscription OnCreateNestedTypeTestModel {\n onCreateNestedTypeTestModel {\n __typename\n id\n nestedVal {\n __typename\n valueOne\n valueTwo\n }\n nullableNestedVal {\n __typename\n valueOne\n valueTwo\n }\n nestedList {\n __typename\n valueOne\n valueTwo\n }\n nestedNullableList {\n __typename\n valueOne\n valueTwo\n }\n nullableNestedList {\n __typename\n valueOne\n valueTwo\n }\n nullableNestedNullableList {\n __typename\n valueOne\n valueTwo\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onCreateNestedTypeTestModel", type: .object(OnCreateNestedTypeTestModel.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onCreateNestedTypeTestModel: OnCreateNestedTypeTestModel? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onCreateNestedTypeTestModel": onCreateNestedTypeTestModel.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onCreateNestedTypeTestModel": onCreateNestedTypeTestModel.flatMap(\.snapshot)]) } - + public var onCreateNestedTypeTestModel: OnCreateNestedTypeTestModel? { get { return (snapshot["onCreateNestedTypeTestModel"] as? Snapshot).flatMap { OnCreateNestedTypeTestModel(snapshot: $0) } @@ -44285,10 +44293,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onCreateNestedTypeTestModel") } } - + public struct OnCreateNestedTypeTestModel: GraphQLSelectionSet { public static let possibleTypes = ["NestedTypeTestModel"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -44301,17 +44309,17 @@ public struct APISwift { 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, nestedVal: NestedVal, nullableNestedVal: NullableNestedVal? = nil, nestedList: [NestedList], nestedNullableList: [NestedNullableList]? = nil, nullableNestedList: [NullableNestedList?], nullableNestedNullableList: [NullableNestedNullableList?]? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "NestedTypeTestModel", "id": id, "nestedVal": nestedVal.snapshot, "nullableNestedVal": nullableNestedVal.flatMap { $0.snapshot }, "nestedList": nestedList.map { $0.snapshot }, "nestedNullableList": nestedNullableList.flatMap { $0.map { $0.snapshot } }, "nullableNestedList": nullableNestedList.map { $0.flatMap { $0.snapshot } }, "nullableNestedNullableList": nullableNestedNullableList.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "NestedTypeTestModel", "id": id, "nestedVal": nestedVal.snapshot, "nullableNestedVal": nullableNestedVal.flatMap(\.snapshot), "nestedList": nestedList.map(\.snapshot), "nestedNullableList": nestedNullableList.flatMap { $0.map(\.snapshot) }, "nullableNestedList": nullableNestedList.map { $0.flatMap(\.snapshot) }, "nullableNestedNullableList": nullableNestedNullableList.flatMap { $0.map { $0.flatMap(\.snapshot) } }, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -44320,7 +44328,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -44329,7 +44337,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var nestedVal: NestedVal { get { return NestedVal(snapshot: snapshot["nestedVal"]! as! Snapshot) @@ -44338,7 +44346,7 @@ public struct APISwift { snapshot.updateValue(newValue.snapshot, forKey: "nestedVal") } } - + public var nullableNestedVal: NullableNestedVal? { get { return (snapshot["nullableNestedVal"] as? Snapshot).flatMap { NullableNestedVal(snapshot: $0) } @@ -44347,43 +44355,43 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "nullableNestedVal") } } - + public var nestedList: [NestedList] { get { return (snapshot["nestedList"] as! [Snapshot]).map { NestedList(snapshot: $0) } } set { - snapshot.updateValue(newValue.map { $0.snapshot }, forKey: "nestedList") + snapshot.updateValue(newValue.map(\.snapshot), forKey: "nestedList") } } - + public var nestedNullableList: [NestedNullableList]? { get { return (snapshot["nestedNullableList"] as? [Snapshot]).flatMap { $0.map { NestedNullableList(snapshot: $0) } } } set { - snapshot.updateValue(newValue.flatMap { $0.map { $0.snapshot } }, forKey: "nestedNullableList") + snapshot.updateValue(newValue.flatMap { $0.map(\.snapshot) }, forKey: "nestedNullableList") } } - + public var nullableNestedList: [NullableNestedList?] { get { return (snapshot["nullableNestedList"] as! [Snapshot?]).map { $0.flatMap { NullableNestedList(snapshot: $0) } } } set { - snapshot.updateValue(newValue.map { $0.flatMap { $0.snapshot } }, forKey: "nullableNestedList") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "nullableNestedList") } } - + public var nullableNestedNullableList: [NullableNestedNullableList?]? { get { return (snapshot["nullableNestedNullableList"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { NullableNestedNullableList(snapshot: $0) } } } } set { - snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "nullableNestedNullableList") + snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap(\.snapshot) } }, forKey: "nullableNestedNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -44392,7 +44400,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -44401,26 +44409,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct NestedVal: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -44429,7 +44437,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -44438,7 +44446,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -44448,26 +44456,26 @@ public struct APISwift { } } } - + public struct NullableNestedVal: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -44476,7 +44484,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -44485,7 +44493,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -44495,26 +44503,26 @@ public struct APISwift { } } } - + public struct NestedList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -44523,7 +44531,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -44532,7 +44540,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -44542,26 +44550,26 @@ public struct APISwift { } } } - + public struct NestedNullableList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -44570,7 +44578,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -44579,7 +44587,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -44589,26 +44597,26 @@ public struct APISwift { } } } - + public struct NullableNestedList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -44617,7 +44625,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -44626,7 +44634,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -44636,26 +44644,26 @@ public struct APISwift { } } } - + public struct NullableNestedNullableList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -44664,7 +44672,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -44673,7 +44681,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -44686,31 +44694,31 @@ public struct APISwift { } } } - + public final class OnUpdateNestedTypeTestModelSubscription: GraphQLSubscription { public static let operationString = "subscription OnUpdateNestedTypeTestModel {\n onUpdateNestedTypeTestModel {\n __typename\n id\n nestedVal {\n __typename\n valueOne\n valueTwo\n }\n nullableNestedVal {\n __typename\n valueOne\n valueTwo\n }\n nestedList {\n __typename\n valueOne\n valueTwo\n }\n nestedNullableList {\n __typename\n valueOne\n valueTwo\n }\n nullableNestedList {\n __typename\n valueOne\n valueTwo\n }\n nullableNestedNullableList {\n __typename\n valueOne\n valueTwo\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onUpdateNestedTypeTestModel", type: .object(OnUpdateNestedTypeTestModel.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onUpdateNestedTypeTestModel: OnUpdateNestedTypeTestModel? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onUpdateNestedTypeTestModel": onUpdateNestedTypeTestModel.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onUpdateNestedTypeTestModel": onUpdateNestedTypeTestModel.flatMap(\.snapshot)]) } - + public var onUpdateNestedTypeTestModel: OnUpdateNestedTypeTestModel? { get { return (snapshot["onUpdateNestedTypeTestModel"] as? Snapshot).flatMap { OnUpdateNestedTypeTestModel(snapshot: $0) } @@ -44719,10 +44727,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onUpdateNestedTypeTestModel") } } - + public struct OnUpdateNestedTypeTestModel: GraphQLSelectionSet { public static let possibleTypes = ["NestedTypeTestModel"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -44735,17 +44743,17 @@ public struct APISwift { 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, nestedVal: NestedVal, nullableNestedVal: NullableNestedVal? = nil, nestedList: [NestedList], nestedNullableList: [NestedNullableList]? = nil, nullableNestedList: [NullableNestedList?], nullableNestedNullableList: [NullableNestedNullableList?]? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "NestedTypeTestModel", "id": id, "nestedVal": nestedVal.snapshot, "nullableNestedVal": nullableNestedVal.flatMap { $0.snapshot }, "nestedList": nestedList.map { $0.snapshot }, "nestedNullableList": nestedNullableList.flatMap { $0.map { $0.snapshot } }, "nullableNestedList": nullableNestedList.map { $0.flatMap { $0.snapshot } }, "nullableNestedNullableList": nullableNestedNullableList.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "NestedTypeTestModel", "id": id, "nestedVal": nestedVal.snapshot, "nullableNestedVal": nullableNestedVal.flatMap(\.snapshot), "nestedList": nestedList.map(\.snapshot), "nestedNullableList": nestedNullableList.flatMap { $0.map(\.snapshot) }, "nullableNestedList": nullableNestedList.map { $0.flatMap(\.snapshot) }, "nullableNestedNullableList": nullableNestedNullableList.flatMap { $0.map { $0.flatMap(\.snapshot) } }, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -44754,7 +44762,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -44763,7 +44771,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var nestedVal: NestedVal { get { return NestedVal(snapshot: snapshot["nestedVal"]! as! Snapshot) @@ -44772,7 +44780,7 @@ public struct APISwift { snapshot.updateValue(newValue.snapshot, forKey: "nestedVal") } } - + public var nullableNestedVal: NullableNestedVal? { get { return (snapshot["nullableNestedVal"] as? Snapshot).flatMap { NullableNestedVal(snapshot: $0) } @@ -44781,43 +44789,43 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "nullableNestedVal") } } - + public var nestedList: [NestedList] { get { return (snapshot["nestedList"] as! [Snapshot]).map { NestedList(snapshot: $0) } } set { - snapshot.updateValue(newValue.map { $0.snapshot }, forKey: "nestedList") + snapshot.updateValue(newValue.map(\.snapshot), forKey: "nestedList") } } - + public var nestedNullableList: [NestedNullableList]? { get { return (snapshot["nestedNullableList"] as? [Snapshot]).flatMap { $0.map { NestedNullableList(snapshot: $0) } } } set { - snapshot.updateValue(newValue.flatMap { $0.map { $0.snapshot } }, forKey: "nestedNullableList") + snapshot.updateValue(newValue.flatMap { $0.map(\.snapshot) }, forKey: "nestedNullableList") } } - + public var nullableNestedList: [NullableNestedList?] { get { return (snapshot["nullableNestedList"] as! [Snapshot?]).map { $0.flatMap { NullableNestedList(snapshot: $0) } } } set { - snapshot.updateValue(newValue.map { $0.flatMap { $0.snapshot } }, forKey: "nullableNestedList") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "nullableNestedList") } } - + public var nullableNestedNullableList: [NullableNestedNullableList?]? { get { return (snapshot["nullableNestedNullableList"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { NullableNestedNullableList(snapshot: $0) } } } } set { - snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "nullableNestedNullableList") + snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap(\.snapshot) } }, forKey: "nullableNestedNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -44826,7 +44834,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -44835,26 +44843,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct NestedVal: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -44863,7 +44871,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -44872,7 +44880,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -44882,26 +44890,26 @@ public struct APISwift { } } } - + public struct NullableNestedVal: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -44910,7 +44918,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -44919,7 +44927,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -44929,26 +44937,26 @@ public struct APISwift { } } } - + public struct NestedList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -44957,7 +44965,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -44966,7 +44974,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -44976,26 +44984,26 @@ public struct APISwift { } } } - + public struct NestedNullableList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -45004,7 +45012,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -45013,7 +45021,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -45023,26 +45031,26 @@ public struct APISwift { } } } - + public struct NullableNestedList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -45051,7 +45059,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -45060,7 +45068,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -45070,26 +45078,26 @@ public struct APISwift { } } } - + public struct NullableNestedNullableList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -45098,7 +45106,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -45107,7 +45115,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -45120,31 +45128,31 @@ public struct APISwift { } } } - + public final class OnDeleteNestedTypeTestModelSubscription: GraphQLSubscription { public static let operationString = "subscription OnDeleteNestedTypeTestModel {\n onDeleteNestedTypeTestModel {\n __typename\n id\n nestedVal {\n __typename\n valueOne\n valueTwo\n }\n nullableNestedVal {\n __typename\n valueOne\n valueTwo\n }\n nestedList {\n __typename\n valueOne\n valueTwo\n }\n nestedNullableList {\n __typename\n valueOne\n valueTwo\n }\n nullableNestedList {\n __typename\n valueOne\n valueTwo\n }\n nullableNestedNullableList {\n __typename\n valueOne\n valueTwo\n }\n createdAt\n updatedAt\n }\n}" - + public init() { } - + public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("onDeleteNestedTypeTestModel", type: .object(OnDeleteNestedTypeTestModel.selections)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(onDeleteNestedTypeTestModel: OnDeleteNestedTypeTestModel? = nil) { - self.init(snapshot: ["__typename": "Subscription", "onDeleteNestedTypeTestModel": onDeleteNestedTypeTestModel.flatMap { $0.snapshot }]) + self.init(snapshot: ["__typename": "Subscription", "onDeleteNestedTypeTestModel": onDeleteNestedTypeTestModel.flatMap(\.snapshot)]) } - + public var onDeleteNestedTypeTestModel: OnDeleteNestedTypeTestModel? { get { return (snapshot["onDeleteNestedTypeTestModel"] as? Snapshot).flatMap { OnDeleteNestedTypeTestModel(snapshot: $0) } @@ -45153,10 +45161,10 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "onDeleteNestedTypeTestModel") } } - + public struct OnDeleteNestedTypeTestModel: GraphQLSelectionSet { public static let possibleTypes = ["NestedTypeTestModel"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), @@ -45169,17 +45177,17 @@ public struct APISwift { 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, nestedVal: NestedVal, nullableNestedVal: NullableNestedVal? = nil, nestedList: [NestedList], nestedNullableList: [NestedNullableList]? = nil, nullableNestedList: [NullableNestedList?], nullableNestedNullableList: [NullableNestedNullableList?]? = nil, createdAt: String, updatedAt: String) { - self.init(snapshot: ["__typename": "NestedTypeTestModel", "id": id, "nestedVal": nestedVal.snapshot, "nullableNestedVal": nullableNestedVal.flatMap { $0.snapshot }, "nestedList": nestedList.map { $0.snapshot }, "nestedNullableList": nestedNullableList.flatMap { $0.map { $0.snapshot } }, "nullableNestedList": nullableNestedList.map { $0.flatMap { $0.snapshot } }, "nullableNestedNullableList": nullableNestedNullableList.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, "createdAt": createdAt, "updatedAt": updatedAt]) + self.init(snapshot: ["__typename": "NestedTypeTestModel", "id": id, "nestedVal": nestedVal.snapshot, "nullableNestedVal": nullableNestedVal.flatMap(\.snapshot), "nestedList": nestedList.map(\.snapshot), "nestedNullableList": nestedNullableList.flatMap { $0.map(\.snapshot) }, "nullableNestedList": nullableNestedList.map { $0.flatMap(\.snapshot) }, "nullableNestedNullableList": nullableNestedNullableList.flatMap { $0.map { $0.flatMap(\.snapshot) } }, "createdAt": createdAt, "updatedAt": updatedAt]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -45188,7 +45196,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -45197,7 +45205,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var nestedVal: NestedVal { get { return NestedVal(snapshot: snapshot["nestedVal"]! as! Snapshot) @@ -45206,7 +45214,7 @@ public struct APISwift { snapshot.updateValue(newValue.snapshot, forKey: "nestedVal") } } - + public var nullableNestedVal: NullableNestedVal? { get { return (snapshot["nullableNestedVal"] as? Snapshot).flatMap { NullableNestedVal(snapshot: $0) } @@ -45215,43 +45223,43 @@ public struct APISwift { snapshot.updateValue(newValue?.snapshot, forKey: "nullableNestedVal") } } - + public var nestedList: [NestedList] { get { return (snapshot["nestedList"] as! [Snapshot]).map { NestedList(snapshot: $0) } } set { - snapshot.updateValue(newValue.map { $0.snapshot }, forKey: "nestedList") + snapshot.updateValue(newValue.map(\.snapshot), forKey: "nestedList") } } - + public var nestedNullableList: [NestedNullableList]? { get { return (snapshot["nestedNullableList"] as? [Snapshot]).flatMap { $0.map { NestedNullableList(snapshot: $0) } } } set { - snapshot.updateValue(newValue.flatMap { $0.map { $0.snapshot } }, forKey: "nestedNullableList") + snapshot.updateValue(newValue.flatMap { $0.map(\.snapshot) }, forKey: "nestedNullableList") } } - + public var nullableNestedList: [NullableNestedList?] { get { return (snapshot["nullableNestedList"] as! [Snapshot?]).map { $0.flatMap { NullableNestedList(snapshot: $0) } } } set { - snapshot.updateValue(newValue.map { $0.flatMap { $0.snapshot } }, forKey: "nullableNestedList") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "nullableNestedList") } } - + public var nullableNestedNullableList: [NullableNestedNullableList?]? { get { return (snapshot["nullableNestedNullableList"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { NullableNestedNullableList(snapshot: $0) } } } } set { - snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "nullableNestedNullableList") + snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap(\.snapshot) } }, forKey: "nullableNestedNullableList") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -45260,7 +45268,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -45269,26 +45277,26 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "updatedAt") } } - + public struct NestedVal: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -45297,7 +45305,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -45306,7 +45314,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -45316,26 +45324,26 @@ public struct APISwift { } } } - + public struct NullableNestedVal: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -45344,7 +45352,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -45353,7 +45361,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -45363,26 +45371,26 @@ public struct APISwift { } } } - + public struct NestedList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -45391,7 +45399,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -45400,7 +45408,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -45410,26 +45418,26 @@ public struct APISwift { } } } - + public struct NestedNullableList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -45438,7 +45446,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -45447,7 +45455,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -45457,26 +45465,26 @@ public struct APISwift { } } } - + public struct NullableNestedList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -45485,7 +45493,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -45494,7 +45502,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String @@ -45504,26 +45512,26 @@ public struct APISwift { } } } - + public struct NullableNestedNullableList: GraphQLSelectionSet { public static let possibleTypes = ["Nested"] - + public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("valueOne", type: .scalar(Int.self)), GraphQLField("valueTwo", type: .scalar(String.self)), ] - + public var snapshot: Snapshot - + public init(snapshot: Snapshot) { self.snapshot = snapshot } - + public init(valueOne: Int? = nil, valueTwo: String? = nil) { self.init(snapshot: ["__typename": "Nested", "valueOne": valueOne, "valueTwo": valueTwo]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -45532,7 +45540,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var valueOne: Int? { get { return snapshot["valueOne"] as? Int @@ -45541,7 +45549,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "valueOne") } } - + public var valueTwo: String? { get { return snapshot["valueTwo"] as? String diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/AnyModelIntegrationTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/AnyModelIntegrationTests.swift index 8a6397c488..7d4072e55d 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/AnyModelIntegrationTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/AnyModelIntegrationTests.swift @@ -5,11 +5,11 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest -import Foundation import AWSAPIPlugin -@testable import APIHostApp +import Foundation +import XCTest @testable import Amplify +@testable import APIHostApp class AnyModelIntegrationTests: XCTestCase { let networkTimeout: TimeInterval = 180.0 @@ -42,9 +42,11 @@ class AnyModelIntegrationTests: XCTestCase { func testCreateAsAnyModel() throws { let createdAt: Temporal.DateTime = .now() let content = "Original post content as of \(createdAt)" - let originalPost = Post(title: "Post title", - content: content, - createdAt: createdAt) + let originalPost = Post( + title: "Post title", + content: content, + createdAt: createdAt + ) let anyPost = try originalPost.eraseToAnyModel() let callbackInvoked = expectation(description: "Callback invoked") @@ -96,9 +98,11 @@ class AnyModelIntegrationTests: XCTestCase { func testUpdateAsAnyModel() throws { let createdAt: Temporal.DateTime = .now() let content = "Original post content as of \(createdAt)" - let originalPost = Post(title: "Post title", - content: content, - createdAt: createdAt) + let originalPost = Post( + title: "Post title", + content: content, + createdAt: createdAt + ) let originalAnyPost = try originalPost.eraseToAnyModel() let createCallbackInvoked = expectation(description: "Create callback invoked") @@ -161,9 +165,11 @@ class AnyModelIntegrationTests: XCTestCase { func testDeleteAsAnyModel() throws { let createdAt: Temporal.DateTime = .now() let content = "Original post content as of \(createdAt)" - let originalPost = Post(title: "Post title", - content: content, - createdAt: createdAt) + let originalPost = Post( + title: "Post title", + content: content, + createdAt: createdAt + ) let originalAnyPost = try originalPost.eraseToAnyModel() let createCallbackInvoked = expectation(description: "Create callback invoked") diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/AppSyncRealTimeClientTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/AppSyncRealTimeClientTests.swift index c151f9c50c..20bfe181f1 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/AppSyncRealTimeClientTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/AppSyncRealTimeClientTests.swift @@ -5,9 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // - -import XCTest import Combine +import XCTest @testable import Amplify @testable import AWSAPIPlugin @testable @_spi(WebSocket) import AWSPluginsCore @@ -38,7 +37,7 @@ class AppSyncRealTimeClientTests: XCTestCase { let data = try TestConfigHelper.retrieve( forResource: GraphQLModelBasedTests.amplifyConfiguration ) - + let amplifyConfig = try JSONDecoder().decode(JSONValue.self, from: data) let (endpoint, apiKey) = (amplifyConfig.api?.plugins?.awsAPIPlugin?.asObject?.values .map { ($0.endpoint?.stringValue, $0.apiKey?.stringValue)} @@ -82,7 +81,7 @@ class AppSyncRealTimeClientTests: XCTestCase { }?.store(in: &cancellables) await fulfillment(of: [subscribedExpectation], timeout: 5) - withExtendedLifetime(cancellables, { }) + withExtendedLifetime(cancellables) { } } func testMultThreads_withConnectedClient_subscribeAndUnsubscribe() async throws { @@ -97,11 +96,11 @@ class AppSyncRealTimeClientTests: XCTestCase { of: AnyCancellable?.self, returning: [AnyCancellable?].self ) { taskGroup in - (0.. AnyCancellable? in guard let self else { return nil } - let subscription = try await self.makeOneSubscription(id: id) { + let subscription = try await makeOneSubscription(id: id) { if case .subscribed = $0 { expectedSubscription.fulfill() Task { @@ -121,7 +120,7 @@ class AppSyncRealTimeClientTests: XCTestCase { } await fulfillment(of: [expectedSubscription, expectedUnsubscription], timeout: 3) - withExtendedLifetime(cancellables, { }) + withExtendedLifetime(cancellables) { } } func testMaxSubscriptionReached_throwMaxSubscriptionsReachedError() async throws { @@ -133,11 +132,11 @@ class AppSyncRealTimeClientTests: XCTestCase { of: AnyCancellable?.self, returning: [AnyCancellable?].self ) { taskGroup in - (0.. AnyCancellable? in guard let self else { return nil } - let subscription = try await self.makeOneSubscription(id: id) { + let subscription = try await makeOneSubscription(id: id) { if case .subscribed = $0 { maxSubsctiptionsSuccess.fulfill() } @@ -154,7 +153,7 @@ class AppSyncRealTimeClientTests: XCTestCase { let maxSubscriptionReachedError = expectation(description: "Should return max subscription reached error") maxSubscriptionReachedError.assertForOverFulfill = false let retryTriggerredAndSucceed = expectation(description: "Retry on max subscription reached error and succeed") - cancellables.append(try await makeOneSubscription { event in + try await cancellables.append(makeOneSubscription { event in if case .error(let errors) = event { XCTAssertTrue(errors.count == 1) XCTAssertTrue(errors[0] is AppSyncRealTimeRequest.Error) @@ -167,7 +166,7 @@ class AppSyncRealTimeClientTests: XCTestCase { } }) await fulfillment(of: [maxSubscriptionReachedError, retryTriggerredAndSucceed], timeout: 5, enforceOrder: true) - withExtendedLifetime(cancellables, { }) + withExtendedLifetime(cancellables) { } } private func makeOneSubscription( @@ -176,7 +175,7 @@ class AppSyncRealTimeClientTests: XCTestCase { ) async throws -> AnyCancellable? { let subscription = try await appSyncRealTimeClient?.subscribe( id: id, - query: Self.appSyncQuery(with: self.subscriptionRequest) + query: Self.appSyncQuery(with: subscriptionRequest) ).sink(receiveValue: { onSubscriptionEvents?($0) }) @@ -195,7 +194,7 @@ class AppSyncRealTimeClientTests: XCTestCase { ) throws -> String { let payload: JSONValue = .object([ "query": .string(query), - "variables": (variables.isEmpty ? .null : .object(variables)) + "variables": variables.isEmpty ? .null : .object(variables) ]) let data = try JSONEncoder().encode(payload) return String(data: data, encoding: .utf8)! diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario1APISwiftTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario1APISwiftTests.swift index 5dacaf7714..b180310ecb 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario1APISwiftTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario1APISwiftTests.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import Amplify +import XCTest #if os(watchOS) @testable import APIWatchApp #else @@ -14,14 +14,15 @@ import Amplify #endif extension GraphQLConnectionScenario1Tests { - + func createTeamAPISwift() async throws -> APISwift.CreateTeam1Mutation.Data.CreateTeam1? { let input = APISwift.CreateTeam1Input(name: "name".withUUID) let mutation = APISwift.CreateTeam1Mutation(input: input) let request = GraphQLRequest( document: APISwift.CreateTeam1Mutation.operationString, variables: mutation.variables?.jsonObject, - responseType: APISwift.CreateTeam1Mutation.Data.self) + responseType: APISwift.CreateTeam1Mutation.Data.self + ) let response = try await Amplify.API.mutate(request: request) switch response { case .success(let data): @@ -30,15 +31,16 @@ extension GraphQLConnectionScenario1Tests { throw graphQLResponseError } } - + func createProjectAPISwift(with team: APISwift.CreateTeam1Mutation.Data.CreateTeam1? = nil) async throws -> APISwift.CreateProject1Mutation.Data.CreateProject1? { - + let input = APISwift.CreateProject1Input(project1TeamId: team?.id) let mutation = APISwift.CreateProject1Mutation(input: input) let request = GraphQLRequest( document: APISwift.CreateProject1Mutation.operationString, variables: mutation.variables?.jsonObject, - responseType: APISwift.CreateProject1Mutation.Data.self) + responseType: APISwift.CreateProject1Mutation.Data.self + ) let response = try await Amplify.API.mutate(request: request) switch response { case .success(let data): @@ -47,14 +49,15 @@ extension GraphQLConnectionScenario1Tests { throw graphQLResponseError } } - + func updateProjectAPISwift(projectId: String, teamId: String) async throws -> APISwift.UpdateProject1Mutation.Data.UpdateProject1? { let input = APISwift.UpdateProject1Input(id: projectId, project1TeamId: teamId) let mutation = APISwift.UpdateProject1Mutation(input: input) let request = GraphQLRequest( document: APISwift.UpdateProject1Mutation.operationString, variables: mutation.variables?.jsonObject, - responseType: APISwift.UpdateProject1Mutation.Data.self) + responseType: APISwift.UpdateProject1Mutation.Data.self + ) let response = try await Amplify.API.mutate(request: request) switch response { case .success(let data): @@ -63,14 +66,15 @@ extension GraphQLConnectionScenario1Tests { throw graphQLResponseError } } - + func deleteProjectAPISwift(projectId: String) async throws -> APISwift.DeleteProject1Mutation.Data.DeleteProject1? { let input = APISwift.DeleteProject1Input(id: projectId) let mutation = APISwift.DeleteProject1Mutation(input: input) let request = GraphQLRequest( document: APISwift.DeleteProject1Mutation.operationString, variables: mutation.variables?.jsonObject, - responseType: APISwift.DeleteProject1Mutation.Data.self) + responseType: APISwift.DeleteProject1Mutation.Data.self + ) let response = try await Amplify.API.mutate(request: request) switch response { case .success(let data): @@ -79,13 +83,14 @@ extension GraphQLConnectionScenario1Tests { throw graphQLResponseError } } - + func getProjectAPISwift(projectId: String) async throws -> APISwift.GetProject1Query.Data.GetProject1? { let query = APISwift.GetProject1Query(id: projectId) let request = GraphQLRequest( document: APISwift.GetProject1Query.operationString, variables: query.variables?.jsonObject, - responseType: APISwift.GetProject1Query.Data.self) + responseType: APISwift.GetProject1Query.Data.self + ) let response = try await Amplify.API.query(request: request) switch response { case .success(let data): @@ -94,13 +99,14 @@ extension GraphQLConnectionScenario1Tests { throw graphQLResponseError } } - + func listProjectsAPISwift() async throws -> APISwift.ListProject1sQuery.Data.ListProject1? { let query = APISwift.ListProject1sQuery(limit: 1) let request = GraphQLRequest( document: APISwift.ListProject1sQuery.operationString, variables: query.variables?.jsonObject, - responseType: APISwift.ListProject1sQuery.Data.self) + responseType: APISwift.ListProject1sQuery.Data.self + ) let response = try await Amplify.API.query(request: request) switch response { case .success(let data): @@ -109,33 +115,35 @@ extension GraphQLConnectionScenario1Tests { throw graphQLResponseError } } - + func testCreateTeamAPISwift() async throws { guard try await createTeamAPISwift() != nil else { XCTFail("Could not create team") return } } - + func testCreateProject() async throws { guard try await createProjectAPISwift() != nil else { XCTFail("Could not create team") return } } - + func testCreateAndGetProjectAPISwift() async throws { guard let team = try await createTeamAPISwift(), - let project = try await createProjectAPISwift(with: team) else { + let project = try await createProjectAPISwift(with: team) + else { XCTFail("Could not create team and a project") return } - + let query = APISwift.GetProject1Query(id: project.id) let request = GraphQLRequest( document: APISwift.GetProject1Query.operationString, variables: query.variables?.jsonObject, - responseType: APISwift.GetProject1Query.Data.self) + responseType: APISwift.GetProject1Query.Data.self + ) let result = try await Amplify.API.query(request: request) switch result { case .success(let data): @@ -153,10 +161,11 @@ extension GraphQLConnectionScenario1Tests { XCTFail("Failed with: \(response)") } } - + func testUpdateProjectWithAnotherTeamAPISwift() async throws { guard let team = try await createTeamAPISwift(), - let project = try await createProjectAPISwift(with: team) else { + let project = try await createProjectAPISwift(with: team) + else { XCTFail("Could not create a Team") return } @@ -164,33 +173,34 @@ extension GraphQLConnectionScenario1Tests { XCTFail("Failed to create another team") return } - + guard let updatedProject = try await updateProjectAPISwift(projectId: project.id, teamId: createdAnotherTeam.id) else { XCTFail("Failed to update project to another team") return } XCTAssertEqual(updatedProject.team?.id, createdAnotherTeam.id) } - + func testDeleteAndGetProjectAPISwift() async throws { guard let team = try await createTeamAPISwift(), - let project = try await createProjectAPISwift(with: team) else { + let project = try await createProjectAPISwift(with: team) + else { XCTFail("Could not create team and a project") return } - + guard let deletedProject = try await deleteProjectAPISwift(projectId: project.id) else { XCTFail("Could not delete project") return } XCTAssertEqual(deletedProject.id, project.id) - + guard try await getProjectAPISwift(projectId: project.id) == nil else { XCTFail("Project after deletion should be nil") return } } - + func testListProjectsAPISwift() async throws { guard let projects = try await listProjectsAPISwift() else { XCTFail("Could not list projects") diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario1Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario1Tests.swift index 89f05f502d..ccaa635436 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario1Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario1Tests.swift @@ -6,8 +6,8 @@ // import XCTest -@testable import AWSAPIPlugin @testable import Amplify +@testable import AWSAPIPlugin #if os(watchOS) @testable import APIWatchApp #else @@ -32,35 +32,36 @@ import XCTest */ class GraphQLConnectionScenario1Tests: XCTestCase { - + override func setUp() async throws { do { Amplify.Logging.logLevel = .verbose try Amplify.add(plugin: AWSAPIPlugin()) - + let amplifyConfig = try TestConfigHelper.retrieveAmplifyConfiguration( forResource: GraphQLModelBasedTests.amplifyConfiguration) try Amplify.configure(amplifyConfig) - + ModelRegistry.register(modelType: Project1.self) ModelRegistry.register(modelType: Team1.self) - + } catch { XCTFail("Error during setup: \(error)") } } - + override func tearDown() async throws { await Amplify.reset() } - + func testCreateAndGetProject() async throws { guard let team = try await createTeam(name: "name".withUUID), - let project = try await createProject(team: team) else { + let project = try await createProject(team: team) + else { XCTFail("Could not create team and a project") return } - + let result = try await Amplify.API.query(request: .get(Project1.self, byId: project.id)) switch result { case .success(let queriedProjectOptional): @@ -74,10 +75,11 @@ class GraphQLConnectionScenario1Tests: XCTestCase { XCTFail("Failed with: \(response)") } } - + func testUpdateProjectWithAnotherTeam() async throws { guard let team = try await createTeam(name: "name".withUUID), - var project = try await createProject(team: team) else { + var project = try await createProject(team: team) + else { XCTFail("Could not create a Team") return } @@ -94,10 +96,11 @@ class GraphQLConnectionScenario1Tests: XCTestCase { } XCTAssertEqual(updatedProject.team, anotherTeam) } - + func testDeleteAndGetProject() async throws { guard let team = try await createTeam(name: "name".withUUID), - let project = try await createProject(team: team) else { + let project = try await createProject(team: team) + else { XCTFail("Could not create team and a project") return } @@ -120,12 +123,13 @@ class GraphQLConnectionScenario1Tests: XCTestCase { XCTFail("Failed with: \(response)") } } - + // The filter we are passing into is the ProjectTeamID, but the API doesn't have the field ProjectTeamID // so we are disabling it func testListProjectsByTeamID() async throws { guard let team = try await createTeam(name: "name".withUUID), - let project = try await createProject(team: team) else { + let project = try await createProject(team: team) + else { XCTFail("Could not create team and a project") return } @@ -139,23 +143,24 @@ class GraphQLConnectionScenario1Tests: XCTestCase { XCTFail("Failed with: \(response)") } } - + func testPaginatedListProjects() async throws { let testCompleted = expectation(description: "test completed") Task { guard let team = try await createTeam(name: "name".withUUID), let projecta = try await createProject(team: team), - let projectb = try await createProject(team: team) else { + let projectb = try await createProject(team: team) + else { XCTFail("Could not create team and two projects") return } - + var results: List? let predicate = Project1.keys.id == projecta.id || Project1.keys.id == projectb.id let request: GraphQLRequest> = GraphQLRequest.list(Project1.self, where: predicate) - + let result = try await Amplify.API.query(request: request) - + guard case .success(let projects) = result else { XCTFail("Missing Successful response") return @@ -177,7 +182,7 @@ class GraphQLConnectionScenario1Tests: XCTestCase { } await fulfillment(of: [testCompleted], timeout: TestCommonConstants.networkTimeout) } - + func createTeam(id: String = UUID().uuidString, name: String) async throws -> Team1? { let team = Team1(id: id, name: name) let graphQLResponse = try await Amplify.API.mutate(request: .create(team)) @@ -188,10 +193,12 @@ class GraphQLConnectionScenario1Tests: XCTestCase { throw graphQLResponseError } } - - func createProject(id: String = UUID().uuidString, - name: String? = nil, - team: Team1? = nil) async throws -> Project1? { + + func createProject( + id: String = UUID().uuidString, + name: String? = nil, + team: Team1? = nil + ) async throws -> Project1? { let project = Project1(id: id, name: name, team: team) let graphQLResponse = try await Amplify.API.mutate(request: .create(project)) switch graphQLResponse { @@ -204,8 +211,10 @@ class GraphQLConnectionScenario1Tests: XCTestCase { } extension Team1: Equatable { - public static func == (lhs: Team1, - rhs: Team1) -> Bool { + public static func == ( + lhs: Team1, + rhs: Team1 + ) -> Bool { return lhs.id == rhs.id && lhs.name == rhs.name } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario2Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario2Tests.swift index 2e43f532d9..11423809ee 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario2Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario2Tests.swift @@ -6,8 +6,8 @@ // import XCTest -@testable import AWSAPIPlugin @testable import Amplify +@testable import AWSAPIPlugin #if os(watchOS) @testable import APIWatchApp #else @@ -62,7 +62,8 @@ class GraphQLConnectionScenario2Tests: XCTestCase { func testCreateAndGetProject() async throws { guard let team = try await createTeam2(name: "name".withUUID), let project2a = try await createProject2(teamID: team.id, team: team), - let project2b = try await createProject2(teamID: team.id, team: team) else { + let project2b = try await createProject2(teamID: team.id, team: team) + else { XCTFail("Could not create team and a project") return } @@ -94,7 +95,8 @@ class GraphQLConnectionScenario2Tests: XCTestCase { func testUpdateProjectWithAnotherTeam() async throws { guard let team = try await createTeam2(name: "name".withUUID), - var project2 = try await createProject2(teamID: team.id, team: team) else { + var project2 = try await createProject2(teamID: team.id, team: team) + else { XCTFail("Could not create team and a project") return } @@ -113,10 +115,11 @@ class GraphQLConnectionScenario2Tests: XCTestCase { // The team object does not get retrieved from the service and is `nil`, but should be eager loaded to contain the `team` // XCTAssertEqual(updatedProject.team, anotherTeam) } - + func testDeleteAndGetProject() async throws { guard let team = try await createTeam2(name: "name".withUUID), - let project2 = try await createProject2(teamID: team.id, team: team) else { + let project2 = try await createProject2(teamID: team.id, team: team) + else { XCTFail("Could not create team and a project") return } @@ -142,7 +145,8 @@ class GraphQLConnectionScenario2Tests: XCTestCase { func testListProjectsByTeamID() async throws { guard let team = try await createTeam2(name: "name".withUUID), - try await createProject2(teamID: team.id, team: team) != nil else { + try await createProject2(teamID: team.id, team: team) != nil + else { XCTFail("Could not create team and two projects") return } @@ -161,7 +165,8 @@ class GraphQLConnectionScenario2Tests: XCTestCase { func testPaginatedListProjectsByTeamID() async throws { guard let team = try await createTeam2(name: "name".withUUID), try await createProject2(teamID: team.id, team: team) != nil, - try await createProject2(teamID: team.id, team: team) != nil else { + try await createProject2(teamID: team.id, team: team) != nil + else { XCTFail("Could not create team and two projects") return } @@ -186,7 +191,7 @@ class GraphQLConnectionScenario2Tests: XCTestCase { } XCTAssertEqual(resultsArray.count, 2) } - + func createTeam2(id: String = UUID().uuidString, name: String) async throws -> Team2? { let team = Team2(id: id, name: name) let graphQLResponse = try await Amplify.API.mutate(request: .create(team)) @@ -198,10 +203,12 @@ class GraphQLConnectionScenario2Tests: XCTestCase { } } - func createProject2(id: String = UUID().uuidString, - name: String? = nil, - teamID: String, - team: Team2? = nil) async throws -> Project2? { + func createProject2( + id: String = UUID().uuidString, + name: String? = nil, + teamID: String, + team: Team2? = nil + ) async throws -> Project2? { let project = Project2(id: id, name: name, teamID: teamID, team: team) let graphQLResponse = try await Amplify.API.mutate(request: .create(project)) switch graphQLResponse { @@ -214,8 +221,10 @@ class GraphQLConnectionScenario2Tests: XCTestCase { } extension Team2: Equatable { - public static func == (lhs: Team2, - rhs: Team2) -> Bool { + public static func == ( + lhs: Team2, + rhs: Team2 + ) -> Bool { return lhs.id == rhs.id && lhs.name == rhs.name && lhs.createdAt == rhs.createdAt diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario3APISwiftTests+Subscribe.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario3APISwiftTests+Subscribe.swift index 9820132217..d98e9e7bad 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario3APISwiftTests+Subscribe.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario3APISwiftTests+Subscribe.swift @@ -6,8 +6,8 @@ // import XCTest -@testable import AWSAPIPlugin @testable import Amplify +@testable import AWSAPIPlugin #if os(watchOS) @testable import APIWatchApp #else @@ -15,21 +15,23 @@ import XCTest #endif extension GraphQLConnectionScenario3Tests { - + func onCreatePost3APISwiftRequest() -> GraphQLRequest { let request = GraphQLRequest( document: APISwift.OnCreatePost3Subscription.operationString, - responseType: APISwift.OnCreatePost3Subscription.Data.self) + responseType: APISwift.OnCreatePost3Subscription.Data.self + ) return request } - + func createPost3APISwift(_ id: String, _ title: String) async throws -> APISwift.CreatePost3Mutation.Data.CreatePost3? { let input = APISwift.CreatePost3Input(id: id, title: title) let mutation = APISwift.CreatePost3Mutation(input: input) let request = GraphQLRequest( document: APISwift.CreatePost3Mutation.operationString, variables: mutation.variables?.jsonObject, - responseType: APISwift.CreatePost3Mutation.Data.self) + responseType: APISwift.CreatePost3Mutation.Data.self + ) let response = try await Amplify.API.mutate(request: request) switch response { case .success(let data): @@ -38,7 +40,7 @@ extension GraphQLConnectionScenario3Tests { throw error } } - + func testOnCreateSubscriptionAPISwift() async throws { let connectedInvoked = expectation(description: "Connection established") let progressInvoked = expectation(description: "progress invoked") @@ -76,10 +78,11 @@ extension GraphQLConnectionScenario3Tests { XCTFail("Unexpected subscription failure") } } - + await fulfillment(of: [connectedInvoked], timeout: TestCommonConstants.networkTimeout) guard try await createPost3APISwift(uuid, title) != nil, - try await createPost3APISwift(uuid2, title) != nil else { + try await createPost3APISwift(uuid2, title) != nil + else { XCTFail("Failed to create post") return } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario3Tests+Helpers.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario3Tests+Helpers.swift index fb95b5abd0..04f23259c9 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario3Tests+Helpers.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario3Tests+Helpers.swift @@ -6,8 +6,8 @@ // import XCTest -@testable import AWSAPIPlugin @testable import Amplify +@testable import AWSAPIPlugin #if os(watchOS) @testable import APIWatchApp #else @@ -15,7 +15,7 @@ import XCTest #endif extension GraphQLConnectionScenario3Tests { - + func createPost(id: String = UUID().uuidString, title: String) async throws -> Post3? { let post = Post3(id: id, title: title) let event = try await Amplify.API.mutate(request: .create(post)) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario3Tests+List.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario3Tests+List.swift index 8edf725162..8ef75606be 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario3Tests+List.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario3Tests+List.swift @@ -6,8 +6,8 @@ // import XCTest -@testable import AWSAPIPlugin @testable import Amplify +@testable import AWSAPIPlugin #if os(watchOS) @testable import APIWatchApp #else @@ -38,7 +38,8 @@ extension GraphQLConnectionScenario3Tests { let commentContent = "content".withUUID guard let post = try await createPost(title: "title".withUUID), try await createComment(postID: post.id, content: commentContent) != nil, - try await createComment(postID: post.id, content: commentContent) != nil else { + try await createComment(postID: post.id, content: commentContent) != nil + else { XCTFail("Could not create post and two comments") return } @@ -78,7 +79,8 @@ extension GraphQLConnectionScenario3Tests { guard let post = try await createPost(title: "title".withUUID), try await createComment(postID: post.id, content: commentContent) != nil, - try await createComment(postID: post.id, content: commentContent) != nil else { + try await createComment(postID: post.id, content: commentContent) != nil + else { XCTFail("Could not create post and two comments") return } @@ -137,13 +139,13 @@ extension GraphQLConnectionScenario3Tests { let post = Post3.keys let predicate = post.id == uuid && post.title == uniqueTitle - let graphQLResponse = try await Amplify.API.query(request: .list(Post3.self, where: predicate, limit: 1000)) + let graphQLResponse = try await Amplify.API.query(request: .list(Post3.self, where: predicate, limit: 1_000)) guard case var .success(posts) = graphQLResponse else { XCTFail("Missing successful response") return } - - while posts.count == 0 && posts.hasNextPage() { + + while posts.isEmpty && posts.hasNextPage() { posts = try await posts.getNextPage() } XCTAssertEqual(posts.count, 1) @@ -174,7 +176,7 @@ extension GraphQLConnectionScenario3Tests { return } - while comments.count == 0 && comments.hasNextPage() { + while comments.isEmpty && comments.hasNextPage() { comments = try await comments.getNextPage() } XCTAssertEqual(comments.count, 1) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario3Tests+Subscribe.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario3Tests+Subscribe.swift index 926831267b..1393525328 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario3Tests+Subscribe.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario3Tests+Subscribe.swift @@ -6,8 +6,8 @@ // import XCTest -@testable import AWSAPIPlugin @testable import Amplify +@testable import AWSAPIPlugin #if os(watchOS) @testable import APIWatchApp #else @@ -53,7 +53,7 @@ extension GraphQLConnectionScenario3Tests { XCTFail("Unexpected subscription failure") } } - + await fulfillment(of: [connectedInvoked], timeout: TestCommonConstants.networkTimeout) let post = Post3(id: uuid, title: title) _ = try await Amplify.API.mutate(request: .create(post)) @@ -62,7 +62,7 @@ extension GraphQLConnectionScenario3Tests { await fulfillment(of: [progressInvoked], timeout: TestCommonConstants.networkTimeout) } - + func testOnUpdatePostSubscriptionWithModel() async throws { let connectingInvoked = expectation(description: "Connection connecting") let connectedInvoked = expectation(description: "Connection established") @@ -91,9 +91,9 @@ extension GraphQLConnectionScenario3Tests { XCTFail("Unexpected subscription failure") } } - + await fulfillment(of: [connectingInvoked, connectedInvoked], timeout: TestCommonConstants.networkTimeout) - + let uuid = UUID().uuidString let testMethodName = String("\(#function)".dropLast(2)) let title = testMethodName + "Title".withUUID @@ -103,12 +103,12 @@ extension GraphQLConnectionScenario3Tests { await fulfillment(of: [progressInvoked], timeout: TestCommonConstants.networkTimeout) } - + func testOnDeletePostSubscriptionWithModel() async throws { let connectingInvoked = expectation(description: "Connection connecting") let connectedInvoked = expectation(description: "Connection established") let progressInvoked = expectation(description: "progress invoked") - + let subscription = Amplify.API.subscribe(request: .subscription(of: Post3.self, type: .onDelete)) Task { do { diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario3Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario3Tests.swift index e8fb12f625..a24ba6d98d 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario3Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario3Tests.swift @@ -6,8 +6,8 @@ // import XCTest -@testable import AWSAPIPlugin @testable import Amplify +@testable import AWSAPIPlugin #if os(watchOS) @testable import APIWatchApp #else diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario4Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario4Tests.swift index 26428342e8..440f58a1be 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario4Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario4Tests.swift @@ -6,8 +6,8 @@ // import XCTest -@testable import AWSAPIPlugin @testable import Amplify +@testable import AWSAPIPlugin #if os(watchOS) @testable import APIWatchApp #else @@ -116,7 +116,7 @@ class GraphQLConnectionScenario4Tests: XCTestCase { try await comments.fetch() results = comments fetchCommentsCompleted.fulfill() - + case .failure(let response): XCTFail("Failed with: \(response)") } @@ -211,13 +211,14 @@ class GraphQLConnectionScenario4Tests: XCTestCase { let commentContent = "content".withUUID guard let post = try await createPost(title: "title".withUUID), try await createComment(content: commentContent, post: post) != nil, - try await createComment(content: commentContent, post: post) != nil else { + try await createComment(content: commentContent, post: post) != nil + else { XCTFail("Could not create post and two comments") return } let predicate = field("postID").eq(post.id) var results: List? - let result = try await Amplify.API.query(request: .list(Comment4.self, where: predicate, limit: 3000)) + let result = try await Amplify.API.query(request: .list(Comment4.self, where: predicate, limit: 3_000)) switch result { case .success(let comments): results = comments @@ -248,7 +249,7 @@ class GraphQLConnectionScenario4Tests: XCTestCase { throw error } } - + func createComment(id: String = UUID().uuidString, content: String, post: Post4) async throws -> Comment4? { let comment = Comment4(id: id, content: content, post: post) let data = try await Amplify.API.mutate(request: .create(comment)) @@ -262,8 +263,10 @@ class GraphQLConnectionScenario4Tests: XCTestCase { } extension Post4: Equatable { - public static func == (lhs: Post4, - rhs: Post4) -> Bool { + public static func == ( + lhs: Post4, + rhs: Post4 + ) -> Bool { return lhs.id == rhs.id && lhs.title == rhs.title } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario5Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario5Tests.swift index 7fa611e950..ddae12ca6a 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario5Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario5Tests.swift @@ -6,8 +6,8 @@ // import XCTest -@testable import AWSAPIPlugin @testable import Amplify +@testable import AWSAPIPlugin #if os(watchOS) @testable import APIWatchApp #else @@ -234,10 +234,10 @@ class GraphQLConnectionScenario5Tests: XCTestCase { resultsArray.append(contentsOf: subsequentResults) } XCTAssertEqual(resultsArray.count, 2) - XCTAssertTrue(resultsArray.contains(where: { (postEditor) -> Bool in + XCTAssertTrue(resultsArray.contains(where: { postEditor -> Bool in postEditor.post.id == post1.id })) - XCTAssertTrue(resultsArray.contains(where: { (postEditor) -> Bool in + XCTAssertTrue(resultsArray.contains(where: { postEditor -> Bool in postEditor.post.id == post2.id })) } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario6Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario6Tests.swift index d53eebfbdb..9e9b0d230a 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario6Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario6Tests.swift @@ -6,8 +6,8 @@ // import XCTest -@testable import AWSAPIPlugin @testable import Amplify +@testable import AWSAPIPlugin #if os(watchOS) @testable import APIWatchApp #else @@ -69,7 +69,8 @@ class GraphQLConnectionScenario6Tests: XCTestCase { let post1 = try await createPost(title: "title".withUUID, blog: blog), try await createPost(title: "title", blog: blog) != nil, let comment1post1 = try await createComment(post: post1, content: commentContent), - let comment2post1 = try await createComment(post: post1, content: commentContent) else { + let comment2post1 = try await createComment(post: post1, content: commentContent) + else { XCTFail("Could not create blog, posts, and comments") return } @@ -98,7 +99,7 @@ class GraphQLConnectionScenario6Tests: XCTestCase { let allPosts = try await getAll(list: resultPosts) XCTAssertEqual(allPosts.count, 2) - guard let fetchedPost = allPosts.first(where: { (post) -> Bool in + guard let fetchedPost = allPosts.first(where: { post -> Bool in post.id == post1.id }), let comments = fetchedPost.comments else { XCTFail("Could not set up - failed to get a post and its comments") @@ -113,16 +114,16 @@ class GraphQLConnectionScenario6Tests: XCTestCase { await fulfillment(of: [fetchCommentsCompleted], timeout: TestCommonConstants.networkTimeout) let allComments = try await getAll(list: resultComments) XCTAssertEqual(allComments.count, 2) - XCTAssertTrue(allComments.contains(where: { (comment) -> Bool in + XCTAssertTrue(allComments.contains(where: { comment -> Bool in comment.id == comment1post1.id })) - XCTAssertTrue(allComments.contains(where: { (comment) -> Bool in + XCTAssertTrue(allComments.contains(where: { comment -> Bool in comment.id == comment2post1.id })) } func getAll(list: List?) async throws -> [M] { - guard var list = list else { + guard var list else { return [] } var results = [M]() diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLModelBasedTests+List.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLModelBasedTests+List.swift index c42916e6e6..97497ea754 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLModelBasedTests+List.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLModelBasedTests+List.swift @@ -6,8 +6,8 @@ // import XCTest -@testable import AWSAPIPlugin @testable import Amplify +@testable import AWSAPIPlugin #if os(watchOS) @testable import APIWatchApp #else @@ -39,8 +39,8 @@ extension GraphQLModelBasedTests { let post = Post.keys let predicate = post.id == uuid1 || post.id == uuid2 var results: List? - let response = try await Amplify.API.query(request: .list(Post.self, where: predicate, limit: 3000)) - + let response = try await Amplify.API.query(request: .list(Post.self, where: predicate, limit: 3_000)) + guard case .success(let graphQLresponse) = response else { XCTFail("Missing successful response") return @@ -96,7 +96,7 @@ extension GraphQLModelBasedTests { subsequentResults = listResult } XCTAssertFalse(subsequentResults.hasNextPage()) - + do { let listResult = try await subsequentResults.getNextPage() XCTFail("Unexpected \(listResult)") @@ -126,7 +126,7 @@ extension GraphQLModelBasedTests { _ = try await Amplify.API.mutate(request: .create(comment)) var results: Post? let response = try await Amplify.API.query(request: .get(Post.self, byId: post.id)) - + guard case .success(let graphQLResponse) = response else { XCTFail("Missing successful response") return @@ -137,7 +137,7 @@ extension GraphQLModelBasedTests { XCTFail("Could not get post") return } - + do { try await retrievedPost.comments?.fetch() XCTFail("Should have failed to fetch") diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLModelBasedTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLModelBasedTests.swift index 8d16762f17..74e20d620e 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLModelBasedTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLModelBasedTests.swift @@ -16,24 +16,24 @@ import XCTest // swiftlint:disable type_body_length class GraphQLModelBasedTests: XCTestCase { - + static let amplifyConfiguration = "testconfiguration/GraphQLModelBasedTests-amplifyconfiguration" - final public class PostCommentModelRegistration: AmplifyModelRegistration { + public final class PostCommentModelRegistration: AmplifyModelRegistration { public func registerModels(registry: ModelRegistry.Type) { ModelRegistry.register(modelType: Post.self) ModelRegistry.register(modelType: Comment.self) } - + public let version: String = "1" } - - + + override func setUp() async throws { await Amplify.reset() Amplify.Logging.logLevel = .verbose let plugin = AWSAPIPlugin(modelRegistration: PostCommentModelRegistration()) - + do { try Amplify.add(plugin: plugin) let amplifyConfig = try TestConfigHelper.retrieveAmplifyConfiguration( @@ -42,16 +42,16 @@ class GraphQLModelBasedTests: XCTestCase { ModelRegistry.register(modelType: Comment.self) ModelRegistry.register(modelType: Post.self) - + } catch { XCTFail("Error during setup: \(error)") } } - + override func tearDown() async throws { await Amplify.reset() } - + func testQuerySinglePostWithModel() async throws { let uuid = UUID().uuidString let testMethodName = String("\(#function)".dropLast(2)) @@ -67,11 +67,11 @@ class GraphQLModelBasedTests: XCTestCase { XCTFail("Missing post from query") return } - + XCTAssertEqual(resultPost.id, post.id) XCTAssertEqual(resultPost.title, title) } - + /// Test custom GraphQLRequest with nested list deserializes to generated Post Model /// /// - Given: A post containing a single comment @@ -86,11 +86,13 @@ class GraphQLModelBasedTests: XCTestCase { let title = testMethodName + "Title" let post = Post(id: uuid, title: title, content: "content", createdAt: .now()) _ = try await Amplify.API.mutate(request: .create(post)) - let comment = Comment(content: "commentContent", - createdAt: .now(), - post: post) + let comment = Comment( + content: "commentContent", + createdAt: .now(), + post: post + ) _ = try await Amplify.API.mutate(request: .create(comment)) - + let document = """ query getPost($id: ID!) { getPost(id: $id){ @@ -124,10 +126,12 @@ class GraphQLModelBasedTests: XCTestCase { } } """ - let graphQLRequest = GraphQLRequest(document: document, - variables: ["id": uuid], - responseType: Post?.self, - decodePath: "getPost") + let graphQLRequest = GraphQLRequest( + document: document, + variables: ["id": uuid], + responseType: Post?.self, + decodePath: "getPost" + ) let graphQLResponse = try await Amplify.API.query(request: graphQLRequest) guard case .success(let data) = graphQLResponse else { XCTFail("Missing successful response") @@ -137,7 +141,7 @@ class GraphQLModelBasedTests: XCTestCase { XCTFail("Missing post from query") return } - + XCTAssertEqual(resultPost.id, post.id) XCTAssertEqual(resultPost.title, title) guard let comments = resultPost.comments else { @@ -146,14 +150,14 @@ class GraphQLModelBasedTests: XCTestCase { } XCTAssertEqual(comments.count, 1) } - + func testListQueryWithModel() async throws { let uuid = UUID().uuidString let testMethodName = String("\(#function)".dropLast(2)) let title = testMethodName + "Title" let post = Post(id: uuid, title: title, content: "content", createdAt: .now()) _ = try await Amplify.API.mutate(request: .create(post)) - + let graphQLResponse = try await Amplify.API.query(request: .list(Post.self)) guard case .success(let posts) = graphQLResponse else { XCTFail("Missing successful response") @@ -161,17 +165,19 @@ class GraphQLModelBasedTests: XCTestCase { } XCTAssertTrue(!posts.isEmpty) } - + func testListQueryWithPredicate() async throws { let uuid = UUID().uuidString let testMethodName = String("\(#function)".dropLast(2)) let uniqueTitle = testMethodName + uuid + "Title" - let createdPost = Post(id: uuid, - title: uniqueTitle, - content: "content", - createdAt: .now(), - draft: true, - rating: 12.3) + let createdPost = Post( + id: uuid, + title: uniqueTitle, + content: "content", + createdAt: .now(), + draft: true, + rating: 12.3 + ) _ = try await Amplify.API.mutate(request: .create(createdPost)) let post = Post.keys let predicate = post.id == uuid && @@ -180,14 +186,14 @@ class GraphQLModelBasedTests: XCTestCase { post.createdAt == createdPost.createdAt && post.rating == 12.3 && post.draft == true - - let graphQLResponse = try await Amplify.API.query(request: .list(Post.self, where: predicate, limit: 1000)) + + let graphQLResponse = try await Amplify.API.query(request: .list(Post.self, where: predicate, limit: 1_000)) guard case .success(var posts) = graphQLResponse else { XCTFail("Missing successful response") return } - - while posts.count == 0 && posts.hasNextPage() { + + while posts.isEmpty && posts.hasNextPage() { posts = try await posts.getNextPage() } XCTAssertEqual(posts.count, 1) @@ -202,7 +208,7 @@ class GraphQLModelBasedTests: XCTestCase { XCTAssertEqual(singlePost.rating, 12.3) XCTAssertEqual(singlePost.draft, true) } - + func testCreatPostWithModel() async throws { let post = Post(title: "title", content: "content", createdAt: .now()) let createdPostResult = try await Amplify.API.mutate(request: .create(post)) @@ -212,16 +218,18 @@ class GraphQLModelBasedTests: XCTestCase { } XCTAssertEqual(resultedPost.title, "title") } - + func testCreateCommentWithModel() async throws { let uuid = UUID().uuidString let testMethodName = String("\(#function)".dropLast(2)) let title = testMethodName + "Title" let post = Post(id: uuid, title: title, content: "content", createdAt: .now()) _ = try await Amplify.API.mutate(request: .create(post)) - let comment = Comment(content: "commentContent", - createdAt: .now(), - post: post) + let comment = Comment( + content: "commentContent", + createdAt: .now(), + post: post + ) let createdCommentResult = try await Amplify.API.mutate(request: .create(comment)) guard case .success(let resultComment) = createdCommentResult else { XCTFail("Error creating a Comment \(createdCommentResult)") @@ -230,7 +238,7 @@ class GraphQLModelBasedTests: XCTestCase { XCTAssertEqual(resultComment.content, "commentContent") XCTAssertNotNil(resultComment.post) } - + func testDeletePostWithModel() async throws { let uuid = UUID().uuidString let testMethodName = String("\(#function)".dropLast(2)) @@ -254,7 +262,7 @@ class GraphQLModelBasedTests: XCTestCase { XCTFail("Failed with: \(response)") } } - + func testUpdatePostWithModel() async throws { let uuid = UUID().uuidString let testMethodName = String("\(#function)".dropLast(2)) @@ -270,7 +278,7 @@ class GraphQLModelBasedTests: XCTestCase { } XCTAssertEqual(updatedPosts.title, updatedTitle) } - + func testOnCreatePostSubscriptionWithModel() async throws { let connectedInvoked = expectation(description: "Connection established") let progressInvoked = expectation(description: "progress invoked") @@ -308,16 +316,16 @@ class GraphQLModelBasedTests: XCTestCase { XCTFail("Unexpected subscription failure") } } - + await fulfillment(of: [connectedInvoked], timeout: TestCommonConstants.networkTimeout) - + let post = Post(id: uuid, title: title, content: "content", createdAt: .now()) _ = try await Amplify.API.mutate(request: .create(post)) let post2 = Post(id: uuid2, title: title, content: "content", createdAt: .now()) _ = try await Amplify.API.mutate(request: .create(post2)) await fulfillment(of: [progressInvoked], timeout: TestCommonConstants.networkTimeout) } - + func testOnUpdatePostSubscriptionWithModel() async throws { let connectingInvoked = expectation(description: "Connection connecting") let connectedInvoked = expectation(description: "Connection established") @@ -346,24 +354,24 @@ class GraphQLModelBasedTests: XCTestCase { XCTFail("Unexpected subscription failure") } } - + await fulfillment(of: [connectingInvoked, connectedInvoked], timeout: TestCommonConstants.networkTimeout) - + let uuid = UUID().uuidString let testMethodName = String("\(#function)".dropLast(2)) let title = testMethodName + "Title" let post = Post(id: uuid, title: title, content: "content", createdAt: .now()) _ = try await Amplify.API.mutate(request: .create(post)) _ = try await Amplify.API.mutate(request: .update(post)) - + await fulfillment(of: [progressInvoked], timeout: TestCommonConstants.networkTimeout) } - + func testOnDeletePostSubscriptionWithModel() async throws { let connectingInvoked = expectation(description: "Connection connecting") let connectedInvoked = expectation(description: "Connection established") let progressInvoked = expectation(description: "progress invoked") - + let subscription = Amplify.API.subscribe(request: .subscription(of: Post.self, type: .onDelete)) Task { do { @@ -386,19 +394,19 @@ class GraphQLModelBasedTests: XCTestCase { XCTFail("Unexpected subscription failure") } } - + await fulfillment(of: [connectingInvoked, connectedInvoked], timeout: TestCommonConstants.networkTimeout) - + let uuid = UUID().uuidString let testMethodName = String("\(#function)".dropLast(2)) let title = testMethodName + "Title" let post = Post(id: uuid, title: title, content: "content", createdAt: .now()) _ = try await Amplify.API.mutate(request: .create(post)) _ = try await Amplify.API.mutate(request: .delete(post)) - + await fulfillment(of: [progressInvoked], timeout: TestCommonConstants.networkTimeout) } - + func testOnCreateCommentSubscriptionWithModel() async throws { let connectedInvoked = expectation(description: "Connection established") let progressInvoked = expectation(description: "progress invoked") @@ -436,7 +444,7 @@ class GraphQLModelBasedTests: XCTestCase { XCTFail("Unexpected subscription failure") } } - + await fulfillment(of: [connectedInvoked], timeout: TestCommonConstants.networkTimeout) let post = Post(id: uuid, title: title, content: "content", createdAt: .now()) _ = try await Amplify.API.mutate(request: .create(post)) @@ -456,10 +464,10 @@ class GraphQLModelBasedTests: XCTestCase { let allSubscribedExpectation = expectation(description: "All subscriptions are subscribed") allSubscribedExpectation.expectedFulfillmentCount = numberOfSubscription - let subscriptions = (0..<5).map { _ in + let subscriptions = (0 ..< 5).map { _ in Amplify.API.subscribe(request: .subscription(of: Comment.self, type: .onCreate)) } - subscriptions.forEach { subscription in + for subscription in subscriptions { Task { do { for try await subscriptionEvent in subscription { @@ -491,8 +499,7 @@ class GraphQLModelBasedTests: XCTestCase { if let appSyncRealTimeClientFactory = getUnderlyingAPIPlugin()?.appSyncRealTimeClientFactory as? AppSyncRealTimeClientFactory, let appSyncRealTimeClient = - await appSyncRealTimeClientFactory.apiToClientCache.values.first as? AppSyncRealTimeClient - { + await appSyncRealTimeClientFactory.apiToClientCache.values.first as? AppSyncRealTimeClient { var appSyncSubscriptions = await appSyncRealTimeClient.numberOfSubscriptions XCTAssertEqual(appSyncSubscriptions, numberOfSubscription) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLScalarAPISwiftTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLScalarAPISwiftTests.swift index 6e3c70c7b2..730b1b4330 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLScalarAPISwiftTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLScalarAPISwiftTests.swift @@ -6,8 +6,8 @@ // import XCTest -@testable import AWSAPIPlugin @testable import Amplify +@testable import AWSAPIPlugin #if os(watchOS) @testable import APIWatchApp #else @@ -15,7 +15,7 @@ import XCTest #endif extension GraphQLScalarTests { - + func testScalarContainerAPISwift() async throws { let id = UUID().uuidString let date = Temporal.Date.now().iso8601String @@ -35,14 +35,16 @@ extension GraphQLScalarTests { myJson: "{}", myPhone: "2342355678", myUrl: "https://www.amazon.com/dp/B000NZW3KC/", - myIpAddress: "123.12.34.56") + myIpAddress: "123.12.34.56" + ) let mutation = APISwift.CreateScalarContainerMutation(input: input) - + let request = GraphQLRequest( document: APISwift.CreateScalarContainerMutation.operationString, variables: mutation.variables?.jsonObject, - responseType: APISwift.CreateScalarContainerMutation.Data.self) - + responseType: APISwift.CreateScalarContainerMutation.Data.self + ) + let data = try await mutateModel(request: request) guard let container = data.createScalarContainer else { XCTFail("Missing created container") @@ -62,21 +64,23 @@ extension GraphQLScalarTests { XCTAssertEqual(container.myPhone, "2342355678") XCTAssertEqual(container.myUrl, "https://www.amazon.com/dp/B000NZW3KC/") XCTAssertEqual(container.myIpAddress, "123.12.34.56") - + } - + func testListIntContainerAPISwift() async throws { let id = UUID().uuidString let input = APISwift.CreateListIntContainerInput( id: id, test: 2, intList: [1, 2, 3], - nullableIntList: [1, 2, 3]) + nullableIntList: [1, 2, 3] + ) let mutation = APISwift.CreateListIntContainerMutation(input: input) let request = GraphQLRequest( document: APISwift.CreateListIntContainerMutation.operationString, variables: mutation.variables?.jsonObject, - responseType: APISwift.CreateListIntContainerMutation.Data.self) + responseType: APISwift.CreateListIntContainerMutation.Data.self + ) let data = try await mutateModel(request: request) guard let container = data.createListIntContainer else { XCTFail("Missing created container") diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLScalarTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLScalarTests.swift index 45593c79d9..3d8c8609be 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLScalarTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLScalarTests.swift @@ -6,8 +6,8 @@ // import XCTest -@testable import AWSAPIPlugin @testable import Amplify +@testable import AWSAPIPlugin #if os(watchOS) @testable import APIWatchApp #else @@ -41,19 +41,21 @@ class GraphQLScalarTests: GraphQLTestBase { } func testScalarContainer() async throws { - let container = ScalarContainer(myString: "myString".withUUID, - myInt: 1, - myDouble: 1.0, - myBool: true, - myDate: .now(), - myTime: .now(), - myDateTime: .now(), - myTimeStamp: 123, - myEmail: "local-part@domain-part", - myJSON: "{}", - myPhone: "2342355678", - myURL: "https://www.amazon.com/dp/B000NZW3KC/", - myIPAddress: "123.12.34.56") + let container = ScalarContainer( + myString: "myString".withUUID, + myInt: 1, + myDouble: 1.0, + myBool: true, + myDate: .now(), + myTime: .now(), + myDateTime: .now(), + myTimeStamp: 123, + myEmail: "local-part@domain-part", + myJSON: "{}", + myPhone: "2342355678", + myURL: "https://www.amazon.com/dp/B000NZW3KC/", + myIPAddress: "123.12.34.56" + ) let updatedContainer = ScalarContainer(id: container.id) let createdModel = try await mutateModel(request: .create(container)) @@ -83,15 +85,18 @@ class GraphQLScalarTests: GraphQLTestBase { intList: [], intNullableList: [], nullableIntList: [], - nullableIntNullableList: nil) - - let updatedContainer = ListIntContainer(id: container.id, - test: 2, - nullableInt: nil, - intList: [1, 2, 3], - intNullableList: [1, 2, 3], - nullableIntList: [1, 2, 3], - nullableIntNullableList: [1, 2, 3]) + nullableIntNullableList: nil + ) + + let updatedContainer = ListIntContainer( + id: container.id, + test: 2, + nullableInt: nil, + intList: [1, 2, 3], + intNullableList: [1, 2, 3], + nullableIntList: [1, 2, 3], + nullableIntNullableList: [1, 2, 3] + ) let createdModel = try await mutateModel(request: .create(container)) XCTAssertEqual(createdModel, container) @@ -119,23 +124,28 @@ class GraphQLScalarTests: GraphQLTestBase { stringList: ["value1".withUUID], stringNullableList: [], nullableStringList: [], - nullableStringNullableList: nil) - - let updatedContainer = ListStringContainer(id: container.id, - test: "test", - nullableString: "test", - stringList: ["value1"], - stringNullableList: ["value1"], - nullableStringList: ["value1"], - nullableStringNullableList: ["value1"]) + nullableStringNullableList: nil + ) + + let updatedContainer = ListStringContainer( + id: container.id, + test: "test", + nullableString: "test", + stringList: ["value1"], + stringNullableList: ["value1"], + nullableStringList: ["value1"], + nullableStringNullableList: ["value1"] + ) let createdModel = try await mutateModel(request: .create(container)) XCTAssertEqual(createdModel, container) let updatedModel = try await mutateModel(request: .update(updatedContainer)) XCTAssertEqual(updatedModel, updatedContainer) - guard let queriedModel = try await queryModel(request: .get(ListStringContainer.self, - byId: container.id)) else { + guard let queriedModel = try await queryModel(request: .get( + ListStringContainer.self, + byId: container.id + )) else { XCTFail("Failed to query model") return } @@ -155,23 +165,28 @@ class GraphQLScalarTests: GraphQLTestBase { stringList: ["value1".withUUID], stringNullableList: nil, nullableStringList: [nil], - nullableStringNullableList: nil) - - let updatedContainer = ListStringContainer(id: container.id, - test: "test", - nullableString: "test", - stringList: ["value1"], - stringNullableList: ["value1"], - nullableStringList: ["value1"], - nullableStringNullableList: ["value1"]) + nullableStringNullableList: nil + ) + + let updatedContainer = ListStringContainer( + id: container.id, + test: "test", + nullableString: "test", + stringList: ["value1"], + stringNullableList: ["value1"], + nullableStringList: ["value1"], + nullableStringNullableList: ["value1"] + ) let createdModel = try await mutateModel(request: .create(container)) XCTAssertEqual(createdModel, container) let updatedModel = try await mutateModel(request: .update(updatedContainer)) XCTAssertEqual(updatedModel, updatedContainer) - guard let queriedModel = try await queryModel(request: .get(ListStringContainer.self, - byId: container.id)) else { + guard let queriedModel = try await queryModel(request: .get( + ListStringContainer.self, + byId: container.id + )) else { XCTFail("Failed to query model") return } @@ -185,19 +200,23 @@ class GraphQLScalarTests: GraphQLTestBase { } func testEnumTestModel() async throws { - let container = EnumTestModel(enumVal: .valueOne, - nullableEnumVal: .valueTwo, - enumList: [.valueOne], - enumNullableList: [.valueTwo], - nullableEnumList: [.valueOne, .valueTwo], - nullableEnumNullableList: [.valueTwo, .valueOne]) - let updatedContainer = EnumTestModel(id: container.id, - enumVal: .valueTwo, - nullableEnumVal: nil, - enumList: [.valueTwo], - enumNullableList: [.valueTwo, .valueOne], - nullableEnumList: [.valueTwo, .valueOne], - nullableEnumNullableList: [.valueOne, .valueTwo]) + let container = EnumTestModel( + enumVal: .valueOne, + nullableEnumVal: .valueTwo, + enumList: [.valueOne], + enumNullableList: [.valueTwo], + nullableEnumList: [.valueOne, .valueTwo], + nullableEnumNullableList: [.valueTwo, .valueOne] + ) + let updatedContainer = EnumTestModel( + id: container.id, + enumVal: .valueTwo, + nullableEnumVal: nil, + enumList: [.valueTwo], + enumNullableList: [.valueTwo, .valueOne], + nullableEnumList: [.valueTwo, .valueOne], + nullableEnumNullableList: [.valueOne, .valueTwo] + ) let createdModel = try await mutateModel(request: .create(container)) XCTAssertEqual(createdModel, container) @@ -218,20 +237,24 @@ class GraphQLScalarTests: GraphQLTestBase { } func testNestedEnumTestModel() async throws { - let container = NestedTypeTestModel(nestedVal: .init(valueOne: 1), - nullableNestedVal: .init(), - nestedList: [.init(valueTwo: "value2")], - nestedNullableList: [.init()], - nullableNestedList: [.init(valueOne: 1, valueTwo: "value2")], - nullableNestedNullableList: [.init(valueOne: 1, valueTwo: "value2")]) - - let updatedContainer = NestedTypeTestModel(id: container.id, - nestedVal: .init(valueOne: 1), - nullableNestedVal: .init(), - nestedList: [.init(valueTwo: "updatedValue"), .init(valueOne: 1)], - nestedNullableList: [.init(valueOne: 1, valueTwo: "value2")], - nullableNestedList: [], - nullableNestedNullableList: nil) + let container = NestedTypeTestModel( + nestedVal: .init(valueOne: 1), + nullableNestedVal: .init(), + nestedList: [.init(valueTwo: "value2")], + nestedNullableList: [.init()], + nullableNestedList: [.init(valueOne: 1, valueTwo: "value2")], + nullableNestedNullableList: [.init(valueOne: 1, valueTwo: "value2")] + ) + + let updatedContainer = NestedTypeTestModel( + id: container.id, + nestedVal: .init(valueOne: 1), + nullableNestedVal: .init(), + nestedList: [.init(valueTwo: "updatedValue"), .init(valueOne: 1)], + nestedNullableList: [.init(valueOne: 1, valueTwo: "value2")], + nullableNestedList: [], + nullableNestedNullableList: nil + ) let createdModel = try await mutateModel(request: .create(container)) XCTAssertEqual(createdModel, container) @@ -239,8 +262,10 @@ class GraphQLScalarTests: GraphQLTestBase { let updatedModel = try await mutateModel(request: .update(updatedContainer)) XCTAssertEqual(updatedModel, updatedContainer) - guard let queriedModel = try await queryModel(request: .get(NestedTypeTestModel.self, - byId: container.id)) else { + guard let queriedModel = try await queryModel(request: .get( + NestedTypeTestModel.self, + byId: container.id + )) else { XCTFail("Failed to query model") return } @@ -256,7 +281,7 @@ class GraphQLScalarTests: GraphQLTestBase { extension ScalarContainer: Equatable { public static func == (lhs: Self, rhs: Self) -> Bool { - return (lhs.id == rhs.id + return lhs.id == rhs.id && lhs.myInt == rhs.myInt && lhs.myDouble == rhs.myDouble && lhs.myBool == rhs.myBool @@ -268,60 +293,60 @@ extension ScalarContainer: Equatable { && lhs.myJSON == rhs.myJSON && lhs.myPhone == rhs.myPhone && lhs.myURL == rhs.myURL - && lhs.myIPAddress == rhs.myIPAddress) + && lhs.myIPAddress == rhs.myIPAddress } } extension ListIntContainer: Equatable { public static func == (lhs: Self, rhs: Self) -> Bool { - return (lhs.id == rhs.id + return lhs.id == rhs.id && lhs.test == rhs.test && lhs.nullableInt == rhs.nullableInt && lhs.intList == rhs.intList && lhs.intNullableList == rhs.intNullableList && lhs.nullableIntList == rhs.nullableIntList - && lhs.nullableIntNullableList == rhs.nullableIntNullableList) + && lhs.nullableIntNullableList == rhs.nullableIntNullableList } } extension ListStringContainer: Equatable { public static func == (lhs: Self, rhs: Self) -> Bool { - return (lhs.id == rhs.id + return lhs.id == rhs.id && lhs.test == rhs.test && lhs.nullableString == rhs.nullableString && lhs.stringList == rhs.stringList && lhs.stringNullableList == rhs.stringNullableList && lhs.nullableStringList == rhs.nullableStringList - && lhs.nullableStringNullableList == rhs.nullableStringNullableList) + && lhs.nullableStringNullableList == rhs.nullableStringNullableList } } extension EnumTestModel: Equatable { public static func == (lhs: Self, rhs: Self) -> Bool { - return (lhs.id == rhs.id + return lhs.id == rhs.id && lhs.enumVal == rhs.enumVal && lhs.nullableEnumVal == rhs.nullableEnumVal && lhs.enumList == rhs.enumList && lhs.enumNullableList == rhs.enumNullableList && lhs.nullableEnumList == rhs.nullableEnumList - && lhs.nullableEnumNullableList == rhs.nullableEnumNullableList) + && lhs.nullableEnumNullableList == rhs.nullableEnumNullableList } } extension NestedTypeTestModel: Equatable { public static func == (lhs: Self, rhs: Self) -> Bool { - return (lhs.id == rhs.id + return lhs.id == rhs.id && lhs.nestedVal == rhs.nestedVal && lhs.nullableNestedVal == rhs.nullableNestedVal && lhs.nestedList == rhs.nestedList && lhs.nestedNullableList == rhs.nestedNullableList && lhs.nullableNestedList == rhs.nullableNestedList - && lhs.nullableNestedNullableList == rhs.nullableNestedNullableList) + && lhs.nullableNestedNullableList == rhs.nullableNestedNullableList } } extension Nested: Equatable { public static func == (lhs: Self, rhs: Self) -> Bool { - return (lhs.valueOne == rhs.valueOne - && lhs.valueTwo == rhs.valueTwo) + return lhs.valueOne == rhs.valueOne + && lhs.valueTwo == rhs.valueTwo } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLSyncBased/GraphQLSyncBasedTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLSyncBased/GraphQLSyncBasedTests.swift index d5f0d43668..af8f092f4c 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLSyncBased/GraphQLSyncBasedTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLSyncBased/GraphQLSyncBasedTests.swift @@ -6,9 +6,9 @@ // import XCTest -@testable import AWSAPIPlugin @testable import Amplify @testable import APIHostApp +@testable import AWSAPIPlugin // swiftlint:disable type_body_length class GraphQLSyncBasedTests: XCTestCase { @@ -104,8 +104,10 @@ class GraphQLSyncBasedTests: XCTestCase { let completeInvoked = expectation(description: "request completed") var responseFromOperation: GraphQLResponse?>? - let request = GraphQLRequest.query(modelName: createdPost.model.modelName, - byId: createdPost.model.id) + let request = GraphQLRequest.query( + modelName: createdPost.model.modelName, + byId: createdPost.model.id + ) _ = Amplify.API.query(request: request) { event in defer { @@ -169,10 +171,12 @@ class GraphQLSyncBasedTests: XCTestCase { let updatedTitle = title + "Updated" - let modifiedPost = Post(id: createdPost.model["id"] as? String ?? "", - title: updatedTitle, - content: createdPost.model["content"] as? String ?? "", - createdAt: .now()) + let modifiedPost = Post( + id: createdPost.model["id"] as? String ?? "", + title: updatedTitle, + content: createdPost.model["content"] as? String ?? "", + createdAt: .now() + ) let completeInvoked = expectation(description: "request completed") var responseFromOperation: GraphQLResponse>? @@ -239,18 +243,22 @@ class GraphQLSyncBasedTests: XCTestCase { let updatedTitle = title + "Updated" - let modifiedPost = Post(id: createdPost.model["id"] as? String ?? "", - title: updatedTitle, - content: createdPost.model["content"] as? String ?? "", - createdAt: .now()) + let modifiedPost = Post( + id: createdPost.model["id"] as? String ?? "", + title: updatedTitle, + content: createdPost.model["content"] as? String ?? "", + createdAt: .now() + ) let completeInvoked = expectation(description: "request completed") var responseFromOperation: GraphQLResponse>? let queryPredicate = post.title == "Does not match" - let request = GraphQLRequest.updateMutation(of: modifiedPost, - where: queryPredicate.graphQLFilter, - version: 1) + let request = GraphQLRequest.updateMutation( + of: modifiedPost, + where: queryPredicate.graphQLFilter, + version: 1 + ) _ = Amplify.API.mutate(request: request) { event in defer { @@ -280,7 +288,8 @@ class GraphQLSyncBasedTests: XCTestCase { XCTAssertEqual(errors.count, 1) guard let error = errors.first, let extensions = error.extensions, - case let .string(errorTypeValue) = extensions["errorType"] else { + case let .string(errorTypeValue) = extensions["errorType"] + else { XCTFail("Failed to get errorType from extensions of the GraphQL error") return } @@ -311,14 +320,18 @@ class GraphQLSyncBasedTests: XCTestCase { return } let updatedTitle = title + "Updated" - let modifiedPost = Post(id: createdPost.model["id"] as? String ?? "", - title: updatedTitle, - content: createdPost.model["content"] as? String ?? "", - createdAt: .now()) + let modifiedPost = Post( + id: createdPost.model["id"] as? String ?? "", + title: updatedTitle, + content: createdPost.model["content"] as? String ?? "", + createdAt: .now() + ) let firstUpdateSuccess = expectation(description: "first update mutation should be successful") - let request = GraphQLRequest.updateMutation(of: modifiedPost, - version: 1) + let request = GraphQLRequest.updateMutation( + of: modifiedPost, + version: 1 + ) _ = Amplify.API.mutate(request: request) { event in switch event { case .success: @@ -416,10 +429,12 @@ class GraphQLSyncBasedTests: XCTestCase { var responseFromOperation: GraphQLResponse>? let post = Post.keys let predicate = post.title == title - let request = GraphQLRequest.syncQuery(modelType: Post.self, - where: predicate, - limit: 1, - lastSync: 123) + let request = GraphQLRequest.syncQuery( + modelType: Post.self, + where: predicate, + limit: 1, + lastSync: 123 + ) _ = Amplify.API.query(request: request) { event in defer { @@ -514,7 +529,8 @@ class GraphQLSyncBasedTests: XCTestCase { case .success: completedInvoked.fulfill() } - }) + } + ) XCTAssertNotNil(operation) await fulfillment(of: [connectedInvoked], timeout: TestCommonConstants.networkTimeout) @@ -533,9 +549,12 @@ class GraphQLSyncBasedTests: XCTestCase { // MARK: Helpers func createPost(id: String, title: String) -> MutationSyncResult? { - let post = Post(id: id, title: title, - content: "content", - createdAt: .now()) + let post = Post( + id: id, + title: title, + content: "content", + createdAt: .now() + ) return createPost(post: post) } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLSyncBased/GraphQLSyncCustomPrimaryKeyTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLSyncBased/GraphQLSyncCustomPrimaryKeyTests.swift index 114c7ad3c6..6b4142aadf 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLSyncBased/GraphQLSyncCustomPrimaryKeyTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLSyncBased/GraphQLSyncCustomPrimaryKeyTests.swift @@ -6,9 +6,9 @@ // import XCTest -@testable import AWSAPIPlugin @testable import Amplify @testable import APIHostApp +@testable import AWSAPIPlugin class GraphQLSyncCustomPrimaryKeyTests: XCTestCase { @@ -55,9 +55,11 @@ class GraphQLSyncCustomPrimaryKeyTests: XCTestCase { } /// Query order - guard let queryMutationSyncResult = queryCustomerOrder(modelName: CustomerOrder.modelName, - byId: createdCustomerOrder.id, - orderId: createdCustomerOrder.orderId), + guard let queryMutationSyncResult = queryCustomerOrder( + modelName: CustomerOrder.modelName, + byId: createdCustomerOrder.id, + orderId: createdCustomerOrder.orderId + ), var queriedCustomerOrder = queryMutationSyncResult.model.instance as? CustomerOrder else { XCTFail("Failed to query customer order") return @@ -67,9 +69,11 @@ class GraphQLSyncCustomPrimaryKeyTests: XCTestCase { /// Update order queriedCustomerOrder.email = "testnew@abc.com" - guard let updateMutationSyncResult = updateCustomerOrder(of: queriedCustomerOrder, - modelSchema: queriedCustomerOrder.schema, - version: queryMutationSyncResult.syncMetadata.version), + guard let updateMutationSyncResult = updateCustomerOrder( + of: queriedCustomerOrder, + modelSchema: queriedCustomerOrder.schema, + version: queryMutationSyncResult.syncMetadata.version + ), let updatedCustomerOrder = updateMutationSyncResult.model.instance as? CustomerOrder else { XCTFail("Failed to update customer order") return @@ -78,9 +82,11 @@ class GraphQLSyncCustomPrimaryKeyTests: XCTestCase { XCTAssertEqual(customerOrder.id, updatedCustomerOrder.id) /// Delete order - guard let deleteMutationSyncResult = deleteCustomerOrder(of: updatedCustomerOrder, - modelSchema: updatedCustomerOrder.schema, - version: updateMutationSyncResult.syncMetadata.version), + guard let deleteMutationSyncResult = deleteCustomerOrder( + of: updatedCustomerOrder, + modelSchema: updatedCustomerOrder.schema, + version: updateMutationSyncResult.syncMetadata.version + ), let deletedCustomerOrder = deleteMutationSyncResult.model.instance as? CustomerOrder else { XCTFail("Failed to update customer order") return @@ -89,9 +95,11 @@ class GraphQLSyncCustomPrimaryKeyTests: XCTestCase { XCTAssertEqual(customerOrder.id, deletedCustomerOrder.id) /// Query after delete - guard let queryAfterDeleteMutationSyncResult = queryCustomerOrder(modelName: CustomerOrder.modelName, - byId: deletedCustomerOrder.id, - orderId: deletedCustomerOrder.orderId), + guard let queryAfterDeleteMutationSyncResult = queryCustomerOrder( + modelName: CustomerOrder.modelName, + byId: deletedCustomerOrder.id, + orderId: deletedCustomerOrder.orderId + ), let queryDeletedCustomerOrder = queryAfterDeleteMutationSyncResult.model.instance as? CustomerOrder else { XCTFail("Failed to query customer order") return @@ -126,9 +134,11 @@ class GraphQLSyncCustomPrimaryKeyTests: XCTestCase { return result } - func queryCustomerOrder(modelName: String, - byId id: String, - orderId: String) -> MutationSyncResult? { + func queryCustomerOrder( + modelName: String, + byId id: String, + orderId: String + ) -> MutationSyncResult? { var documentBuilder = ModelBasedGraphQLDocumentBuilder(modelName: modelName, operationType: .query) documentBuilder.add(decorator: DirectiveNameDecorator(type: .get)) documentBuilder.add(decorator: ModelIdDecorator(id: id, fields: ["orderId": orderId])) @@ -136,10 +146,12 @@ class GraphQLSyncCustomPrimaryKeyTests: XCTestCase { documentBuilder.add(decorator: AuthRuleDecorator(.query)) let document = documentBuilder.build() - let queryRequest = GraphQLRequest(document: document.stringValue, - variables: document.variables, - responseType: MutationSyncResult?.self, - decodePath: document.name) + let queryRequest = GraphQLRequest( + document: document.stringValue, + variables: document.variables, + responseType: MutationSyncResult?.self, + decodePath: document.name + ) var querySyncResult: MutationSyncResult? let querySuccess = expectation(description: "query successful") _ = Amplify.API.query(request: queryRequest) { event in @@ -160,14 +172,17 @@ class GraphQLSyncCustomPrimaryKeyTests: XCTestCase { return querySyncResult } - func updateCustomerOrder(of model: Model, - modelSchema: ModelSchema, - version: Int) -> MutationSyncResult? { + func updateCustomerOrder( + of model: Model, + modelSchema: ModelSchema, + version: Int + ) -> MutationSyncResult? { let updateSuccess = expectation(description: "update successful") let updateRequest = GraphQLRequest.updateMutation( of: model, modelSchema: modelSchema, - version: version) + version: version + ) var updateSyncResult: MutationSyncResult? _ = Amplify.API.mutate(request: updateRequest) { event in @@ -188,14 +203,17 @@ class GraphQLSyncCustomPrimaryKeyTests: XCTestCase { return updateSyncResult } - func deleteCustomerOrder(of model: Model, - modelSchema: ModelSchema, - version: Int) -> MutationSyncResult? { + func deleteCustomerOrder( + of model: Model, + modelSchema: ModelSchema, + version: Int + ) -> MutationSyncResult? { let deleteSuccess = expectation(description: "delete successful") let deleteRequest = GraphQLRequest.deleteMutation( of: model, modelSchema: modelSchema, - version: version) + version: version + ) var deleteSyncResult: MutationSyncResult? _ = Amplify.API.mutate(request: deleteRequest) { event in diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLTestBase.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLTestBase.swift index 582da2028a..e2f3c08021 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLTestBase.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLTestBase.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import Amplify +import XCTest #if os(watchOS) @testable import APIWatchApp #else diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/AmplifyModels.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/AmplifyModels.swift index b0f249dd64..21d22a2183 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/AmplifyModels.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/AmplifyModels.swift @@ -1,12 +1,19 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -// Contains the set of classes that conforms to the `Model` protocol. +// Contains the set of classes that conforms to the `Model` protocol. -final public class AmplifyModels: AmplifyModelRegistration { +public final class AmplifyModels: AmplifyModelRegistration { public let version: String = "5ee542e5c6ab0424a858288c724b1322" - + public func registerModels(registry: ModelRegistry.Type) { ModelRegistry.register(modelType: Post.self) ModelRegistry.register(modelType: Comment.self) @@ -30,4 +37,4 @@ final public class AmplifyModels: AmplifyModelRegistration { ModelRegistry.register(modelType: EnumTestModel.self) ModelRegistry.register(modelType: NestedTypeTestModel.self) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Blog6+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Blog6+Schema.swift index e2ae53bc53..18a0eb9f2e 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Blog6+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Blog6+Schema.swift @@ -1,25 +1,32 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Blog6 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Blog6 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case name case posts case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let blog6 = Blog6.keys - + model.pluralName = "Blog6s" - + model.fields( .id(), .field(blog6.name, is: .required, ofType: .string), @@ -28,4 +35,4 @@ extension Blog6 { .field(blog6.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Blog6.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Blog6.swift index 87254248e6..32f821132d 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Blog6.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Blog6.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct Blog6: Model { public var posts: List? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - name: String, - posts: List? = []) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + name: String, + posts: List? = [] + ) { + self.init( + id: id, name: name, posts: posts, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - name: String, - posts: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + name: String, + posts: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.posts = posts self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment+Schema.swift index d1274038df..1988a133df 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment+Schema.swift @@ -1,25 +1,32 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Comment { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Comment { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case content case createdAt case post case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let comment = Comment.keys - + model.pluralName = "Comments" - + model.fields( .id(), .field(comment.content, is: .required, ofType: .string), @@ -28,4 +35,4 @@ extension Comment { .field(comment.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment.swift index 9429276f9f..f6e3f2d0bf 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,26 +15,32 @@ public struct Comment: Model { public var createdAt: Temporal.DateTime public var post: Post? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - content: String, - createdAt: Temporal.DateTime, - post: Post? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + content: String, + createdAt: Temporal.DateTime, + post: Post? = nil + ) { + self.init( + id: id, content: content, createdAt: createdAt, post: post, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - content: String, - createdAt: Temporal.DateTime, - post: Post? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + content: String, + createdAt: Temporal.DateTime, + post: Post? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self.createdAt = createdAt self.post = post self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment3+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment3+Schema.swift index 8fbf885ad9..30a30e52be 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment3+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment3+Schema.swift @@ -1,29 +1,36 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Comment3 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Comment3 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case postID case content case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let comment3 = Comment3.keys - + model.pluralName = "Comment3s" - + model.attributes( .index(fields: ["postID", "content"], name: "byPost3") ) - + model.fields( .id(), .field(comment3.postID, is: .required, ofType: .string), @@ -32,4 +39,4 @@ extension Comment3 { .field(comment3.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment3.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment3.swift index 0e18356e52..433ce52a9e 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment3.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment3.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct Comment3: Model { public var content: String public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - postID: String, - content: String) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + postID: String, + content: String + ) { + self.init( + id: id, postID: postID, content: content, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - postID: String, - content: String, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + postID: String, + content: String, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.postID = postID self.content = content self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment4+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment4+Schema.swift index ce30f58729..87f711c6dd 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment4+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment4+Schema.swift @@ -1,29 +1,36 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Comment4 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Comment4 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case content case post case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let comment4 = Comment4.keys - + model.pluralName = "Comment4s" - + model.attributes( .index(fields: ["postID", "content"], name: "byPost4") ) - + model.fields( .id(), .field(comment4.content, is: .required, ofType: .string), @@ -32,4 +39,4 @@ extension Comment4 { .field(comment4.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment4.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment4.swift index e6a4cae7c9..35790685c0 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment4.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment4.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct Comment4: Model { public var post: Post4? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - content: String, - post: Post4? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + content: String, + post: Post4? = nil + ) { + self.init( + id: id, content: content, post: post, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - content: String, - post: Post4? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + content: String, + post: Post4? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self.post = post self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment6+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment6+Schema.swift index 8b4ffe225d..6e97d92f3f 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment6+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment6+Schema.swift @@ -1,29 +1,36 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Comment6 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Comment6 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case post case content case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let comment6 = Comment6.keys - + model.pluralName = "Comment6s" - + model.attributes( .index(fields: ["postID", "content"], name: "byPost") ) - + model.fields( .id(), .belongsTo(comment6.post, is: .optional, ofType: Post6.self, targetName: "postID"), @@ -32,4 +39,4 @@ extension Comment6 { .field(comment6.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment6.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment6.swift index e7d8dd8c1e..ab6cb6a60d 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment6.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Comment6.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct Comment6: Model { public var content: String public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - post: Post6? = nil, - content: String) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + post: Post6? = nil, + content: String + ) { + self.init( + id: id, post: post, content: content, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - post: Post6? = nil, - content: String, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + post: Post6? = nil, + content: String, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.post = post self.content = content self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/EnumTestModel+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/EnumTestModel+Schema.swift index 86e972d90e..12351a88e6 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/EnumTestModel+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/EnumTestModel+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension EnumTestModel { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension EnumTestModel { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case enumVal case nullableEnumVal @@ -15,15 +22,15 @@ extension EnumTestModel { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let enumTestModel = EnumTestModel.keys - + model.pluralName = "EnumTestModels" - + model.fields( .id(), .field(enumTestModel.enumVal, is: .required, ofType: .enum(type: TestEnum.self)), @@ -36,4 +43,4 @@ extension EnumTestModel { .field(enumTestModel.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/EnumTestModel.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/EnumTestModel.swift index 57a45cd219..de9368dd4d 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/EnumTestModel.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/EnumTestModel.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -12,15 +19,18 @@ public struct EnumTestModel: Model { public var nullableEnumNullableList: [TestEnum?]? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - enumVal: TestEnum, - nullableEnumVal: TestEnum? = nil, - enumList: [TestEnum] = [], - enumNullableList: [TestEnum]? = nil, - nullableEnumList: [TestEnum?] = [], - nullableEnumNullableList: [TestEnum?]? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + enumVal: TestEnum, + nullableEnumVal: TestEnum? = nil, + enumList: [TestEnum] = [], + enumNullableList: [TestEnum]? = nil, + nullableEnumList: [TestEnum?] = [], + nullableEnumNullableList: [TestEnum?]? = nil + ) { + self.init( + id: id, enumVal: enumVal, nullableEnumVal: nullableEnumVal, enumList: enumList, @@ -28,17 +38,20 @@ public struct EnumTestModel: Model { nullableEnumList: nullableEnumList, nullableEnumNullableList: nullableEnumNullableList, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - enumVal: TestEnum, - nullableEnumVal: TestEnum? = nil, - enumList: [TestEnum] = [], - enumNullableList: [TestEnum]? = nil, - nullableEnumList: [TestEnum?] = [], - nullableEnumNullableList: [TestEnum?]? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + enumVal: TestEnum, + nullableEnumVal: TestEnum? = nil, + enumList: [TestEnum] = [], + enumNullableList: [TestEnum]? = nil, + nullableEnumList: [TestEnum?] = [], + nullableEnumNullableList: [TestEnum?]? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.enumVal = enumVal self.nullableEnumVal = nullableEnumVal @@ -49,4 +62,4 @@ public struct EnumTestModel: Model { self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/ListIntContainer+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/ListIntContainer+Schema.swift index ebf312ae68..14aace5cdf 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/ListIntContainer+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/ListIntContainer+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension ListIntContainer { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension ListIntContainer { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case test case nullableInt @@ -15,15 +22,15 @@ extension ListIntContainer { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let listIntContainer = ListIntContainer.keys - + model.pluralName = "ListIntContainers" - + model.fields( .id(), .field(listIntContainer.test, is: .required, ofType: .int), @@ -36,4 +43,4 @@ extension ListIntContainer { .field(listIntContainer.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/ListIntContainer.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/ListIntContainer.swift index 040edd16e8..efb53081d8 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/ListIntContainer.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/ListIntContainer.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -12,15 +19,18 @@ public struct ListIntContainer: Model { public var nullableIntNullableList: [Int?]? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - test: Int, - nullableInt: Int? = nil, - intList: [Int] = [], - intNullableList: [Int]? = nil, - nullableIntList: [Int?] = [], - nullableIntNullableList: [Int?]? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + test: Int, + nullableInt: Int? = nil, + intList: [Int] = [], + intNullableList: [Int]? = nil, + nullableIntList: [Int?] = [], + nullableIntNullableList: [Int?]? = nil + ) { + self.init( + id: id, test: test, nullableInt: nullableInt, intList: intList, @@ -28,17 +38,20 @@ public struct ListIntContainer: Model { nullableIntList: nullableIntList, nullableIntNullableList: nullableIntNullableList, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - test: Int, - nullableInt: Int? = nil, - intList: [Int] = [], - intNullableList: [Int]? = nil, - nullableIntList: [Int?] = [], - nullableIntNullableList: [Int?]? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + test: Int, + nullableInt: Int? = nil, + intList: [Int] = [], + intNullableList: [Int]? = nil, + nullableIntList: [Int?] = [], + nullableIntNullableList: [Int?]? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.test = test self.nullableInt = nullableInt @@ -49,4 +62,4 @@ public struct ListIntContainer: Model { self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/ListStringContainer+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/ListStringContainer+Schema.swift index d233dd6642..691fbef988 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/ListStringContainer+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/ListStringContainer+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension ListStringContainer { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension ListStringContainer { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case test case nullableString @@ -15,15 +22,15 @@ extension ListStringContainer { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let listStringContainer = ListStringContainer.keys - + model.pluralName = "ListStringContainers" - + model.fields( .id(), .field(listStringContainer.test, is: .required, ofType: .string), @@ -36,4 +43,4 @@ extension ListStringContainer { .field(listStringContainer.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/ListStringContainer.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/ListStringContainer.swift index cfe1107366..d08e28aa86 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/ListStringContainer.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/ListStringContainer.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -12,15 +19,18 @@ public struct ListStringContainer: Model { public var nullableStringNullableList: [String?]? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - test: String, - nullableString: String? = nil, - stringList: [String] = [], - stringNullableList: [String]? = nil, - nullableStringList: [String?] = [], - nullableStringNullableList: [String?]? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + test: String, + nullableString: String? = nil, + stringList: [String] = [], + stringNullableList: [String]? = nil, + nullableStringList: [String?] = [], + nullableStringNullableList: [String?]? = nil + ) { + self.init( + id: id, test: test, nullableString: nullableString, stringList: stringList, @@ -28,17 +38,20 @@ public struct ListStringContainer: Model { nullableStringList: nullableStringList, nullableStringNullableList: nullableStringNullableList, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - test: String, - nullableString: String? = nil, - stringList: [String] = [], - stringNullableList: [String]? = nil, - nullableStringList: [String?] = [], - nullableStringNullableList: [String?]? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + test: String, + nullableString: String? = nil, + stringList: [String] = [], + stringNullableList: [String]? = nil, + nullableStringList: [String?] = [], + nullableStringNullableList: [String?]? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.test = test self.nullableString = nullableString @@ -49,4 +62,4 @@ public struct ListStringContainer: Model { self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Nested+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Nested+Schema.swift index 1c83d051d7..d2cd8eeea4 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Nested+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Nested+Schema.swift @@ -1,25 +1,32 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Nested { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Nested { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case valueOne case valueTwo } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let nested = Nested.keys - + model.pluralName = "Nesteds" - + model.fields( .field(nested.valueOne, is: .optional, ofType: .int), .field(nested.valueTwo, is: .optional, ofType: .string) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Nested.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Nested.swift index 37415d4550..19da9762a3 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Nested.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Nested.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,4 +12,4 @@ import Foundation public struct Nested: Embeddable { var valueOne: Int? var valueTwo: String? -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/NestedTypeTestModel+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/NestedTypeTestModel+Schema.swift index 7d179f4aa7..97e08bff55 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/NestedTypeTestModel+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/NestedTypeTestModel+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension NestedTypeTestModel { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension NestedTypeTestModel { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case nestedVal case nullableNestedVal @@ -15,15 +22,15 @@ extension NestedTypeTestModel { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let nestedTypeTestModel = NestedTypeTestModel.keys - + model.pluralName = "NestedTypeTestModels" - + model.fields( .id(), .field(nestedTypeTestModel.nestedVal, is: .required, ofType: .embedded(type: Nested.self)), @@ -36,4 +43,4 @@ extension NestedTypeTestModel { .field(nestedTypeTestModel.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/NestedTypeTestModel.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/NestedTypeTestModel.swift index 2167581607..bd5c875239 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/NestedTypeTestModel.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/NestedTypeTestModel.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -12,15 +19,18 @@ public struct NestedTypeTestModel: Model { public var nullableNestedNullableList: [Nested?]? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - nestedVal: Nested, - nullableNestedVal: Nested? = nil, - nestedList: [Nested] = [], - nestedNullableList: [Nested]? = nil, - nullableNestedList: [Nested?] = [], - nullableNestedNullableList: [Nested?]? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + nestedVal: Nested, + nullableNestedVal: Nested? = nil, + nestedList: [Nested] = [], + nestedNullableList: [Nested]? = nil, + nullableNestedList: [Nested?] = [], + nullableNestedNullableList: [Nested?]? = nil + ) { + self.init( + id: id, nestedVal: nestedVal, nullableNestedVal: nullableNestedVal, nestedList: nestedList, @@ -28,17 +38,20 @@ public struct NestedTypeTestModel: Model { nullableNestedList: nullableNestedList, nullableNestedNullableList: nullableNestedNullableList, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - nestedVal: Nested, - nullableNestedVal: Nested? = nil, - nestedList: [Nested] = [], - nestedNullableList: [Nested]? = nil, - nullableNestedList: [Nested?] = [], - nullableNestedNullableList: [Nested?]? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + nestedVal: Nested, + nullableNestedVal: Nested? = nil, + nestedList: [Nested] = [], + nestedNullableList: [Nested]? = nil, + nullableNestedList: [Nested?] = [], + nullableNestedNullableList: [Nested?]? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.nestedVal = nestedVal self.nullableNestedVal = nullableNestedVal @@ -49,4 +62,4 @@ public struct NestedTypeTestModel: Model { self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post+Schema.swift index a0b8083af8..3f7cdf6d04 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Post { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Post { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case title case content @@ -15,15 +22,15 @@ extension Post { case status case comments } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let post = Post.keys - + model.pluralName = "Posts" - + model.fields( .id(), .field(post.title, is: .required, ofType: .string), @@ -36,4 +43,4 @@ extension Post { .hasMany(post.comments, is: .optional, ofType: Comment.self, associatedWith: Comment.keys.post) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post.swift index 8b7bb7c7b2..7c43a79452 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -12,8 +19,9 @@ public struct Post: Model { public var rating: Double? public var status: PostStatus? public var comments: List? - - public init(id: String = UUID().uuidString, + + public init( + id: String = UUID().uuidString, title: String, content: String, createdAt: Temporal.DateTime, @@ -21,7 +29,8 @@ public struct Post: Model { draft: Bool? = nil, rating: Double? = nil, status: PostStatus? = nil, - comments: List? = []) { + comments: List? = [] + ) { self.id = id self.title = title self.content = content @@ -32,4 +41,4 @@ public struct Post: Model { self.status = status self.comments = comments } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post3+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post3+Schema.swift index 75ebd10d14..89cdb79d89 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post3+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post3+Schema.swift @@ -1,25 +1,32 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Post3 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Post3 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case title case comments case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let post3 = Post3.keys - + model.pluralName = "Post3s" - + model.fields( .id(), .field(post3.title, is: .required, ofType: .string), @@ -28,4 +35,4 @@ extension Post3 { .field(post3.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post3.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post3.swift index 5ef0d6e3fc..a52879301a 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post3.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post3.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct Post3: Model { public var comments: List? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - title: String, - comments: List? = []) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + title: String, + comments: List? = [] + ) { + self.init( + id: id, title: title, comments: comments, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - title: String, - comments: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + title: String, + comments: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.title = title self.comments = comments self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post4+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post4+Schema.swift index 1c387d0beb..288d863f58 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post4+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post4+Schema.swift @@ -1,25 +1,32 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Post4 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Post4 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case title case comments case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let post4 = Post4.keys - + model.pluralName = "Post4s" - + model.fields( .id(), .field(post4.title, is: .required, ofType: .string), @@ -28,4 +35,4 @@ extension Post4 { .field(post4.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post4.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post4.swift index 490e66612a..568c276a51 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post4.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post4.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct Post4: Model { public var comments: List? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - title: String, - comments: List? = []) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + title: String, + comments: List? = [] + ) { + self.init( + id: id, title: title, comments: comments, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - title: String, - comments: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + title: String, + comments: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.title = title self.comments = comments self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post5+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post5+Schema.swift index eb35a225e4..8d0f270b8b 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post5+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post5+Schema.swift @@ -1,25 +1,32 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Post5 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Post5 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case title case editors case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let post5 = Post5.keys - + model.pluralName = "Post5s" - + model.fields( .id(), .field(post5.title, is: .required, ofType: .string), @@ -28,4 +35,4 @@ extension Post5 { .field(post5.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post5.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post5.swift index d679aab098..eb4b6de060 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post5.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post5.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct Post5: Model { public var editors: List? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - title: String, - editors: List? = []) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + title: String, + editors: List? = [] + ) { + self.init( + id: id, title: title, editors: editors, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - title: String, - editors: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + title: String, + editors: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.title = title self.editors = editors self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post6+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post6+Schema.swift index 2b46ba95b4..97877b60f3 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post6+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post6+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Post6 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Post6 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case title case blog @@ -12,19 +19,19 @@ extension Post6 { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let post6 = Post6.keys - + model.pluralName = "Post6s" - + model.attributes( .index(fields: ["blogID"], name: "byBlog") ) - + model.fields( .id(), .field(post6.title, is: .required, ofType: .string), @@ -34,4 +41,4 @@ extension Post6 { .field(post6.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post6.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post6.swift index 5ef29766ed..6fa200740c 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post6.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Post6.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -9,24 +16,30 @@ public struct Post6: Model { public var comments: List? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - title: String, - blog: Blog6? = nil, - comments: List? = []) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + title: String, + blog: Blog6? = nil, + comments: List? = [] + ) { + self.init( + id: id, title: title, blog: blog, comments: comments, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - title: String, - blog: Blog6? = nil, - comments: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + title: String, + blog: Blog6? = nil, + comments: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.title = title self.blog = blog @@ -34,4 +47,4 @@ public struct Post6: Model { self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/PostEditor5+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/PostEditor5+Schema.swift index e71af25b39..19a150f67a 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/PostEditor5+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/PostEditor5+Schema.swift @@ -1,30 +1,37 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension PostEditor5 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension PostEditor5 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case post case editor case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let postEditor5 = PostEditor5.keys - + model.pluralName = "PostEditor5s" - + model.attributes( .index(fields: ["postID", "editorID"], name: "byPost5"), .index(fields: ["editorID", "postID"], name: "byEditor5") ) - + model.fields( .id(), .belongsTo(postEditor5.post, is: .required, ofType: Post5.self, targetName: "postID"), @@ -33,4 +40,4 @@ extension PostEditor5 { .field(postEditor5.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/PostEditor5.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/PostEditor5.swift index 137855324e..811e733d87 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/PostEditor5.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/PostEditor5.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct PostEditor5: Model { public var editor: User5 public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - post: Post5, - editor: User5) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + post: Post5, + editor: User5 + ) { + self.init( + id: id, post: post, editor: editor, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - post: Post5, - editor: User5, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + post: Post5, + editor: User5, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.post = post self.editor = editor self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/PostStatus.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/PostStatus.swift index 028109105e..8233e7fa11 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/PostStatus.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/PostStatus.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -6,4 +13,4 @@ public enum PostStatus: String, EnumPersistable { case `private` = "PRIVATE" case draft = "DRAFT" case published = "PUBLISHED" -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Project1+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Project1+Schema.swift index 685894c1e4..d18c0e1430 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Project1+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Project1+Schema.swift @@ -1,25 +1,32 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Project1 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Project1 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case name case team case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let project1 = Project1.keys - + model.pluralName = "Project1s" - + model.fields( .id(), .field(project1.name, is: .optional, ofType: .string), @@ -28,4 +35,4 @@ extension Project1 { .field(project1.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Project1.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Project1.swift index 2976be7151..281da8c4a9 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Project1.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Project1.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct Project1: Model { public var team: Team1? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - name: String? = nil, - team: Team1? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + name: String? = nil, + team: Team1? = nil + ) { + self.init( + id: id, name: name, team: team, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - name: String? = nil, - team: Team1? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + name: String? = nil, + team: Team1? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.team = team self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Project2+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Project2+Schema.swift index d49e19a581..80b1991ba6 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Project2+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Project2+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Project2 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Project2 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case name case teamID @@ -12,15 +19,15 @@ extension Project2 { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let project2 = Project2.keys - + model.pluralName = "Project2s" - + model.fields( .id(), .field(project2.name, is: .optional, ofType: .string), @@ -30,4 +37,4 @@ extension Project2 { .field(project2.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Project2.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Project2.swift index bbbd615678..36ce1f4487 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Project2.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Project2.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -9,24 +16,30 @@ public struct Project2: Model { public var team: Team2? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - name: String? = nil, - teamID: String, - team: Team2? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + name: String? = nil, + teamID: String, + team: Team2? = nil + ) { + self.init( + id: id, name: name, teamID: teamID, team: team, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - name: String? = nil, - teamID: String, - team: Team2? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + name: String? = nil, + teamID: String, + team: Team2? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.teamID = teamID @@ -34,4 +47,4 @@ public struct Project2: Model { self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/ScalarContainer+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/ScalarContainer+Schema.swift index 0efe2b05ba..6f0d8ff99e 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/ScalarContainer+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/ScalarContainer+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension ScalarContainer { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension ScalarContainer { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case myString case myInt @@ -22,15 +29,15 @@ extension ScalarContainer { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let scalarContainer = ScalarContainer.keys - + model.pluralName = "ScalarContainers" - + model.fields( .id(), .field(scalarContainer.myString, is: .optional, ofType: .string), @@ -50,4 +57,4 @@ extension ScalarContainer { .field(scalarContainer.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/ScalarContainer.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/ScalarContainer.swift index 9559211652..ee87c57ecd 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/ScalarContainer.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/ScalarContainer.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -19,22 +26,25 @@ public struct ScalarContainer: Model { public var myIPAddress: String? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - myString: String? = nil, - myInt: Int? = nil, - myDouble: Double? = nil, - myBool: Bool? = nil, - myDate: Temporal.Date? = nil, - myTime: Temporal.Time? = nil, - myDateTime: Temporal.DateTime? = nil, - myTimeStamp: Int? = nil, - myEmail: String? = nil, - myJSON: String? = nil, - myPhone: String? = nil, - myURL: String? = nil, - myIPAddress: String? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + myString: String? = nil, + myInt: Int? = nil, + myDouble: Double? = nil, + myBool: Bool? = nil, + myDate: Temporal.Date? = nil, + myTime: Temporal.Time? = nil, + myDateTime: Temporal.DateTime? = nil, + myTimeStamp: Int? = nil, + myEmail: String? = nil, + myJSON: String? = nil, + myPhone: String? = nil, + myURL: String? = nil, + myIPAddress: String? = nil + ) { + self.init( + id: id, myString: myString, myInt: myInt, myDouble: myDouble, @@ -49,24 +59,27 @@ public struct ScalarContainer: Model { myURL: myURL, myIPAddress: myIPAddress, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - myString: String? = nil, - myInt: Int? = nil, - myDouble: Double? = nil, - myBool: Bool? = nil, - myDate: Temporal.Date? = nil, - myTime: Temporal.Time? = nil, - myDateTime: Temporal.DateTime? = nil, - myTimeStamp: Int? = nil, - myEmail: String? = nil, - myJSON: String? = nil, - myPhone: String? = nil, - myURL: String? = nil, - myIPAddress: String? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + myString: String? = nil, + myInt: Int? = nil, + myDouble: Double? = nil, + myBool: Bool? = nil, + myDate: Temporal.Date? = nil, + myTime: Temporal.Time? = nil, + myDateTime: Temporal.DateTime? = nil, + myTimeStamp: Int? = nil, + myEmail: String? = nil, + myJSON: String? = nil, + myPhone: String? = nil, + myURL: String? = nil, + myIPAddress: String? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.myString = myString self.myInt = myInt @@ -84,4 +97,4 @@ public struct ScalarContainer: Model { self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Team1+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Team1+Schema.swift index 9a0e3f9707..f589eb16ec 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Team1+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Team1+Schema.swift @@ -1,24 +1,31 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Team1 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Team1 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case name case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let team1 = Team1.keys - + model.pluralName = "Team1s" - + model.fields( .id(), .field(team1.name, is: .required, ofType: .string), @@ -26,4 +33,4 @@ extension Team1 { .field(team1.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Team1.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Team1.swift index 5a641dd9c9..8f5c0b9f44 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Team1.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Team1.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -7,21 +14,27 @@ public struct Team1: Model { public var name: String public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - name: String) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + name: String + ) { + self.init( + id: id, name: name, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - name: String, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + name: String, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Team2+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Team2+Schema.swift index 684253fe6a..aebd17466a 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Team2+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Team2+Schema.swift @@ -1,24 +1,31 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Team2 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Team2 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case name case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let team2 = Team2.keys - + model.pluralName = "Team2s" - + model.fields( .id(), .field(team2.name, is: .required, ofType: .string), @@ -26,4 +33,4 @@ extension Team2 { .field(team2.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Team2.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Team2.swift index 3c5ab9f91c..cec6e39d68 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Team2.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/Team2.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -7,21 +14,27 @@ public struct Team2: Model { public var name: String public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - name: String) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + name: String + ) { + self.init( + id: id, name: name, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - name: String, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + name: String, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/TestEnum.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/TestEnum.swift index 8c0fdf51ef..774eca554f 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/TestEnum.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/TestEnum.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,4 +12,4 @@ import Foundation public enum TestEnum: String, EnumPersistable { case valueOne = "VALUE_ONE" case valueTwo = "VALUE_TWO" -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/User5+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/User5+Schema.swift index 82e4c569db..60f0678b52 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/User5+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/User5+Schema.swift @@ -1,25 +1,32 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension User5 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension User5 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case username case posts case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let user5 = User5.keys - + model.pluralName = "User5s" - + model.fields( .id(), .field(user5.username, is: .required, ofType: .string), @@ -28,4 +35,4 @@ extension User5 { .field(user5.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/User5.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/User5.swift index ff56db1e40..32727a0c3c 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/User5.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Models/User5.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct User5: Model { public var posts: List? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - username: String, - posts: List? = []) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + username: String, + posts: List? = [] + ) { + self.init( + id: id, username: username, posts: posts, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - username: String, - posts: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + username: String, + posts: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.username = username self.posts = posts self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Todo.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Todo.swift index 2a88d92570..0c6e1cb0de 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Todo.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Todo.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify +import Foundation struct Todo: Decodable { let typename: String @@ -48,15 +48,15 @@ class CreateTodoMutation { static func variables(id: String? = nil, name: String?, description: String? = nil) -> [String: Any] { var input: [String: Any] = [:] - if let id = id { + if let id { input.updateValue(id, forKey: "id") } - if let name = name { + if let name { input.updateValue(name, forKey: "name") } - if let description = description { + if let description { input.updateValue(description, forKey: "description") } @@ -92,10 +92,10 @@ class UpdateTodoMutation { static func variables(id: String, name: String? = nil, description: String? = nil) -> [String: Any] { var input: [String: Any] = [:] input.updateValue(id, forKey: "id") - if let name = name { + if let name { input.updateValue(name, forKey: "name") } - if let description = description { + if let description { input.updateValue(description, forKey: "description") } return ["input": input] @@ -119,7 +119,7 @@ class DeleteTodoMutation { static func variables(id: String?) -> [String: Any] { var input: [String: Any] = [:] - if let id = id { + if let id { input.updateValue(id, forKey: "id") } @@ -166,20 +166,22 @@ class ListTodosQuery { }\n} """ - static func variables(filter: [String: Any]? = nil, - limit: Int? = nil, - nextToken: String? = nil) -> [String: Any] { + static func variables( + filter: [String: Any]? = nil, + limit: Int? = nil, + nextToken: String? = nil + ) -> [String: Any] { var input: [String: Any] = [:] - if let filter = filter { + if let filter { input.updateValue(filter, forKey: "filter") } - if let limit = limit { + if let limit { input.updateValue(limit, forKey: "limit") } - if let nextToken = nextToken { + if let nextToken { input.updateValue(nextToken, forKey: "nextToken") } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/AWSAPIPluginGen2GraphQLBaseTest.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/AWSAPIPluginGen2GraphQLBaseTest.swift index b3ae499f53..5e19af4f0c 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/AWSAPIPluginGen2GraphQLBaseTest.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/AWSAPIPluginGen2GraphQLBaseTest.swift @@ -5,17 +5,17 @@ // SPDX-License-Identifier: Apache-2.0 // +import AWSCognitoAuthPlugin import XCTest @testable import AWSAPIPlugin @_spi(InternalAmplifyConfiguration) @testable import Amplify @testable import APIHostApp @testable import AWSPluginsCore -import AWSCognitoAuthPlugin class AWSAPIPluginGen2GraphQLBaseTest: XCTestCase { var defaultTestEmail = "test-\(UUID().uuidString)@amazon.com" - + var amplifyConfig: AmplifyOutputsData! override func setUp() { @@ -41,9 +41,11 @@ class AWSAPIPluginGen2GraphQLBaseTest: XCTestCase { /// Setup API with given models /// - Parameter models: DataStore models - func setup(withModels models: AmplifyModelRegistration, - logLevel: LogLevel = .verbose, - withAuthPlugin: Bool = false) async { + func setup( + withModels models: AmplifyModelRegistration, + logLevel: LogLevel = .verbose, + withAuthPlugin: Bool = false + ) async { do { setupConfig() Amplify.Logging.logLevel = logLevel @@ -110,8 +112,10 @@ class AWSAPIPluginGen2GraphQLBaseTest: XCTestCase { case loaded(model: M?) } - func assertLazyReference(_ lazyModel: LazyReference, - state: AssertLazyModelState) { + func assertLazyReference( + _ lazyModel: LazyReference, + state: AssertLazyModelState + ) { switch state { case .notLoaded(let expectedIdentifiers): if case .notLoaded(let identifiers) = lazyModel.modelProvider.getState() { @@ -121,7 +125,7 @@ class AWSAPIPluginGen2GraphQLBaseTest: XCTestCase { } case .loaded(let expectedModel): if case .loaded(let model) = lazyModel.modelProvider.getState() { - guard let expectedModel = expectedModel, let model = model else { + guard let expectedModel, let model else { XCTAssertNil(model) return } @@ -137,7 +141,7 @@ class AWSAPIPluginGen2GraphQLBaseTest: XCTestCase { case isLoaded(count: Int) } - func assertList(_ list: List, state: AssertListState) { + func assertList(_ list: List, state: AssertListState) { switch state { case .isNotLoaded(let expectedAssociatedIdentifiers, let expectedAssociatedFields): if case .notLoaded(let associatedIdentifiers, let associatedFields) = list.listProvider.getState() { @@ -155,12 +159,12 @@ class AWSAPIPluginGen2GraphQLBaseTest: XCTestCase { } } - func assertModelExists(_ model: M) async throws { + func assertModelExists(_ model: some Model) async throws { let modelExists = try await query(for: model) != nil XCTAssertTrue(modelExists) } - func assertModelDoesNotExist(_ model: M) async throws { + func assertModelDoesNotExist(_ model: some Model) async throws { let modelExists = try await query(for: model) != nil XCTAssertFalse(modelExists) } @@ -168,8 +172,10 @@ class AWSAPIPluginGen2GraphQLBaseTest: XCTestCase { func query(for model: M, includes: IncludedAssociations = { _ in [] }) async throws -> M? { let id = M.identifier(model)(schema: model.schema) - var documentBuilder = ModelBasedGraphQLDocumentBuilder(modelSchema: model.schema, - operationType: .query) + var documentBuilder = ModelBasedGraphQLDocumentBuilder( + modelSchema: model.schema, + operationType: .query + ) documentBuilder.add(decorator: DirectiveNameDecorator(type: .get)) if let modelPath = M.rootPath as? ModelPath { @@ -179,10 +185,12 @@ class AWSAPIPluginGen2GraphQLBaseTest: XCTestCase { documentBuilder.add(decorator: ModelIdDecorator(identifierFields: id.fields)) let document = documentBuilder.build() - let request = GraphQLRequest(document: document.stringValue, - variables: document.variables, - responseType: M?.self, - decodePath: document.name) + let request = GraphQLRequest( + document: document.stringValue, + variables: document.variables, + responseType: M?.self, + decodePath: document.name + ) return try await query(request) } @@ -206,8 +214,7 @@ class AWSAPIPluginGen2GraphQLBaseTest: XCTestCase { } if let data = subscriptionEvent.extractData(), - try await verifyChange(data) - { + try await verifyChange(data) { eventReceived.fulfill() } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/AuthSignInHelper.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/AuthSignInHelper.swift index 768145ee0b..fe0547ea0f 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/AuthSignInHelper.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/AuthSignInHelper.swift @@ -21,13 +21,14 @@ enum AuthSignInHelper { username: String, password: String, email: String, - phoneNumber: String? = nil) async throws -> Bool { + phoneNumber: String? = nil + ) async throws -> Bool { var userAttributes = [ AuthUserAttribute(.email, value: email) ] - if let phoneNumber = phoneNumber { + if let phoneNumber { userAttributes.append(AuthUserAttribute(.phoneNumber, value: phoneNumber)) } @@ -45,13 +46,15 @@ enum AuthSignInHelper { username: String, password: String, email: String, - phoneNumber: String? = nil) async throws -> Bool { + phoneNumber: String? = nil + ) async throws -> Bool { await signOut() let signedUp = try await AuthSignInHelper.signUpUser( username: username, password: password, email: email, - phoneNumber: phoneNumber) + phoneNumber: phoneNumber + ) guard signedUp else { throw AuthError.invalidState("Auth sign up failed", "", nil) } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/GraphQLLocationPostUser1Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/GraphQLLocationPostUser1Tests.swift index 65fdc898ab..711321ee4a 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/GraphQLLocationPostUser1Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/GraphQLLocationPostUser1Tests.swift @@ -19,7 +19,8 @@ final class GraphQLLocationPostUser1Tests: AWSAPIPluginGen2GraphQLBaseTest { let post = Post( location: .init( lat: 48.837006, - long: 8.28245)) + long: 8.28245 + )) let createdPost = try await Amplify.API.mutate(request: .create(post)).get() print("\(createdPost)") diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/Location1+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/Location1+Schema.swift index c3ecfd312c..b6f4d2b8af 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/Location1+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/Location1+Schema.swift @@ -1,26 +1,33 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Location1 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Location1 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case lat case long } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let location1 = Location1.keys - + model.listPluralName = "Location1s" model.syncPluralName = "Location1s" - + model.fields( .field(location1.lat, is: .optional, ofType: .double), .field(location1.long, is: .optional, ofType: .double) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/Location1.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/Location1.swift index c7bb5ace84..a47c2eaa28 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/Location1.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/Location1.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,4 +12,4 @@ import Foundation public struct Location1: Embeddable { var lat: Double? var long: Double? -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/Post1+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/Post1+Schema.swift index d6d325cb6d..f191f0f6d7 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/Post1+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/Post1+Schema.swift @@ -1,34 +1,41 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Post1 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Post1 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case location case content case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let post1 = Post1.keys - + model.authRules = [ rule(allow: .public, provider: .apiKey, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "Post1s" model.syncPluralName = "Post1s" - + model.attributes( .primaryKey(fields: [post1.id]) ) - + model.fields( .field(post1.id, is: .required, ofType: .string), .field(post1.location, is: .optional, ofType: .embedded(type: Location1.self)), @@ -37,26 +44,26 @@ extension Post1 { .field(post1.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Post1: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Post1 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == Post1 { + var id: FieldPath { + string("id") } - public var content: FieldPath { - string("content") + var content: FieldPath { + string("content") } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/Post1.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/Post1.swift index 49096a3269..ff4b0e535c 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/Post1.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/Post1.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct Post1: Model { public var content: String? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - location: Location1? = nil, - content: String? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + location: Location1? = nil, + content: String? = nil + ) { + self.init( + id: id, location: location, content: content, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - location: Location1? = nil, - content: String? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + location: Location1? = nil, + content: String? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.location = location self.content = content self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/User1+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/User1+Schema.swift index cf451f68a5..2b63193c75 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/User1+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/User1+Schema.swift @@ -1,33 +1,40 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension User1 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension User1 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case lastKnownLocation case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let user1 = User1.keys - + model.authRules = [ rule(allow: .public, provider: .apiKey, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "User1s" model.syncPluralName = "User1s" - + model.attributes( .primaryKey(fields: [user1.id]) ) - + model.fields( .field(user1.id, is: .required, ofType: .string), .field(user1.lastKnownLocation, is: .optional, ofType: .embedded(type: Location1.self)), @@ -35,23 +42,23 @@ extension User1 { .field(user1.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension User1: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == User1 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == User1 { + var id: FieldPath { + string("id") } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/User1.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/User1.swift index fffb5a42e5..a292eda4ea 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/User1.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_1/User1.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -7,21 +14,27 @@ public struct User1: Model { public var lastKnownLocation: Location1? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - lastKnownLocation: Location1? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + lastKnownLocation: Location1? = nil + ) { + self.init( + id: id, lastKnownLocation: lastKnownLocation, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - lastKnownLocation: Location1? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + lastKnownLocation: Location1? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.lastKnownLocation = lastKnownLocation self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_10/Customer10+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_10/Customer10+Schema.swift index 089a6a3d61..1f343cfdcb 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_10/Customer10+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_10/Customer10+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Customer10 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Customer10 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case name case phoneNumber @@ -12,25 +19,25 @@ extension Customer10 { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let customer10 = Customer10.keys - + model.authRules = [ rule(allow: .public, provider: .apiKey, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "Customer10s" model.syncPluralName = "Customer10s" - + model.attributes( .index(fields: ["accountRepresentativeId"], name: "customer10sByAccountRepresentativeId"), .primaryKey(fields: [customer10.id]) ) - + model.fields( .field(customer10.id, is: .required, ofType: .string), .field(customer10.name, is: .optional, ofType: .string), @@ -40,32 +47,32 @@ extension Customer10 { .field(customer10.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Customer10: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Customer10 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == Customer10 { + var id: FieldPath { + string("id") } - public var name: FieldPath { - string("name") + var name: FieldPath { + string("name") } - public var phoneNumber: FieldPath { - string("phoneNumber") + var phoneNumber: FieldPath { + string("phoneNumber") } - public var accountRepresentativeId: FieldPath { - string("accountRepresentativeId") + var accountRepresentativeId: FieldPath { + string("accountRepresentativeId") } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_10/Customer10.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_10/Customer10.swift index 5d5d2a959b..9920d1533a 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_10/Customer10.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_10/Customer10.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -9,24 +16,30 @@ public struct Customer10: Model { public var accountRepresentativeId: String public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - name: String? = nil, - phoneNumber: String? = nil, - accountRepresentativeId: String) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + name: String? = nil, + phoneNumber: String? = nil, + accountRepresentativeId: String + ) { + self.init( + id: id, name: name, phoneNumber: phoneNumber, accountRepresentativeId: accountRepresentativeId, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - name: String? = nil, - phoneNumber: String? = nil, - accountRepresentativeId: String, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + name: String? = nil, + phoneNumber: String? = nil, + accountRepresentativeId: String, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.phoneNumber = phoneNumber @@ -34,4 +47,4 @@ public struct Customer10: Model { self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_10/GraphQLCustomer10Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_10/GraphQLCustomer10Tests.swift index 80cacd0df2..b0d8225fdc 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_10/GraphQLCustomer10Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_10/GraphQLCustomer10Tests.swift @@ -5,13 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 // - -import Foundation import Combine +import Foundation import XCTest -@testable import Amplify import AWSPluginsCore +@testable import Amplify final class GraphQLCustomer10Tests: AWSAPIPluginGen2GraphQLBaseTest { @@ -49,13 +48,14 @@ final class GraphQLCustomer10Tests: AWSAPIPluginGen2GraphQLBaseTest { let request = GraphQLRequest>( document: document, responseType: PaginatedList.self, - decodePath: operationName) + decodePath: operationName + ) let queriedCustomers = try await Amplify.API.query( request: request).get() // Code Snippet Ends - XCTAssertTrue(queriedCustomers.items.count != 0 || queriedCustomers.nextToken != nil) + XCTAssertTrue(!queriedCustomers.items.isEmpty || queriedCustomers.nextToken != nil) } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_11/GraphQLPost11Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_11/GraphQLPost11Tests.swift index f8960e9fb0..1c8950f090 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_11/GraphQLPost11Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_11/GraphQLPost11Tests.swift @@ -21,7 +21,8 @@ final class GraphQLPost11Tests: AWSAPIPluginGen2GraphQLBaseTest { _ = try await AuthSignInHelper.registerAndSignInUser( username: username, password: password, - email: defaultTestEmail) + email: defaultTestEmail + ) } catch { XCTFail("Could not sign up and sign in user \(error)") } @@ -31,7 +32,8 @@ final class GraphQLPost11Tests: AWSAPIPluginGen2GraphQLBaseTest { let post = Post(title: "Hello World") let createdTodo = try await Amplify.API.mutate(request: .create( post, - authMode: .amazonCognitoUserPools)).get() + authMode: .amazonCognitoUserPools + )).get() } catch { print("Failed to create post", error) // Code Snippet Ends @@ -46,11 +48,12 @@ final class GraphQLPost11Tests: AWSAPIPluginGen2GraphQLBaseTest { do { let queriedPosts = try await Amplify.API.query(request: .list( Post.self, - authMode: .awsIAM)).get() + authMode: .awsIAM + )).get() print("Number of posts:", queriedPosts.count) // Code Snippet Ends - XCTAssertTrue(queriedPosts.count > 0 || queriedPosts.hasNextPage()) + XCTAssertTrue(!queriedPosts.isEmpty || queriedPosts.hasNextPage()) // Code Snippet Begins } catch { print("Failed to list posts", error) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_11/Post11+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_11/Post11+Schema.swift index 874efebc20..71252b983b 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_11/Post11+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_11/Post11+Schema.swift @@ -1,35 +1,42 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Post11 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Post11 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case title case content case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let post11 = Post11.keys - + model.authRules = [ rule(allow: .public, provider: .iam, operations: [.read]), rule(allow: .owner, ownerField: "owner", identityClaim: "cognito:username", provider: .userPools, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "Post11s" model.syncPluralName = "Post11s" - + model.attributes( .primaryKey(fields: [post11.id]) ) - + model.fields( .field(post11.id, is: .required, ofType: .string), .field(post11.title, is: .optional, ofType: .string), @@ -38,29 +45,29 @@ extension Post11 { .field(post11.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Post11: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Post11 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == Post11 { + var id: FieldPath { + string("id") } - public var title: FieldPath { - string("title") + var title: FieldPath { + string("title") } - public var content: FieldPath { - string("content") + var content: FieldPath { + string("content") } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_11/Post11.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_11/Post11.swift index 11b513d670..b19d8e9999 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_11/Post11.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_11/Post11.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct Post11: Model { public var content: String? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - title: String? = nil, - content: String? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + title: String? = nil, + content: String? = nil + ) { + self.init( + id: id, title: title, content: content, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - title: String? = nil, - content: String? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + title: String? = nil, + content: String? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.title = title self.content = content self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_12/GraphQLTodo12Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_12/GraphQLTodo12Tests.swift index 60faaadefa..d52bf9a78e 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_12/GraphQLTodo12Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_12/GraphQLTodo12Tests.swift @@ -15,13 +15,14 @@ final class GraphQLTodo12Tests: AWSAPIPluginGen2GraphQLBaseTest { // https://docs.amplify.aws/react/build-a-backend/data/customize-authz/public-data-access/#add-public-authorization-rule-using-api-key-based-authentication func testCodeSnippet() async throws { await setup(withModels: Todo12Models()) - + // Code Snippet begins do { let todo = Todo(content: "My new todo") let createdTodo = try await Amplify.API.mutate(request: .create( todo, - authMode: .apiKey)).get() + authMode: .apiKey + )).get() } catch { print("Failed to create todo", error) // Code Snippet Ends diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_12/Todo12+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_12/Todo12+Schema.swift index a9ded86979..201ea658f8 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_12/Todo12+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_12/Todo12+Schema.swift @@ -1,33 +1,40 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Todo12 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Todo12 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case content case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let todo12 = Todo12.keys - + model.authRules = [ rule(allow: .public, provider: .apiKey, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "Todo12s" model.syncPluralName = "Todo12s" - + model.attributes( .primaryKey(fields: [todo12.id]) ) - + model.fields( .field(todo12.id, is: .required, ofType: .string), .field(todo12.content, is: .optional, ofType: .string), @@ -35,26 +42,26 @@ extension Todo12 { .field(todo12.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Todo12: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Todo12 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == Todo12 { + var id: FieldPath { + string("id") } - public var content: FieldPath { - string("content") + var content: FieldPath { + string("content") } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_12/Todo12.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_12/Todo12.swift index 34639f2153..0f24e2a5f4 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_12/Todo12.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_12/Todo12.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -7,21 +14,27 @@ public struct Todo12: Model { public var content: String? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - content: String? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + content: String? = nil + ) { + self.init( + id: id, content: content, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - content: String? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + content: String? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_13/GraphQLTodo13Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_13/GraphQLTodo13Tests.swift index dc81e3aecd..cb3556882d 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_13/GraphQLTodo13Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_13/GraphQLTodo13Tests.swift @@ -21,7 +21,8 @@ final class GraphQLTodo13Tests: AWSAPIPluginGen2GraphQLBaseTest { let todo = Todo(content: "My new todo") let createdTodo = try await Amplify.API.mutate(request: .create( todo, - authMode: .awsIAM)).get() + authMode: .awsIAM + )).get() // Code Snippet Ends XCTAssertEqual(createdTodo.id, todo.id) // Code Snippet Begins diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_13/Todo13+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_13/Todo13+Schema.swift index f8646c9a76..37aa1af60a 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_13/Todo13+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_13/Todo13+Schema.swift @@ -1,33 +1,40 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Todo13 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Todo13 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case content case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let todo13 = Todo13.keys - + model.authRules = [ rule(allow: .public, provider: .iam, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "Todo13s" model.syncPluralName = "Todo13s" - + model.attributes( .primaryKey(fields: [todo13.id]) ) - + model.fields( .field(todo13.id, is: .required, ofType: .string), .field(todo13.content, is: .optional, ofType: .string), @@ -35,26 +42,26 @@ extension Todo13 { .field(todo13.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Todo13: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Todo13 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == Todo13 { + var id: FieldPath { + string("id") } - public var content: FieldPath { - string("content") + var content: FieldPath { + string("content") } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_13/Todo13.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_13/Todo13.swift index cce0e45d70..2485b1d811 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_13/Todo13.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_13/Todo13.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -7,21 +14,27 @@ public struct Todo13: Model { public var content: String? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - content: String? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + content: String? = nil + ) { + self.init( + id: id, content: content, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - content: String? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + content: String? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_14/GraphQLTodo14Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_14/GraphQLTodo14Tests.swift index dcb9fa2e6d..3752e50008 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_14/GraphQLTodo14Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_14/GraphQLTodo14Tests.swift @@ -21,7 +21,8 @@ final class GraphQLTodo14Tests: AWSAPIPluginGen2GraphQLBaseTest { _ = try await AuthSignInHelper.registerAndSignInUser( username: username, password: password, - email: defaultTestEmail) + email: defaultTestEmail + ) } catch { XCTFail("Could not sign up and sign in user \(error)") } @@ -31,7 +32,8 @@ final class GraphQLTodo14Tests: AWSAPIPluginGen2GraphQLBaseTest { let todo = Todo(content: "My new todo") let createdTodo = try await Amplify.API.mutate(request: .create( todo, - authMode: .amazonCognitoUserPools)).get() + authMode: .amazonCognitoUserPools + )).get() // Code Snippet Ends XCTAssertEqual(createdTodo.id, todo.id) // Code Snippet Begins diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_14/Todo14+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_14/Todo14+Schema.swift index c7b1cb8a9a..5be8993e1d 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_14/Todo14+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_14/Todo14+Schema.swift @@ -1,33 +1,40 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Todo14 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Todo14 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case content case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let todo14 = Todo14.keys - + model.authRules = [ rule(allow: .owner, ownerField: "owner", identityClaim: "cognito:username", provider: .userPools, operations: [.create, .read, .update]) ] - + model.listPluralName = "Todo14s" model.syncPluralName = "Todo14s" - + model.attributes( .primaryKey(fields: [todo14.id]) ) - + model.fields( .field(todo14.id, is: .required, ofType: .string), .field(todo14.content, is: .optional, ofType: .string), @@ -35,26 +42,26 @@ extension Todo14 { .field(todo14.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Todo14: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Todo14 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == Todo14 { + var id: FieldPath { + string("id") } - public var content: FieldPath { - string("content") + var content: FieldPath { + string("content") } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_14/Todo14.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_14/Todo14.swift index 27d172c39b..887686110d 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_14/Todo14.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_14/Todo14.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -7,21 +14,27 @@ public struct Todo14: Model { public var content: String? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - content: String? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + content: String? = nil + ) { + self.init( + id: id, content: content, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - content: String? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + content: String? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_15/GraphQLTodo15Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_15/GraphQLTodo15Tests.swift index d7cd68305f..be24132344 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_15/GraphQLTodo15Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_15/GraphQLTodo15Tests.swift @@ -21,7 +21,8 @@ final class GraphQLTodo15Tests: AWSAPIPluginGen2GraphQLBaseTest { _ = try await AuthSignInHelper.registerAndSignInUser( username: username, password: password, - email: defaultTestEmail) + email: defaultTestEmail + ) } catch { XCTFail("Could not sign up and sign in user \(error)") } @@ -31,7 +32,8 @@ final class GraphQLTodo15Tests: AWSAPIPluginGen2GraphQLBaseTest { let todo = Todo(content: "My new todo") let createdTodo = try await Amplify.API.mutate(request: .create( todo, - authMode: .amazonCognitoUserPools)).get() + authMode: .amazonCognitoUserPools + )).get() // Code Snippet Ends XCTAssertEqual(createdTodo.id, todo.id) // Code Snippet Begins @@ -51,14 +53,16 @@ final class GraphQLTodo15Tests: AWSAPIPluginGen2GraphQLBaseTest { _ = try await AuthSignInHelper.registerAndSignInUser( username: username, password: password, - email: defaultTestEmail) + email: defaultTestEmail + ) } catch { XCTFail("Could not sign up and sign in user \(error)") } let todo = Todo(content: "My new todo") var createdTodo = try await Amplify.API.mutate(request: .create( todo, - authMode: .amazonCognitoUserPools)).get() + authMode: .amazonCognitoUserPools + )).get() let otherUserId = "otherUserId" // Code Snippet begins @@ -66,7 +70,8 @@ final class GraphQLTodo15Tests: AWSAPIPluginGen2GraphQLBaseTest { createdTodo.owners?.append(otherUserId) let updatedTodo = try await Amplify.API.mutate(request: .update( createdTodo, - authMode: .amazonCognitoUserPools)).get() + authMode: .amazonCognitoUserPools + )).get() // Code Snippet Ends XCTAssertEqual(updatedTodo.id, todo.id) XCTAssertEqual(updatedTodo.owners?.count, 2) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_15/Todo15+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_15/Todo15+Schema.swift index 8b271ff315..a1fbbdb25f 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_15/Todo15+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_15/Todo15+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Todo15 { +public extension Todo15 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id case content case owners @@ -12,10 +19,10 @@ extension Todo15 { case updatedAt } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let todo15 = Todo15.keys model.authRules = [ @@ -37,29 +44,29 @@ extension Todo15 { .field(todo15.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } + class Path: ModelPath { } - public static var rootPath: PropertyContainerPath? { Path() } + static var rootPath: PropertyContainerPath? { Path() } } extension Todo15: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Todo15 { - public var id: FieldPath { +public extension ModelPath where ModelType == Todo15 { + var id: FieldPath { string("id") } - public var content: FieldPath { + var content: FieldPath { string("content") } - public var owners: FieldPath { + var owners: FieldPath { string("owners") } - public var createdAt: FieldPath { + var createdAt: FieldPath { datetime("createdAt") } - public var updatedAt: FieldPath { + var updatedAt: FieldPath { datetime("updatedAt") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_15/Todo15.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_15/Todo15.swift index 4e68848094..b61b3e4109 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_15/Todo15.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_15/Todo15.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -9,20 +16,26 @@ public struct Todo15: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - public init(id: String = UUID().uuidString, - content: String? = nil, - owners: [String?]? = nil) { - self.init(id: id, + public init( + id: String = UUID().uuidString, + content: String? = nil, + owners: [String?]? = nil + ) { + self.init( + id: id, content: content, owners: owners, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - content: String? = nil, - owners: [String?]? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + content: String? = nil, + owners: [String?]? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self.owners = owners diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_16/GraphQLTodo16Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_16/GraphQLTodo16Tests.swift index 5ccc18db98..6da1157b4a 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_16/GraphQLTodo16Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_16/GraphQLTodo16Tests.swift @@ -21,7 +21,8 @@ final class GraphQLTodo16Tests: AWSAPIPluginGen2GraphQLBaseTest { _ = try await AuthSignInHelper.registerAndSignInUser( username: username, password: password, - email: defaultTestEmail) + email: defaultTestEmail + ) } catch { XCTFail("Could not sign up and sign in user \(error)") } @@ -31,7 +32,8 @@ final class GraphQLTodo16Tests: AWSAPIPluginGen2GraphQLBaseTest { let todo = Todo(content: "My new todo") let createdTodo = try await Amplify.API.mutate(request: .create( todo, - authMode: .amazonCognitoUserPools)).get() + authMode: .amazonCognitoUserPools + )).get() // Code Snippet Ends XCTAssertEqual(createdTodo.id, todo.id) // Code Snippet Begins diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_16/Todo16+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_16/Todo16+Schema.swift index f7cc2e55f8..c0183e14cf 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_16/Todo16+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_16/Todo16+Schema.swift @@ -1,33 +1,40 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Todo16 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Todo16 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case content case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let todo16 = Todo16.keys - + model.authRules = [ rule(allow: .private, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "Todo16s" model.syncPluralName = "Todo16s" - + model.attributes( .primaryKey(fields: [todo16.id]) ) - + model.fields( .field(todo16.id, is: .required, ofType: .string), .field(todo16.content, is: .optional, ofType: .string), @@ -35,26 +42,26 @@ extension Todo16 { .field(todo16.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Todo16: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Todo16 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == Todo16 { + var id: FieldPath { + string("id") } - public var content: FieldPath { - string("content") + var content: FieldPath { + string("content") } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_16/Todo16.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_16/Todo16.swift index 11fc206310..b4b403f17e 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_16/Todo16.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_16/Todo16.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -7,21 +14,27 @@ public struct Todo16: Model { public var content: String? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - content: String? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + content: String? = nil + ) { + self.init( + id: id, content: content, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - content: String? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + content: String? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_17/GraphQLTodo17Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_17/GraphQLTodo17Tests.swift index c1199f82a8..d0c9ecf8b2 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_17/GraphQLTodo17Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_17/GraphQLTodo17Tests.swift @@ -21,7 +21,8 @@ final class GraphQLTodo17Tests: AWSAPIPluginGen2GraphQLBaseTest { _ = try await AuthSignInHelper.registerAndSignInUser( username: username, password: password, - email: defaultTestEmail) + email: defaultTestEmail + ) } catch { XCTFail("Could not sign up and sign in user \(error)") } @@ -31,7 +32,8 @@ final class GraphQLTodo17Tests: AWSAPIPluginGen2GraphQLBaseTest { let todo = Todo(content: "My new todo") let createdTodo = try await Amplify.API.mutate(request: .create( todo, - authMode: .awsIAM)).get() + authMode: .awsIAM + )).get() // Code Snippet Ends XCTAssertEqual(createdTodo.id, todo.id) // Code Snippet Begins diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_17/Todo17+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_17/Todo17+Schema.swift index 49fc0d8cf8..a4077df7d7 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_17/Todo17+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_17/Todo17+Schema.swift @@ -1,33 +1,40 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Todo17 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Todo17 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case content case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let todo17 = Todo17.keys - + model.authRules = [ rule(allow: .private, provider: .iam, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "Todo17s" model.syncPluralName = "Todo17s" - + model.attributes( .primaryKey(fields: [todo17.id]) ) - + model.fields( .field(todo17.id, is: .required, ofType: .string), .field(todo17.content, is: .optional, ofType: .string), @@ -35,26 +42,26 @@ extension Todo17 { .field(todo17.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Todo17: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Todo17 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == Todo17 { + var id: FieldPath { + string("id") } - public var content: FieldPath { - string("content") + var content: FieldPath { + string("content") } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_17/Todo17.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_17/Todo17.swift index 5e7f05fb8f..75e8f0fb40 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_17/Todo17.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_17/Todo17.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -7,21 +14,27 @@ public struct Todo17: Model { public var content: String? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - content: String? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + content: String? = nil + ) { + self.init( + id: id, content: content, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - content: String? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + content: String? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_18/GraphQLSalary18Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_18/GraphQLSalary18Tests.swift index 83fd00da50..7ee12d0b0f 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_18/GraphQLSalary18Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_18/GraphQLSalary18Tests.swift @@ -20,19 +20,22 @@ final class GraphQLSalary18Tests: AWSAPIPluginGen2GraphQLBaseTest { _ = try await AuthSignInHelper.registerAndSignInUser( username: username, password: password, - email: defaultTestEmail) + email: defaultTestEmail + ) } catch { XCTFail("Could not sign up and sign in user \(error)") } - + // Code Snippet begins do { let salary = Salary( wage: 50.25, - currency: "USD") + currency: "USD" + ) let createdSalary = try await Amplify.API.mutate(request: .create( salary, - authMode: .amazonCognitoUserPools)).get() + authMode: .amazonCognitoUserPools + )).get() // Code Snippet Ends XCTFail("Should not make it to here. Expected to catch failure since user is not in the Admin group.") // Code Snippet begins diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_18/Salary18+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_18/Salary18+Schema.swift index c38405bfa8..bbcf7fca0f 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_18/Salary18+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_18/Salary18+Schema.swift @@ -1,34 +1,41 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Salary18 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Salary18 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case wage case currency case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let salary18 = Salary18.keys - + model.authRules = [ rule(allow: .groups, groupClaim: "cognito:groups", groups: ["Admin"], provider: .userPools, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "Salary18s" model.syncPluralName = "Salary18s" - + model.attributes( .primaryKey(fields: [salary18.id]) ) - + model.fields( .field(salary18.id, is: .required, ofType: .string), .field(salary18.wage, is: .optional, ofType: .double), @@ -37,29 +44,29 @@ extension Salary18 { .field(salary18.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Salary18: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Salary18 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == Salary18 { + var id: FieldPath { + string("id") } - public var wage: FieldPath { - double("wage") + var wage: FieldPath { + double("wage") } - public var currency: FieldPath { - string("currency") + var currency: FieldPath { + string("currency") } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_18/Salary18.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_18/Salary18.swift index 041e8faaea..4ff6dc5a64 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_18/Salary18.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_18/Salary18.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct Salary18: Model { public var currency: String? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - wage: Double? = nil, - currency: String? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + wage: Double? = nil, + currency: String? = nil + ) { + self.init( + id: id, wage: wage, currency: currency, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - wage: Double? = nil, - currency: String? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + wage: Double? = nil, + currency: String? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.wage = wage self.currency = currency self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_2/GraphQLPostVideoPrivacySetting2Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_2/GraphQLPostVideoPrivacySetting2Tests.swift index 45d7c66a1b..53711d8dd7 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_2/GraphQLPostVideoPrivacySetting2Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_2/GraphQLPostVideoPrivacySetting2Tests.swift @@ -19,7 +19,8 @@ final class GraphQLPostVideoPrivacySettings2Tests: AWSAPIPluginGen2GraphQLBaseTe // Code Snippet Begins let post = Post( content: "hello", - privacySetting: .private) + privacySetting: .private + ) let createdPost = try await Amplify.API.mutate(request: .create(post)).get() // Code Snippet Ends diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_2/Post2+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_2/Post2+Schema.swift index f8aaae10fc..e5164fec5f 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_2/Post2+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_2/Post2+Schema.swift @@ -1,34 +1,41 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Post2 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Post2 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case content case privacySetting case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let post2 = Post2.keys - + model.authRules = [ rule(allow: .public, provider: .apiKey, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "Post2s" model.syncPluralName = "Post2s" - + model.attributes( .primaryKey(fields: [post2.id]) ) - + model.fields( .field(post2.id, is: .required, ofType: .string), .field(post2.content, is: .optional, ofType: .string), @@ -37,26 +44,26 @@ extension Post2 { .field(post2.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Post2: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Post2 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == Post2 { + var id: FieldPath { + string("id") } - public var content: FieldPath { - string("content") + var content: FieldPath { + string("content") } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_2/Post2.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_2/Post2.swift index 9ed7b58d6b..22e22e02e1 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_2/Post2.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_2/Post2.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct Post2: Model { public var privacySetting: PrivacySetting2? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - content: String? = nil, - privacySetting: PrivacySetting2? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + content: String? = nil, + privacySetting: PrivacySetting2? = nil + ) { + self.init( + id: id, content: content, privacySetting: privacySetting, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - content: String? = nil, - privacySetting: PrivacySetting2? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + content: String? = nil, + privacySetting: PrivacySetting2? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self.privacySetting = privacySetting self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_2/PrivacySetting2.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_2/PrivacySetting2.swift index a3cbe56cc4..282b318fc1 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_2/PrivacySetting2.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_2/PrivacySetting2.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -6,4 +13,4 @@ public enum PrivacySetting2: String, EnumPersistable { case `private` = "PRIVATE" case friendsOnly = "FRIENDS_ONLY" case `public` = "PUBLIC" -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_2/Video2+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_2/Video2+Schema.swift index ae333846a0..568798cf1e 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_2/Video2+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_2/Video2+Schema.swift @@ -1,33 +1,40 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Video2 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Video2 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case privacySetting case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let video2 = Video2.keys - + model.authRules = [ rule(allow: .public, provider: .apiKey, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "Video2s" model.syncPluralName = "Video2s" - + model.attributes( .primaryKey(fields: [video2.id]) ) - + model.fields( .field(video2.id, is: .required, ofType: .string), .field(video2.privacySetting, is: .optional, ofType: .enum(type: PrivacySetting2.self)), @@ -35,23 +42,23 @@ extension Video2 { .field(video2.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Video2: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Video2 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == Video2 { + var id: FieldPath { + string("id") } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_2/Video2.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_2/Video2.swift index c066eefa31..c0509ab14c 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_2/Video2.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_2/Video2.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -7,21 +14,27 @@ public struct Video2: Model { public var privacySetting: PrivacySetting2? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - privacySetting: PrivacySetting2? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + privacySetting: PrivacySetting2? = nil + ) { + self.init( + id: id, privacySetting: privacySetting, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - privacySetting: PrivacySetting2? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + privacySetting: PrivacySetting2? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.privacySetting = privacySetting self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_3/GraphQLTeamMember3Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_3/GraphQLTeamMember3Tests.swift index 1ae35afd0d..7829c0f5be 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_3/GraphQLTeamMember3Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_3/GraphQLTeamMember3Tests.swift @@ -24,7 +24,8 @@ final class GraphQLTeamMember3Tests: AWSAPIPluginGen2GraphQLBaseTest { let member = Member( name: "Tim", - team: createdTeam) // Directly pass in the team instance + team: createdTeam + ) // Directly pass in the team instance let createdMember = try await Amplify.API.mutate(request: .create(member)) } catch { print("Create team or member failed", error) @@ -44,7 +45,8 @@ final class GraphQLTeamMember3Tests: AWSAPIPluginGen2GraphQLBaseTest { let oldTeamCreated = try await Amplify.API.mutate(request: .create(oldTeam)).get() let member = Member( name: "Tim", - team: oldTeamCreated) // Directly pass in the post instance + team: oldTeamCreated + ) // Directly pass in the post instance var existingMember = try await Amplify.API.mutate(request: .create(member)).get() // Code Snippet Begins @@ -79,7 +81,8 @@ final class GraphQLTeamMember3Tests: AWSAPIPluginGen2GraphQLBaseTest { let teamCreated = try await Amplify.API.mutate(request: .create(team)).get() let member = Member( name: "Tim", - team: teamCreated) // Directly pass in the post instance + team: teamCreated + ) // Directly pass in the post instance var existingMember = try await Amplify.API.mutate(request: .create(member)).get() // Code Snippet Begins @@ -102,7 +105,8 @@ final class GraphQLTeamMember3Tests: AWSAPIPluginGen2GraphQLBaseTest { let teamCreated = try await Amplify.API.mutate(request: .create(team)).get() let member = Member( name: "Tim", - team: teamCreated) // Directly pass in the post instance + team: teamCreated + ) // Directly pass in the post instance _ = try await Amplify.API.mutate(request: .create(member)).get() // Code Snippet Begins @@ -110,7 +114,8 @@ final class GraphQLTeamMember3Tests: AWSAPIPluginGen2GraphQLBaseTest { let queriedTeam = try await Amplify.API.query( request: .get( Team.self, - byIdentifier: team.identifier)).get() + byIdentifier: team.identifier + )).get() guard let queriedTeam, let members = queriedTeam.members else { print("Missing team or members") @@ -122,7 +127,7 @@ final class GraphQLTeamMember3Tests: AWSAPIPluginGen2GraphQLBaseTest { try await members.fetch() print("Number of members: \(members.count)") // Code Snippet Ends - XCTAssertTrue(members.count > 0) + XCTAssertTrue(!members.isEmpty) // Code Snippet Begins } catch { print("Failed to fetch team or members", error) @@ -140,7 +145,8 @@ final class GraphQLTeamMember3Tests: AWSAPIPluginGen2GraphQLBaseTest { let teamCreated = try await Amplify.API.mutate(request: .create(team)).get() let member = Member( name: "Tim", - team: teamCreated) // Directly pass in the post instance + team: teamCreated + ) // Directly pass in the post instance _ = try await Amplify.API.mutate(request: .create(member)).get() // Code Snippet Begins @@ -149,7 +155,8 @@ final class GraphQLTeamMember3Tests: AWSAPIPluginGen2GraphQLBaseTest { request: .get( Team.self, byIdentifier: team.identifier, - includes: { team in [team.members]})) + includes: { team in [team.members]} + )) .get() guard let queriedTeamWithMembers, let members = queriedTeamWithMembers.members else { print("Missing team or members") @@ -160,7 +167,7 @@ final class GraphQLTeamMember3Tests: AWSAPIPluginGen2GraphQLBaseTest { } print("Number of members: \(members.count)") // Code Snippet Ends - XCTAssertTrue(members.count > 0) + XCTAssertTrue(!members.isEmpty) // Code Snippet Begins } catch { print("Failed to fetch team with members", error) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_3/Member3+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_3/Member3+Schema.swift index e288a808c0..13bb3215c2 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_3/Member3+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_3/Member3+Schema.swift @@ -1,34 +1,41 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Member3 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Member3 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case name case team case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let member3 = Member3.keys - + model.authRules = [ rule(allow: .public, provider: .apiKey, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "Member3s" model.syncPluralName = "Member3s" - + model.attributes( .primaryKey(fields: [member3.id]) ) - + model.fields( .field(member3.id, is: .required, ofType: .string), .field(member3.name, is: .required, ofType: .string), @@ -37,29 +44,29 @@ extension Member3 { .field(member3.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Member3: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Member3 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == Member3 { + var id: FieldPath { + string("id") } - public var name: FieldPath { - string("name") + var name: FieldPath { + string("name") } - public var team: ModelPath { - Team3.Path(name: "team", parent: self) + var team: ModelPath { + Team3.Path(name: "team", parent: self) } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_3/Member3.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_3/Member3.swift index 10f6c94442..fbaa6047b1 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_3/Member3.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_3/Member3.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,29 +12,35 @@ import Foundation public struct Member3: Model { public let id: String public var name: String - internal var _team: LazyReference + var _team: LazyReference public var team: Team3? { - get async throws { + get async throws { try await _team.get() - } + } } public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - name: String, - team: Team3? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + name: String, + team: Team3? = nil + ) { + self.init( + id: id, name: name, team: team, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - name: String, - team: Team3? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + name: String, + team: Team3? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self._team = LazyReference(team) @@ -35,15 +48,15 @@ public struct Member3: Model { self.updatedAt = updatedAt } public mutating func setTeam(_ team: Team3? = nil) { - self._team = LazyReference(team) + _team = LazyReference(team) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decode(String.self, forKey: .id) - name = try values.decode(String.self, forKey: .name) - _team = try values.decodeIfPresent(LazyReference.self, forKey: .team) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.id = try values.decode(String.self, forKey: .id) + self.name = try values.decode(String.self, forKey: .name) + self._team = try values.decodeIfPresent(LazyReference.self, forKey: .team) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) @@ -53,4 +66,4 @@ public struct Member3: Model { try container.encode(createdAt, forKey: .createdAt) try container.encode(updatedAt, forKey: .updatedAt) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_3/Team3+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_3/Team3+Schema.swift index b09f9b50ea..9a22d2dca0 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_3/Team3+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_3/Team3+Schema.swift @@ -1,34 +1,41 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Team3 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Team3 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case mantra case members case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let team3 = Team3.keys - + model.authRules = [ rule(allow: .public, provider: .apiKey, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "Team3s" model.syncPluralName = "Team3s" - + model.attributes( .primaryKey(fields: [team3.id]) ) - + model.fields( .field(team3.id, is: .required, ofType: .string), .field(team3.mantra, is: .required, ofType: .string), @@ -37,29 +44,29 @@ extension Team3 { .field(team3.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Team3: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Team3 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == Team3 { + var id: FieldPath { + string("id") } - public var mantra: FieldPath { - string("mantra") + var mantra: FieldPath { + string("mantra") } - public var members: ModelPath { - Member3.Path(name: "members", isCollection: true, parent: self) + var members: ModelPath { + Member3.Path(name: "members", isCollection: true, parent: self) } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_3/Team3.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_3/Team3.swift index 2cf2dba585..78f496c7e6 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_3/Team3.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_3/Team3.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct Team3: Model { public var members: List? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - mantra: String, - members: List? = []) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + mantra: String, + members: List? = [] + ) { + self.init( + id: id, mantra: mantra, members: members, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - mantra: String, - members: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + mantra: String, + members: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.mantra = mantra self.members = members self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Cart4+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Cart4+Schema.swift index f524ceab99..1e54d58520 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Cart4+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Cart4+Schema.swift @@ -1,34 +1,41 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Cart4 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Cart4 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case items case customer case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let cart4 = Cart4.keys - + model.authRules = [ rule(allow: .public, provider: .apiKey, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "Cart4s" model.syncPluralName = "Cart4s" - + model.attributes( .primaryKey(fields: [cart4.id]) ) - + model.fields( .field(cart4.id, is: .required, ofType: .string), .field(cart4.items, is: .optional, ofType: .embeddedCollection(of: String.self)), @@ -37,29 +44,29 @@ extension Cart4 { .field(cart4.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Cart4: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Cart4 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == Cart4 { + var id: FieldPath { + string("id") } - public var items: FieldPath { - string("items") + var items: FieldPath { + string("items") } - public var customer: ModelPath { - Customer4.Path(name: "customer", parent: self) + var customer: ModelPath { + Customer4.Path(name: "customer", parent: self) } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Cart4.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Cart4.swift index 31d636fd1e..3493796d0a 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Cart4.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Cart4.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,29 +12,35 @@ import Foundation public struct Cart4: Model { public let id: String public var items: [String]? - internal var _customer: LazyReference + var _customer: LazyReference public var customer: Customer4? { - get async throws { + get async throws { try await _customer.get() - } + } } public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - items: [String]? = nil, - customer: Customer4? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + items: [String]? = nil, + customer: Customer4? = nil + ) { + self.init( + id: id, items: items, customer: customer, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - items: [String]? = nil, - customer: Customer4? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + items: [String]? = nil, + customer: Customer4? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.items = items self._customer = LazyReference(customer) @@ -35,15 +48,15 @@ public struct Cart4: Model { self.updatedAt = updatedAt } public mutating func setCustomer(_ customer: Customer4? = nil) { - self._customer = LazyReference(customer) + _customer = LazyReference(customer) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decode(String.self, forKey: .id) - items = try values.decode([String].self, forKey: .items) - _customer = try values.decodeIfPresent(LazyReference.self, forKey: .customer) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.id = try values.decode(String.self, forKey: .id) + self.items = try values.decode([String].self, forKey: .items) + self._customer = try values.decodeIfPresent(LazyReference.self, forKey: .customer) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) @@ -53,4 +66,4 @@ public struct Cart4: Model { try container.encode(createdAt, forKey: .createdAt) try container.encode(updatedAt, forKey: .updatedAt) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Customer4+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Customer4+Schema.swift index 56b085c0c3..e003f2a098 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Customer4+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Customer4+Schema.swift @@ -1,34 +1,41 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Customer4 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Customer4 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case name case activeCart case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let customer4 = Customer4.keys - + model.authRules = [ rule(allow: .public, provider: .apiKey, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "Customer4s" model.syncPluralName = "Customer4s" - + model.attributes( .primaryKey(fields: [customer4.id]) ) - + model.fields( .field(customer4.id, is: .required, ofType: .string), .field(customer4.name, is: .optional, ofType: .string), @@ -37,29 +44,29 @@ extension Customer4 { .field(customer4.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Customer4: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Customer4 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == Customer4 { + var id: FieldPath { + string("id") } - public var name: FieldPath { - string("name") + var name: FieldPath { + string("name") } - public var activeCart: ModelPath { - Cart4.Path(name: "activeCart", parent: self) + var activeCart: ModelPath { + Cart4.Path(name: "activeCart", parent: self) } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Customer4.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Customer4.swift index 13ee66321a..8ae99d8a47 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Customer4.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Customer4.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,29 +12,35 @@ import Foundation public struct Customer4: Model { public let id: String public var name: String? - internal var _activeCart: LazyReference + var _activeCart: LazyReference public var activeCart: Cart4? { - get async throws { + get async throws { try await _activeCart.get() - } + } } public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - name: String? = nil, - activeCart: Cart4? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + name: String? = nil, + activeCart: Cart4? = nil + ) { + self.init( + id: id, name: name, activeCart: activeCart, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - name: String? = nil, - activeCart: Cart4? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + name: String? = nil, + activeCart: Cart4? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self._activeCart = LazyReference(activeCart) @@ -35,15 +48,15 @@ public struct Customer4: Model { self.updatedAt = updatedAt } public mutating func setActiveCart(_ activeCart: Cart4? = nil) { - self._activeCart = LazyReference(activeCart) + _activeCart = LazyReference(activeCart) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decode(String.self, forKey: .id) - name = try? values.decode(String?.self, forKey: .name) - _activeCart = try values.decodeIfPresent(LazyReference.self, forKey: .activeCart) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.id = try values.decode(String.self, forKey: .id) + self.name = try? values.decode(String?.self, forKey: .name) + self._activeCart = try values.decodeIfPresent(LazyReference.self, forKey: .activeCart) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) @@ -53,4 +66,4 @@ public struct Customer4: Model { try container.encode(createdAt, forKey: .createdAt) try container.encode(updatedAt, forKey: .updatedAt) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Gen2_41/GraphQLPostPerson41Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Gen2_41/GraphQLPostPerson41Tests.swift index 603ad7a259..c24ba889ea 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Gen2_41/GraphQLPostPerson41Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Gen2_41/GraphQLPostPerson41Tests.swift @@ -24,7 +24,8 @@ final class GraphQLPostPerson41Tests: AWSAPIPluginGen2GraphQLBaseTest { title: "title", content: "content", author: author, - editor: editor) + editor: editor + ) _ = try await Amplify.API.mutate(request: .create(post)) // Code Snippet Begins @@ -32,7 +33,8 @@ final class GraphQLPostPerson41Tests: AWSAPIPluginGen2GraphQLBaseTest { guard let queriedPost = try await Amplify.API.query( request: .get( Post.self, - byIdentifier: post.identifier)).get() else { + byIdentifier: post.identifier + )).get() else { print("Missing post") // Code Snippet Ends XCTFail("Missing post") diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Gen2_41/Person41+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Gen2_41/Person41+Schema.swift index 67f028ed2e..e44ce5b2b4 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Gen2_41/Person41+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Gen2_41/Person41+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Person41 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Person41 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case name case editedPosts @@ -12,24 +19,24 @@ extension Person41 { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let person41 = Person41.keys - + model.authRules = [ rule(allow: .public, provider: .apiKey, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "Person41s" model.syncPluralName = "Person41s" - + model.attributes( .primaryKey(fields: [person41.id]) ) - + model.fields( .field(person41.id, is: .required, ofType: .string), .field(person41.name, is: .optional, ofType: .string), @@ -39,32 +46,32 @@ extension Person41 { .field(person41.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Person41: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Person41 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == Person41 { + var id: FieldPath { + string("id") } - public var name: FieldPath { - string("name") + var name: FieldPath { + string("name") } - public var editedPosts: ModelPath { - Post41.Path(name: "editedPosts", isCollection: true, parent: self) + var editedPosts: ModelPath { + Post41.Path(name: "editedPosts", isCollection: true, parent: self) } - public var authoredPosts: ModelPath { - Post41.Path(name: "authoredPosts", isCollection: true, parent: self) + var authoredPosts: ModelPath { + Post41.Path(name: "authoredPosts", isCollection: true, parent: self) } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Gen2_41/Person41.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Gen2_41/Person41.swift index 4c7858347c..4751a1ef51 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Gen2_41/Person41.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Gen2_41/Person41.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -9,24 +16,30 @@ public struct Person41: Model { public var authoredPosts: List? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - name: String? = nil, - editedPosts: List? = [], - authoredPosts: List? = []) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + name: String? = nil, + editedPosts: List? = [], + authoredPosts: List? = [] + ) { + self.init( + id: id, name: name, editedPosts: editedPosts, authoredPosts: authoredPosts, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - name: String? = nil, - editedPosts: List? = [], - authoredPosts: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + name: String? = nil, + editedPosts: List? = [], + authoredPosts: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.editedPosts = editedPosts @@ -34,4 +47,4 @@ public struct Person41: Model { self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Gen2_41/Post41+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Gen2_41/Post41+Schema.swift index 4fb0d7e363..7e648e19b7 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Gen2_41/Post41+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Gen2_41/Post41+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Post41 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Post41 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case title case content @@ -13,24 +20,24 @@ extension Post41 { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let post41 = Post41.keys - + model.authRules = [ rule(allow: .public, provider: .apiKey, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "Post41s" model.syncPluralName = "Post41s" - + model.attributes( .primaryKey(fields: [post41.id]) ) - + model.fields( .field(post41.id, is: .required, ofType: .string), .field(post41.title, is: .required, ofType: .string), @@ -41,35 +48,35 @@ extension Post41 { .field(post41.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Post41: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Post41 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == Post41 { + var id: FieldPath { + string("id") } - public var title: FieldPath { - string("title") + var title: FieldPath { + string("title") } - public var content: FieldPath { - string("content") + var content: FieldPath { + string("content") } - public var author: ModelPath { - Person41.Path(name: "author", parent: self) + var author: ModelPath { + Person41.Path(name: "author", parent: self) } - public var editor: ModelPath { - Person41.Path(name: "editor", parent: self) + var editor: ModelPath { + Person41.Path(name: "editor", parent: self) } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Gen2_41/Post41.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Gen2_41/Post41.swift index f81d4ebb4c..f7a3bf8004 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Gen2_41/Post41.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/Gen2_41/Post41.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -6,41 +13,47 @@ public struct Post41: Model { public let id: String public var title: String public var content: String - internal var _author: LazyReference + var _author: LazyReference public var author: Person41? { - get async throws { + get async throws { try await _author.get() - } + } } - internal var _editor: LazyReference + var _editor: LazyReference public var editor: Person41? { - get async throws { + get async throws { try await _editor.get() - } + } } public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - title: String, - content: String, - author: Person41? = nil, - editor: Person41? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + title: String, + content: String, + author: Person41? = nil, + editor: Person41? = nil + ) { + self.init( + id: id, title: title, content: content, author: author, editor: editor, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - title: String, - content: String, - author: Person41? = nil, - editor: Person41? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + title: String, + content: String, + author: Person41? = nil, + editor: Person41? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.title = title self.content = content @@ -50,20 +63,20 @@ public struct Post41: Model { self.updatedAt = updatedAt } public mutating func setAuthor(_ author: Person41? = nil) { - self._author = LazyReference(author) + _author = LazyReference(author) } public mutating func setEditor(_ editor: Person41? = nil) { - self._editor = LazyReference(editor) + _editor = LazyReference(editor) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decode(String.self, forKey: .id) - title = try values.decode(String.self, forKey: .title) - content = try values.decode(String.self, forKey: .content) - _author = try values.decodeIfPresent(LazyReference.self, forKey: .author) ?? LazyReference(identifiers: nil) - _editor = try values.decodeIfPresent(LazyReference.self, forKey: .editor) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.id = try values.decode(String.self, forKey: .id) + self.title = try values.decode(String.self, forKey: .title) + self.content = try values.decode(String.self, forKey: .content) + self._author = try values.decodeIfPresent(LazyReference.self, forKey: .author) ?? LazyReference(identifiers: nil) + self._editor = try values.decodeIfPresent(LazyReference.self, forKey: .editor) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) @@ -75,4 +88,4 @@ public struct Post41: Model { try container.encode(createdAt, forKey: .createdAt) try container.encode(updatedAt, forKey: .updatedAt) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/GraphQLCartCustomer4Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/GraphQLCartCustomer4Tests.swift index da49e94714..34eb637591 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/GraphQLCartCustomer4Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_4/GraphQLCartCustomer4Tests.swift @@ -24,7 +24,8 @@ final class GraphQLCartCustomer4Tests: AWSAPIPluginGen2GraphQLBaseTest { let cart = Cart( items: ["Tomato", "Ice", "Mint"], - customer: createdCustomer) + customer: createdCustomer + ) let createdCart = try await Amplify.API.mutate(request: .create(cart)).get() // Code Snippet Ends @@ -47,7 +48,8 @@ final class GraphQLCartCustomer4Tests: AWSAPIPluginGen2GraphQLBaseTest { let createdCustomer = try await Amplify.API.mutate(request: .create(customer)).get() let cart = Cart( items: ["Tomato", "Ice", "Mint"], - customer: createdCustomer) + customer: createdCustomer + ) var existingCart = try await Amplify.API.mutate(request: .create(cart)).get() // Code Snippet Begins @@ -77,7 +79,8 @@ final class GraphQLCartCustomer4Tests: AWSAPIPluginGen2GraphQLBaseTest { let createdCustomer = try await Amplify.API.mutate(request: .create(customer)).get() let cart = Cart( items: ["Tomato", "Ice", "Mint"], - customer: createdCustomer) + customer: createdCustomer + ) var existingCart = try await Amplify.API.mutate(request: .create(cart)).get() // Code Snippet Begins @@ -105,7 +108,8 @@ final class GraphQLCartCustomer4Tests: AWSAPIPluginGen2GraphQLBaseTest { let createdCustomer = try await Amplify.API.mutate(request: .create(customer)).get() let cart = Cart( items: ["Tomato", "Ice", "Mint"], - customer: createdCustomer) + customer: createdCustomer + ) var existingCart = try await Amplify.API.mutate(request: .create(cart)).get() // Code Snippet Begins @@ -113,7 +117,8 @@ final class GraphQLCartCustomer4Tests: AWSAPIPluginGen2GraphQLBaseTest { guard let queriedCart = try await Amplify.API.query( request: .get( Cart.self, - byIdentifier: existingCart.identifier)).get() else { + byIdentifier: existingCart.identifier + )).get() else { print("Missing cart") // Code Snippet Ends XCTFail("Missing cart") diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_5/GraphQLTodo5Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_5/GraphQLTodo5Tests.swift index 24213e89e3..ce0c538643 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_5/GraphQLTodo5Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_5/GraphQLTodo5Tests.swift @@ -20,7 +20,8 @@ final class GraphQLTodo5Tests: AWSAPIPluginGen2GraphQLBaseTest { // Code Snippet Begins let todo = Todo( content: "Buy Milk", - completed: false) + completed: false + ) let createdTodo = try await Amplify.API.mutate(request: .create(todo)).get() print("New Todo created: \(createdTodo)") // Code Snippet Ends diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_5/Todo5+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_5/Todo5+Schema.swift index 74023717f2..4165e342b3 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_5/Todo5+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_5/Todo5+Schema.swift @@ -1,34 +1,41 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Todo5 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Todo5 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case content case completed case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let todo5 = Todo5.keys - + model.authRules = [ rule(allow: .public, provider: .apiKey, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "Todo5s" model.syncPluralName = "Todo5s" - + model.attributes( .primaryKey(fields: [todo5.id]) ) - + model.fields( .field(todo5.id, is: .required, ofType: .string), .field(todo5.content, is: .optional, ofType: .string), @@ -37,29 +44,29 @@ extension Todo5 { .field(todo5.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Todo5: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Todo5 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == Todo5 { + var id: FieldPath { + string("id") } - public var content: FieldPath { - string("content") + var content: FieldPath { + string("content") } - public var completed: FieldPath { - bool("completed") + var completed: FieldPath { + bool("completed") } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_5/Todo5.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_5/Todo5.swift index d10de7e4e0..17b885ec81 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_5/Todo5.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_5/Todo5.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct Todo5: Model { public var completed: Bool? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - content: String? = nil, - completed: Bool? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + content: String? = nil, + completed: Bool? = nil + ) { + self.init( + id: id, content: content, completed: completed, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - content: String? = nil, - completed: Bool? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + content: String? = nil, + completed: Bool? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self.completed = completed self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_6/GraphQLTodo6Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_6/GraphQLTodo6Tests.swift index 82b8c32ca1..e69f9f0064 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_6/GraphQLTodo6Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_6/GraphQLTodo6Tests.swift @@ -21,7 +21,8 @@ final class GraphQLTodo6Tests: AWSAPIPluginGen2GraphQLBaseTest { let todo = Todo( todoId: "MyUniqueTodoId", content: "Buy Milk", - completed: false) + completed: false + ) let createdTodo = try await Amplify.API.mutate(request: .create(todo)).get() print("New Todo created: \(createdTodo)") // Code Snippet Ends diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_6/Todo6+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_6/Todo6+Schema.swift index 6e92724406..8a897680ce 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_6/Todo6+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_6/Todo6+Schema.swift @@ -1,35 +1,42 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Todo6 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Todo6 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case todoId case content case completed case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let todo6 = Todo6.keys - + model.authRules = [ rule(allow: .public, provider: .apiKey, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "Todo6s" model.syncPluralName = "Todo6s" - + model.attributes( .index(fields: ["todoId"], name: nil), .primaryKey(fields: [todo6.todoId]) ) - + model.fields( .field(todo6.todoId, is: .required, ofType: .string), .field(todo6.content, is: .optional, ofType: .string), @@ -38,9 +45,9 @@ extension Todo6 { .field(todo6.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Todo6: ModelIdentifiable { @@ -48,25 +55,25 @@ extension Todo6: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension Todo6.IdentifierProtocol { - public static func identifier(todoId: String) -> Self { - .make(fields:[(name: "todoId", value: todoId)]) +public extension Todo6.IdentifierProtocol { + static func identifier(todoId: String) -> Self { + .make(fields: [(name: "todoId", value: todoId)]) } } -extension ModelPath where ModelType == Todo6 { - public var todoId: FieldPath { - string("todoId") +public extension ModelPath where ModelType == Todo6 { + var todoId: FieldPath { + string("todoId") } - public var content: FieldPath { - string("content") + var content: FieldPath { + string("content") } - public var completed: FieldPath { - bool("completed") + var completed: FieldPath { + bool("completed") } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_6/Todo6.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_6/Todo6.swift index 04c2eea180..4a8bdf0f02 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_6/Todo6.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_6/Todo6.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct Todo6: Model { public var completed: Bool? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(todoId: String, - content: String? = nil, - completed: Bool? = nil) { - self.init(todoId: todoId, + + public init( + todoId: String, + content: String? = nil, + completed: Bool? = nil + ) { + self.init( + todoId: todoId, content: content, completed: completed, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(todoId: String, - content: String? = nil, - completed: Bool? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + todoId: String, + content: String? = nil, + completed: Bool? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.todoId = todoId self.content = content self.completed = completed self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_7/GraphQLStoreBranch7Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_7/GraphQLStoreBranch7Tests.swift index 7b5456085e..9836ca8547 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_7/GraphQLStoreBranch7Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_7/GraphQLStoreBranch7Tests.swift @@ -5,13 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 // - -import Foundation import Combine +import Foundation import XCTest -@testable import Amplify import AWSPluginsCore +@testable import Amplify final class GraphQLStoreBranch7Tests: AWSAPIPluginGen2GraphQLBaseTest { @@ -25,7 +24,9 @@ final class GraphQLStoreBranch7Tests: AWSAPIPluginGen2GraphQLBaseTest { StoreBranch.self, byIdentifier: .identifier( tenantId: "123", - name: "Downtown"))) + name: "Downtown" + ) + )) } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_7/StoreBranch7+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_7/StoreBranch7+Schema.swift index 9ef1b980a9..35d6e087b1 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_7/StoreBranch7+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_7/StoreBranch7+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension StoreBranch7 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension StoreBranch7 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case tenantId case name case country @@ -15,25 +22,25 @@ extension StoreBranch7 { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let storeBranch7 = StoreBranch7.keys - + model.authRules = [ rule(allow: .public, provider: .apiKey, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "StoreBranch7s" model.syncPluralName = "StoreBranch7s" - + model.attributes( .index(fields: ["tenantId", "name"], name: nil), .primaryKey(fields: [storeBranch7.tenantId, storeBranch7.name]) ) - + model.fields( .field(storeBranch7.tenantId, is: .required, ofType: .string), .field(storeBranch7.name, is: .required, ofType: .string), @@ -46,9 +53,9 @@ extension StoreBranch7 { .field(storeBranch7.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension StoreBranch7: ModelIdentifiable { @@ -56,38 +63,40 @@ extension StoreBranch7: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension StoreBranch7.IdentifierProtocol { - public static func identifier(tenantId: String, - name: String) -> Self { - .make(fields:[(name: "tenantId", value: tenantId), (name: "name", value: name)]) +public extension StoreBranch7.IdentifierProtocol { + static func identifier( + tenantId: String, + name: String + ) -> Self { + .make(fields: [(name: "tenantId", value: tenantId), (name: "name", value: name)]) } } -extension ModelPath where ModelType == StoreBranch7 { - public var tenantId: FieldPath { - string("tenantId") +public extension ModelPath where ModelType == StoreBranch7 { + var tenantId: FieldPath { + string("tenantId") } - public var name: FieldPath { - string("name") + var name: FieldPath { + string("name") } - public var country: FieldPath { - string("country") + var country: FieldPath { + string("country") } - public var state: FieldPath { - string("state") + var state: FieldPath { + string("state") } - public var city: FieldPath { - string("city") + var city: FieldPath { + string("city") } - public var zipCode: FieldPath { - string("zipCode") + var zipCode: FieldPath { + string("zipCode") } - public var streetAddress: FieldPath { - string("streetAddress") + var streetAddress: FieldPath { + string("streetAddress") } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_7/StoreBranch7.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_7/StoreBranch7.swift index 5dd00d59a1..8a82d452f9 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_7/StoreBranch7.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_7/StoreBranch7.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -12,15 +19,18 @@ public struct StoreBranch7: Model { public var streetAddress: String? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(tenantId: String, - name: String, - country: String? = nil, - state: String? = nil, - city: String? = nil, - zipCode: String? = nil, - streetAddress: String? = nil) { - self.init(tenantId: tenantId, + + public init( + tenantId: String, + name: String, + country: String? = nil, + state: String? = nil, + city: String? = nil, + zipCode: String? = nil, + streetAddress: String? = nil + ) { + self.init( + tenantId: tenantId, name: name, country: country, state: state, @@ -28,17 +38,20 @@ public struct StoreBranch7: Model { zipCode: zipCode, streetAddress: streetAddress, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(tenantId: String, - name: String, - country: String? = nil, - state: String? = nil, - city: String? = nil, - zipCode: String? = nil, - streetAddress: String? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + tenantId: String, + name: String, + country: String? = nil, + state: String? = nil, + city: String? = nil, + zipCode: String? = nil, + streetAddress: String? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.tenantId = tenantId self.name = name self.country = country @@ -49,4 +62,4 @@ public struct StoreBranch7: Model { self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_8/Customer8+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_8/Customer8+Schema.swift index be4fe91412..5442031204 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_8/Customer8+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_8/Customer8+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Customer8 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Customer8 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case name case phoneNumber @@ -12,25 +19,25 @@ extension Customer8 { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let customer8 = Customer8.keys - + model.authRules = [ rule(allow: .public, provider: .apiKey, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "Customer8s" model.syncPluralName = "Customer8s" - + model.attributes( .index(fields: ["accountRepresentativeId"], name: "customer8sByAccountRepresentativeId"), .primaryKey(fields: [customer8.id]) ) - + model.fields( .field(customer8.id, is: .required, ofType: .string), .field(customer8.name, is: .optional, ofType: .string), @@ -40,32 +47,32 @@ extension Customer8 { .field(customer8.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Customer8: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Customer8 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == Customer8 { + var id: FieldPath { + string("id") } - public var name: FieldPath { - string("name") + var name: FieldPath { + string("name") } - public var phoneNumber: FieldPath { - string("phoneNumber") + var phoneNumber: FieldPath { + string("phoneNumber") } - public var accountRepresentativeId: FieldPath { - string("accountRepresentativeId") + var accountRepresentativeId: FieldPath { + string("accountRepresentativeId") } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_8/Customer8.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_8/Customer8.swift index a944b2c99b..39c2db63f7 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_8/Customer8.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_8/Customer8.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -9,24 +16,30 @@ public struct Customer8: Model { public var accountRepresentativeId: String public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - name: String? = nil, - phoneNumber: String? = nil, - accountRepresentativeId: String) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + name: String? = nil, + phoneNumber: String? = nil, + accountRepresentativeId: String + ) { + self.init( + id: id, name: name, phoneNumber: phoneNumber, accountRepresentativeId: accountRepresentativeId, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - name: String? = nil, - phoneNumber: String? = nil, - accountRepresentativeId: String, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + name: String? = nil, + phoneNumber: String? = nil, + accountRepresentativeId: String, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.phoneNumber = phoneNumber @@ -34,4 +47,4 @@ public struct Customer8: Model { self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_8/GraphQLCustomer8Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_8/GraphQLCustomer8Tests.swift index affb93019f..b155318d1d 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_8/GraphQLCustomer8Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_8/GraphQLCustomer8Tests.swift @@ -45,13 +45,14 @@ final class GraphQLCustomer8Tests: AWSAPIPluginGen2GraphQLBaseTest { let request = GraphQLRequest>( document: document, responseType: PaginatedList.self, - decodePath: operationName) + decodePath: operationName + ) let queriedCustomers = try await Amplify.API.query( request: request).get() // Code Snippet Ends - XCTAssertTrue(queriedCustomers.items.count != 0 || queriedCustomers.nextToken != nil) + XCTAssertTrue(!queriedCustomers.items.isEmpty || queriedCustomers.nextToken != nil) } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_9/Customer9+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_9/Customer9+Schema.swift index 57489c5117..fd72f78934 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_9/Customer9+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_9/Customer9+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Customer9 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Customer9 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case name case phoneNumber @@ -12,25 +19,25 @@ extension Customer9 { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let customer9 = Customer9.keys - + model.authRules = [ rule(allow: .public, provider: .apiKey, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "Customer9s" model.syncPluralName = "Customer9s" - + model.attributes( .index(fields: ["accountRepresentativeId", "name"], name: "customer9sByAccountRepresentativeIdAndName"), .primaryKey(fields: [customer9.id]) ) - + model.fields( .field(customer9.id, is: .required, ofType: .string), .field(customer9.name, is: .optional, ofType: .string), @@ -40,32 +47,32 @@ extension Customer9 { .field(customer9.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Customer9: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Customer9 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == Customer9 { + var id: FieldPath { + string("id") } - public var name: FieldPath { - string("name") + var name: FieldPath { + string("name") } - public var phoneNumber: FieldPath { - string("phoneNumber") + var phoneNumber: FieldPath { + string("phoneNumber") } - public var accountRepresentativeId: FieldPath { - string("accountRepresentativeId") + var accountRepresentativeId: FieldPath { + string("accountRepresentativeId") } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_9/Customer9.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_9/Customer9.swift index 8154a90db0..099c39ed44 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_9/Customer9.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_9/Customer9.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -9,24 +16,30 @@ public struct Customer9: Model { public var accountRepresentativeId: String public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - name: String? = nil, - phoneNumber: String? = nil, - accountRepresentativeId: String) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + name: String? = nil, + phoneNumber: String? = nil, + accountRepresentativeId: String + ) { + self.init( + id: id, name: name, phoneNumber: phoneNumber, accountRepresentativeId: accountRepresentativeId, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - name: String? = nil, - phoneNumber: String? = nil, - accountRepresentativeId: String, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + name: String? = nil, + phoneNumber: String? = nil, + accountRepresentativeId: String, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.phoneNumber = phoneNumber @@ -34,4 +47,4 @@ public struct Customer9: Model { self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_9/GraphQLCustomer9Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_9/GraphQLCustomer9Tests.swift index ee4420f122..d5f5d89e48 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_9/GraphQLCustomer9Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/Gen2_9/GraphQLCustomer9Tests.swift @@ -45,13 +45,14 @@ final class GraphQLCustomer9Tests: AWSAPIPluginGen2GraphQLBaseTest { var request = GraphQLRequest>( document: document, responseType: PaginatedList.self, - decodePath: operationName) + decodePath: operationName + ) let queriedCustomers = try await Amplify.API.query( request: request).get() // Code Snippet Ends - XCTAssertTrue(queriedCustomers.items.count != 0 || queriedCustomers.nextToken != nil) + XCTAssertTrue(!queriedCustomers.items.isEmpty || queriedCustomers.nextToken != nil) } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL1/Comment4V2+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL1/Comment4V2+Schema.swift index e02097061d..82f2280138 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL1/Comment4V2+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL1/Comment4V2+Schema.swift @@ -1,35 +1,42 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Comment4V2 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Comment4V2 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case content case post case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let comment4V2 = Comment4V2.keys - + model.authRules = [ rule(allow: .public, provider: .apiKey, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "Comment4V2s" model.syncPluralName = "Comment4V2s" - + model.attributes( .index(fields: ["id"], name: nil), .primaryKey(fields: [comment4V2.id]) ) - + model.fields( .field(comment4V2.id, is: .required, ofType: .string), .field(comment4V2.content, is: .required, ofType: .string), @@ -38,29 +45,29 @@ extension Comment4V2 { .field(comment4V2.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Comment4V2: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Comment4V2 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == Comment4V2 { + var id: FieldPath { + string("id") } - public var content: FieldPath { - string("content") + var content: FieldPath { + string("content") } - public var post: ModelPath { - Post4V2.Path(name: "post", parent: self) + var post: ModelPath { + Post4V2.Path(name: "post", parent: self) } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL1/Comment4V2.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL1/Comment4V2.swift index 1c6a50f04f..5b71a919c9 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL1/Comment4V2.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL1/Comment4V2.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,29 +12,35 @@ import Foundation public struct Comment4V2: Model { public let id: String public var content: String - internal var _post: LazyReference + var _post: LazyReference public var post: Post4V2? { - get async throws { + get async throws { try await _post.get() - } + } } public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - content: String, - post: Post4V2? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + content: String, + post: Post4V2? = nil + ) { + self.init( + id: id, content: content, post: post, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - content: String, - post: Post4V2? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + content: String, + post: Post4V2? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self._post = LazyReference(post) @@ -35,15 +48,15 @@ public struct Comment4V2: Model { self.updatedAt = updatedAt } public mutating func setPost(_ post: Post4V2? = nil) { - self._post = LazyReference(post) + _post = LazyReference(post) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decode(String.self, forKey: .id) - content = try values.decode(String.self, forKey: .content) - _post = try values.decodeIfPresent(LazyReference.self, forKey: .post) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.id = try values.decode(String.self, forKey: .id) + self.content = try values.decode(String.self, forKey: .content) + self._post = try values.decodeIfPresent(LazyReference.self, forKey: .post) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) @@ -53,4 +66,4 @@ public struct Comment4V2: Model { try container.encode(createdAt, forKey: .createdAt) try container.encode(updatedAt, forKey: .updatedAt) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL1/GraphQLLazyLoadPostComment4V2Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL1/GraphQLLazyLoadPostComment4V2Tests.swift index 6f7750cdb3..9537323d2c 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL1/GraphQLLazyLoadPostComment4V2Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL1/GraphQLLazyLoadPostComment4V2Tests.swift @@ -5,13 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 // - -import Foundation import Combine +import Foundation import XCTest -@testable import Amplify import AWSPluginsCore +@testable import Amplify final class GraphQLLazyLoadPostComment4V2Tests: AWSAPIPluginGen2GraphQLBaseTest { @@ -22,7 +21,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: AWSAPIPluginGen2GraphQLBaseTest try await mutate(.create(post)) try await mutate(.create(comment)) } - + // Without `includes` and latest codegenerated types with the model path, the post should be lazy loaded func testCommentWithLazyLoadPost() async throws { await setup(withModels: PostComment4V2Models()) @@ -30,13 +29,13 @@ final class GraphQLLazyLoadPostComment4V2Tests: AWSAPIPluginGen2GraphQLBaseTest let comment = Comment(content: "content", post: post) let createdPost = try await mutate(.create(post)) let createdComment = try await mutate(.create(comment)) - + // The comment's post should not be loaded, since no `includes` is passed in. // And the codegenerated swift models have the new modelPath properties. assertLazyReference(createdComment._post, state: .notLoaded(identifiers: [.init(name: "id", value: createdPost.id)])) let loadedPost = try await createdComment.post! XCTAssertEqual(loadedPost.id, createdPost.id) - + // The loaded post should have comments that are also not loaded let comments = loadedPost.comments! assertList(comments, state: .isNotLoaded(associatedIdentifiers: [createdPost.id], associatedFields: ["post"])) @@ -46,7 +45,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: AWSAPIPluginGen2GraphQLBaseTest // the loaded comment's post should not be loaded assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [.init(name: "id", value: createdPost.id)])) } - + // With `includes` on `comment.post`, the comment's post should be eager loaded. func testCommentWithEagerLoadPost() async throws { await setup(withModels: PostComment4V2Models()) @@ -67,7 +66,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: AWSAPIPluginGen2GraphQLBaseTest // further nested models should not be loaded assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id)])) } - + // With `includes` on `comment.post.comments`, func testCommentWithEagerLoadPostAndPostComments() async throws { await setup(withModels: PostComment4V2Models()) @@ -116,7 +115,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: AWSAPIPluginGen2GraphQLBaseTest // further nested models should not be loaded assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.identifier)])) } - + /* - Given: Api plugin is cleared @@ -170,7 +169,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: AWSAPIPluginGen2GraphQLBaseTest XCTAssertEqual(request.document, expectedDocument) try await mutate(request) } - + // Without `includes` and latest codegenerated types with the model path, the post's comments should be lazy loaded func testPostWithLazyLoadComments() async throws { await setup(withModels: PostComment4V2Models()) @@ -185,7 +184,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: AWSAPIPluginGen2GraphQLBaseTest assertList(comments, state: .isLoaded(count: 1)) assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id)])) } - + // With `includes` on `post.comments` should eager load the post's comments func testPostWithEagerLoadComments() async throws { await setup(withModels: PostComment4V2Models()) @@ -198,7 +197,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: AWSAPIPluginGen2GraphQLBaseTest assertList(comments, state: .isLoaded(count: 1)) assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id)])) } - + // With `includes` on `post.comments.post` should eager load the post's comments' post func testPostWithEagerLoadCommentsAndPost() async throws { await setup(withModels: PostComment4V2Models()) @@ -211,25 +210,29 @@ final class GraphQLLazyLoadPostComment4V2Tests: AWSAPIPluginGen2GraphQLBaseTest assertList(comments, state: .isLoaded(count: 1)) assertLazyReference(comments.first!._post, state: .loaded(model: createdPost)) } - + func testListPostsListComments() async throws { await setup(withModels: PostComment4V2Models()) let post = Post(title: "title") let comment = Comment(content: "content", post: post) try await mutate(.create(post)) try await mutate(.create(comment)) - + let queriedPosts = try await listQuery(.list(Post.self, where: Post.keys.id == post.id)) assertList(queriedPosts, state: .isLoaded(count: 1)) - assertList(queriedPosts.first!.comments!, - state: .isNotLoaded(associatedIdentifiers: [post.id], associatedFields: ["post"])) - + assertList( + queriedPosts.first!.comments!, + state: .isNotLoaded(associatedIdentifiers: [post.id], associatedFields: ["post"]) + ) + let queriedComments = try await listQuery(.list(Comment.self, where: Comment.keys.id == comment.id)) assertList(queriedComments, state: .isLoaded(count: 1)) - assertLazyReference(queriedComments.first!._post, - state: .notLoaded(identifiers: [.init(name: "id", value: post.id)])) + assertLazyReference( + queriedComments.first!._post, + state: .notLoaded(identifiers: [.init(name: "id", value: post.id)]) + ) } - + func testCreateWithoutPost() async throws { await setup(withModels: PostComment4V2Models()) let comment = Comment(content: "content") @@ -245,7 +248,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: AWSAPIPluginGen2GraphQLBaseTest let queriedCommentWithPost = try await query(.get(Comment.self, byId: queriedCommentAfterUpdate.id, includes: { comment in [comment.post]}))! assertLazyReference(queriedCommentWithPost._post, state: .loaded(model: createdPost)) } - + func testUpdateToNewPost() async throws { await setup(withModels: PostComment4V2Models()) let post = Post(title: "title") @@ -254,7 +257,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: AWSAPIPluginGen2GraphQLBaseTest try await mutate(.create(comment)) var queriedComment = try await query(.get(Comment.self, byId: comment.id))! assertLazyReference(queriedComment._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id)])) - + let newPost = Post(title: "title") let createdNewPost = try await mutate(.create(newPost)) queriedComment.setPost(newPost) @@ -264,7 +267,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: AWSAPIPluginGen2GraphQLBaseTest let queriedCommentWithPost = try await query(.get(Comment.self, byId: queriedCommentAfterUpdate.id, includes: { comment in [comment.post]}))! assertLazyReference(queriedCommentWithPost._post, state: .loaded(model: createdNewPost)) } - + func testUpdateRemovePost() async throws { await setup(withModels: PostComment4V2Models()) let post = Post(title: "title") @@ -273,20 +276,20 @@ final class GraphQLLazyLoadPostComment4V2Tests: AWSAPIPluginGen2GraphQLBaseTest try await mutate(.create(comment)) var queriedComment = try await query(.get(Comment.self, byId: comment.id))! assertLazyReference(queriedComment._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id)])) - + queriedComment.setPost(nil) let updateCommentRemovePost = try await mutate(.update(queriedComment)) let queriedCommentAfterUpdate = try await query(.get(Comment.self, byId: updateCommentRemovePost.id))! assertLazyReference(queriedCommentAfterUpdate._post, state: .notLoaded(identifiers: nil)) } - + func testDelete() async throws { await setup(withModels: PostComment4V2Models()) let post = Post(title: "title") let comment = Comment(content: "content", post: post) let createdPost = try await mutate(.create(post)) try await mutate(.create(comment)) - + try await mutate(.delete(createdPost)) let queriedPost = try await query(.get(Post.self, byId: post.id)) XCTAssertNil(queriedPost) @@ -296,7 +299,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: AWSAPIPluginGen2GraphQLBaseTest let queryDeletedComment = try await query(.get(Comment.self, byId: comment.id)) XCTAssertNil(queryDeletedComment) } - + func testSubscribeToComments() async throws { await setup(withModels: PostComment4V2Models()) let post = Post(title: "title") @@ -328,14 +331,14 @@ final class GraphQLLazyLoadPostComment4V2Tests: AWSAPIPluginGen2GraphQLBaseTest XCTFail("Subscription has terminated with \(error)") } } - + await fulfillment(of: [connected], timeout: 10) let comment = Comment(content: "content", post: post) try await mutate(.create(comment)) await fulfillment(of: [onCreatedComment], timeout: 10) subscription.cancel() } - + // The identical `includes` parameter should be used because the selection set of the mutation // has to match the selection set of the subscription. func testSubscribeToCommentsIncludesPost() async throws { @@ -344,9 +347,11 @@ final class GraphQLLazyLoadPostComment4V2Tests: AWSAPIPluginGen2GraphQLBaseTest try await mutate(.create(post)) let connected = expectation(description: "subscription connected") let onCreatedComment = expectation(description: "onCreatedComment received") - let subscriptionIncludes = Amplify.API.subscribe(request: .subscription(of: Comment.self, - type: .onCreate, - includes: { comment in [comment.post]})) + let subscriptionIncludes = Amplify.API.subscribe(request: .subscription( + of: Comment.self, + type: .onCreate, + includes: { comment in [comment.post]} + )) Task { do { for try await subscriptionEvent in subscriptionIncludes { @@ -371,18 +376,18 @@ final class GraphQLLazyLoadPostComment4V2Tests: AWSAPIPluginGen2GraphQLBaseTest XCTFail("Subscription has terminated with \(error)") } } - + await fulfillment(of: [connected], timeout: 20) let comment = Comment(content: "content", post: post) try await mutate(.create(comment, includes: { comment in [comment.post] })) await fulfillment(of: [onCreatedComment], timeout: 20) subscriptionIncludes.cancel() } - + func testSubscribeToPosts() async throws { await setup(withModels: PostComment4V2Models()) let post = Post(title: "title") - + let connected = expectation(description: "subscription connected") let onCreatedPost = expectation(description: "onCreatedPost received") let subscription = Amplify.API.subscribe(request: .subscription(of: Post.self, type: .onCreate)) @@ -410,22 +415,24 @@ final class GraphQLLazyLoadPostComment4V2Tests: AWSAPIPluginGen2GraphQLBaseTest XCTFail("Subscription has terminated with \(error)") } } - + await fulfillment(of: [connected], timeout: 10) try await mutate(.create(post)) await fulfillment(of: [onCreatedPost], timeout: 10) subscription.cancel() } - + func testSubscribeToPostsIncludes() async throws { await setup(withModels: PostComment4V2Models()) let post = Post(title: "title") - + let connected = expectation(description: "subscription connected") let onCreatedPost = expectation(description: "onCreatedPost received") - let subscriptionIncludes = Amplify.API.subscribe(request: .subscription(of: Post.self, - type: .onCreate, - includes: { post in [post.comments]})) + let subscriptionIncludes = Amplify.API.subscribe(request: .subscription( + of: Post.self, + type: .onCreate, + includes: { post in [post.comments]} + )) Task { do { for try await subscriptionEvent in subscriptionIncludes { @@ -450,7 +457,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: AWSAPIPluginGen2GraphQLBaseTest XCTFail("Subscription has terminated with \(error)") } } - + await fulfillment(of: [connected], timeout: 10) try await mutate(.create(post, includes: { post in [post.comments]})) await fulfillment(of: [onCreatedPost], timeout: 10) @@ -463,7 +470,7 @@ extension GraphQLLazyLoadPostComment4V2Tests: DefaultLogger { } extension GraphQLLazyLoadPostComment4V2Tests { typealias Post = Post4V2 typealias Comment = Comment4V2 - + struct PostComment4V2Models: AmplifyModelRegistration { public let version: String = "version" func registerModels(registry: ModelRegistry.Type) { diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL1/Post4V2+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL1/Post4V2+Schema.swift index 0bbc928091..583f281cad 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL1/Post4V2+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL1/Post4V2+Schema.swift @@ -1,35 +1,42 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Post4V2 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Post4V2 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case title case comments case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let post4V2 = Post4V2.keys - + model.authRules = [ rule(allow: .public, provider: .apiKey, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "Post4V2s" model.syncPluralName = "Post4V2s" - + model.attributes( .index(fields: ["id"], name: nil), .primaryKey(fields: [post4V2.id]) ) - + model.fields( .field(post4V2.id, is: .required, ofType: .string), .field(post4V2.title, is: .required, ofType: .string), @@ -38,29 +45,29 @@ extension Post4V2 { .field(post4V2.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Post4V2: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Post4V2 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == Post4V2 { + var id: FieldPath { + string("id") } - public var title: FieldPath { - string("title") + var title: FieldPath { + string("title") } - public var comments: ModelPath { - Comment4V2.Path(name: "comments", isCollection: true, parent: self) + var comments: ModelPath { + Comment4V2.Path(name: "comments", isCollection: true, parent: self) } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL1/Post4V2.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL1/Post4V2.swift index 08f3e4b429..9106744759 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL1/Post4V2.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL1/Post4V2.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct Post4V2: Model { public var comments: List? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - title: String, - comments: List? = []) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + title: String, + comments: List? = [] + ) { + self.init( + id: id, title: title, comments: comments, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - title: String, - comments: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + title: String, + comments: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.title = title self.comments = comments self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL3/CommentWithCompositeKey+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL3/CommentWithCompositeKey+Schema.swift index 8e4fbcf9d2..5761fe6ca3 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL3/CommentWithCompositeKey+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL3/CommentWithCompositeKey+Schema.swift @@ -1,35 +1,42 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension CommentWithCompositeKey { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension CommentWithCompositeKey { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case content case post case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let commentWithCompositeKey = CommentWithCompositeKey.keys - + model.authRules = [ rule(allow: .public, provider: .apiKey, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "CommentWithCompositeKeys" model.syncPluralName = "CommentWithCompositeKeys" - + model.attributes( .index(fields: ["id", "content"], name: nil), .primaryKey(fields: [commentWithCompositeKey.id, commentWithCompositeKey.content]) ) - + model.fields( .field(commentWithCompositeKey.id, is: .required, ofType: .string), .field(commentWithCompositeKey.content, is: .required, ofType: .string), @@ -38,9 +45,9 @@ extension CommentWithCompositeKey { .field(commentWithCompositeKey.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension CommentWithCompositeKey: ModelIdentifiable { @@ -48,26 +55,28 @@ extension CommentWithCompositeKey: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension CommentWithCompositeKey.IdentifierProtocol { - public static func identifier(id: String, - content: String) -> Self { - .make(fields:[(name: "id", value: id), (name: "content", value: content)]) +public extension CommentWithCompositeKey.IdentifierProtocol { + static func identifier( + id: String, + content: String + ) -> Self { + .make(fields: [(name: "id", value: id), (name: "content", value: content)]) } } -extension ModelPath where ModelType == CommentWithCompositeKey { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == CommentWithCompositeKey { + var id: FieldPath { + string("id") } - public var content: FieldPath { - string("content") + var content: FieldPath { + string("content") } - public var post: ModelPath { - PostWithCompositeKey.Path(name: "post", parent: self) + var post: ModelPath { + PostWithCompositeKey.Path(name: "post", parent: self) } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL3/CommentWithCompositeKey.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL3/CommentWithCompositeKey.swift index 2ac30be7be..1a34e3ef6c 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL3/CommentWithCompositeKey.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL3/CommentWithCompositeKey.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,29 +12,35 @@ import Foundation public struct CommentWithCompositeKey: Model { public let id: String public let content: String - internal var _post: LazyReference + var _post: LazyReference public var post: PostWithCompositeKey? { - get async throws { + get async throws { try await _post.get() - } + } } public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - content: String, - post: PostWithCompositeKey? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + content: String, + post: PostWithCompositeKey? = nil + ) { + self.init( + id: id, content: content, post: post, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - content: String, - post: PostWithCompositeKey? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + content: String, + post: PostWithCompositeKey? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self._post = LazyReference(post) @@ -35,15 +48,15 @@ public struct CommentWithCompositeKey: Model { self.updatedAt = updatedAt } public mutating func setPost(_ post: PostWithCompositeKey? = nil) { - self._post = LazyReference(post) + _post = LazyReference(post) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decode(String.self, forKey: .id) - content = try values.decode(String.self, forKey: .content) - _post = try values.decodeIfPresent(LazyReference.self, forKey: .post) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.id = try values.decode(String.self, forKey: .id) + self.content = try values.decode(String.self, forKey: .content) + self._post = try values.decodeIfPresent(LazyReference.self, forKey: .post) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) @@ -53,4 +66,4 @@ public struct CommentWithCompositeKey: Model { try container.encode(createdAt, forKey: .createdAt) try container.encode(updatedAt, forKey: .updatedAt) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL3/GraphQLLazyLoadPostCommentWithCompositeKeyTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL3/GraphQLLazyLoadPostCommentWithCompositeKeyTests.swift index f6af16533f..630cbb67c5 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL3/GraphQLLazyLoadPostCommentWithCompositeKeyTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL3/GraphQLLazyLoadPostCommentWithCompositeKeyTests.swift @@ -5,49 +5,55 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Combine +import Foundation import XCTest -@testable import Amplify import AWSPluginsCore +@testable import Amplify final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: AWSAPIPluginGen2GraphQLBaseTest { func testSave() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) - + let post = Post(title: "title") let comment = Comment(content: "content", post: post) let savedPost = try await mutate(.create(post)) let savedComment = try await mutate(.create(comment)) } - + func testCommentWithLazyLoadPost() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) - + let post = Post(title: "title") let comment = Comment(content: "content", post: post) let createdPost = try await mutate(.create(post)) let createdComment = try await mutate(.create(comment)) - + // The comment's post should not be loaded, since no `includes` is passed in. // And the codegenerated swift models have the new modelPath properties. - assertLazyReference(createdComment._post, state: .notLoaded(identifiers: [.init(name: "id", value: createdPost.id), - .init(name: "title", value: createdPost.title)])) + assertLazyReference(createdComment._post, state: .notLoaded(identifiers: [ + .init(name: "id", value: createdPost.id), + .init(name: "title", value: createdPost.title) + ])) let loadedPost = try await createdComment.post! XCTAssertEqual(loadedPost.id, createdPost.id) - + // The loaded post should have comments that are also not loaded let comments = loadedPost.comments! - assertList(comments, state: .isNotLoaded(associatedIdentifiers: [post.id, post.title], - associatedFields: ["post"])) + assertList(comments, state: .isNotLoaded( + associatedIdentifiers: [post.id, post.title], + associatedFields: ["post"] + )) try await comments.fetch() assertList(comments, state: .isLoaded(count: 1)) - assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [.init(name: "id", value: createdPost.id), - .init(name: "title", value: createdPost.title)])) + assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [ + .init(name: "id", value: createdPost.id), + .init(name: "title", value: createdPost.title) + ])) } - + // With `includes` on `comment.post`, the comment's post should be eager loaded. func testCommentWithEagerLoadPost() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) @@ -61,16 +67,20 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: AWSAPIPluginGen2Gra XCTAssertEqual(loadedPost.id, post.id) // The loaded post should have comments that are not loaded let comments = loadedPost.comments! - assertList(comments, state: .isNotLoaded(associatedIdentifiers: [post.id, post.title], - associatedFields: ["post"])) + assertList(comments, state: .isNotLoaded( + associatedIdentifiers: [post.id, post.title], + associatedFields: ["post"] + )) // load the comments try await comments.fetch() assertList(comments, state: .isLoaded(count: 1)) // further nested models should not be loaded - assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [.init(name: "id", value: createdPost.id), - .init(name: "title", value: createdPost.title)])) + assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [ + .init(name: "id", value: createdPost.id), + .init(name: "title", value: createdPost.title) + ])) } - + // With `includes` on `comment.post.comments`, func testCommentWithEagerLoadPostAndPostComments() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) @@ -118,10 +128,12 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: AWSAPIPluginGen2Gra let comments = loadedPost.comments! assertList(comments, state: .isLoaded(count: 1)) // further nested models should not be loaded - assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id), - .init(name: "title", value: post.title)])) + assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [ + .init(name: "id", value: post.id), + .init(name: "title", value: post.title) + ])) } - + // Without `includes` and latest codegenerated types with the model path, the post's comments should be lazy loaded func testPostWithLazyLoadComments() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) @@ -134,10 +146,12 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: AWSAPIPluginGen2Gra assertList(comments, state: .isNotLoaded(associatedIdentifiers: [post.id, post.title], associatedFields: ["post"])) try await comments.fetch() assertList(comments, state: .isLoaded(count: 1)) - assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id), - .init(name: "title", value: post.title)])) + assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [ + .init(name: "id", value: post.id), + .init(name: "title", value: post.title) + ])) } - + // With `includes` on `post.comments` should eager load the post's comments func testPostWithEagerLoadComments() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) @@ -148,10 +162,12 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: AWSAPIPluginGen2Gra let queriedPost = try await query(.get(Post.self, byIdentifier: .identifier(id: post.id, title: post.title), includes: { post in [post.comments]}))! let comments = queriedPost.comments! assertList(comments, state: .isLoaded(count: 1)) - assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id), - .init(name: "title", value: post.title)])) + assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [ + .init(name: "id", value: post.id), + .init(name: "title", value: post.title) + ])) } - + // With `includes` on `post.comments.post` should eager load the post's comments' post func testPostWithEagerLoadCommentsAndPost() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) @@ -159,35 +175,44 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: AWSAPIPluginGen2Gra let comment = Comment(content: "content", post: post) let createdPost = try await mutate(.create(post)) _ = try await mutate(.create(comment)) - let queriedPost = try await query(.get(Post.self, - byIdentifier: .identifier(id: post.id, - title: post.title), - includes: { post in [post.comments.post]}))! + let queriedPost = try await query(.get( + Post.self, + byIdentifier: .identifier( + id: post.id, + title: post.title + ), + includes: { post in [post.comments.post]} + ))! let comments = queriedPost.comments! assertList(comments, state: .isLoaded(count: 1)) assertLazyReference(comments.first!._post, state: .loaded(model: createdPost)) } - + func testListPostsListComments() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) let post = Post(title: "title") let comment = Comment(content: "content", post: post) try await mutate(.create(post)) try await mutate(.create(comment)) - + let queriedPosts = try await listQuery(.list(Post.self, where: Post.keys.id == post.id)) assertList(queriedPosts, state: .isLoaded(count: 1)) - assertList(queriedPosts.first!.comments!, - state: .isNotLoaded(associatedIdentifiers: [post.id, post.title], associatedFields: ["post"])) - + assertList( + queriedPosts.first!.comments!, + state: .isNotLoaded(associatedIdentifiers: [post.id, post.title], associatedFields: ["post"]) + ) + let queriedComments = try await listQuery(.list(Comment.self, where: Comment.keys.id == comment.id)) assertList(queriedComments, state: .isLoaded(count: 1)) - assertLazyReference(queriedComments.first!._post, - state: .notLoaded(identifiers: [ - .init(name: "id", value: post.id), - .init(name: "title", value: "title")])) + assertLazyReference( + queriedComments.first!._post, + state: .notLoaded(identifiers: [ + .init(name: "id", value: post.id), + .init(name: "title", value: "title") + ]) + ) } - + func testCreateWithoutPost() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) let comment = Comment(content: "content") @@ -198,18 +223,28 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: AWSAPIPluginGen2Gra let createdPost = try await mutate(.create(post)) queriedComment.setPost(createdPost) let updateCommentWithPost = try await mutate(.update(queriedComment)) - let queriedCommentAfterUpdate = try await query(.get(Comment.self, - byIdentifier: .identifier(id: updateCommentWithPost.id, - content: updateCommentWithPost.content)))! - assertLazyReference(queriedCommentAfterUpdate._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id), - .init(name: "title", value: post.title)])) - let queriedCommentWithPost = try await query(.get(Comment.self, - byIdentifier: .identifier(id: queriedCommentAfterUpdate.id, - content: queriedCommentAfterUpdate.content), - includes: { comment in [comment.post]}))! + let queriedCommentAfterUpdate = try await query(.get( + Comment.self, + byIdentifier: .identifier( + id: updateCommentWithPost.id, + content: updateCommentWithPost.content + ) + ))! + assertLazyReference(queriedCommentAfterUpdate._post, state: .notLoaded(identifiers: [ + .init(name: "id", value: post.id), + .init(name: "title", value: post.title) + ])) + let queriedCommentWithPost = try await query(.get( + Comment.self, + byIdentifier: .identifier( + id: queriedCommentAfterUpdate.id, + content: queriedCommentAfterUpdate.content + ), + includes: { comment in [comment.post]} + ))! assertLazyReference(queriedCommentWithPost._post, state: .loaded(model: createdPost)) } - + func testUpdateToNewPost() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) let post = Post(title: "title") @@ -217,25 +252,37 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: AWSAPIPluginGen2Gra try await mutate(.create(post)) try await mutate(.create(comment)) var queriedComment = try await query(.get(Comment.self, byIdentifier: .identifier(id: comment.id, content: comment.content)))! - assertLazyReference(queriedComment._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id), - .init(name: "title", value: post.title)])) - + assertLazyReference(queriedComment._post, state: .notLoaded(identifiers: [ + .init(name: "id", value: post.id), + .init(name: "title", value: post.title) + ])) + let newPost = Post(title: "title") let createdNewPost = try await mutate(.create(newPost)) queriedComment.setPost(newPost) let updateCommentWithPost = try await mutate(.update(queriedComment)) - let queriedCommentAfterUpdate = try await query(.get(Comment.self, - byIdentifier: .identifier(id: updateCommentWithPost.id, - content: updateCommentWithPost.content)))! - assertLazyReference(queriedCommentAfterUpdate._post, state: .notLoaded(identifiers: [.init(name: "id", value: newPost.id), - .init(name: "title", value: newPost.title)])) - let queriedCommentWithPost = try await query(.get(Comment.self, - byIdentifier: .identifier(id: queriedCommentAfterUpdate.id, - content: queriedCommentAfterUpdate.content), - includes: { comment in [comment.post]}))! + let queriedCommentAfterUpdate = try await query(.get( + Comment.self, + byIdentifier: .identifier( + id: updateCommentWithPost.id, + content: updateCommentWithPost.content + ) + ))! + assertLazyReference(queriedCommentAfterUpdate._post, state: .notLoaded(identifiers: [ + .init(name: "id", value: newPost.id), + .init(name: "title", value: newPost.title) + ])) + let queriedCommentWithPost = try await query(.get( + Comment.self, + byIdentifier: .identifier( + id: queriedCommentAfterUpdate.id, + content: queriedCommentAfterUpdate.content + ), + includes: { comment in [comment.post]} + ))! assertLazyReference(queriedCommentWithPost._post, state: .loaded(model: createdNewPost)) } - + func testUpdateRemovePost() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) let post = Post(title: "title") @@ -243,22 +290,24 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: AWSAPIPluginGen2Gra try await mutate(.create(post)) try await mutate(.create(comment)) var queriedComment = try await query(.get(Comment.self, byIdentifier: .identifier(id: comment.id, content: comment.content)))! - assertLazyReference(queriedComment._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id), - .init(name: "title", value: post.title)])) - + assertLazyReference(queriedComment._post, state: .notLoaded(identifiers: [ + .init(name: "id", value: post.id), + .init(name: "title", value: post.title) + ])) + queriedComment.setPost(nil) let updateCommentRemovePost = try await mutate(.update(queriedComment)) let queriedCommentAfterUpdate = try await query(.get(Comment.self, byIdentifier: .identifier(id: updateCommentRemovePost.id, content: updateCommentRemovePost.content)))! assertLazyReference(queriedCommentAfterUpdate._post, state: .notLoaded(identifiers: nil)) } - + func testDelete() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) let post = Post(title: "title") let comment = Comment(content: "content", post: post) let createdPost = try await mutate(.create(post)) try await mutate(.create(comment)) - + try await mutate(.delete(createdPost)) let queriedPost = try await query(.get(Post.self, byIdentifier: .identifier(id: post.id, title: post.title))) XCTAssertNil(queriedPost) @@ -268,7 +317,7 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: AWSAPIPluginGen2Gra let queryDeletedComment = try await query(.get(Comment.self, byIdentifier: .identifier(id: comment.id, content: comment.content))) XCTAssertNil(queryDeletedComment) } - + func testSubscribeToComments() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) let post = Post(title: "title") @@ -289,8 +338,10 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: AWSAPIPluginGen2Gra switch result { case .success(let createdComment): log.verbose("Successfully got createdComment from subscription: \(createdComment)") - assertLazyReference(createdComment._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id), - .init(name: "title", value: post.title)])) + assertLazyReference(createdComment._post, state: .notLoaded(identifiers: [ + .init(name: "id", value: post.id), + .init(name: "title", value: post.title) + ])) onCreatedComment.fulfill() case .failure(let error): XCTFail("Got failed result with \(error.errorDescription)") @@ -301,14 +352,14 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: AWSAPIPluginGen2Gra XCTFail("Subscription has terminated with \(error)") } } - + await fulfillment(of: [connected], timeout: 10) let comment = Comment(content: "content", post: post) try await mutate(.create(comment)) await fulfillment(of: [onCreatedComment], timeout: 10) subscription.cancel() } - + // The identical `includes` parameter should be used because the selection set of the mutation // has to match the selection set of the subscription. func testSubscribeToCommentsIncludesPost() async throws { @@ -317,9 +368,11 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: AWSAPIPluginGen2Gra try await mutate(.create(post)) let connected = expectation(description: "subscription connected") let onCreatedComment = expectation(description: "onCreatedComment received") - let subscriptionIncludes = Amplify.API.subscribe(request: .subscription(of: Comment.self, - type: .onCreate, - includes: { comment in [comment.post]})) + let subscriptionIncludes = Amplify.API.subscribe(request: .subscription( + of: Comment.self, + type: .onCreate, + includes: { comment in [comment.post]} + )) Task { do { for try await subscriptionEvent in subscriptionIncludes { @@ -344,18 +397,18 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: AWSAPIPluginGen2Gra XCTFail("Subscription has terminated with \(error)") } } - + await fulfillment(of: [connected], timeout: 20) let comment = Comment(content: "content", post: post) try await mutate(.create(comment, includes: { comment in [comment.post] })) await fulfillment(of: [onCreatedComment], timeout: 20) subscriptionIncludes.cancel() } - + func testSubscribeToPosts() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) let post = Post(title: "title") - + let connected = expectation(description: "subscription connected") let onCreatedPost = expectation(description: "onCreatedPost received") let subscription = Amplify.API.subscribe(request: .subscription(of: Post.self, type: .onCreate)) @@ -383,22 +436,24 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: AWSAPIPluginGen2Gra XCTFail("Subscription has terminated with \(error)") } } - + await fulfillment(of: [connected], timeout: 10) try await mutate(.create(post)) await fulfillment(of: [onCreatedPost], timeout: 10) subscription.cancel() } - + func testSubscribeToPostsIncludes() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) let post = Post(title: "title") - + let connected = expectation(description: "subscription connected") let onCreatedPost = expectation(description: "onCreatedPost received") - let subscriptionIncludes = Amplify.API.subscribe(request: .subscription(of: Post.self, - type: .onCreate, - includes: { post in [post.comments]})) + let subscriptionIncludes = Amplify.API.subscribe(request: .subscription( + of: Post.self, + type: .onCreate, + includes: { post in [post.comments]} + )) Task { do { for try await subscriptionEvent in subscriptionIncludes { @@ -423,7 +478,7 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: AWSAPIPluginGen2Gra XCTFail("Subscription has terminated with \(error)") } } - + await fulfillment(of: [connected], timeout: 10) try await mutate(.create(post, includes: { post in [post.comments]})) await fulfillment(of: [onCreatedPost], timeout: 10) @@ -436,7 +491,7 @@ extension GraphQLLazyLoadPostCommentWithCompositeKeyTests: DefaultLogger { } extension GraphQLLazyLoadPostCommentWithCompositeKeyTests { typealias Post = PostWithCompositeKey typealias Comment = CommentWithCompositeKey - + struct PostCommentWithCompositeKeyModels: AmplifyModelRegistration { public let version: String = "version" func registerModels(registry: ModelRegistry.Type) { diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL3/PostWithCompositeKey+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL3/PostWithCompositeKey+Schema.swift index a11b35aa0d..2db0fb4c2d 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL3/PostWithCompositeKey+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL3/PostWithCompositeKey+Schema.swift @@ -1,35 +1,42 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension PostWithCompositeKey { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension PostWithCompositeKey { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case title case comments case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let postWithCompositeKey = PostWithCompositeKey.keys - + model.authRules = [ rule(allow: .public, provider: .apiKey, operations: [.create, .update, .delete, .read]) ] - + model.listPluralName = "PostWithCompositeKeys" model.syncPluralName = "PostWithCompositeKeys" - + model.attributes( .index(fields: ["id", "title"], name: nil), .primaryKey(fields: [postWithCompositeKey.id, postWithCompositeKey.title]) ) - + model.fields( .field(postWithCompositeKey.id, is: .required, ofType: .string), .field(postWithCompositeKey.title, is: .required, ofType: .string), @@ -38,9 +45,9 @@ extension PostWithCompositeKey { .field(postWithCompositeKey.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension PostWithCompositeKey: ModelIdentifiable { @@ -48,26 +55,28 @@ extension PostWithCompositeKey: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension PostWithCompositeKey.IdentifierProtocol { - public static func identifier(id: String, - title: String) -> Self { - .make(fields:[(name: "id", value: id), (name: "title", value: title)]) +public extension PostWithCompositeKey.IdentifierProtocol { + static func identifier( + id: String, + title: String + ) -> Self { + .make(fields: [(name: "id", value: id), (name: "title", value: title)]) } } -extension ModelPath where ModelType == PostWithCompositeKey { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == PostWithCompositeKey { + var id: FieldPath { + string("id") } - public var title: FieldPath { - string("title") + var title: FieldPath { + string("title") } - public var comments: ModelPath { - CommentWithCompositeKey.Path(name: "comments", isCollection: true, parent: self) + var comments: ModelPath { + CommentWithCompositeKey.Path(name: "comments", isCollection: true, parent: self) } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL3/PostWithCompositeKey.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL3/PostWithCompositeKey.swift index e9de7de986..ac441cae5d 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL3/PostWithCompositeKey.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGen2GraphQLTests/LL3/PostWithCompositeKey.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct PostWithCompositeKey: Model { public var comments: List? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - title: String, - comments: List? = []) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + title: String, + comments: List? = [] + ) { + self.init( + id: id, title: title, comments: comments, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - title: String, - comments: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + title: String, + comments: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.title = title self.comments = comments self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLIAMTests/API.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLIAMTests/API.swift index 0c77d28084..ae4c776f91 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLIAMTests/API.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLIAMTests/API.swift @@ -1,26 +1,34 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // 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 { +public extension JSONEncodable { + 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) +public extension [String: JSONEncodable?] { + var withNilValuesRemoved: [String: JSONEncodable] { + var filtered = [String: JSONEncodable](minimumCapacity: count) for (key, value) in self { if value != nil { filtered[key] = value @@ -39,13 +47,13 @@ public extension GraphQLMapConvertible { } 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 { @@ -68,12 +76,12 @@ public protocol GraphQLFragment: GraphQLSelectionSet { 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 { +public extension GraphQLSelectionSet { + init(from decoder: Decoder) throws { if let jsonObject = try? APISwiftJSONValue(from: decoder) { let encoder = JSONEncoder() let jsonData = try encoder.encode(jsonObject) @@ -92,10 +100,10 @@ enum APISwiftJSONValue: Codable { 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) { @@ -110,10 +118,10 @@ enum APISwiftJSONValue: Codable { self = .null } } - + func encode(to encoder: Encoder) throws { var container = encoder.singleValueContainer() - + switch self { case .array(let value): try container.encode(value) @@ -136,19 +144,19 @@ 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 } } @@ -157,7 +165,7 @@ public indirect enum GraphQLOutputType { case object([GraphQLSelection]) case nonNull(GraphQLOutputType) case list(GraphQLOutputType) - + var namedType: GraphQLOutputType { switch self { case .nonNull(let innerType), .list(let innerType): @@ -171,25 +179,25 @@ 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; + 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; + self.selections = selections } } public struct GraphQLFragmentSpread: GraphQLSelection { let fragment: GraphQLFragment.Type - + public init(_ fragment: GraphQLFragment.Type) { self.fragment = fragment } @@ -197,10 +205,10 @@ public struct GraphQLFragmentSpread: GraphQLSelection { public struct GraphQLTypeCase: GraphQLSelection { let variants: [String: [GraphQLSelection]] let `default`: [GraphQLSelection] - + public init(variants: [String: [GraphQLSelection]], default: [GraphQLSelection]) { self.variants = variants - self.default = `default`; + self.default = `default` } } public typealias JSONObject = [String: Any] @@ -215,7 +223,7 @@ public enum JSONDecodingError: Error, LocalizedError { case nullValue case wrongType case couldNotConvert(value: Any, to: Any.Type) - + public var errorDescription: String? { switch self { case .missingValue: @@ -284,8 +292,8 @@ extension Bool: JSONDecodable, JSONEncodable { return self } } -extension RawRepresentable where RawValue: JSONDecodable { - public init(jsonValue value: Any) throws { +public extension RawRepresentable where RawValue: JSONDecodable { + init(jsonValue value: Any) throws { let rawValue = try RawValue(jsonValue: value) if let tempSelf = Self(rawValue: rawValue) { self = tempSelf @@ -294,17 +302,17 @@ extension RawRepresentable where RawValue: JSONDecodable { } } } -extension RawRepresentable where RawValue: JSONEncodable { - public var jsonValue: Any { +public extension RawRepresentable where RawValue: JSONEncodable { + var jsonValue: Any { return rawValue.jsonValue } } -extension Optional where Wrapped: JSONDecodable { - public init(jsonValue value: Any) throws { +public extension Optional where Wrapped: JSONDecodable { + init(jsonValue value: Any) throws { if value is NSNull { self = .none } else { - self = .some(try Wrapped(jsonValue: value)) + self = try .some(Wrapped(jsonValue: value)) } } } @@ -324,7 +332,7 @@ extension Dictionary: JSONEncodable { public var jsonValue: Any { return jsonObject } - + public var jsonObject: JSONObject { var jsonObject = JSONObject(minimumCapacity: count) for (key, value) in self { @@ -339,7 +347,7 @@ extension Dictionary: JSONEncodable { } extension Array: JSONEncodable { public var jsonValue: Any { - return map() { element -> (Any) in + return map { element -> (Any) in if case let element as JSONEncodable = element { return element.jsonValue } else { @@ -356,12 +364,12 @@ extension URL: JSONDecodable, JSONEncodable { self.init(string: string)! } public var jsonValue: Any { - return self.absoluteString + return absoluteString } } extension Dictionary { static func += (lhs: inout Dictionary, rhs: Dictionary) { - lhs.merge(rhs) { (_, new) in new } + lhs.merge(rhs) { _, new in new } } } #elseif canImport(AWSAppSync) @@ -370,11 +378,11 @@ import AWSAppSync 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] + self.graphQLMap = ["id": id, "name": name, "description": description] } - + public var id: GraphQLID? { get { return graphQLMap["id"] as! GraphQLID? @@ -383,7 +391,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return graphQLMap["name"] as! String @@ -392,7 +400,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "name") } } - + public var description: String? { get { return graphQLMap["description"] as! String? @@ -402,14 +410,14 @@ public struct APISwift { } } } - + 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] + self.graphQLMap = ["name": name, "description": description, "and": and, "or": or, "not": not] } - + public var name: ModelStringInput? { get { return graphQLMap["name"] as! ModelStringInput? @@ -418,7 +426,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "name") } } - + public var description: ModelStringInput? { get { return graphQLMap["description"] as! ModelStringInput? @@ -427,7 +435,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "description") } } - + public var and: [ModelTodoConditionInput?]? { get { return graphQLMap["and"] as! [ModelTodoConditionInput?]? @@ -436,7 +444,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelTodoConditionInput?]? { get { return graphQLMap["or"] as! [ModelTodoConditionInput?]? @@ -445,7 +453,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelTodoConditionInput? { get { return graphQLMap["not"] as! ModelTodoConditionInput? @@ -455,14 +463,14 @@ public struct APISwift { } } } - + 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] + self.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? @@ -471,7 +479,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "ne") } } - + public var eq: String? { get { return graphQLMap["eq"] as! String? @@ -480,7 +488,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "eq") } } - + public var le: String? { get { return graphQLMap["le"] as! String? @@ -489,7 +497,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "le") } } - + public var lt: String? { get { return graphQLMap["lt"] as! String? @@ -498,7 +506,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "lt") } } - + public var ge: String? { get { return graphQLMap["ge"] as! String? @@ -507,7 +515,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "ge") } } - + public var gt: String? { get { return graphQLMap["gt"] as! String? @@ -516,7 +524,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "gt") } } - + public var contains: String? { get { return graphQLMap["contains"] as! String? @@ -525,7 +533,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "contains") } } - + public var notContains: String? { get { return graphQLMap["notContains"] as! String? @@ -534,7 +542,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "notContains") } } - + public var between: [String?]? { get { return graphQLMap["between"] as! [String?]? @@ -543,7 +551,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "between") } } - + public var beginsWith: String? { get { return graphQLMap["beginsWith"] as! String? @@ -552,7 +560,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "beginsWith") } } - + public var attributeExists: Bool? { get { return graphQLMap["attributeExists"] as! Bool? @@ -561,7 +569,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "attributeExists") } } - + public var attributeType: ModelAttributeTypes? { get { return graphQLMap["attributeType"] as! ModelAttributeTypes? @@ -570,7 +578,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "attributeType") } } - + public var size: ModelSizeInput? { get { return graphQLMap["size"] as! ModelSizeInput? @@ -580,7 +588,7 @@ public struct APISwift { } } } - + public enum ModelAttributeTypes: RawRepresentable, Equatable, JSONDecodable, JSONEncodable { public typealias RawValue = String case binary @@ -595,7 +603,7 @@ public struct APISwift { case null /// Auto generated constant for unknown enum values case unknown(RawValue) - + public init?(rawValue: RawValue) { switch rawValue { case "binary": self = .binary @@ -611,7 +619,7 @@ public struct APISwift { default: self = .unknown(rawValue) } } - + public var rawValue: RawValue { switch self { case .binary: return "binary" @@ -627,7 +635,7 @@ public struct APISwift { case .unknown(let value): return value } } - + public static func == (lhs: ModelAttributeTypes, rhs: ModelAttributeTypes) -> Bool { switch (lhs, rhs) { case (.binary, .binary): return true @@ -645,14 +653,14 @@ public struct APISwift { } } } - + 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] + self.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? @@ -661,7 +669,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "ne") } } - + public var eq: Int? { get { return graphQLMap["eq"] as! Int? @@ -670,7 +678,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "eq") } } - + public var le: Int? { get { return graphQLMap["le"] as! Int? @@ -679,7 +687,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "le") } } - + public var lt: Int? { get { return graphQLMap["lt"] as! Int? @@ -688,7 +696,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "lt") } } - + public var ge: Int? { get { return graphQLMap["ge"] as! Int? @@ -697,7 +705,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "ge") } } - + public var gt: Int? { get { return graphQLMap["gt"] as! Int? @@ -706,7 +714,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "gt") } } - + public var between: [Int?]? { get { return graphQLMap["between"] as! [Int?]? @@ -716,14 +724,14 @@ public struct APISwift { } } } - + 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] + self.graphQLMap = ["id": id, "name": name, "description": description] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -732,7 +740,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return graphQLMap["name"] as! String? @@ -741,7 +749,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "name") } } - + public var description: String? { get { return graphQLMap["description"] as! String? @@ -751,14 +759,14 @@ public struct APISwift { } } } - + public struct DeleteTodoInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID) { - graphQLMap = ["id": id] + self.graphQLMap = ["id": id] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -768,14 +776,14 @@ public struct APISwift { } } } - + 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] + self.graphQLMap = ["id": id, "name": name, "description": description, "and": and, "or": or, "not": not] } - + public var id: ModelIDInput? { get { return graphQLMap["id"] as! ModelIDInput? @@ -784,7 +792,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var name: ModelStringInput? { get { return graphQLMap["name"] as! ModelStringInput? @@ -793,7 +801,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "name") } } - + public var description: ModelStringInput? { get { return graphQLMap["description"] as! ModelStringInput? @@ -802,7 +810,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "description") } } - + public var and: [ModelTodoFilterInput?]? { get { return graphQLMap["and"] as! [ModelTodoFilterInput?]? @@ -811,7 +819,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelTodoFilterInput?]? { get { return graphQLMap["or"] as! [ModelTodoFilterInput?]? @@ -820,7 +828,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelTodoFilterInput? { get { return graphQLMap["not"] as! ModelTodoFilterInput? @@ -830,14 +838,14 @@ public struct APISwift { } } } - + 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] + self.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? @@ -846,7 +854,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "ne") } } - + public var eq: GraphQLID? { get { return graphQLMap["eq"] as! GraphQLID? @@ -855,7 +863,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "eq") } } - + public var le: GraphQLID? { get { return graphQLMap["le"] as! GraphQLID? @@ -864,7 +872,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "le") } } - + public var lt: GraphQLID? { get { return graphQLMap["lt"] as! GraphQLID? @@ -873,7 +881,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "lt") } } - + public var ge: GraphQLID? { get { return graphQLMap["ge"] as! GraphQLID? @@ -882,7 +890,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "ge") } } - + public var gt: GraphQLID? { get { return graphQLMap["gt"] as! GraphQLID? @@ -891,7 +899,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "gt") } } - + public var contains: GraphQLID? { get { return graphQLMap["contains"] as! GraphQLID? @@ -900,7 +908,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "contains") } } - + public var notContains: GraphQLID? { get { return graphQLMap["notContains"] as! GraphQLID? @@ -909,7 +917,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "notContains") } } - + public var between: [GraphQLID?]? { get { return graphQLMap["between"] as! [GraphQLID?]? @@ -918,7 +926,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "between") } } - + public var beginsWith: GraphQLID? { get { return graphQLMap["beginsWith"] as! GraphQLID? @@ -927,7 +935,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "beginsWith") } } - + public var attributeExists: Bool? { get { return graphQLMap["attributeExists"] as! Bool? @@ -936,7 +944,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "attributeExists") } } - + public var attributeType: ModelAttributeTypes? { get { return graphQLMap["attributeType"] as! ModelAttributeTypes? @@ -945,7 +953,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "attributeType") } } - + public var size: ModelSizeInput? { get { return graphQLMap["size"] as! ModelSizeInput? @@ -955,40 +963,40 @@ public struct APISwift { } } } - + 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 }]) + self.init(snapshot: ["__typename": "Mutation", "createTodo": createTodo.flatMap(\.snapshot)]) } - + public var createTodo: CreateTodo? { get { return (snapshot["createTodo"] as? Snapshot).flatMap { CreateTodo(snapshot: $0) } @@ -997,10 +1005,10 @@ public struct APISwift { 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))), @@ -1009,17 +1017,17 @@ public struct APISwift { 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 @@ -1028,7 +1036,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -1037,7 +1045,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -1046,7 +1054,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var description: String? { get { return snapshot["description"] as? String @@ -1055,7 +1063,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "description") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -1064,7 +1072,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -1076,40 +1084,40 @@ public struct APISwift { } } } - + 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 }]) + self.init(snapshot: ["__typename": "Mutation", "updateTodo": updateTodo.flatMap(\.snapshot)]) } - + public var updateTodo: UpdateTodo? { get { return (snapshot["updateTodo"] as? Snapshot).flatMap { UpdateTodo(snapshot: $0) } @@ -1118,10 +1126,10 @@ public struct APISwift { 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))), @@ -1130,17 +1138,17 @@ public struct APISwift { 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 @@ -1149,7 +1157,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -1158,7 +1166,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -1167,7 +1175,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var description: String? { get { return snapshot["description"] as? String @@ -1176,7 +1184,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "description") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -1185,7 +1193,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -1197,40 +1205,40 @@ public struct APISwift { } } } - + 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 }]) + self.init(snapshot: ["__typename": "Mutation", "deleteTodo": deleteTodo.flatMap(\.snapshot)]) } - + public var deleteTodo: DeleteTodo? { get { return (snapshot["deleteTodo"] as? Snapshot).flatMap { DeleteTodo(snapshot: $0) } @@ -1239,10 +1247,10 @@ public struct APISwift { 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))), @@ -1251,17 +1259,17 @@ public struct APISwift { 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 @@ -1270,7 +1278,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -1279,7 +1287,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -1288,7 +1296,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var description: String? { get { return snapshot["description"] as? String @@ -1297,7 +1305,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "description") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -1306,7 +1314,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -1318,38 +1326,38 @@ public struct APISwift { } } } - + 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 }]) + self.init(snapshot: ["__typename": "Query", "getTodo": getTodo.flatMap(\.snapshot)]) } - + public var getTodo: GetTodo? { get { return (snapshot["getTodo"] as? Snapshot).flatMap { GetTodo(snapshot: $0) } @@ -1358,10 +1366,10 @@ public struct APISwift { 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))), @@ -1370,17 +1378,17 @@ public struct APISwift { 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 @@ -1389,7 +1397,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -1398,7 +1406,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -1407,7 +1415,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var description: String? { get { return snapshot["description"] as? String @@ -1416,7 +1424,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "description") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -1425,7 +1433,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -1437,42 +1445,42 @@ public struct APISwift { } } } - + 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 }]) + self.init(snapshot: ["__typename": "Query", "listTodos": listTodos.flatMap(\.snapshot)]) } - + public var listTodos: ListTodo? { get { return (snapshot["listTodos"] as? Snapshot).flatMap { ListTodo(snapshot: $0) } @@ -1481,26 +1489,26 @@ public struct APISwift { 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]) + self.init(snapshot: ["__typename": "ModelTodoConnection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -1509,16 +1517,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -1527,10 +1535,10 @@ public struct APISwift { 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))), @@ -1539,17 +1547,17 @@ public struct APISwift { 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 @@ -1558,7 +1566,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -1567,7 +1575,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -1576,7 +1584,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var description: String? { get { return snapshot["description"] as? String @@ -1585,7 +1593,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "description") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -1594,7 +1602,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -1607,31 +1615,31 @@ public struct APISwift { } } } - + 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 }]) + self.init(snapshot: ["__typename": "Subscription", "onCreateTodo": onCreateTodo.flatMap(\.snapshot)]) } - + public var onCreateTodo: OnCreateTodo? { get { return (snapshot["onCreateTodo"] as? Snapshot).flatMap { OnCreateTodo(snapshot: $0) } @@ -1640,10 +1648,10 @@ public struct APISwift { 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))), @@ -1652,17 +1660,17 @@ public struct APISwift { 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 @@ -1671,7 +1679,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -1680,7 +1688,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -1689,7 +1697,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var description: String? { get { return snapshot["description"] as? String @@ -1698,7 +1706,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "description") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -1707,7 +1715,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -1719,31 +1727,31 @@ public struct APISwift { } } } - + 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 }]) + self.init(snapshot: ["__typename": "Subscription", "onUpdateTodo": onUpdateTodo.flatMap(\.snapshot)]) } - + public var onUpdateTodo: OnUpdateTodo? { get { return (snapshot["onUpdateTodo"] as? Snapshot).flatMap { OnUpdateTodo(snapshot: $0) } @@ -1752,10 +1760,10 @@ public struct APISwift { 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))), @@ -1764,17 +1772,17 @@ public struct APISwift { 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 @@ -1783,7 +1791,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -1792,7 +1800,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -1801,7 +1809,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var description: String? { get { return snapshot["description"] as? String @@ -1810,7 +1818,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "description") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -1819,7 +1827,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -1831,31 +1839,31 @@ public struct APISwift { } } } - + 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 }]) + self.init(snapshot: ["__typename": "Subscription", "onDeleteTodo": onDeleteTodo.flatMap(\.snapshot)]) } - + public var onDeleteTodo: OnDeleteTodo? { get { return (snapshot["onDeleteTodo"] as? Snapshot).flatMap { OnDeleteTodo(snapshot: $0) } @@ -1864,10 +1872,10 @@ public struct APISwift { 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))), @@ -1876,17 +1884,17 @@ public struct APISwift { 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 @@ -1895,7 +1903,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -1904,7 +1912,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -1913,7 +1921,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var description: String? { get { return snapshot["description"] as? String @@ -1922,7 +1930,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "description") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -1931,7 +1939,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLIAMTests/GraphQLWithIAMIntegrationAPISwiftTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLIAMTests/GraphQLWithIAMIntegrationAPISwiftTests.swift index c3e8e8e48b..99ac025ef3 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLIAMTests/GraphQLWithIAMIntegrationAPISwiftTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLIAMTests/GraphQLWithIAMIntegrationAPISwiftTests.swift @@ -5,28 +5,32 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import AWSAPIPlugin import AWSCognitoAuthPlugin +import XCTest @testable import Amplify @testable import APIHostApp extension GraphQLWithIAMIntegrationTests { - + func createTodoAPISwift() async throws { let expectedId = UUID().uuidString let expectedName = "testCreateTodoMutationName" let expectedDescription = "testCreateTodoMutationDescription" - let input = APISwift.CreateTodoInput(id: expectedId, - name: expectedName, - description: expectedDescription) + let input = APISwift.CreateTodoInput( + id: expectedId, + name: expectedName, + description: expectedDescription + ) let mutation = APISwift.CreateTodoMutation(input: input) - let request = GraphQLRequest(document: APISwift.CreateTodoMutation.operationString, - variables: mutation.variables?.jsonObject, - responseType: APISwift.CreateTodoMutation.Data.self) - - + let request = GraphQLRequest( + document: APISwift.CreateTodoMutation.operationString, + variables: mutation.variables?.jsonObject, + responseType: APISwift.CreateTodoMutation.Data.self + ) + + let event = try await Amplify.API.mutate(request: request) switch event { case .success(let data): @@ -44,7 +48,7 @@ extension GraphQLWithIAMIntegrationTests { XCTFail("Unexpected .failed event: \(error)") } } - + func testCreateTodoAPISwift() async throws { try await createAuthenticatedUser() try await createTodoAPISwift() diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLIAMTests/GraphQLWithIAMIntegrationTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLIAMTests/GraphQLWithIAMIntegrationTests.swift index a100bc9b29..8924a70acc 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLIAMTests/GraphQLWithIAMIntegrationTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLIAMTests/GraphQLWithIAMIntegrationTests.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import AWSAPIPlugin import AWSCognitoAuthPlugin +import XCTest @testable import Amplify @testable import APIHostApp @@ -31,7 +31,7 @@ class GraphQLWithIAMIntegrationTests: XCTestCase { } catch { XCTFail("Error during setup: \(error)") } - + } override func tearDown() async throws { @@ -40,7 +40,7 @@ class GraphQLWithIAMIntegrationTests: XCTestCase { } await Amplify.reset() } - + func testSignUserOut() async throws { if try await isSignedIn() { print("User is signed in") @@ -48,7 +48,7 @@ class GraphQLWithIAMIntegrationTests: XCTestCase { await signOut() } - + /// Test create mutation with a custom GraphQL Document /// /// - Given: A custom GraphQL document containing CreateTodo mutation request, and user is signed in. @@ -61,7 +61,7 @@ class GraphQLWithIAMIntegrationTests: XCTestCase { try await createAuthenticatedUser() try await createTodoTest() } - + /// An unauthenticated user should not fail /// /// - Given: A CreateTodo mutation request, and user is not signed in. @@ -76,18 +76,22 @@ class GraphQLWithIAMIntegrationTests: XCTestCase { } try await createTodoTest() } - + func createTodoTest() async throws { let expectedId = UUID().uuidString let expectedName = "testCreateTodoMutationName" let expectedDescription = "testCreateTodoMutationDescription" - let request = GraphQLRequest(document: CreateTodoMutation.document, - variables: CreateTodoMutation.variables(id: expectedId, - name: expectedName, - description: expectedDescription), - responseType: CreateTodoMutation.Data.self) - - + let request = GraphQLRequest( + document: CreateTodoMutation.document, + variables: CreateTodoMutation.variables( + id: expectedId, + name: expectedName, + description: expectedDescription + ), + responseType: CreateTodoMutation.Data.self + ) + + let event = try await Amplify.API.mutate(request: request) switch event { case .success(let data): @@ -120,7 +124,7 @@ class GraphQLWithIAMIntegrationTests: XCTestCase { } try await onCreateTodoTest() } - + /// A subscription to onCreate todo should receive an event for each create Todo mutation API called /// /// - Given: An onCreate Todo subscription established @@ -133,7 +137,7 @@ class GraphQLWithIAMIntegrationTests: XCTestCase { try await createAuthenticatedUser() try await onCreateTodoTest() } - + func onCreateTodoTest() async throws { let connectedInvoked = expectation(description: "Connection established") let progressInvoked = expectation(description: "progress invoked") @@ -167,7 +171,7 @@ class GraphQLWithIAMIntegrationTests: XCTestCase { } } } - + await fulfillment(of: [connectedInvoked], timeout: TestCommonConstants.networkTimeout) _ = try await createTodo(id: uuid, name: name) _ = try await createTodo(id: uuid2, name: name) @@ -177,7 +181,7 @@ class GraphQLWithIAMIntegrationTests: XCTestCase { } // MARK: - Helpers - + func createTodo(id: String, name: String) async throws -> Todo { let todo = Todo(id: id, name: name) let event = try await Amplify.API.mutate(request: .create(todo)) @@ -190,7 +194,7 @@ class GraphQLWithIAMIntegrationTests: XCTestCase { } // MARK: - Auth Helpers - + func createAuthenticatedUser() async throws { if try await isSignedIn() { await signOut() @@ -198,12 +202,12 @@ class GraphQLWithIAMIntegrationTests: XCTestCase { try await signUp() try await signIn() } - + func isSignedIn() async throws -> Bool { let authSession = try await Amplify.Auth.fetchAuthSession() return authSession.isSignedIn } - + func signUp() async throws { let signUpResult = try await Amplify.Auth.signUp(username: username, password: password) guard signUpResult.isSignUpComplete else { @@ -211,7 +215,7 @@ class GraphQLWithIAMIntegrationTests: XCTestCase { return } } - + func signIn() async throws { let signInResult = try await Amplify.Auth.signIn(username: username, password: password) guard signInResult.isSignedIn else { @@ -219,7 +223,7 @@ class GraphQLWithIAMIntegrationTests: XCTestCase { return } } - + func signOut() async { _ = await Amplify.Auth.signOut() } @@ -231,9 +235,11 @@ class GraphQLWithIAMIntegrationTests: XCTestCase { public var name: String public var description: String? - init(id: String = UUID().uuidString, - name: String, - description: String? = nil) { + init( + id: String = UUID().uuidString, + name: String, + description: String? = nil + ) { self.id = id self.name = name self.description = description diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLIAMTests/Todo.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLIAMTests/Todo.swift index 2a88d92570..0c6e1cb0de 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLIAMTests/Todo.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLIAMTests/Todo.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify +import Foundation struct Todo: Decodable { let typename: String @@ -48,15 +48,15 @@ class CreateTodoMutation { static func variables(id: String? = nil, name: String?, description: String? = nil) -> [String: Any] { var input: [String: Any] = [:] - if let id = id { + if let id { input.updateValue(id, forKey: "id") } - if let name = name { + if let name { input.updateValue(name, forKey: "name") } - if let description = description { + if let description { input.updateValue(description, forKey: "description") } @@ -92,10 +92,10 @@ class UpdateTodoMutation { static func variables(id: String, name: String? = nil, description: String? = nil) -> [String: Any] { var input: [String: Any] = [:] input.updateValue(id, forKey: "id") - if let name = name { + if let name { input.updateValue(name, forKey: "name") } - if let description = description { + if let description { input.updateValue(description, forKey: "description") } return ["input": input] @@ -119,7 +119,7 @@ class DeleteTodoMutation { static func variables(id: String?) -> [String: Any] { var input: [String: Any] = [:] - if let id = id { + if let id { input.updateValue(id, forKey: "id") } @@ -166,20 +166,22 @@ class ListTodosQuery { }\n} """ - static func variables(filter: [String: Any]? = nil, - limit: Int? = nil, - nextToken: String? = nil) -> [String: Any] { + static func variables( + filter: [String: Any]? = nil, + limit: Int? = nil, + nextToken: String? = nil + ) -> [String: Any] { var input: [String: Any] = [:] - if let filter = filter { + if let filter { input.updateValue(filter, forKey: "filter") } - if let limit = limit { + if let limit { input.updateValue(limit, forKey: "limit") } - if let nextToken = nextToken { + if let nextToken { input.updateValue(nextToken, forKey: "nextToken") } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLLambdaAuthTests/GraphQLWithLambdaAuthIntegrationTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLLambdaAuthTests/GraphQLWithLambdaAuthIntegrationTests.swift index 5be0f9d63a..43732b3adc 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLLambdaAuthTests/GraphQLWithLambdaAuthIntegrationTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLLambdaAuthTests/GraphQLWithLambdaAuthIntegrationTests.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import AWSAPIPlugin +import XCTest @testable import Amplify #if os(watchOS) @testable import APIWatchApp @@ -15,9 +15,9 @@ import AWSAPIPlugin #endif class GraphQLWithLambdaAuthIntegrationTests: XCTestCase { - + let amplifyConfigurationFile = "testconfiguration/GraphQLWithLambdaAuthIntegrationTests-amplifyconfiguration" - + override func setUp() async throws{ do { try Amplify.add(plugin: AWSAPIPlugin(apiAuthProviderFactory: TestAPIAuthProviderFactory())) @@ -46,11 +46,15 @@ class GraphQLWithLambdaAuthIntegrationTests: XCTestCase { let expectedId = UUID().uuidString let expectedName = "testCreateTodoMutationName" let expectedDescription = "testCreateTodoMutationDescription" - let request = GraphQLRequest(document: CreateTodoMutation.document, - variables: CreateTodoMutation.variables(id: expectedId, - name: expectedName, - description: expectedDescription), - responseType: CreateTodoMutation.Data.self) + let request = GraphQLRequest( + document: CreateTodoMutation.document, + variables: CreateTodoMutation.variables( + id: expectedId, + name: expectedName, + description: expectedDescription + ), + responseType: CreateTodoMutation.Data.self + ) let graphQLResponse = try await Amplify.API.mutate(request: request) guard case let .success(data) = graphQLResponse else { XCTFail("Missing successful response") @@ -60,7 +64,7 @@ class GraphQLWithLambdaAuthIntegrationTests: XCTestCase { XCTFail("Missing Todo") return } - + XCTAssertEqual(todo.id, expectedId) XCTAssertEqual(todo.name, expectedName) XCTAssertEqual(todo.description, expectedDescription) @@ -103,12 +107,12 @@ class GraphQLWithLambdaAuthIntegrationTests: XCTestCase { /// func testOnCreateTodoSubscription() async throws { let connectedInvoked = expectation(description: "Connection established") - + let uuid = UUID().uuidString let uuid2 = UUID().uuidString let name = String("\(#function)".dropLast(2)) let subscriptions = Amplify.API.subscribe(request: .subscription(of: Todo.self, type: .onCreate)) - + let progressInvoked = expectation(description: "progress invoked") progressInvoked.expectedFulfillmentCount = 2 @@ -161,9 +165,11 @@ class GraphQLWithLambdaAuthIntegrationTests: XCTestCase { public var name: String public var description: String? - init(id: String = UUID().uuidString, - name: String, - description: String? = nil) { + init( + id: String = UUID().uuidString, + name: String, + description: String? = nil + ) { self.id = id self.name = name self.description = description diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLLambdaAuthTests/Todo.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLLambdaAuthTests/Todo.swift index ab57c527ec..72d7161d61 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLLambdaAuthTests/Todo.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLLambdaAuthTests/Todo.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify +import Foundation struct Todo: Decodable { let typename: String @@ -48,15 +48,15 @@ class CreateTodoMutation { static func variables(id: String? = nil, name: String?, description: String? = nil) -> [String: Any] { var input: [String: Any] = [:] - if let id = id { + if let id { input.updateValue(id, forKey: "id") } - if let name = name { + if let name { input.updateValue(name, forKey: "name") } - if let description = description { + if let description { input.updateValue(description, forKey: "description") } @@ -92,10 +92,10 @@ class UpdateTodoMutation { static func variables(id: String, name: String? = nil, description: String? = nil) -> [String: Any] { var input: [String: Any] = [:] input.updateValue(id, forKey: "id") - if let name = name { + if let name { input.updateValue(name, forKey: "name") } - if let description = description { + if let description { input.updateValue(description, forKey: "description") } return ["input": input] @@ -119,7 +119,7 @@ class DeleteTodoMutation { static func variables(id: String?) -> [String: Any] { var input: [String: Any] = [:] - if let id = id { + if let id { input.updateValue(id, forKey: "id") } @@ -166,20 +166,22 @@ class ListTodosQuery { }\n} """ - static func variables(filter: [String: Any]? = nil, - limit: Int? = nil, - nextToken: String? = nil) -> [String: Any] { + static func variables( + filter: [String: Any]? = nil, + limit: Int? = nil, + nextToken: String? = nil + ) -> [String: Any] { var input: [String: Any] = [:] - if let filter = filter { + if let filter { input.updateValue(filter, forKey: "filter") } - if let limit = limit { + if let limit { input.updateValue(limit, forKey: "limit") } - if let nextToken = nextToken { + if let nextToken { input.updateValue(nextToken, forKey: "nextToken") } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLUserPoolTests/API.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLUserPoolTests/API.swift index e951fb7c91..bf7bf16d35 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLUserPoolTests/API.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLUserPoolTests/API.swift @@ -1,26 +1,34 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // 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 { +public extension JSONEncodable { + 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) +public extension [String: JSONEncodable?] { + var withNilValuesRemoved: [String: JSONEncodable] { + var filtered = [String: JSONEncodable](minimumCapacity: count) for (key, value) in self { if value != nil { filtered[key] = value @@ -39,13 +47,13 @@ public extension GraphQLMapConvertible { } 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 { @@ -68,12 +76,12 @@ public protocol GraphQLFragment: GraphQLSelectionSet { 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 { +public extension GraphQLSelectionSet { + init(from decoder: Decoder) throws { if let jsonObject = try? APISwiftJSONValue(from: decoder) { let encoder = JSONEncoder() let jsonData = try encoder.encode(jsonObject) @@ -92,10 +100,10 @@ enum APISwiftJSONValue: Codable { 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) { @@ -110,10 +118,10 @@ enum APISwiftJSONValue: Codable { self = .null } } - + func encode(to encoder: Encoder) throws { var container = encoder.singleValueContainer() - + switch self { case .array(let value): try container.encode(value) @@ -136,19 +144,19 @@ 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 } } @@ -157,7 +165,7 @@ public indirect enum GraphQLOutputType { case object([GraphQLSelection]) case nonNull(GraphQLOutputType) case list(GraphQLOutputType) - + var namedType: GraphQLOutputType { switch self { case .nonNull(let innerType), .list(let innerType): @@ -171,25 +179,25 @@ 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; + 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; + self.selections = selections } } public struct GraphQLFragmentSpread: GraphQLSelection { let fragment: GraphQLFragment.Type - + public init(_ fragment: GraphQLFragment.Type) { self.fragment = fragment } @@ -197,10 +205,10 @@ public struct GraphQLFragmentSpread: GraphQLSelection { public struct GraphQLTypeCase: GraphQLSelection { let variants: [String: [GraphQLSelection]] let `default`: [GraphQLSelection] - + public init(variants: [String: [GraphQLSelection]], default: [GraphQLSelection]) { self.variants = variants - self.default = `default`; + self.default = `default` } } public typealias JSONObject = [String: Any] @@ -215,7 +223,7 @@ public enum JSONDecodingError: Error, LocalizedError { case nullValue case wrongType case couldNotConvert(value: Any, to: Any.Type) - + public var errorDescription: String? { switch self { case .missingValue: @@ -284,8 +292,8 @@ extension Bool: JSONDecodable, JSONEncodable { return self } } -extension RawRepresentable where RawValue: JSONDecodable { - public init(jsonValue value: Any) throws { +public extension RawRepresentable where RawValue: JSONDecodable { + init(jsonValue value: Any) throws { let rawValue = try RawValue(jsonValue: value) if let tempSelf = Self(rawValue: rawValue) { self = tempSelf @@ -294,17 +302,17 @@ extension RawRepresentable where RawValue: JSONDecodable { } } } -extension RawRepresentable where RawValue: JSONEncodable { - public var jsonValue: Any { +public extension RawRepresentable where RawValue: JSONEncodable { + var jsonValue: Any { return rawValue.jsonValue } } -extension Optional where Wrapped: JSONDecodable { - public init(jsonValue value: Any) throws { +public extension Optional where Wrapped: JSONDecodable { + init(jsonValue value: Any) throws { if value is NSNull { self = .none } else { - self = .some(try Wrapped(jsonValue: value)) + self = try .some(Wrapped(jsonValue: value)) } } } @@ -324,7 +332,7 @@ extension Dictionary: JSONEncodable { public var jsonValue: Any { return jsonObject } - + public var jsonObject: JSONObject { var jsonObject = JSONObject(minimumCapacity: count) for (key, value) in self { @@ -339,7 +347,7 @@ extension Dictionary: JSONEncodable { } extension Array: JSONEncodable { public var jsonValue: Any { - return map() { element -> (Any) in + return map { element -> (Any) in if case let element as JSONEncodable = element { return element.jsonValue } else { @@ -356,12 +364,12 @@ extension URL: JSONDecodable, JSONEncodable { self.init(string: string)! } public var jsonValue: Any { - return self.absoluteString + return absoluteString } } extension Dictionary { static func += (lhs: inout Dictionary, rhs: Dictionary) { - lhs.merge(rhs) { (_, new) in new } + lhs.merge(rhs) { _, new in new } } } #elseif canImport(AWSAppSync) @@ -371,11 +379,11 @@ import AWSAppSync 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] + self.graphQLMap = ["id": id, "name": name, "description": description] } - + public var id: GraphQLID? { get { return graphQLMap["id"] as! GraphQLID? @@ -384,7 +392,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return graphQLMap["name"] as! String @@ -393,7 +401,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "name") } } - + public var description: String? { get { return graphQLMap["description"] as! String? @@ -403,14 +411,14 @@ public struct APISwift { } } } - + 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] + self.graphQLMap = ["name": name, "description": description, "and": and, "or": or, "not": not] } - + public var name: ModelStringInput? { get { return graphQLMap["name"] as! ModelStringInput? @@ -419,7 +427,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "name") } } - + public var description: ModelStringInput? { get { return graphQLMap["description"] as! ModelStringInput? @@ -428,7 +436,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "description") } } - + public var and: [ModelTodoConditionInput?]? { get { return graphQLMap["and"] as! [ModelTodoConditionInput?]? @@ -437,7 +445,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelTodoConditionInput?]? { get { return graphQLMap["or"] as! [ModelTodoConditionInput?]? @@ -446,7 +454,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelTodoConditionInput? { get { return graphQLMap["not"] as! ModelTodoConditionInput? @@ -456,14 +464,14 @@ public struct APISwift { } } } - + 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] + self.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? @@ -472,7 +480,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "ne") } } - + public var eq: String? { get { return graphQLMap["eq"] as! String? @@ -481,7 +489,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "eq") } } - + public var le: String? { get { return graphQLMap["le"] as! String? @@ -490,7 +498,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "le") } } - + public var lt: String? { get { return graphQLMap["lt"] as! String? @@ -499,7 +507,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "lt") } } - + public var ge: String? { get { return graphQLMap["ge"] as! String? @@ -508,7 +516,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "ge") } } - + public var gt: String? { get { return graphQLMap["gt"] as! String? @@ -517,7 +525,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "gt") } } - + public var contains: String? { get { return graphQLMap["contains"] as! String? @@ -526,7 +534,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "contains") } } - + public var notContains: String? { get { return graphQLMap["notContains"] as! String? @@ -535,7 +543,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "notContains") } } - + public var between: [String?]? { get { return graphQLMap["between"] as! [String?]? @@ -544,7 +552,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "between") } } - + public var beginsWith: String? { get { return graphQLMap["beginsWith"] as! String? @@ -553,7 +561,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "beginsWith") } } - + public var attributeExists: Bool? { get { return graphQLMap["attributeExists"] as! Bool? @@ -562,7 +570,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "attributeExists") } } - + public var attributeType: ModelAttributeTypes? { get { return graphQLMap["attributeType"] as! ModelAttributeTypes? @@ -571,7 +579,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "attributeType") } } - + public var size: ModelSizeInput? { get { return graphQLMap["size"] as! ModelSizeInput? @@ -581,7 +589,7 @@ public struct APISwift { } } } - + public enum ModelAttributeTypes: RawRepresentable, Equatable, JSONDecodable, JSONEncodable { public typealias RawValue = String case binary @@ -596,7 +604,7 @@ public struct APISwift { case null /// Auto generated constant for unknown enum values case unknown(RawValue) - + public init?(rawValue: RawValue) { switch rawValue { case "binary": self = .binary @@ -612,7 +620,7 @@ public struct APISwift { default: self = .unknown(rawValue) } } - + public var rawValue: RawValue { switch self { case .binary: return "binary" @@ -628,7 +636,7 @@ public struct APISwift { case .unknown(let value): return value } } - + public static func == (lhs: ModelAttributeTypes, rhs: ModelAttributeTypes) -> Bool { switch (lhs, rhs) { case (.binary, .binary): return true @@ -646,14 +654,14 @@ public struct APISwift { } } } - + 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] + self.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? @@ -662,7 +670,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "ne") } } - + public var eq: Int? { get { return graphQLMap["eq"] as! Int? @@ -671,7 +679,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "eq") } } - + public var le: Int? { get { return graphQLMap["le"] as! Int? @@ -680,7 +688,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "le") } } - + public var lt: Int? { get { return graphQLMap["lt"] as! Int? @@ -689,7 +697,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "lt") } } - + public var ge: Int? { get { return graphQLMap["ge"] as! Int? @@ -698,7 +706,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "ge") } } - + public var gt: Int? { get { return graphQLMap["gt"] as! Int? @@ -707,7 +715,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "gt") } } - + public var between: [Int?]? { get { return graphQLMap["between"] as! [Int?]? @@ -717,14 +725,14 @@ public struct APISwift { } } } - + 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] + self.graphQLMap = ["id": id, "name": name, "description": description] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -733,7 +741,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var name: String? { get { return graphQLMap["name"] as! String? @@ -742,7 +750,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "name") } } - + public var description: String? { get { return graphQLMap["description"] as! String? @@ -752,14 +760,14 @@ public struct APISwift { } } } - + public struct DeleteTodoInput: GraphQLMapConvertible { public var graphQLMap: GraphQLMap - + public init(id: GraphQLID) { - graphQLMap = ["id": id] + self.graphQLMap = ["id": id] } - + public var id: GraphQLID { get { return graphQLMap["id"] as! GraphQLID @@ -769,14 +777,14 @@ public struct APISwift { } } } - + 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] + self.graphQLMap = ["id": id, "name": name, "description": description, "and": and, "or": or, "not": not] } - + public var id: ModelIDInput? { get { return graphQLMap["id"] as! ModelIDInput? @@ -785,7 +793,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "id") } } - + public var name: ModelStringInput? { get { return graphQLMap["name"] as! ModelStringInput? @@ -794,7 +802,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "name") } } - + public var description: ModelStringInput? { get { return graphQLMap["description"] as! ModelStringInput? @@ -803,7 +811,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "description") } } - + public var and: [ModelTodoFilterInput?]? { get { return graphQLMap["and"] as! [ModelTodoFilterInput?]? @@ -812,7 +820,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "and") } } - + public var or: [ModelTodoFilterInput?]? { get { return graphQLMap["or"] as! [ModelTodoFilterInput?]? @@ -821,7 +829,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "or") } } - + public var not: ModelTodoFilterInput? { get { return graphQLMap["not"] as! ModelTodoFilterInput? @@ -831,14 +839,14 @@ public struct APISwift { } } } - + 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] + self.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? @@ -847,7 +855,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "ne") } } - + public var eq: GraphQLID? { get { return graphQLMap["eq"] as! GraphQLID? @@ -856,7 +864,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "eq") } } - + public var le: GraphQLID? { get { return graphQLMap["le"] as! GraphQLID? @@ -865,7 +873,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "le") } } - + public var lt: GraphQLID? { get { return graphQLMap["lt"] as! GraphQLID? @@ -874,7 +882,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "lt") } } - + public var ge: GraphQLID? { get { return graphQLMap["ge"] as! GraphQLID? @@ -883,7 +891,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "ge") } } - + public var gt: GraphQLID? { get { return graphQLMap["gt"] as! GraphQLID? @@ -892,7 +900,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "gt") } } - + public var contains: GraphQLID? { get { return graphQLMap["contains"] as! GraphQLID? @@ -901,7 +909,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "contains") } } - + public var notContains: GraphQLID? { get { return graphQLMap["notContains"] as! GraphQLID? @@ -910,7 +918,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "notContains") } } - + public var between: [GraphQLID?]? { get { return graphQLMap["between"] as! [GraphQLID?]? @@ -919,7 +927,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "between") } } - + public var beginsWith: GraphQLID? { get { return graphQLMap["beginsWith"] as! GraphQLID? @@ -928,7 +936,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "beginsWith") } } - + public var attributeExists: Bool? { get { return graphQLMap["attributeExists"] as! Bool? @@ -937,7 +945,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "attributeExists") } } - + public var attributeType: ModelAttributeTypes? { get { return graphQLMap["attributeType"] as! ModelAttributeTypes? @@ -946,7 +954,7 @@ public struct APISwift { graphQLMap.updateValue(newValue, forKey: "attributeType") } } - + public var size: ModelSizeInput? { get { return graphQLMap["size"] as! ModelSizeInput? @@ -956,40 +964,40 @@ public struct APISwift { } } } - + 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 }]) + self.init(snapshot: ["__typename": "Mutation", "createTodo": createTodo.flatMap(\.snapshot)]) } - + public var createTodo: CreateTodo? { get { return (snapshot["createTodo"] as? Snapshot).flatMap { CreateTodo(snapshot: $0) } @@ -998,10 +1006,10 @@ public struct APISwift { 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))), @@ -1010,17 +1018,17 @@ public struct APISwift { 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 @@ -1029,7 +1037,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -1038,7 +1046,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -1047,7 +1055,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var description: String? { get { return snapshot["description"] as? String @@ -1056,7 +1064,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "description") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -1065,7 +1073,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -1077,40 +1085,40 @@ public struct APISwift { } } } - + 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 }]) + self.init(snapshot: ["__typename": "Mutation", "updateTodo": updateTodo.flatMap(\.snapshot)]) } - + public var updateTodo: UpdateTodo? { get { return (snapshot["updateTodo"] as? Snapshot).flatMap { UpdateTodo(snapshot: $0) } @@ -1119,10 +1127,10 @@ public struct APISwift { 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))), @@ -1131,17 +1139,17 @@ public struct APISwift { 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 @@ -1150,7 +1158,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -1159,7 +1167,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -1168,7 +1176,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var description: String? { get { return snapshot["description"] as? String @@ -1177,7 +1185,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "description") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -1186,7 +1194,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -1198,40 +1206,40 @@ public struct APISwift { } } } - + 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 }]) + self.init(snapshot: ["__typename": "Mutation", "deleteTodo": deleteTodo.flatMap(\.snapshot)]) } - + public var deleteTodo: DeleteTodo? { get { return (snapshot["deleteTodo"] as? Snapshot).flatMap { DeleteTodo(snapshot: $0) } @@ -1240,10 +1248,10 @@ public struct APISwift { 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))), @@ -1252,17 +1260,17 @@ public struct APISwift { 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 @@ -1271,7 +1279,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -1280,7 +1288,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -1289,7 +1297,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var description: String? { get { return snapshot["description"] as? String @@ -1298,7 +1306,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "description") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -1307,7 +1315,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -1319,38 +1327,38 @@ public struct APISwift { } } } - + 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 }]) + self.init(snapshot: ["__typename": "Query", "getTodo": getTodo.flatMap(\.snapshot)]) } - + public var getTodo: GetTodo? { get { return (snapshot["getTodo"] as? Snapshot).flatMap { GetTodo(snapshot: $0) } @@ -1359,10 +1367,10 @@ public struct APISwift { 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))), @@ -1371,17 +1379,17 @@ public struct APISwift { 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 @@ -1390,7 +1398,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -1399,7 +1407,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -1408,7 +1416,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var description: String? { get { return snapshot["description"] as? String @@ -1417,7 +1425,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "description") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -1426,7 +1434,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -1438,42 +1446,42 @@ public struct APISwift { } } } - + 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 }]) + self.init(snapshot: ["__typename": "Query", "listTodos": listTodos.flatMap(\.snapshot)]) } - + public var listTodos: ListTodo? { get { return (snapshot["listTodos"] as? Snapshot).flatMap { ListTodo(snapshot: $0) } @@ -1482,26 +1490,26 @@ public struct APISwift { 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]) + self.init(snapshot: ["__typename": "ModelTodoConnection", "items": items.map { $0.flatMap(\.snapshot) }, "nextToken": nextToken]) } - + public var __typename: String { get { return snapshot["__typename"]! as! String @@ -1510,16 +1518,16 @@ public struct APISwift { 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") + snapshot.updateValue(newValue.map { $0.flatMap(\.snapshot) }, forKey: "items") } } - + public var nextToken: String? { get { return snapshot["nextToken"] as? String @@ -1528,10 +1536,10 @@ public struct APISwift { 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))), @@ -1540,17 +1548,17 @@ public struct APISwift { 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 @@ -1559,7 +1567,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -1568,7 +1576,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -1577,7 +1585,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var description: String? { get { return snapshot["description"] as? String @@ -1586,7 +1594,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "description") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -1595,7 +1603,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -1608,31 +1616,31 @@ public struct APISwift { } } } - + 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 }]) + self.init(snapshot: ["__typename": "Subscription", "onCreateTodo": onCreateTodo.flatMap(\.snapshot)]) } - + public var onCreateTodo: OnCreateTodo? { get { return (snapshot["onCreateTodo"] as? Snapshot).flatMap { OnCreateTodo(snapshot: $0) } @@ -1641,10 +1649,10 @@ public struct APISwift { 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))), @@ -1653,17 +1661,17 @@ public struct APISwift { 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 @@ -1672,7 +1680,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -1681,7 +1689,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -1690,7 +1698,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var description: String? { get { return snapshot["description"] as? String @@ -1699,7 +1707,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "description") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -1708,7 +1716,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -1720,31 +1728,31 @@ public struct APISwift { } } } - + 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 }]) + self.init(snapshot: ["__typename": "Subscription", "onUpdateTodo": onUpdateTodo.flatMap(\.snapshot)]) } - + public var onUpdateTodo: OnUpdateTodo? { get { return (snapshot["onUpdateTodo"] as? Snapshot).flatMap { OnUpdateTodo(snapshot: $0) } @@ -1753,10 +1761,10 @@ public struct APISwift { 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))), @@ -1765,17 +1773,17 @@ public struct APISwift { 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 @@ -1784,7 +1792,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -1793,7 +1801,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -1802,7 +1810,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var description: String? { get { return snapshot["description"] as? String @@ -1811,7 +1819,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "description") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -1820,7 +1828,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String @@ -1832,31 +1840,31 @@ public struct APISwift { } } } - + 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 }]) + self.init(snapshot: ["__typename": "Subscription", "onDeleteTodo": onDeleteTodo.flatMap(\.snapshot)]) } - + public var onDeleteTodo: OnDeleteTodo? { get { return (snapshot["onDeleteTodo"] as? Snapshot).flatMap { OnDeleteTodo(snapshot: $0) } @@ -1865,10 +1873,10 @@ public struct APISwift { 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))), @@ -1877,17 +1885,17 @@ public struct APISwift { 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 @@ -1896,7 +1904,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "__typename") } } - + public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID @@ -1905,7 +1913,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "id") } } - + public var name: String { get { return snapshot["name"]! as! String @@ -1914,7 +1922,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "name") } } - + public var description: String? { get { return snapshot["description"] as? String @@ -1923,7 +1931,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "description") } } - + public var createdAt: String { get { return snapshot["createdAt"]! as! String @@ -1932,7 +1940,7 @@ public struct APISwift { snapshot.updateValue(newValue, forKey: "createdAt") } } - + public var updatedAt: String { get { return snapshot["updatedAt"]! as! String diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLUserPoolTests/Base/AsyncExpectation.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLUserPoolTests/Base/AsyncExpectation.swift index 9b3bd39a7a..6403ffdab0 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLUserPoolTests/Base/AsyncExpectation.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLUserPoolTests/Base/AsyncExpectation.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import Amplify import Foundation import XCTest -import Amplify public actor AsyncExpectation { enum State { @@ -28,10 +28,12 @@ public actor AsyncExpectation { state == .fulfilled } - public init(description: String, - isInverted: Bool = false, - expectedFulfillmentCount: Int = 1) { - expectationDescription = description + public init( + description: String, + isInverted: Bool = false, + expectedFulfillmentCount: Int = 1 + ) { + self.expectationDescription = description self.isInverted = isInverted self.expectedFulfillmentCount = expectedFulfillmentCount } @@ -59,7 +61,7 @@ public actor AsyncExpectation { } } - internal nonisolated func wait() async throws { + nonisolated func wait() async throws { try await withTaskCancellationHandler(handler: { Task { await cancel() @@ -69,8 +71,10 @@ public actor AsyncExpectation { }) } - internal func timeOut(file: StaticString = #filePath, - line: UInt = #line) async { + func timeOut( + file: StaticString = #filePath, + line: UInt = #line + ) async { if isInverted { state = .timedOut } else if state != .fulfilled { @@ -103,7 +107,7 @@ public actor AsyncExpectation { } -extension XCTestCase { +public extension XCTestCase { /// Creates a new async expectation with an associated description. /// @@ -118,12 +122,16 @@ extension XCTestCase { /// - description: A string to display in the test log for this expectation, to help diagnose failures. /// - isInverted: Indicates that the expectation is not intended to happen. /// - expectedFulfillmentCount: The number of times fulfill() must be called before the expectation is completely fulfilled. (default = 1) - public func expectation(description: String, - isInverted: Bool = false, - expectedFulfillmentCount: Int = 1) -> AsyncExpectation { - expectation(description: description, - isInverted: isInverted, - expectedFulfillmentCount: expectedFulfillmentCount) + func expectation( + description: String, + isInverted: Bool = false, + expectedFulfillmentCount: Int = 1 + ) -> AsyncExpectation { + expectation( + description: description, + isInverted: isInverted, + expectedFulfillmentCount: expectedFulfillmentCount + ) } /// Waits for the test to fulfill a set of expectations within a specified time. @@ -131,33 +139,43 @@ extension XCTestCase { /// - expectations: An array of async expectations that must be fulfilled. /// - timeout: The number of seconds within which all expectations must be fulfilled. @MainActor - public func waitForExpectations(_ expectations: [AsyncExpectation], - timeout: Double = 1.0, - file: StaticString = #filePath, - line: UInt = #line) async { - await AsyncTesting.waitForExpectations(expectations, - timeout: timeout, - file: file, - line: line) + func waitForExpectations( + _ expectations: [AsyncExpectation], + timeout: Double = 1.0, + file: StaticString = #filePath, + line: UInt = #line + ) async { + await AsyncTesting.waitForExpectations( + expectations, + timeout: timeout, + file: file, + line: line + ) } } public enum AsyncTesting { - public static func expectation(description: String, - isInverted: Bool = false, - expectedFulfillmentCount: Int = 1) -> AsyncExpectation { - expectation(description: description, - isInverted: isInverted, - expectedFulfillmentCount: expectedFulfillmentCount) + public static func expectation( + description: String, + isInverted: Bool = false, + expectedFulfillmentCount: Int = 1 + ) -> AsyncExpectation { + expectation( + description: description, + isInverted: isInverted, + expectedFulfillmentCount: expectedFulfillmentCount + ) } @MainActor - public static func waitForExpectations(_ expectations: [AsyncExpectation], - timeout: Double = 1.0, - file: StaticString = #filePath, - line: UInt = #line) async { + public static func waitForExpectations( + _ expectations: [AsyncExpectation], + timeout: Double = 1.0, + file: StaticString = #filePath, + line: UInt = #line + ) async { guard !expectations.isEmpty else { return } // check if all expectations are already satisfied and skip sleeping diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLUserPoolTests/GraphQLWithUserPoolIntegrationAPISwiftTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLUserPoolTests/GraphQLWithUserPoolIntegrationAPISwiftTests.swift index 8ab5a60fcd..4d416a3045 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLUserPoolTests/GraphQLWithUserPoolIntegrationAPISwiftTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLUserPoolTests/GraphQLWithUserPoolIntegrationAPISwiftTests.swift @@ -5,29 +5,33 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest -import Foundation import AWSAPIPlugin import AWSCognitoAuthPlugin +import Foundation +import XCTest @testable import Amplify @testable import APIHostApp extension GraphQLWithUserPoolIntegrationTests { - + func createTodoAPISwift() async throws { let expectedId = UUID().uuidString let expectedName = "testCreateTodoMutationName" let expectedDescription = "testCreateTodoMutationDescription" - let input = APISwift.CreateTodoInput(id: expectedId, - name: expectedName, - description: expectedDescription) + let input = APISwift.CreateTodoInput( + id: expectedId, + name: expectedName, + description: expectedDescription + ) let mutation = APISwift.CreateTodoMutation(input: input) - let request = GraphQLRequest(document: APISwift.CreateTodoMutation.operationString, - variables: mutation.variables?.jsonObject, - responseType: APISwift.CreateTodoMutation.Data.self) - - + let request = GraphQLRequest( + document: APISwift.CreateTodoMutation.operationString, + variables: mutation.variables?.jsonObject, + responseType: APISwift.CreateTodoMutation.Data.self + ) + + let event = try await Amplify.API.mutate(request: request) switch event { case .success(let data): @@ -45,7 +49,7 @@ extension GraphQLWithUserPoolIntegrationTests { XCTFail("Unexpected .failed event: \(error)") } } - + func testCreateTodoMutationWithUserPoolWithSignedInUserAPISwift() async throws { try await createAuthenticatedUser() try await createTodoAPISwift() diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLUserPoolTests/GraphQLWithUserPoolIntegrationTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLUserPoolTests/GraphQLWithUserPoolIntegrationTests.swift index b69d85b123..21788f0206 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLUserPoolTests/GraphQLWithUserPoolIntegrationTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLUserPoolTests/GraphQLWithUserPoolIntegrationTests.swift @@ -5,20 +5,21 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest -import Foundation import AWSAPIPlugin import AWSCognitoAuthPlugin +import Foundation +import XCTest @testable import Amplify @testable import APIHostApp + // swiftlint:disable type_body_length class GraphQLWithUserPoolIntegrationTests: XCTestCase { let amplifyConfigurationFile = "testconfiguration/GraphQLWithUserPoolIntegrationTests-amplifyconfiguration" let username = "integTest\(UUID().uuidString)" let password = "P123@\(UUID().uuidString)" - + override func setUp() { do { try Amplify.add(plugin: AWSAPIPlugin()) @@ -35,7 +36,7 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { await signOut() await Amplify.reset() } - + /// Given: A CreateTodo mutation request, and user signed in, graphql has userpools as auth mode. /// When: Call mutate API /// Then: The operation completes successfully with no errors and todo in response @@ -44,11 +45,15 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { let expectedId = UUID().uuidString let expectedName = "testCreateTodoMutationName" let expectedDescription = "testCreateTodoMutationDescription" - let request = GraphQLRequest(document: CreateTodoMutation.document, - variables: CreateTodoMutation.variables(id: expectedId, - name: expectedName, - description: expectedDescription), - responseType: CreateTodoMutation.Data.self) + let request = GraphQLRequest( + document: CreateTodoMutation.document, + variables: CreateTodoMutation.variables( + id: expectedId, + name: expectedName, + description: expectedDescription + ), + responseType: CreateTodoMutation.Data.self + ) let graphQLResponse = try await Amplify.API.mutate(request: request) guard case let .success(data) = graphQLResponse else { XCTFail("Missing successful response") @@ -72,11 +77,15 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { let expectedId = UUID().uuidString let expectedName = "testCreateTodoMutationName" let expectedDescription = "testCreateTodoMutationDescription" - let request = GraphQLRequest(document: CreateTodoMutation.document, - variables: CreateTodoMutation.variables(id: expectedId, - name: expectedName, - description: expectedDescription), - responseType: CreateTodoMutation.Data.self) + let request = GraphQLRequest( + document: CreateTodoMutation.document, + variables: CreateTodoMutation.variables( + id: expectedId, + name: expectedName, + description: expectedDescription + ), + responseType: CreateTodoMutation.Data.self + ) do { let graphQLResponse = try await Amplify.API.mutate(request: request) XCTFail("Unexpected .completed event: \(graphQLResponse)") @@ -93,24 +102,28 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { let expectedId = UUID().uuidString let expectedName = "testCreateTodoMutationName" let expectedDescription = "testCreateTodoMutationDescription" - let request = GraphQLRequest(document: CreateTodoMutation.document, - variables: CreateTodoMutation.variables(id: expectedId, - name: expectedName, - description: expectedDescription), - responseType: Todo?.self, - decodePath: CreateTodoMutation.decodePath) + let request = GraphQLRequest( + document: CreateTodoMutation.document, + variables: CreateTodoMutation.variables( + id: expectedId, + name: expectedName, + description: expectedDescription + ), + responseType: Todo?.self, + decodePath: CreateTodoMutation.decodePath + ) let graphQLResponse = try await Amplify.API.mutate(request: request) guard case let .success(data) = graphQLResponse else { XCTFail("Missing successful response") return } - + guard let todo = data else { XCTFail("Missing Todo") return } - + XCTAssertEqual(todo.id, expectedId) XCTAssertEqual(todo.name, expectedName) XCTAssertEqual(todo.description, expectedDescription) @@ -125,12 +138,16 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { let uuid = UUID().uuidString // create a Todo mutation with a missing/invalid "name" variable value - let request = GraphQLRequest(document: CreateTodoMutation.document, - variables: CreateTodoMutation.variables(id: uuid, - name: nil, - description: nil), - responseType: Todo?.self, - decodePath: CreateTodoMutation.decodePath) + let request = GraphQLRequest( + document: CreateTodoMutation.document, + variables: CreateTodoMutation.variables( + id: uuid, + name: nil, + description: nil + ), + responseType: Todo?.self, + decodePath: CreateTodoMutation.decodePath + ) let graphQLResponse = try await Amplify.API.mutate(request: request) guard case let .failure(graphQLResponseError) = graphQLResponse else { XCTFail("Unexpected response success \(graphQLResponse)") @@ -140,8 +157,10 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { XCTFail("Missing errors") return } - XCTAssertEqual("Variable 'input' has coerced Null value for NonNull type 'String!'", - firstError.message) + XCTAssertEqual( + "Variable 'input' has coerced Null value for NonNull type 'String!'", + firstError.message + ) } /// Given: A CreateTodo mutation request with incorrect repsonse type (ListTodo instead of Todo) @@ -152,17 +171,21 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { let expectedId = UUID().uuidString let expectedName = "testCreateTodoMutationName" let expectedDescription = "testCreateTodoMutationDescription" - let request = GraphQLRequest(document: CreateTodoMutation.document, - variables: CreateTodoMutation.variables(id: expectedId, - name: expectedName, - description: expectedDescription), - responseType: MalformedCreateTodoData.self) + let request = GraphQLRequest( + document: CreateTodoMutation.document, + variables: CreateTodoMutation.variables( + id: expectedId, + name: expectedName, + description: expectedDescription + ), + responseType: MalformedCreateTodoData.self + ) let graphQLResponse = try await Amplify.API.mutate(request: request) guard case let .failure(graphQLResponseError) = graphQLResponse else { XCTFail("Unexpected event: \(graphQLResponse)") return } - + guard case .transformationError = graphQLResponseError else { XCTFail("Should be transformation error") return @@ -183,9 +206,11 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { return } - let request = GraphQLRequest(document: GetTodoQuery.document, - variables: GetTodoQuery.variables(id: todo.id), - responseType: GetTodoQuery.Data.self) + let request = GraphQLRequest( + document: GetTodoQuery.document, + variables: GetTodoQuery.variables(id: todo.id), + responseType: GetTodoQuery.Data.self + ) let graphQLResponse = try await Amplify.API.query(request: request) guard case let .success(data) = graphQLResponse else { XCTFail("Missing successful response") @@ -195,7 +220,7 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { XCTFail("Missing Todo") return } - + XCTAssertEqual(todo.id, todo.id) XCTAssertEqual(todo.name, name) XCTAssertEqual(todo.description, description) @@ -208,9 +233,11 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { func testGetTodoQueryForMissingTodo() async throws { try await createAuthenticatedUser() let uuid = UUID().uuidString - let request = GraphQLRequest(document: GetTodoQuery.document, - variables: GetTodoQuery.variables(id: uuid), - responseType: GetTodoQuery.Data.self) + let request = GraphQLRequest( + document: GetTodoQuery.document, + variables: GetTodoQuery.variables(id: uuid), + responseType: GetTodoQuery.Data.self + ) let graphQLResponse = try await Amplify.API.query(request: request) guard case let .success(data) = graphQLResponse else { XCTFail("Missing successful response") @@ -234,11 +261,15 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { } let expectedName = name + "Updated" let expectedDescription = description + "Updated" - let request = GraphQLRequest(document: UpdateTodoMutation.document, - variables: UpdateTodoMutation.variables(id: todo.id, - name: expectedName, - description: expectedDescription), - responseType: UpdateTodoMutation.Data.self) + let request = GraphQLRequest( + document: UpdateTodoMutation.document, + variables: UpdateTodoMutation.variables( + id: todo.id, + name: expectedName, + description: expectedDescription + ), + responseType: UpdateTodoMutation.Data.self + ) let graphQLResponse = try await Amplify.API.mutate(request: request) guard case let .success(data) = graphQLResponse else { XCTFail("Missing successful response") @@ -268,9 +299,11 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { return } - let request = GraphQLRequest(document: DeleteTodoMutation.document, - variables: DeleteTodoMutation.variables(id: todo.id), - responseType: DeleteTodoMutation.Data.self) + let request = GraphQLRequest( + document: DeleteTodoMutation.document, + variables: DeleteTodoMutation.variables(id: todo.id), + responseType: DeleteTodoMutation.Data.self + ) let graphQLResponse = try await Amplify.API.mutate(request: request) guard case let .success(data) = graphQLResponse else { XCTFail("Missing successful response") @@ -280,23 +313,25 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { XCTFail("Missing deleteTodo") return } - + XCTAssertEqual(deleteTodo.id, todo.id) XCTAssertEqual(deleteTodo.name, name) XCTAssertEqual(deleteTodo.description, description) XCTAssertEqual(deleteTodo.typename, String(describing: Todo.self)) - let getTodoRequest = GraphQLRequest(document: GetTodoQuery.document, - variables: GetTodoQuery.variables(id: todo.id), - responseType: GetTodoQuery.Data.self) + let getTodoRequest = GraphQLRequest( + document: GetTodoQuery.document, + variables: GetTodoQuery.variables(id: todo.id), + responseType: GetTodoQuery.Data.self + ) let graphQLResponse2 = try await Amplify.API.query(request: getTodoRequest) XCTAssertNotNil(graphQLResponse2) - + guard case let .success(data) = graphQLResponse2 else { XCTFail("Missing successful response") return } - + XCTAssertNil(data.getTodo) } @@ -314,9 +349,11 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { return } - let request = GraphQLRequest(document: ListTodosQuery.document, - variables: nil, - responseType: ListTodosQuery.Data.self) + let request = GraphQLRequest( + document: ListTodosQuery.document, + variables: nil, + responseType: ListTodosQuery.Data.self + ) let graphQLResponse = try await Amplify.API.query(request: request) switch graphQLResponse { case .success(let data): @@ -338,9 +375,11 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { let uuid = UUID().uuidString let filter = ["id": ["eq": uuid]] let variables = ListTodosQuery.variables(filter: filter, limit: 10) - let request = GraphQLRequest(document: ListTodosQuery.document, - variables: variables, - responseType: ListTodosQuery.Data.self) + let request = GraphQLRequest( + document: ListTodosQuery.document, + variables: variables, + responseType: ListTodosQuery.Data.self + ) let graphQLResponse = try await Amplify.API.query(request: request) guard case let .success(data) = graphQLResponse else { XCTFail("Missing successful response") @@ -360,9 +399,11 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { let connectedInvoked = expectation(description: "Connection established") connectedInvoked.isInverted = true let completedInvoked = expectation(description: "Completed invoked") - let request = GraphQLRequest(document: OnCreateTodoSubscription.document, - variables: nil, - responseType: OnCreateTodoSubscription.Data.self) + let request = GraphQLRequest( + document: OnCreateTodoSubscription.document, + variables: nil, + responseType: OnCreateTodoSubscription.Data.self + ) let subscriptions = Amplify.API.subscribe(request: request) Task { @@ -401,9 +442,11 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { let completedInvoked = expectation(description: "Completed invoked") let progressInvoked = expectation(description: "progress invoked") progressInvoked.expectedFulfillmentCount = 2 - let request = GraphQLRequest(document: OnCreateTodoSubscription.document, - variables: nil, - responseType: OnCreateTodoSubscription.Data.self) + let request = GraphQLRequest( + document: OnCreateTodoSubscription.document, + variables: nil, + responseType: OnCreateTodoSubscription.Data.self + ) let subscriptions = Amplify.API.subscribe(request: request) Task { for try await subscription in subscriptions { @@ -421,7 +464,7 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { progressInvoked.fulfill() } } - + completedInvoked.fulfill() } await fulfillment(of: [connectedInvoked], timeout: TestCommonConstants.networkTimeout) @@ -457,9 +500,11 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { let progressInvoked = expectation(description: "progress invoked") progressInvoked.expectedFulfillmentCount = 2 - let request = GraphQLRequest(document: OnUpdateTodoSubscription.document, - variables: nil, - responseType: OnUpdateTodoSubscription.Data.self) + let request = GraphQLRequest( + document: OnUpdateTodoSubscription.document, + variables: nil, + responseType: OnUpdateTodoSubscription.Data.self + ) let subscriptions = Amplify.API.subscribe(request: request) Task { for try await subscription in subscriptions { @@ -514,9 +559,11 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { let disconnectedInvoked = expectation(description: "Connection disconnected") let completedInvoked = expectation(description: "Completed invoked") let progressInvoked = expectation(description: "progress invoked") - let request = GraphQLRequest(document: OnDeleteTodoSubscription.document, - variables: nil, - responseType: OnDeleteTodoSubscription.Data.self) + let request = GraphQLRequest( + document: OnDeleteTodoSubscription.document, + variables: nil, + responseType: OnDeleteTodoSubscription.Data.self + ) let subscriptions = Amplify.API.subscribe(request: request) Task { for try await subscription in subscriptions { @@ -553,25 +600,27 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { } await fulfillment(of: [progressInvoked], timeout: TestCommonConstants.networkTimeout) - + subscriptions.cancel() await fulfillment(of: [disconnectedInvoked, completedInvoked], timeout: TestCommonConstants.networkTimeout) } func testCreateMultipleSubscriptions() async throws { try await createAuthenticatedUser() - let subscriptions = [await createTodoSubscription(), - await createTodoSubscription(), - await createTodoSubscription(), - await createTodoSubscription(), - await createTodoSubscription()] + let subscriptions = await [ + createTodoSubscription(), + createTodoSubscription(), + createTodoSubscription(), + createTodoSubscription(), + createTodoSubscription() + ] for subscription in subscriptions { subscription.cancel() } } - + // MARK: - Auth Helpers - + func createAuthenticatedUser() async throws { if try await isSignedIn() { await signOut() @@ -579,12 +628,12 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { try await signUp() try await signIn() } - + func isSignedIn() async throws -> Bool { let authSession = try await Amplify.Auth.fetchAuthSession() return authSession.isSignedIn } - + func signUp() async throws { let signUpResult = try await Amplify.Auth.signUp(username: username, password: password) guard signUpResult.isSignUpComplete else { @@ -594,26 +643,32 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { } func signIn() async throws { - let signInResult = try await Amplify.Auth.signIn(username: username, - password: password) + let signInResult = try await Amplify.Auth.signIn( + username: username, + password: password + ) guard signInResult.isSignedIn else { XCTFail("Sign in successful but not complete") return } } - + func signOut() async { _ = await Amplify.Auth.signOut() } // MARK: - Helpers - + func createTodo(id: String, name: String, description: String) async throws -> Todo? { - let request = GraphQLRequest(document: CreateTodoMutation.document, - variables: CreateTodoMutation.variables(id: id, - name: name, - description: description), - responseType: CreateTodoMutation.Data.self) + let request = GraphQLRequest( + document: CreateTodoMutation.document, + variables: CreateTodoMutation.variables( + id: id, + name: name, + description: description + ), + responseType: CreateTodoMutation.Data.self + ) let graphQLResponse = try await Amplify.API.mutate(request: request) switch graphQLResponse { case .success(let data): @@ -624,11 +679,15 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { } func updateTodo(id: String, name: String, description: String) async throws -> Todo? { - let request = GraphQLRequest(document: UpdateTodoMutation.document, - variables: UpdateTodoMutation.variables(id: id, - name: name, - description: description), - responseType: UpdateTodoMutation.Data.self) + let request = GraphQLRequest( + document: UpdateTodoMutation.document, + variables: UpdateTodoMutation.variables( + id: id, + name: name, + description: description + ), + responseType: UpdateTodoMutation.Data.self + ) let graphQLResponse = try await Amplify.API.mutate(request: request) switch graphQLResponse { case .success(let data): @@ -639,9 +698,11 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { } func deleteTodo(id: String) async throws -> Todo? { - let request = GraphQLRequest(document: DeleteTodoMutation.document, - variables: DeleteTodoMutation.variables(id: id), - responseType: DeleteTodoMutation.Data.self) + let request = GraphQLRequest( + document: DeleteTodoMutation.document, + variables: DeleteTodoMutation.variables(id: id), + responseType: DeleteTodoMutation.Data.self + ) let graphQLResponse = try await Amplify.API.mutate(request: request) switch graphQLResponse { case .success(let data): @@ -653,9 +714,11 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase { func createTodoSubscription() async -> AmplifyAsyncThrowingSequence> { let connectedInvoked = expectation(description: "Connection established") - let request = GraphQLRequest(document: OnCreateTodoSubscription.document, - variables: nil, - responseType: OnCreateTodoSubscription.Data.self) + let request = GraphQLRequest( + document: OnCreateTodoSubscription.document, + variables: nil, + responseType: OnCreateTodoSubscription.Data.self + ) let subscriptions = Amplify.API.subscribe(request: request) Task { for try await subscription in subscriptions { diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLUserPoolTests/Todo.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLUserPoolTests/Todo.swift index ab57c527ec..72d7161d61 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLUserPoolTests/Todo.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLUserPoolTests/Todo.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify +import Foundation struct Todo: Decodable { let typename: String @@ -48,15 +48,15 @@ class CreateTodoMutation { static func variables(id: String? = nil, name: String?, description: String? = nil) -> [String: Any] { var input: [String: Any] = [:] - if let id = id { + if let id { input.updateValue(id, forKey: "id") } - if let name = name { + if let name { input.updateValue(name, forKey: "name") } - if let description = description { + if let description { input.updateValue(description, forKey: "description") } @@ -92,10 +92,10 @@ class UpdateTodoMutation { static func variables(id: String, name: String? = nil, description: String? = nil) -> [String: Any] { var input: [String: Any] = [:] input.updateValue(id, forKey: "id") - if let name = name { + if let name { input.updateValue(name, forKey: "name") } - if let description = description { + if let description { input.updateValue(description, forKey: "description") } return ["input": input] @@ -119,7 +119,7 @@ class DeleteTodoMutation { static func variables(id: String?) -> [String: Any] { var input: [String: Any] = [:] - if let id = id { + if let id { input.updateValue(id, forKey: "id") } @@ -166,20 +166,22 @@ class ListTodosQuery { }\n} """ - static func variables(filter: [String: Any]? = nil, - limit: Int? = nil, - nextToken: String? = nil) -> [String: Any] { + static func variables( + filter: [String: Any]? = nil, + limit: Int? = nil, + nextToken: String? = nil + ) -> [String: Any] { var input: [String: Any] = [:] - if let filter = filter { + if let filter { input.updateValue(filter, forKey: "filter") } - if let limit = limit { + if let limit { input.updateValue(limit, forKey: "limit") } - if let nextToken = nextToken { + if let nextToken { input.updateValue(nextToken, forKey: "nextToken") } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginIGraphQLAuthDirectiveTests/Base/AuthSignInHelper.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginIGraphQLAuthDirectiveTests/Base/AuthSignInHelper.swift index 98e6d9556a..d091aa412a 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginIGraphQLAuthDirectiveTests/Base/AuthSignInHelper.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginIGraphQLAuthDirectiveTests/Base/AuthSignInHelper.swift @@ -9,7 +9,7 @@ import Amplify public typealias CompletionType = (Bool, AuthError?) -> Void -public struct AuthSignInHelper { +public enum AuthSignInHelper { public static func signUpUser(username: String, password: String, email: String) async throws -> AuthSignUpResult { let options = AuthSignUpRequest.Options(userAttributes: [AuthUserAttribute(.email, value: email)]) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginIGraphQLAuthDirectiveTests/GraphQLAuthDirectiveIntegrationTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginIGraphQLAuthDirectiveTests/GraphQLAuthDirectiveIntegrationTests.swift index d3d73f8061..cf44c21c4d 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginIGraphQLAuthDirectiveTests/GraphQLAuthDirectiveIntegrationTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginIGraphQLAuthDirectiveTests/GraphQLAuthDirectiveIntegrationTests.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest -import AWSPluginsCore import AWSAPIPlugin import AWSCognitoAuthPlugin +import AWSPluginsCore +import XCTest @testable import Amplify @testable import APIHostApp @@ -18,11 +18,11 @@ class GraphQLAuthDirectiveIntegrationTests: XCTestCase { let username: String let password: String } - + let amplifyConfigurationFile = "testconfiguration/GraphQLWithUserPoolIntegrationTests-amplifyconfiguration" var user1: User! var user2: User! - + override func setUp() async throws { do { user1 = User(username: "integTest\(UUID().uuidString)", password: "P123@\(UUID().uuidString)") @@ -31,13 +31,17 @@ class GraphQLAuthDirectiveIntegrationTests: XCTestCase { try Amplify.add(plugin: AWSCognitoAuthPlugin()) let amplifyConfig = try TestConfigHelper.retrieveAmplifyConfiguration(forResource: amplifyConfigurationFile) try Amplify.configure(amplifyConfig) - - _ = try await AuthSignInHelper.signUpUser(username: user1.username, - password: user1.password, - email: "\(user1.username)@\(UUID().uuidString).com") - _ = try await AuthSignInHelper.signUpUser(username: user2.username, - password: user2.password, - email: "\(user2.username)@\(UUID().uuidString).com") + + _ = try await AuthSignInHelper.signUpUser( + username: user1.username, + password: user1.password, + email: "\(user1.username)@\(UUID().uuidString).com" + ) + _ = try await AuthSignInHelper.signUpUser( + username: user2.username, + password: user2.password, + email: "\(user2.username)@\(UUID().uuidString).com" + ) ModelRegistry.register(modelType: SocialNote.self) } catch { XCTFail("Error during setup: \(error)") @@ -46,12 +50,12 @@ class GraphQLAuthDirectiveIntegrationTests: XCTestCase { await signOut() } } - + override func tearDown() async throws { await signOut() await Amplify.reset() } - + /// Models created with: /// @auth(rules: [ { allow: owner, operations: [create, update, delete] } ]) /// @@ -80,14 +84,15 @@ class GraphQLAuthDirectiveIntegrationTests: XCTestCase { XCTFail("Owner should be able to successfully create a note") return } - + let ownerReadNoteResult = try await queryNote(byId: ownerCreatedNote.model.id) guard case let .success(ownerReadNoteOptional) = ownerReadNoteResult, - let ownerReadNote = ownerReadNoteOptional else { + let ownerReadNote = ownerReadNoteOptional + else { XCTFail("Owner should be able to query for own note") return } - + let ownerUpdateNote = SocialNote(id: ownerReadNote.model.id, content: "owner updated content", owner: nil) let ownerUpdatedNoteResult = try await updateNote(ownerUpdateNote, version: ownerReadNote.syncMetadata.version) guard case let .success(ownerUpdatedNote) = ownerUpdatedNoteResult else { @@ -95,20 +100,22 @@ class GraphQLAuthDirectiveIntegrationTests: XCTestCase { return } await signOut() - + try await signIn(username: user2.username, password: user2.password) let otherReadNoteResult = try await queryNote(byId: id) guard case let .success(otherReadNoteOptional) = otherReadNoteResult, - let otherReadNote = otherReadNoteOptional else { + let otherReadNote = otherReadNoteOptional + else { XCTFail("Others should be able to read the note") return } - + let otherUpdateNote = SocialNote(id: otherReadNote.model.id, content: "other updated content", owner: nil) do { let otherUpdatedNoteResult = try await updateNote(otherUpdateNote, version: otherReadNote.syncMetadata.version) guard case let .failure(graphQLResponseErrorOnUpdate) = otherUpdatedNoteResult, - let appSyncErrorOnUpdate = getAppSyncError(graphQLResponseErrorOnUpdate) else { + let appSyncErrorOnUpdate = getAppSyncError(graphQLResponseErrorOnUpdate) + else { XCTFail("Other should not be able to update owner's note") return } @@ -116,20 +123,20 @@ class GraphQLAuthDirectiveIntegrationTests: XCTestCase { } catch (let error) { XCTFail("Failed with error: \(error)") } - + await signOut() try await signIn(username: user1.username, password: user1.password) do { let result = try await deleteNote(byId: id, version: ownerUpdatedNote.syncMetadata.version) XCTAssertNotNil(result) - } catch(let error) { + } catch (let error) { XCTFail("Owner should be able to delete own note: \(error)") } } catch (let error as APIError) { XCTFail("Failed with error: \(error)") } } - + /// An unauthorized user should not be able to make a mutation /// - Given: An API backend as per README.md with SocialNote schema /// - When: An unauthorized mutation request is made @@ -147,7 +154,7 @@ class GraphQLAuthDirectiveIntegrationTests: XCTestCase { } await fulfillment(of: [failureInvoked], timeout: TestCommonConstants.networkTimeout) } - + /// - Given: An API backend as per README.md with SocialNote schema /// - When: An authrorized syncQuery request is made /// - Then: The request should succeed @@ -162,7 +169,7 @@ class GraphQLAuthDirectiveIntegrationTests: XCTestCase { XCTFail("Failed with error: \(error)") } } - + /// An unauthorized user should not be able to query /// - Given: An API backend as per README.md with SocialNote schema /// - When: An unauthrorized syncQuery request is made @@ -173,14 +180,14 @@ class GraphQLAuthDirectiveIntegrationTests: XCTestCase { do { _ = try await Amplify.API.query(request: request) XCTFail("Should not have completed successfully") - } catch (let error as APIError){ + } catch (let error as APIError) { self.assertNotAuthenticated(error) failureInvoked.fulfill() } - + await fulfillment(of: [failureInvoked], timeout: TestCommonConstants.networkTimeout) } - + /// An authorized user should not subscribe to mutation events /// - Given: An API backend as per README.md with SocialNote schema /// - When: An authorized user sets up subscription to API @@ -189,8 +196,10 @@ class GraphQLAuthDirectiveIntegrationTests: XCTestCase { try await signIn(username: user1.username, password: user1.password) let connectedInvoked = expectation(description: "Connection established") let progressInvoked = expectation(description: "Progress invoked") - let request = GraphQLRequest.subscription(to: SocialNote.self, - subscriptionType: .onCreate) + let request = GraphQLRequest.subscription( + to: SocialNote.self, + subscriptionType: .onCreate + ) let subscription = Amplify.API.subscribe(request: request) Task { do { @@ -213,22 +222,22 @@ class GraphQLAuthDirectiveIntegrationTests: XCTestCase { XCTFail("Unexpected subscription failure: \(error)") } } - + await fulfillment(of: [connectedInvoked], timeout: TestCommonConstants.networkTimeout) - + do { _ = try await createNote(content: "owner created content") } catch (let error) { XCTFail("Owner should be able to successfully create a note: \(error)") } - + await fulfillment(of: [progressInvoked], timeout: TestCommonConstants.networkTimeout) subscription.cancel() } - - + + // MARK: - Helpers - + func signIn(username: String, password: String) async throws { do { let signInResult = try await Amplify.Auth.signIn(username: username, password: password) @@ -240,43 +249,45 @@ class GraphQLAuthDirectiveIntegrationTests: XCTestCase { XCTFail("Failed with signIn error: \(error)") } } - + func signOut() async { _ = await Amplify.Auth.signOut() } - + func isSignedIn() async throws -> Bool { let authSession = try await Amplify.Auth.fetchAuthSession() return authSession.isSignedIn } - + func createNote(_ id: String = UUID().uuidString, content: String) async throws -> GraphQLResponse { let note = SocialNote(id: id, content: content, owner: nil) let request = GraphQLRequest.createMutation(of: note) let mutateResult = try await Amplify.API.mutate(request: request) return mutateResult } - + func updateNote(_ note: SocialNote, version: Int) async throws -> GraphQLResponse { let request = GraphQLRequest.updateMutation(of: note, version: version) let mutateResult = try await Amplify.API.mutate(request: request) return mutateResult } - + func deleteNote(byId id: String, version: Int) async throws -> GraphQLResponse { - let request = GraphQLRequest.deleteMutation(of: SocialNote(id: id, content: ""), - modelSchema: SocialNote.schema, - version: version) + let request = GraphQLRequest.deleteMutation( + of: SocialNote(id: id, content: ""), + modelSchema: SocialNote.schema, + version: version + ) let mutateResult = try await Amplify.API.mutate(request: request) return mutateResult } - + func queryNote(byId id: String) async throws -> GraphQLResponse { let request = GraphQLRequest.query(modelName: SocialNote.modelName, byId: id) let queryResult = try await Amplify.API.query(request: request) return queryResult } - + func syncQuery() async throws -> SyncQueryResult { let syncQueryInvoked = expectation(description: "note was sync queried") var resultOptional: SyncQueryResult? @@ -295,18 +306,19 @@ class GraphQLAuthDirectiveIntegrationTests: XCTestCase { } return result } - + func getAppSyncError(_ graphQLResponseError: GraphQLResponseError) -> AppSyncErrorType? { guard case let .error(errors) = graphQLResponseError, let error = errors.first, let extensions = error.extensions, - case let .string(errorTypeValue) = extensions["errorType"] else { + case let .string(errorTypeValue) = extensions["errorType"] + else { XCTFail("Missing expected `errorType` from error.extensions") return nil } return AppSyncErrorType(errorTypeValue) } - + func assertNotAuthenticated(_ error: APIError) { guard case let .operationError(_, _, underlyingError) = error else { XCTFail("Error should be operationError") diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginIGraphQLAuthDirectiveTests/SocialNote.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginIGraphQLAuthDirectiveTests/SocialNote.swift index 11cfbce7f6..f307e6ee39 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginIGraphQLAuthDirectiveTests/SocialNote.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginIGraphQLAuthDirectiveTests/SocialNote.swift @@ -13,27 +13,29 @@ public struct SocialNote: Model { public var content: String public var owner: String? - public init(id: String = UUID().uuidString, - content: String, - owner: String? = nil) { + public init( + id: String = UUID().uuidString, + content: String, + owner: String? = nil + ) { self.id = id self.content = content self.owner = owner } } -extension SocialNote { +public extension SocialNote { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id case content case owner } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let socialNote = SocialNote.keys model.authRules = [ diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/GraphQLLazyLoadBaseTest.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/GraphQLLazyLoadBaseTest.swift index 219d3d549f..5903c23d16 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/GraphQLLazyLoadBaseTest.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/GraphQLLazyLoadBaseTest.swift @@ -6,59 +6,62 @@ // import XCTest -@testable import AWSAPIPlugin @testable import Amplify @testable import APIHostApp +@testable import AWSAPIPlugin @testable import AWSPluginsCore class GraphQLLazyLoadBaseTest: XCTestCase { - + var amplifyConfig: AmplifyConfiguration! - + override func setUp() { continueAfterFailure = false } - + override func tearDown() async throws { await Amplify.reset() try await Task.sleep(seconds: 1) } - + func setupConfig() { let basePath = "testconfiguration" let baseFileName = "GraphQLLazyLoadTests" let configFile = "\(basePath)/\(baseFileName)-amplifyconfiguration" - + do { amplifyConfig = try TestConfigHelper.retrieveAmplifyConfiguration(forResource: configFile) } catch { XCTFail("Error during setup: \(error)") } } - + func apiEndpointName() throws -> String { guard let apiPlugin = amplifyConfig.api?.plugins["awsAPIPlugin"], - case .object(let value) = apiPlugin else { + case .object(let value) = apiPlugin + else { throw APIError.invalidConfiguration("API endpoint not found.", "Check the provided configuration") } return value.keys.first! } - + /// Setup API with given models /// - Parameter models: DataStore models - func setup(withModels models: AmplifyModelRegistration, - logLevel: LogLevel = .verbose) async { + func setup( + withModels models: AmplifyModelRegistration, + logLevel: LogLevel = .verbose + ) async { do { setupConfig() Amplify.Logging.logLevel = logLevel try Amplify.add(plugin: AWSAPIPlugin(modelRegistration: models)) try Amplify.configure(amplifyConfig) - + } catch { XCTFail("Error during setup: \(error)") } } - + @discardableResult func mutate(_ request: GraphQLRequest) async throws -> M { do { @@ -72,10 +75,10 @@ class GraphQLLazyLoadBaseTest: XCTestCase { } catch { XCTFail("Failed with error \(error)") } - + throw "See XCTFail message" } - + func query(_ request: GraphQLRequest) async throws -> M? { do { let graphQLResponse = try await Amplify.API.query(request: request) @@ -90,7 +93,7 @@ class GraphQLLazyLoadBaseTest: XCTestCase { } throw "See XCTFail message" } - + func listQuery(_ request: GraphQLRequest>) async throws -> List { do { let graphQLResponse = try await Amplify.API.query(request: request) @@ -105,14 +108,16 @@ class GraphQLLazyLoadBaseTest: XCTestCase { } throw "See XCTFail message" } - + enum AssertLazyModelState { case notLoaded(identifiers: [LazyReferenceIdentifier]?) case loaded(model: M?) } - - func assertLazyReference(_ lazyModel: LazyReference, - state: AssertLazyModelState) { + + func assertLazyReference( + _ lazyModel: LazyReference, + state: AssertLazyModelState + ) { switch state { case .notLoaded(let expectedIdentifiers): if case .notLoaded(let identifiers) = lazyModel.modelProvider.getState() { @@ -122,7 +127,7 @@ class GraphQLLazyLoadBaseTest: XCTestCase { } case .loaded(let expectedModel): if case .loaded(let model) = lazyModel.modelProvider.getState() { - guard let expectedModel = expectedModel, let model = model else { + guard let expectedModel, let model else { XCTAssertNil(model) return } @@ -132,13 +137,13 @@ class GraphQLLazyLoadBaseTest: XCTestCase { } } } - + enum AssertListState { case isNotLoaded(associatedIdentifiers: [String], associatedFields: [String]) case isLoaded(count: Int) } - - func assertList(_ list: List, state: AssertListState) { + + func assertList(_ list: List, state: AssertListState) { switch state { case .isNotLoaded(let expectedAssociatedIdentifiers, let expectedAssociatedFields): if case .notLoaded(let associatedIdentifiers, let associatedFields) = list.listProvider.getState() { @@ -155,35 +160,39 @@ class GraphQLLazyLoadBaseTest: XCTestCase { } } } - - func assertModelExists(_ model: M) async throws { + + func assertModelExists(_ model: some Model) async throws { let modelExists = try await query(for: model) != nil XCTAssertTrue(modelExists) } - - func assertModelDoesNotExist(_ model: M) async throws { + + func assertModelDoesNotExist(_ model: some Model) async throws { let modelExists = try await query(for: model) != nil XCTAssertFalse(modelExists) } - + func query(for model: M, includes: IncludedAssociations = { _ in [] }) async throws -> M? { let id = M.identifier(model)(schema: model.schema) - - var documentBuilder = ModelBasedGraphQLDocumentBuilder(modelSchema: model.schema, - operationType: .query) + + var documentBuilder = ModelBasedGraphQLDocumentBuilder( + modelSchema: model.schema, + operationType: .query + ) documentBuilder.add(decorator: DirectiveNameDecorator(type: .get)) - + if let modelPath = M.rootPath as? ModelPath { let associations = includes(modelPath) documentBuilder.add(decorator: IncludeAssociationDecorator(associations)) } documentBuilder.add(decorator: ModelIdDecorator(identifierFields: id.fields)) let document = documentBuilder.build() - - let request = GraphQLRequest(document: document.stringValue, - variables: document.variables, - responseType: M?.self, - decodePath: document.name) + + let request = GraphQLRequest( + document: document.stringValue, + variables: document.variables, + responseType: M?.self, + decodePath: document.name + ) return try await query(request) } @@ -207,8 +216,7 @@ class GraphQLLazyLoadBaseTest: XCTestCase { } if let data = subscriptionEvent.extractData(), - try await verifyChange(data) - { + try await verifyChange(data) { eventReceived.fulfill() } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/GraphQLLazyLoadPhoneCallTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/GraphQLLazyLoadPhoneCallTests.swift index df714fd717..67f7b27654 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/GraphQLLazyLoadPhoneCallTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/GraphQLLazyLoadPhoneCallTests.swift @@ -5,19 +5,19 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Combine +import Foundation import XCTest -@testable import Amplify import AWSPluginsCore +@testable import Amplify final class GraphQLLazyLoadPhoneCallTests: GraphQLLazyLoadBaseTest { - + func testConfigure() async throws { await setup(withModels: PhoneCallModels()) } - + /// Saving a person should be successfully /// /// - Given: A model instance of a Person @@ -30,7 +30,7 @@ final class GraphQLLazyLoadPhoneCallTests: GraphQLLazyLoadBaseTest { let person = Person(name: "name") try await mutate(.create(person)) } - + /// Saving a PhoneCall, requires a caller and a callee, should be successful. /// /// - Given: Two saved persons @@ -46,28 +46,32 @@ final class GraphQLLazyLoadPhoneCallTests: GraphQLLazyLoadBaseTest { let savedCaller = try await mutate(.create(caller)) let callee = Person(name: "callee") let savedCallee = try await mutate(.create(callee)) - + let phoneCall = PhoneCall(caller: savedCaller, callee: savedCallee) let savedPhoneCall = try await mutate(.create(phoneCall)) let queriedPhoneCall = try await query(for: savedPhoneCall)! - assertLazyReference(queriedPhoneCall._caller, - state: .notLoaded(identifiers: [.init(name: "id", value: caller.id)])) - assertLazyReference(queriedPhoneCall._callee, - state: .notLoaded(identifiers: [.init(name: "id", value: callee.id)])) + assertLazyReference( + queriedPhoneCall._caller, + state: .notLoaded(identifiers: [.init(name: "id", value: caller.id)]) + ) + assertLazyReference( + queriedPhoneCall._callee, + state: .notLoaded(identifiers: [.init(name: "id", value: callee.id)]) + ) let loadedCaller = try await queriedPhoneCall.caller let loadedCallee = try await queriedPhoneCall.callee assertLazyReference(queriedPhoneCall._caller, state: .loaded(model: savedCaller)) assertLazyReference(queriedPhoneCall._callee, state: .loaded(model: savedCallee)) - + let queriedCaller = try await query(for: caller)! try await queriedCaller.callerOf?.fetch() XCTAssertEqual(queriedCaller.callerOf!.count, 1) - + let queriedCallee = try await query(for: callee)! try await queriedCallee.calleeOf?.fetch() XCTAssertEqual(queriedCallee.calleeOf!.count, 1) } - + /// Saving a Transcript with a PhoneCall and a PhoneCall with a Transcript, should be successful /// /// - Given: A Transcript with a PhoneCall. A PhoneCall with a Transcript @@ -87,39 +91,45 @@ final class GraphQLLazyLoadPhoneCallTests: GraphQLLazyLoadBaseTest { let savedCallee = try await mutate(.create(callee)) var phoneCall = PhoneCall(caller: savedCaller, callee: savedCallee) let transcript = Transcript(text: "text", phoneCall: phoneCall) - + // This is a DX painpoint, the transcript can be set on either the connected model reference or the FK phoneCall.setTranscript(transcript) phoneCall.phoneCallTranscriptId = transcript.id - + let savedPhoneCall = try await mutate(.create(phoneCall)) XCTAssertEqual(savedPhoneCall.phoneCallTranscriptId, transcript.id) let savedTranscript = try await mutate(.create(transcript)) - assertLazyReference(savedTranscript._phoneCall, - state: .notLoaded(identifiers: [.init(name: "id", value: savedPhoneCall.id)])) - + assertLazyReference( + savedTranscript._phoneCall, + state: .notLoaded(identifiers: [.init(name: "id", value: savedPhoneCall.id)]) + ) + let queriedTranscript = try await query(for: savedTranscript)! - assertLazyReference(queriedTranscript._phoneCall, - state: .notLoaded(identifiers: [.init(name: "id", value: savedPhoneCall.id)])) + assertLazyReference( + queriedTranscript._phoneCall, + state: .notLoaded(identifiers: [.init(name: "id", value: savedPhoneCall.id)]) + ) let loadedPhoneCall = try await queriedTranscript.phoneCall! - assertLazyReference(queriedTranscript._phoneCall, - state: .loaded(model: savedPhoneCall)) + assertLazyReference( + queriedTranscript._phoneCall, + state: .loaded(model: savedPhoneCall) + ) let loadedCaller = try await loadedPhoneCall.caller let loadedCallee = try await loadedPhoneCall.callee - + try await loadedCaller.callerOf?.fetch() XCTAssertEqual(loadedCaller.callerOf!.count, 1) - + try await loadedCaller.calleeOf?.fetch() XCTAssertEqual(loadedCaller.calleeOf!.count, 0) - + try await loadedCallee.callerOf?.fetch() XCTAssertEqual(loadedCallee.callerOf!.count, 0) - + try await loadedCallee.calleeOf?.fetch() XCTAssertEqual(loadedCallee.calleeOf!.count, 1) } - + func testUpdatePhoneCallToTranscript() async throws { await setup(withModels: PhoneCallModels()) let caller = Person(name: "caller") @@ -131,22 +141,22 @@ final class GraphQLLazyLoadPhoneCallTests: GraphQLLazyLoadBaseTest { XCTAssertNil(savedPhoneCall.phoneCallTranscriptId) let transcript = Transcript(text: "text", phoneCall: phoneCall) let savedTranscript = try await mutate(.create(transcript)) - + var queriedPhoneCall = try await query(for: savedPhoneCall)! queriedPhoneCall.setTranscript(transcript) let updatedPhoneCall = try await mutate(.update(queriedPhoneCall)) XCTAssertEqual(updatedPhoneCall.phoneCallTranscriptId, transcript.id) } - + func testDeletePerson() async throws { await setup(withModels: PhoneCallModels()) let person = Person(name: "name") let savedPerson = try await mutate(.create(person)) - + try await mutate(.delete(savedPerson)) try await assertModelDoesNotExist(savedPerson) } - + /// Deleting a PhoneCall is successful /// /// - Given: PhoneCall, belongs to two Persons @@ -163,13 +173,13 @@ final class GraphQLLazyLoadPhoneCallTests: GraphQLLazyLoadBaseTest { let savedCallee = try await mutate(.create(callee)) let phoneCall = PhoneCall(caller: savedCaller, callee: savedCallee) let savedPhoneCall = try await mutate(.create(phoneCall)) - + try await mutate(.delete(savedPhoneCall)) try await assertModelDoesNotExist(savedPhoneCall) try await assertModelExists(caller) try await assertModelExists(callee) } - + /// Delete a PhoneCall before deleting the Caller and Callee /// /// - Given: PhoneCall which belongs to two different Persons (caller and callee) @@ -186,7 +196,7 @@ final class GraphQLLazyLoadPhoneCallTests: GraphQLLazyLoadBaseTest { let savedCallee = try await mutate(.create(callee)) let phoneCall = PhoneCall(caller: savedCaller, callee: savedCallee) let savedPhoneCall = try await mutate(.create(phoneCall)) - + try await mutate(.delete(savedPhoneCall)) try await mutate(.delete(savedCaller)) try await mutate(.delete(savedCallee)) @@ -194,7 +204,7 @@ final class GraphQLLazyLoadPhoneCallTests: GraphQLLazyLoadBaseTest { try await assertModelDoesNotExist(savedCaller) try await assertModelDoesNotExist(savedCallee) } - + /// Delete PhoneCall before Deleting Transcript. /// /// - Given: Transcript belongs to a PhoneCall @@ -212,10 +222,10 @@ final class GraphQLLazyLoadPhoneCallTests: GraphQLLazyLoadBaseTest { var phoneCall = PhoneCall(caller: savedCaller, callee: savedCallee) let transcript = Transcript(text: "text", phoneCall: phoneCall) phoneCall.phoneCallTranscriptId = transcript.id - + let savedPhoneCall = try await mutate(.create(phoneCall)) let savedTranscript = try await mutate(.create(transcript)) - + try await mutate(.delete(savedPhoneCall)) try await mutate(.delete(savedTranscript)) try await assertModelDoesNotExist(savedTranscript) @@ -226,7 +236,7 @@ final class GraphQLLazyLoadPhoneCallTests: GraphQLLazyLoadBaseTest { extension GraphQLLazyLoadPhoneCallTests: DefaultLogger { } extension GraphQLLazyLoadPhoneCallTests { - + struct PhoneCallModels: AmplifyModelRegistration { public let version: String = "version" func registerModels(registry: ModelRegistry.Type) { diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/Person+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/Person+Schema.swift index 28bef917e2..52d8a37214 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/Person+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/Person+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Person { +public extension Person { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id case name case callerOf @@ -12,19 +19,19 @@ extension Person { case createdAt case updatedAt } - - public static let keys = CodingKeys.self + + static let keys = CodingKeys.self // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let schema = defineSchema { model in let person = Person.keys - + model.pluralName = "People" - + model.attributes( .primaryKey(fields: [person.id]) ) - + model.fields( .field(person.id, is: .required, ofType: .string), .field(person.name, is: .required, ofType: .string), @@ -36,32 +43,32 @@ extension Person { .field(person.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Person: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Person { - public var id: FieldPath { +public extension ModelPath where ModelType == Person { + var id: FieldPath { string("id") } - public var name: FieldPath { + var name: FieldPath { string("name") } - public var callerOf: ModelPath { + var callerOf: ModelPath { PhoneCall.Path(name: "callerOf", isCollection: true, parent: self) } - public var calleeOf: ModelPath { + var calleeOf: ModelPath { PhoneCall.Path(name: "calleeOf", isCollection: true, parent: self) } - public var createdAt: FieldPath { + var createdAt: FieldPath { datetime("createdAt") } - public var updatedAt: FieldPath { + var updatedAt: FieldPath { datetime("updatedAt") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/Person.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/Person.swift index f3d6c1328a..7b577b70b5 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/Person.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/Person.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -9,24 +16,30 @@ public struct Person: Model { public var calleeOf: List? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - name: String, - callerOf: List = [], - calleeOf: List = []) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + name: String, + callerOf: List = [], + calleeOf: List = [] + ) { + self.init( + id: id, name: name, callerOf: callerOf, calleeOf: calleeOf, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - name: String, - callerOf: List = [], - calleeOf: List = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + name: String, + callerOf: List = [], + calleeOf: List = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.callerOf = callerOf diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/PhoneCall+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/PhoneCall+Schema.swift index 557468c4c4..6f2522afe1 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/PhoneCall+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/PhoneCall+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension PhoneCall { +public extension PhoneCall { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id case caller case callee @@ -13,21 +20,21 @@ extension PhoneCall { case updatedAt case phoneCallTranscriptId } - - public static let keys = CodingKeys.self + + static let keys = CodingKeys.self // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let schema = defineSchema { model in let phoneCall = PhoneCall.keys - + model.pluralName = "PhoneCalls" - + model.attributes( .index(fields: ["callerId"], name: "byCaller"), .index(fields: ["calleeId"], name: "byCallee"), .primaryKey(fields: [phoneCall.id]) ) - + model.fields( .field(phoneCall.id, is: .required, ofType: .string), .belongsTo(phoneCall.caller, is: .required, ofType: Person.self, targetNames: ["callerId"]), @@ -38,35 +45,35 @@ extension PhoneCall { .field(phoneCall.phoneCallTranscriptId, is: .optional, ofType: .string) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension PhoneCall: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == PhoneCall { - public var id: FieldPath { +public extension ModelPath where ModelType == PhoneCall { + var id: FieldPath { string("id") } - public var caller: ModelPath { + var caller: ModelPath { Person.Path(name: "caller", parent: self) } - public var callee: ModelPath { + var callee: ModelPath { Person.Path(name: "callee", parent: self) } - public var transcript: ModelPath { + var transcript: ModelPath { Transcript.Path(name: "transcript", parent: self) } - public var createdAt: FieldPath { + var createdAt: FieldPath { datetime("createdAt") } - public var updatedAt: FieldPath { + var updatedAt: FieldPath { datetime("updatedAt") } - public var phoneCallTranscriptId: FieldPath { + var phoneCallTranscriptId: FieldPath { string("phoneCallTranscriptId") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/PhoneCall.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/PhoneCall.swift index 54ebec566c..723b4cb393 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/PhoneCall.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/PhoneCall.swift @@ -1,22 +1,29 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation public struct PhoneCall: Model { public let id: String - internal var _caller: LazyReference + var _caller: LazyReference public var caller: Person { get async throws { try await _caller.require() } } - internal var _callee: LazyReference + var _callee: LazyReference public var callee: Person { get async throws { try await _callee.require() } } - internal var _transcript: LazyReference + var _transcript: LazyReference public var transcript: Transcript? { get async throws { try await _transcript.get() @@ -25,27 +32,33 @@ public struct PhoneCall: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? public var phoneCallTranscriptId: String? - - public init(id: String = UUID().uuidString, - caller: Person, - callee: Person, - transcript: Transcript? = nil, - phoneCallTranscriptId: String? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + caller: Person, + callee: Person, + transcript: Transcript? = nil, + phoneCallTranscriptId: String? = nil + ) { + self.init( + id: id, caller: caller, callee: callee, transcript: transcript, createdAt: nil, updatedAt: nil, - phoneCallTranscriptId: phoneCallTranscriptId) + phoneCallTranscriptId: phoneCallTranscriptId + ) } - internal init(id: String = UUID().uuidString, - caller: Person, - callee: Person, - transcript: Transcript? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil, - phoneCallTranscriptId: String? = nil) { + init( + id: String = UUID().uuidString, + caller: Person, + callee: Person, + transcript: Transcript? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil, + phoneCallTranscriptId: String? = nil + ) { self.id = id self._caller = LazyReference(caller) self._callee = LazyReference(callee) @@ -55,23 +68,23 @@ public struct PhoneCall: Model { self.phoneCallTranscriptId = phoneCallTranscriptId } public mutating func setCaller(_ caller: Person) { - self._caller = LazyReference(caller) + _caller = LazyReference(caller) } public mutating func setCallee(_ callee: Person) { - self._callee = LazyReference(callee) + _callee = LazyReference(callee) } public mutating func setTranscript(_ transcript: Transcript? = nil) { - self._transcript = LazyReference(transcript) + _transcript = LazyReference(transcript) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decode(String.self, forKey: .id) - _caller = try values.decodeIfPresent(LazyReference.self, forKey: .caller) ?? LazyReference(identifiers: nil) - _callee = try values.decodeIfPresent(LazyReference.self, forKey: .callee) ?? LazyReference(identifiers: nil) - _transcript = try values.decodeIfPresent(LazyReference.self, forKey: .transcript) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) - phoneCallTranscriptId = try? values.decode(String?.self, forKey: .phoneCallTranscriptId) + self.id = try values.decode(String.self, forKey: .id) + self._caller = try values.decodeIfPresent(LazyReference.self, forKey: .caller) ?? LazyReference(identifiers: nil) + self._callee = try values.decodeIfPresent(LazyReference.self, forKey: .callee) ?? LazyReference(identifiers: nil) + self._transcript = try values.decodeIfPresent(LazyReference.self, forKey: .transcript) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.phoneCallTranscriptId = try? values.decode(String?.self, forKey: .phoneCallTranscriptId) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/Transcript+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/Transcript+Schema.swift index 7bffc18bdb..7c600943a4 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/Transcript+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/Transcript+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Transcript { +public extension Transcript { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id case text case language @@ -12,19 +19,19 @@ extension Transcript { case createdAt case updatedAt } - - public static let keys = CodingKeys.self + + static let keys = CodingKeys.self // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let schema = defineSchema { model in let transcript = Transcript.keys - + model.pluralName = "Transcripts" - + model.attributes( .primaryKey(fields: [transcript.id]) ) - + model.fields( .field(transcript.id, is: .required, ofType: .string), .field(transcript.text, is: .required, ofType: .string), @@ -34,32 +41,32 @@ extension Transcript { .field(transcript.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Transcript: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Transcript { - public var id: FieldPath { +public extension ModelPath where ModelType == Transcript { + var id: FieldPath { string("id") } - public var text: FieldPath { + var text: FieldPath { string("text") } - public var language: FieldPath { + var language: FieldPath { string("language") } - public var phoneCall: ModelPath { + var phoneCall: ModelPath { PhoneCall.Path(name: "phoneCall", parent: self) } - public var createdAt: FieldPath { + var createdAt: FieldPath { datetime("createdAt") } - public var updatedAt: FieldPath { + var updatedAt: FieldPath { datetime("updatedAt") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/Transcript.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/Transcript.swift index 039f461e5b..4144fd8b5b 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/Transcript.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/L13/Transcript.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -6,7 +13,7 @@ public struct Transcript: Model { public let id: String public var text: String public var language: String? - internal var _phoneCall: LazyReference + var _phoneCall: LazyReference public var phoneCall: PhoneCall? { get async throws { try await _phoneCall.get() @@ -14,24 +21,30 @@ public struct Transcript: Model { } public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - text: String, - language: String? = nil, - phoneCall: PhoneCall? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + text: String, + language: String? = nil, + phoneCall: PhoneCall? = nil + ) { + self.init( + id: id, text: text, language: language, phoneCall: phoneCall, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - text: String, - language: String? = nil, - phoneCall: PhoneCall? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + text: String, + language: String? = nil, + phoneCall: PhoneCall? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.text = text self.language = language @@ -40,16 +53,16 @@ public struct Transcript: Model { self.updatedAt = updatedAt } public mutating func setPhoneCall(_ phoneCall: PhoneCall? = nil) { - self._phoneCall = LazyReference(phoneCall) + _phoneCall = LazyReference(phoneCall) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decode(String.self, forKey: .id) - text = try values.decode(String.self, forKey: .text) - language = try? values.decode(String?.self, forKey: .language) - _phoneCall = try values.decodeIfPresent(LazyReference.self, forKey: .phoneCall) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.id = try values.decode(String.self, forKey: .id) + self.text = try values.decode(String.self, forKey: .text) + self.language = try? values.decode(String?.self, forKey: .language) + self._phoneCall = try values.decodeIfPresent(LazyReference.self, forKey: .phoneCall) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL1/Comment4V2+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL1/Comment4V2+Schema.swift index 225bbfd4fd..448c925ca0 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL1/Comment4V2+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL1/Comment4V2+Schema.swift @@ -1,34 +1,41 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Comment4V2 { +public extension Comment4V2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id case content case post case createdAt case updatedAt } - - public static let keys = CodingKeys.self + + static let keys = CodingKeys.self // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let schema = defineSchema { model in let comment4V2 = Comment4V2.keys - + model.authRules = [ rule(allow: .public, operations: [.create, .update, .delete, .read]) ] - + model.pluralName = "Comment4V2s" - + model.attributes( .index(fields: ["postID", "content"], name: "byPost4"), .primaryKey(fields: [comment4V2.id]) ) - + model.fields( .field(comment4V2.id, is: .required, ofType: .string), .field(comment4V2.content, is: .required, ofType: .string), @@ -37,29 +44,29 @@ extension Comment4V2 { .field(comment4V2.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Comment4V2: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Comment4V2 { - public var id: FieldPath { +public extension ModelPath where ModelType == Comment4V2 { + var id: FieldPath { string("id") } - public var content: FieldPath { + var content: FieldPath { string("content") } - public var post: ModelPath { + var post: ModelPath { Post4V2.Path(name: "post", parent: self) } - public var createdAt: FieldPath { + var createdAt: FieldPath { datetime("createdAt") } - public var updatedAt: FieldPath { + var updatedAt: FieldPath { datetime("updatedAt") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL1/Comment4V2.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL1/Comment4V2.swift index fe39f08abe..ee184a16d7 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL1/Comment4V2.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL1/Comment4V2.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,7 +12,7 @@ import Foundation public struct Comment4V2: Model { public let id: String public var content: String - internal var _post: LazyReference + var _post: LazyReference public var post: Post4V2? { get async throws { try await _post.get() @@ -13,21 +20,27 @@ public struct Comment4V2: Model { } public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - content: String, - post: Post4V2? = nil) { - self.init(id: id, - content: content, - post: post, - createdAt: nil, - updatedAt: nil) + + public init( + id: String = UUID().uuidString, + content: String, + post: Post4V2? = nil + ) { + self.init( + id: id, + content: content, + post: post, + createdAt: nil, + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - content: String, - post: Post4V2? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + content: String, + post: Post4V2? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self._post = LazyReference(post) @@ -35,15 +48,15 @@ public struct Comment4V2: Model { self.updatedAt = updatedAt } public mutating func setPost(_ post: Post4V2? = nil) { - self._post = LazyReference(post) + _post = LazyReference(post) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decode(String.self, forKey: .id) - content = try values.decode(String.self, forKey: .content) - _post = try values.decodeIfPresent(LazyReference.self, forKey: .post) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.id = try values.decode(String.self, forKey: .id) + self.content = try values.decode(String.self, forKey: .content) + self._post = try values.decodeIfPresent(LazyReference.self, forKey: .post) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL1/GraphQLLazyLoadPostComment4V2Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL1/GraphQLLazyLoadPostComment4V2Tests.swift index 1b2e2a9838..dea5ae358b 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL1/GraphQLLazyLoadPostComment4V2Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL1/GraphQLLazyLoadPostComment4V2Tests.swift @@ -5,13 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 // - -import Foundation import Combine +import Foundation import XCTest -@testable import Amplify import AWSPluginsCore +@testable import Amplify final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest { @@ -22,7 +21,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest { try await mutate(.create(post)) try await mutate(.create(comment)) } - + // Without `includes` and latest codegenerated types with the model path, the post should be lazy loaded func testCommentWithLazyLoadPost() async throws { await setup(withModels: PostComment4V2Models()) @@ -30,13 +29,13 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest { let comment = Comment(content: "content", post: post) let createdPost = try await mutate(.create(post)) let createdComment = try await mutate(.create(comment)) - + // The comment's post should not be loaded, since no `includes` is passed in. // And the codegenerated swift models have the new modelPath properties. assertLazyReference(createdComment._post, state: .notLoaded(identifiers: [.init(name: "id", value: createdPost.id)])) let loadedPost = try await createdComment.post! XCTAssertEqual(loadedPost.id, createdPost.id) - + // The loaded post should have comments that are also not loaded let comments = loadedPost.comments! assertList(comments, state: .isNotLoaded(associatedIdentifiers: [createdPost.id], associatedFields: ["post"])) @@ -46,7 +45,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest { // the loaded comment's post should not be loaded assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [.init(name: "id", value: createdPost.id)])) } - + // With `includes` on `comment.post`, the comment's post should be eager loaded. func testCommentWithEagerLoadPost() async throws { await setup(withModels: PostComment4V2Models()) @@ -67,7 +66,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest { // further nested models should not be loaded assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id)])) } - + // With `includes` on `comment.post.comments`, func testCommentWithEagerLoadPostAndPostComments() async throws { await setup(withModels: PostComment4V2Models()) @@ -116,7 +115,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest { // further nested models should not be loaded assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.identifier)])) } - + /* - Given: Api plugin is cleared @@ -170,7 +169,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest { XCTAssertEqual(request.document, expectedDocument) try await mutate(request) } - + // Without `includes` and latest codegenerated types with the model path, the post's comments should be lazy loaded func testPostWithLazyLoadComments() async throws { await setup(withModels: PostComment4V2Models()) @@ -185,7 +184,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest { assertList(comments, state: .isLoaded(count: 1)) assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id)])) } - + // With `includes` on `post.comments` should eager load the post's comments func testPostWithEagerLoadComments() async throws { await setup(withModels: PostComment4V2Models()) @@ -198,7 +197,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest { assertList(comments, state: .isLoaded(count: 1)) assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id)])) } - + // With `includes` on `post.comments.post` should eager load the post's comments' post func testPostWithEagerLoadCommentsAndPost() async throws { await setup(withModels: PostComment4V2Models()) @@ -211,25 +210,29 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest { assertList(comments, state: .isLoaded(count: 1)) assertLazyReference(comments.first!._post, state: .loaded(model: createdPost)) } - + func testListPostsListComments() async throws { await setup(withModels: PostComment4V2Models()) let post = Post(title: "title") let comment = Comment(content: "content", post: post) try await mutate(.create(post)) try await mutate(.create(comment)) - + let queriedPosts = try await listQuery(.list(Post.self, where: Post.keys.id == post.id)) assertList(queriedPosts, state: .isLoaded(count: 1)) - assertList(queriedPosts.first!.comments!, - state: .isNotLoaded(associatedIdentifiers: [post.id], associatedFields: ["post"])) - + assertList( + queriedPosts.first!.comments!, + state: .isNotLoaded(associatedIdentifiers: [post.id], associatedFields: ["post"]) + ) + let queriedComments = try await listQuery(.list(Comment.self, where: Comment.keys.id == comment.id)) assertList(queriedComments, state: .isLoaded(count: 1)) - assertLazyReference(queriedComments.first!._post, - state: .notLoaded(identifiers: [.init(name: "id", value: post.id)])) + assertLazyReference( + queriedComments.first!._post, + state: .notLoaded(identifiers: [.init(name: "id", value: post.id)]) + ) } - + func testCreateWithoutPost() async throws { await setup(withModels: PostComment4V2Models()) let comment = Comment(content: "content") @@ -245,7 +248,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest { let queriedCommentWithPost = try await query(.get(Comment.self, byId: queriedCommentAfterUpdate.id, includes: { comment in [comment.post]}))! assertLazyReference(queriedCommentWithPost._post, state: .loaded(model: createdPost)) } - + func testUpdateToNewPost() async throws { await setup(withModels: PostComment4V2Models()) let post = Post(title: "title") @@ -254,7 +257,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest { try await mutate(.create(comment)) var queriedComment = try await query(.get(Comment.self, byId: comment.id))! assertLazyReference(queriedComment._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id)])) - + let newPost = Post(title: "title") let createdNewPost = try await mutate(.create(newPost)) queriedComment.setPost(newPost) @@ -264,7 +267,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest { let queriedCommentWithPost = try await query(.get(Comment.self, byId: queriedCommentAfterUpdate.id, includes: { comment in [comment.post]}))! assertLazyReference(queriedCommentWithPost._post, state: .loaded(model: createdNewPost)) } - + func testUpdateRemovePost() async throws { await setup(withModels: PostComment4V2Models()) let post = Post(title: "title") @@ -273,20 +276,20 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest { try await mutate(.create(comment)) var queriedComment = try await query(.get(Comment.self, byId: comment.id))! assertLazyReference(queriedComment._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id)])) - + queriedComment.setPost(nil) let updateCommentRemovePost = try await mutate(.update(queriedComment)) let queriedCommentAfterUpdate = try await query(.get(Comment.self, byId: updateCommentRemovePost.id))! assertLazyReference(queriedCommentAfterUpdate._post, state: .notLoaded(identifiers: nil)) } - + func testDelete() async throws { await setup(withModels: PostComment4V2Models()) let post = Post(title: "title") let comment = Comment(content: "content", post: post) let createdPost = try await mutate(.create(post)) try await mutate(.create(comment)) - + try await mutate(.delete(createdPost)) let queriedPost = try await query(.get(Post.self, byId: post.id)) XCTAssertNil(queriedPost) @@ -296,7 +299,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest { let queryDeletedComment = try await query(.get(Comment.self, byId: comment.id)) XCTAssertNil(queryDeletedComment) } - + func testSubscribeToComments() async throws { await setup(withModels: PostComment4V2Models()) let post = Post(title: "title") @@ -328,14 +331,14 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest { XCTFail("Subscription has terminated with \(error)") } } - + await fulfillment(of: [connected], timeout: 10) let comment = Comment(content: "content", post: post) try await mutate(.create(comment)) await fulfillment(of: [onCreatedComment], timeout: 10) subscription.cancel() } - + // The identical `includes` parameter should be used because the selection set of the mutation // has to match the selection set of the subscription. func testSubscribeToCommentsIncludesPost() async throws { @@ -344,9 +347,11 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest { try await mutate(.create(post)) let connected = expectation(description: "subscription connected") let onCreatedComment = expectation(description: "onCreatedComment received") - let subscriptionIncludes = Amplify.API.subscribe(request: .subscription(of: Comment.self, - type: .onCreate, - includes: { comment in [comment.post]})) + let subscriptionIncludes = Amplify.API.subscribe(request: .subscription( + of: Comment.self, + type: .onCreate, + includes: { comment in [comment.post]} + )) Task { do { for try await subscriptionEvent in subscriptionIncludes { @@ -371,18 +376,18 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest { XCTFail("Subscription has terminated with \(error)") } } - + await fulfillment(of: [connected], timeout: 20) let comment = Comment(content: "content", post: post) try await mutate(.create(comment, includes: { comment in [comment.post] })) await fulfillment(of: [onCreatedComment], timeout: 20) subscriptionIncludes.cancel() } - + func testSubscribeToPosts() async throws { await setup(withModels: PostComment4V2Models()) let post = Post(title: "title") - + let connected = expectation(description: "subscription connected") let onCreatedPost = expectation(description: "onCreatedPost received") let subscription = Amplify.API.subscribe(request: .subscription(of: Post.self, type: .onCreate)) @@ -410,22 +415,24 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest { XCTFail("Subscription has terminated with \(error)") } } - + await fulfillment(of: [connected], timeout: 10) try await mutate(.create(post)) await fulfillment(of: [onCreatedPost], timeout: 10) subscription.cancel() } - + func testSubscribeToPostsIncludes() async throws { await setup(withModels: PostComment4V2Models()) let post = Post(title: "title") - + let connected = expectation(description: "subscription connected") let onCreatedPost = expectation(description: "onCreatedPost received") - let subscriptionIncludes = Amplify.API.subscribe(request: .subscription(of: Post.self, - type: .onCreate, - includes: { post in [post.comments]})) + let subscriptionIncludes = Amplify.API.subscribe(request: .subscription( + of: Post.self, + type: .onCreate, + includes: { post in [post.comments]} + )) Task { do { for try await subscriptionEvent in subscriptionIncludes { @@ -450,7 +457,7 @@ final class GraphQLLazyLoadPostComment4V2Tests: GraphQLLazyLoadBaseTest { XCTFail("Subscription has terminated with \(error)") } } - + await fulfillment(of: [connected], timeout: 10) try await mutate(.create(post, includes: { post in [post.comments]})) await fulfillment(of: [onCreatedPost], timeout: 10) @@ -463,7 +470,7 @@ extension GraphQLLazyLoadPostComment4V2Tests: DefaultLogger { } extension GraphQLLazyLoadBaseTest { typealias Post = Post4V2 typealias Comment = Comment4V2 - + struct PostComment4V2Models: AmplifyModelRegistration { public let version: String = "version" func registerModels(registry: ModelRegistry.Type) { diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL1/Post4V2+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL1/Post4V2+Schema.swift index 2b1435bfa7..cd402d73fb 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL1/Post4V2+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL1/Post4V2+Schema.swift @@ -1,33 +1,40 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Post4V2 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Post4V2 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case title case comments case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let post4V2 = Post4V2.keys - + model.authRules = [ rule(allow: .public, operations: [.create, .update, .delete, .read]) ] - + model.pluralName = "Post4V2s" - + model.attributes( .primaryKey(fields: [post4V2.id]) ) - + model.fields( .field(post4V2.id, is: .required, ofType: .string), .field(post4V2.title, is: .required, ofType: .string), @@ -36,10 +43,10 @@ extension Post4V2 { .field(post4V2.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Post4V2: ModelIdentifiable { diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL1/Post4V2.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL1/Post4V2.swift index 08f3e4b429..9106744759 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL1/Post4V2.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL1/Post4V2.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct Post4V2: Model { public var comments: List? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - title: String, - comments: List? = []) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + title: String, + comments: List? = [] + ) { + self.init( + id: id, title: title, comments: comments, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - title: String, - comments: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + title: String, + comments: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.title = title self.comments = comments self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL10/Comment7+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL10/Comment7+Schema.swift index 2850d94c8d..1cb4ae68a7 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL10/Comment7+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL10/Comment7+Schema.swift @@ -1,31 +1,38 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Comment7 { +public extension Comment7 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case commentId case content case post case createdAt case updatedAt } - - public static let keys = CodingKeys.self + + static let keys = CodingKeys.self // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let schema = defineSchema { model in let comment7 = Comment7.keys - + model.pluralName = "Comment7s" - + model.attributes( .index(fields: ["commentId", "content"], name: nil), .index(fields: ["postId", "postTitle"], name: "byPost"), .primaryKey(fields: [comment7.commentId, comment7.content]) ) - + model.fields( .field(comment7.commentId, is: .required, ofType: .string), .field(comment7.content, is: .required, ofType: .string), @@ -34,9 +41,9 @@ extension Comment7 { .field(comment7.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Comment7: ModelIdentifiable { @@ -44,26 +51,28 @@ extension Comment7: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension Comment7.IdentifierProtocol { - public static func identifier(commentId: String, - content: String) -> Self { - .make(fields:[(name: "commentId", value: commentId), (name: "content", value: content)]) +public extension Comment7.IdentifierProtocol { + static func identifier( + commentId: String, + content: String + ) -> Self { + .make(fields: [(name: "commentId", value: commentId), (name: "content", value: content)]) } } -extension ModelPath where ModelType == Comment7 { - public var commentId: FieldPath { +public extension ModelPath where ModelType == Comment7 { + var commentId: FieldPath { string("commentId") } - public var content: FieldPath { + var content: FieldPath { string("content") } - public var post: ModelPath { + var post: ModelPath { Post7.Path(name: "post", parent: self) } - public var createdAt: FieldPath { + var createdAt: FieldPath { datetime("createdAt") } - public var updatedAt: FieldPath { + var updatedAt: FieldPath { datetime("updatedAt") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL10/Comment7.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL10/Comment7.swift index e2f2ea2620..3e8e4efddd 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL10/Comment7.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL10/Comment7.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,7 +12,7 @@ import Foundation public struct Comment7: Model { public let commentId: String public let content: String - internal var _post: LazyReference + var _post: LazyReference public var post: Post7? { get async throws { try await _post.get() @@ -13,21 +20,27 @@ public struct Comment7: Model { } public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(commentId: String, - content: String, - post: Post7? = nil) { - self.init(commentId: commentId, + + public init( + commentId: String, + content: String, + post: Post7? = nil + ) { + self.init( + commentId: commentId, content: content, post: post, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(commentId: String, - content: String, - post: Post7? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + commentId: String, + content: String, + post: Post7? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.commentId = commentId self.content = content self._post = LazyReference(post) @@ -35,15 +48,15 @@ public struct Comment7: Model { self.updatedAt = updatedAt } public mutating func setPost(_ post: Post7? = nil) { - self._post = LazyReference(post) + _post = LazyReference(post) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - commentId = try values.decode(String.self, forKey: .commentId) - content = try values.decode(String.self, forKey: .content) - _post = try values.decodeIfPresent(LazyReference.self, forKey: .post) ?? LazyReference(identifiers: nil) - createdAt = try values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.commentId = try values.decode(String.self, forKey: .commentId) + self.content = try values.decode(String.self, forKey: .content) + self._post = try values.decodeIfPresent(LazyReference.self, forKey: .post) ?? LazyReference(identifiers: nil) + self.createdAt = try values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL10/GraphQLLazyLoadPostComment7Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL10/GraphQLLazyLoadPostComment7Tests.swift index 28d7434a23..ba23c15b2b 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL10/GraphQLLazyLoadPostComment7Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL10/GraphQLLazyLoadPostComment7Tests.swift @@ -5,24 +5,24 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Combine +import Foundation import XCTest -@testable import Amplify import AWSPluginsCore +@testable import Amplify final class GraphQLLazyLoadPostComment7Tests: GraphQLLazyLoadBaseTest { func testSave() async throws { await setup(withModels: PostComment7Models()) - + let post = Post(postId: UUID().uuidString, title: "title") let comment = Comment(commentId: UUID().uuidString, content: "content", post: post) try await mutate(.create(post)) try await mutate(.create(comment)) } - + // Without `includes` and latest codegenerated types with the model path, the post should be lazy loaded func testCommentWithLazyLoadPost() async throws { await setup(withModels: PostComment7Models()) @@ -30,15 +30,17 @@ final class GraphQLLazyLoadPostComment7Tests: GraphQLLazyLoadBaseTest { let comment = Comment(commentId: UUID().uuidString, content: "content", post: post) let createdPost = try await mutate(.create(post)) let createdComment = try await mutate(.create(comment)) - + // The comment's post should not be loaded, since no `includes` is passed in. // And the codegenerated swift models have the new modelPath properties. - assertLazyReference(createdComment._post, state: .notLoaded(identifiers: [.init(name: "postId", value: createdPost.postId), - .init(name: "title", value: post.title)])) + assertLazyReference(createdComment._post, state: .notLoaded(identifiers: [ + .init(name: "postId", value: createdPost.postId), + .init(name: "title", value: post.title) + ])) let loadedPost = try await createdComment.post! XCTAssertEqual(loadedPost.postId, createdPost.postId) XCTAssertEqual(loadedPost.title, createdPost.title) - + let comments = loadedPost.comments! // The loaded post should have comments that are also not loaded assertList(comments, state: .isNotLoaded(associatedIdentifiers: [createdPost.postId, createdPost.title], associatedFields: ["post"])) @@ -46,10 +48,12 @@ final class GraphQLLazyLoadPostComment7Tests: GraphQLLazyLoadBaseTest { try await comments.fetch() assertList(comments, state: .isLoaded(count: 1)) // the loaded comment's post should not be loaded - assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [.init(name: "postId", value: createdPost.postId), - .init(name: "title", value: createdPost.title)])) + assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [ + .init(name: "postId", value: createdPost.postId), + .init(name: "title", value: createdPost.title) + ])) } - + // With `includes` on `comment.post`, the comment's post should be eager loaded. func testCommentWithEagerLoadPost() async throws { await setup(withModels: PostComment7Models()) @@ -68,10 +72,12 @@ final class GraphQLLazyLoadPostComment7Tests: GraphQLLazyLoadBaseTest { try await comments.fetch() assertList(comments, state: .isLoaded(count: 1)) // further nested models should not be loaded - assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [.init(name: "postId", value: createdPost.postId), - .init(name: "title", value: createdPost.title)])) + assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [ + .init(name: "postId", value: createdPost.postId), + .init(name: "title", value: createdPost.title) + ])) } - + func testQueryThenLazyLoad() async throws { await setup(withModels: PostComment7Models()) let post = Post(postId: UUID().uuidString, title: "title") @@ -80,87 +86,114 @@ final class GraphQLLazyLoadPostComment7Tests: GraphQLLazyLoadBaseTest { let savedComment = try await mutate(.create(comment, includes: { comment in [comment.post]})) try await assertComment(savedComment, hasEagerLoaded: savedPost) try await assertPost(savedPost, canLazyLoad: savedComment) - let queriedComment = try await query(.get(Comment.self, byIdentifier: .identifier(commentId: comment.commentId, - content: comment.content)))! + let queriedComment = try await query(.get(Comment.self, byIdentifier: .identifier( + commentId: comment.commentId, + content: comment.content + )))! try await assertComment(queriedComment, canLazyLoad: savedPost) let queriedPost = try await query(.get(Post.self, byIdentifier: .identifier(postId: post.postId, title: post.title)))! try await assertPost(queriedPost, canLazyLoad: savedComment) } - + func testListPostsListComments() async throws { await setup(withModels: PostComment7Models()) let post = Post(postId: UUID().uuidString, title: "title") let comment = Comment(commentId: UUID().uuidString, content: "content", post: post) try await mutate(.create(post)) try await mutate(.create(comment)) - + let queriedPosts = try await listQuery(.list(Post.self, where: Post.keys.postId == post.postId)) assertList(queriedPosts, state: .isLoaded(count: 1)) - assertList(queriedPosts.first!.comments!, - state: .isNotLoaded(associatedIdentifiers: [post.postId, post.title], associatedFields: ["post"])) - + assertList( + queriedPosts.first!.comments!, + state: .isNotLoaded(associatedIdentifiers: [post.postId, post.title], associatedFields: ["post"]) + ) + let queriedComments = try await listQuery(.list(Comment.self, where: Comment.keys.commentId == comment.commentId)) assertList(queriedComments, state: .isLoaded(count: 1)) - assertLazyReference(queriedComments.first!._post, - state: .notLoaded(identifiers: [ - .init(name: "postId", value: post.postId), - .init(name: "title", value: "title")])) + assertLazyReference( + queriedComments.first!._post, + state: .notLoaded(identifiers: [ + .init(name: "postId", value: post.postId), + .init(name: "title", value: "title") + ]) + ) } - - func assertComment(_ comment: Comment, - hasEagerLoaded post: Post) async throws { - assertLazyReference(comment._post, - state: .loaded(model: post)) - + + func assertComment( + _ comment: Comment, + hasEagerLoaded post: Post + ) async throws { + assertLazyReference( + comment._post, + state: .loaded(model: post) + ) + guard let loadedPost = try await comment.post else { XCTFail("Failed to retrieve the post from the comment") return } XCTAssertEqual(loadedPost.postId, post.postId) - + try await assertPost(loadedPost, canLazyLoad: comment) } - - func assertComment(_ comment: Comment, - canLazyLoad post: Post) async throws { - assertLazyReference(comment._post, state: .notLoaded(identifiers: [.init(name: "postId", value: post.postId), - .init(name: "title", value: post.title)])) + + func assertComment( + _ comment: Comment, + canLazyLoad post: Post + ) async throws { + assertLazyReference(comment._post, state: .notLoaded(identifiers: [ + .init(name: "postId", value: post.postId), + .init(name: "title", value: post.title) + ])) guard let loadedPost = try await comment.post else { XCTFail("Failed to load the post from the comment") return } XCTAssertEqual(loadedPost.postId, post.postId) - assertLazyReference(comment._post, - state: .loaded(model: post)) + assertLazyReference( + comment._post, + state: .loaded(model: post) + ) try await assertPost(loadedPost, canLazyLoad: comment) } - - func assertPost(_ post: Post, - canLazyLoad comment: Comment) async throws { + + func assertPost( + _ post: Post, + canLazyLoad comment: Comment + ) async throws { guard let comments = post.comments else { XCTFail("Missing comments on post") return } - assertList(comments, state: .isNotLoaded(associatedIdentifiers: [post.postId, post.title], - associatedFields: ["post"])) + assertList(comments, state: .isNotLoaded( + associatedIdentifiers: [post.postId, post.title], + associatedFields: ["post"] + )) try await comments.fetch() assertList(comments, state: .isLoaded(count: 1)) guard let comment = comments.first else { XCTFail("Missing lazy loaded comment from post") return } - assertLazyReference(comment._post, state: .notLoaded(identifiers: [.init(name: "postId", value: post.postId), - .init(name: "title", value: post.title)])) + assertLazyReference(comment._post, state: .notLoaded(identifiers: [ + .init(name: "postId", value: post.postId), + .init(name: "title", value: post.title) + ])) } - + func testSaveWithoutPost() async throws { await setup(withModels: PostComment7Models()) let comment = Comment(commentId: UUID().uuidString, content: "content") let savedComment = try await mutate(.create(comment)) - var queriedComment = try await query(.get(Comment.self, byIdentifier: .identifier(commentId: comment.commentId, - content: comment.content)))! - assertLazyReference(queriedComment._post, - state: .notLoaded(identifiers: nil)) + var queriedComment = try await query(.get(Comment.self, byIdentifier: .identifier( + commentId: comment.commentId, + content: comment.content + )))! + assertLazyReference( + queriedComment._post, + state: .notLoaded(identifiers: nil) + ) let post = Post(postId: UUID().uuidString, title: "title") let savedPost = try await mutate(.create(post)) queriedComment.setPost(savedPost) @@ -168,34 +201,42 @@ final class GraphQLLazyLoadPostComment7Tests: GraphQLLazyLoadBaseTest { let queriedComment2 = try await query(for: saveCommentWithPost)! try await assertComment(queriedComment2, canLazyLoad: post) } - + func testUpdateFromQueriedComment() async throws { await setup(withModels: PostComment7Models()) let post = Post(postId: UUID().uuidString, title: "title") let comment = Comment(commentId: UUID().uuidString, content: "content", post: post) let savedPost = try await mutate(.create(post)) let savedComment = try await mutate(.create(comment)) - var queriedComment = try await query(.get(Comment.self, byIdentifier: .identifier(commentId: comment.commentId, - content: comment.content)))! - assertLazyReference(queriedComment._post, state: .notLoaded(identifiers: [.init(name: "postId", value: post.postId), - .init(name: "title", value: post.title)])) + var queriedComment = try await query(.get(Comment.self, byIdentifier: .identifier( + commentId: comment.commentId, + content: comment.content + )))! + assertLazyReference(queriedComment._post, state: .notLoaded(identifiers: [ + .init(name: "postId", value: post.postId), + .init(name: "title", value: post.title) + ])) let savedQueriedComment = try await mutate(.update(queriedComment)) let queriedComment2 = try await query(for: savedQueriedComment)! try await assertComment(queriedComment2, canLazyLoad: savedPost) } - + func testUpdateToNewPost() async throws { await setup(withModels: PostComment7Models()) - + let post = Post(postId: UUID().uuidString, title: "title") let comment = Comment(commentId: UUID().uuidString, content: "content", post: post) _ = try await mutate(.create(post)) let savedComment = try await mutate(.create(comment)) - var queriedComment = try await query(.get(Comment.self, byIdentifier: .identifier(commentId: comment.commentId, - content: comment.content)))! - assertLazyReference(queriedComment._post, state: .notLoaded(identifiers: [.init(name: "postId", value: post.postId), - .init(name: "title", value: post.title)])) - + var queriedComment = try await query(.get(Comment.self, byIdentifier: .identifier( + commentId: comment.commentId, + content: comment.content + )))! + assertLazyReference(queriedComment._post, state: .notLoaded(identifiers: [ + .init(name: "postId", value: post.postId), + .init(name: "title", value: post.title) + ])) + let newPost = Post(postId: UUID().uuidString, title: "title") _ = try await mutate(.create(newPost)) queriedComment.setPost(newPost) @@ -203,28 +244,34 @@ final class GraphQLLazyLoadPostComment7Tests: GraphQLLazyLoadBaseTest { let queriedComment2 = try await query(for: saveCommentWithNewPost)! try await assertComment(queriedComment2, canLazyLoad: newPost) } - + func testUpdateRemovePost() async throws { await setup(withModels: PostComment7Models()) - + let post = Post(postId: UUID().uuidString, title: "title") let comment = Comment(commentId: UUID().uuidString, content: "content", post: post) _ = try await mutate(.create(post)) let savedComment = try await mutate(.create(comment)) - var queriedComment = try await query(.get(Comment.self, byIdentifier: .identifier(commentId: comment.commentId, - content: comment.content)))! - assertLazyReference(queriedComment._post, state: .notLoaded(identifiers: [.init(name: "postId", value: post.postId), - .init(name: "title", value: post.title)])) + var queriedComment = try await query(.get(Comment.self, byIdentifier: .identifier( + commentId: comment.commentId, + content: comment.content + )))! + assertLazyReference(queriedComment._post, state: .notLoaded(identifiers: [ + .init(name: "postId", value: post.postId), + .init(name: "title", value: post.title) + ])) queriedComment.setPost(nil) let saveCommentRemovePost = try await mutate(.update(queriedComment)) let queriedCommentNoPost = try await query(for: saveCommentRemovePost)! - assertLazyReference(queriedCommentNoPost._post, - state: .notLoaded(identifiers: nil)) + assertLazyReference( + queriedCommentNoPost._post, + state: .notLoaded(identifiers: nil) + ) } - + func testDelete() async throws { await setup(withModels: PostComment7Models()) - + let post = Post(postId: UUID().uuidString, title: "title") let comment = Comment(commentId: UUID().uuidString, content: "content", post: post) let savedPost = try await mutate(.create(post)) @@ -242,7 +289,7 @@ extension GraphQLLazyLoadPostComment7Tests: DefaultLogger { } extension GraphQLLazyLoadPostComment7Tests { typealias Post = Post7 typealias Comment = Comment7 - + struct PostComment7Models: AmplifyModelRegistration { public let version: String = "version" func registerModels(registry: ModelRegistry.Type) { diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL10/Post7+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL10/Post7+Schema.swift index 9b511cde28..4ebf8b81ef 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL10/Post7+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL10/Post7+Schema.swift @@ -1,30 +1,37 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Post7 { +public extension Post7 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case postId case title case comments case createdAt case updatedAt } - - public static let keys = CodingKeys.self + + static let keys = CodingKeys.self // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let schema = defineSchema { model in let post7 = Post7.keys - + model.pluralName = "Post7s" - + model.attributes( .index(fields: ["postId", "title"], name: nil), .primaryKey(fields: [post7.postId, post7.title]) ) - + model.fields( .field(post7.postId, is: .required, ofType: .string), .field(post7.title, is: .required, ofType: .string), @@ -33,9 +40,9 @@ extension Post7 { .field(post7.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Post7: ModelIdentifiable { @@ -43,26 +50,28 @@ extension Post7: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension Post7.IdentifierProtocol { - public static func identifier(postId: String, - title: String) -> Self { - .make(fields:[(name: "postId", value: postId), (name: "title", value: title)]) +public extension Post7.IdentifierProtocol { + static func identifier( + postId: String, + title: String + ) -> Self { + .make(fields: [(name: "postId", value: postId), (name: "title", value: title)]) } } -extension ModelPath where ModelType == Post7 { - public var postId: FieldPath { +public extension ModelPath where ModelType == Post7 { + var postId: FieldPath { string("postId") } - public var title: FieldPath { + var title: FieldPath { string("title") } - public var comments: ModelPath { + var comments: ModelPath { Comment7.Path(name: "comments", isCollection: true, parent: self) } - public var createdAt: FieldPath { + var createdAt: FieldPath { datetime("createdAt") } - public var updatedAt: FieldPath { + var updatedAt: FieldPath { datetime("updatedAt") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL10/Post7.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL10/Post7.swift index aecf363022..c07fbc8320 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL10/Post7.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL10/Post7.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,21 +15,27 @@ public struct Post7: Model { public var comments: List? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(postId: String, - title: String, - comments: List? = []) { - self.init(postId: postId, + + public init( + postId: String, + title: String, + comments: List? = [] + ) { + self.init( + postId: postId, title: title, comments: comments, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(postId: String, - title: String, - comments: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + postId: String, + title: String, + comments: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.postId = postId self.title = title self.comments = comments diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL11/Comment8+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL11/Comment8+Schema.swift index 7c5a3571b2..415c2046a0 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL11/Comment8+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL11/Comment8+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Comment8 { +public extension Comment8 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case commentId case content case postId @@ -12,21 +19,21 @@ extension Comment8 { case createdAt case updatedAt } - - public static let keys = CodingKeys.self + + static let keys = CodingKeys.self // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let schema = defineSchema { model in let comment8 = Comment8.keys - + model.pluralName = "Comment8s" - + model.attributes( .index(fields: ["commentId", "content"], name: nil), .index(fields: ["postId", "postTitle"], name: "byPost"), .primaryKey(fields: [comment8.commentId, comment8.content]) ) - + model.fields( .field(comment8.commentId, is: .required, ofType: .string), .field(comment8.content, is: .required, ofType: .string), @@ -36,9 +43,9 @@ extension Comment8 { .field(comment8.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Comment8: ModelIdentifiable { @@ -46,29 +53,31 @@ extension Comment8: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension Comment8.IdentifierProtocol { - public static func identifier(commentId: String, - content: String) -> Self { - .make(fields:[(name: "commentId", value: commentId), (name: "content", value: content)]) +public extension Comment8.IdentifierProtocol { + static func identifier( + commentId: String, + content: String + ) -> Self { + .make(fields: [(name: "commentId", value: commentId), (name: "content", value: content)]) } } -extension ModelPath where ModelType == Comment8 { - public var commentId: FieldPath { +public extension ModelPath where ModelType == Comment8 { + var commentId: FieldPath { string("commentId") } - public var content: FieldPath { + var content: FieldPath { string("content") } - public var postId: FieldPath { + var postId: FieldPath { string("postId") } - public var postTitle: FieldPath { + var postTitle: FieldPath { string("postTitle") } - public var createdAt: FieldPath { + var createdAt: FieldPath { datetime("createdAt") } - public var updatedAt: FieldPath { + var updatedAt: FieldPath { datetime("updatedAt") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL11/Comment8.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL11/Comment8.swift index 22fcd26a4b..0fc5456492 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL11/Comment8.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL11/Comment8.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -9,24 +16,30 @@ public struct Comment8: Model { public var postTitle: String? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(commentId: String, - content: String, - postId: String? = nil, - postTitle: String? = nil) { - self.init(commentId: commentId, + + public init( + commentId: String, + content: String, + postId: String? = nil, + postTitle: String? = nil + ) { + self.init( + commentId: commentId, content: content, postId: postId, postTitle: postTitle, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(commentId: String, - content: String, - postId: String? = nil, - postTitle: String? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + commentId: String, + content: String, + postId: String? = nil, + postTitle: String? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.commentId = commentId self.content = content self.postId = postId @@ -34,4 +47,4 @@ public struct Comment8: Model { self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL11/GraphQLLazyLoadPostComment8Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL11/GraphQLLazyLoadPostComment8Tests.swift index ff51b5e9c3..904b902ef8 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL11/GraphQLLazyLoadPostComment8Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL11/GraphQLLazyLoadPostComment8Tests.swift @@ -5,35 +5,39 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Combine +import Foundation import XCTest -@testable import Amplify import AWSPluginsCore +@testable import Amplify final class GraphQLLazyLoadPostComment8Tests: GraphQLLazyLoadBaseTest { func testSave() async throws { await setup(withModels: PostComment8Models()) - + let post = Post(postId: UUID().uuidString, title: "title") - let comment = Comment(commentId: UUID().uuidString, - content: "content", - postId: post.postId, - postTitle: post.title) + let comment = Comment( + commentId: UUID().uuidString, + content: "content", + postId: post.postId, + postTitle: post.title + ) let savedPost = try await mutate(.create(post)) let savedComment = try await mutate(.create(comment)) } - + func testQueryThenLazyLoad() async throws { await setup(withModels: PostComment8Models()) - + let post = Post(postId: UUID().uuidString, title: "title") - let comment = Comment(commentId: UUID().uuidString, - content: "content", - postId: post.postId, - postTitle: post.title) + let comment = Comment( + commentId: UUID().uuidString, + content: "content", + postId: post.postId, + postTitle: post.title + ) let savedPost = try await mutate(.create(post)) let savedComment = try await mutate(.create(comment)) assertComment(savedComment, contains: savedPost) @@ -43,25 +47,29 @@ final class GraphQLLazyLoadPostComment8Tests: GraphQLLazyLoadBaseTest { let queriedPost = try await query(.get(Post.self, byIdentifier: .identifier(postId: post.postId, title: post.title)))! try await assertPost(queriedPost, canLazyLoad: savedComment) } - + func assertComment(_ comment: Comment, contains post: Post) { XCTAssertEqual(comment.postId, post.postId) XCTAssertEqual(comment.postTitle, post.title) } - + func assertCommentDoesNotContainPost(_ comment: Comment) { XCTAssertNil(comment.postId) XCTAssertNil(comment.postTitle) } - - func assertPost(_ post: Post, - canLazyLoad comment: Comment) async throws { + + func assertPost( + _ post: Post, + canLazyLoad comment: Comment + ) async throws { guard let comments = post.comments else { XCTFail("Missing comments on post") return } - assertList(comments, state: .isNotLoaded(associatedIdentifiers: [post.postId, post.title], - associatedFields: ["postId", "postTitle"])) + assertList(comments, state: .isNotLoaded( + associatedIdentifiers: [post.postId, post.title], + associatedFields: ["postId", "postTitle"] + )) try await comments.fetch() assertList(comments, state: .isLoaded(count: 1)) guard let comment = comments.first else { @@ -70,29 +78,33 @@ final class GraphQLLazyLoadPostComment8Tests: GraphQLLazyLoadBaseTest { } assertComment(comment, contains: post) } - + func testListPostsListComments() async throws { await setup(withModels: PostComment8Models()) let post = Post(postId: UUID().uuidString, title: "title") - let comment = Comment(commentId: UUID().uuidString, - content: "content", - postId: post.postId, - postTitle: post.title) + let comment = Comment( + commentId: UUID().uuidString, + content: "content", + postId: post.postId, + postTitle: post.title + ) try await mutate(.create(post)) try await mutate(.create(comment)) - - + + let queriedPosts = try await listQuery(.list(Post.self, where: Post.keys.postId == post.postId)) assertList(queriedPosts, state: .isLoaded(count: 1)) - assertList(queriedPosts.first!.comments!, - state: .isNotLoaded(associatedIdentifiers: [post.postId, post.title], associatedFields: ["postId", "postTitle"])) - + assertList( + queriedPosts.first!.comments!, + state: .isNotLoaded(associatedIdentifiers: [post.postId, post.title], associatedFields: ["postId", "postTitle"]) + ) + let queriedComments = try await listQuery(.list(Comment.self, where: Comment.keys.commentId == comment.commentId)) assertList(queriedComments, state: .isLoaded(count: 1)) XCTAssertEqual(queriedComments.first!.postId, post.postId) XCTAssertEqual(queriedComments.first!.postTitle, post.title) } - + func testSaveWithoutPost() async throws { await setup(withModels: PostComment8Models()) let comment = Comment(commentId: UUID().uuidString, content: "content") @@ -107,14 +119,16 @@ final class GraphQLLazyLoadPostComment8Tests: GraphQLLazyLoadBaseTest { let queriedComment2 = try await query(for: saveCommentWithPost)! assertComment(queriedComment2, contains: post) } - + func testUpdateFromQueriedComment() async throws { await setup(withModels: PostComment8Models()) let post = Post(postId: UUID().uuidString, title: "title") - let comment = Comment(commentId: UUID().uuidString, - content: "content", - postId: post.postId, - postTitle: post.title) + let comment = Comment( + commentId: UUID().uuidString, + content: "content", + postId: post.postId, + postTitle: post.title + ) let savedPost = try await mutate(.create(post)) let savedComment = try await mutate(.create(comment)) let queriedComment = try await query(.get(Comment.self, byIdentifier: .identifier(commentId: comment.commentId, content: comment.content)))! @@ -123,15 +137,17 @@ final class GraphQLLazyLoadPostComment8Tests: GraphQLLazyLoadBaseTest { let queriedComment2 = try await query(for: savedQueriedComment)! assertComment(queriedComment2, contains: savedPost) } - + func testUpdateToNewPost() async throws { await setup(withModels: PostComment8Models()) - + let post = Post(postId: UUID().uuidString, title: "title") - let comment = Comment(commentId: UUID().uuidString, - content: "content", - postId: post.postId, - postTitle: post.title) + let comment = Comment( + commentId: UUID().uuidString, + content: "content", + postId: post.postId, + postTitle: post.title + ) _ = try await mutate(.create(post)) let savedComment = try await mutate(.create(comment)) var queriedComment = try await query(.get(Comment.self, byIdentifier: .identifier(commentId: comment.commentId, content: comment.content)))! @@ -144,39 +160,43 @@ final class GraphQLLazyLoadPostComment8Tests: GraphQLLazyLoadBaseTest { let queriedComment2 = try await query(for: saveCommentWithNewPost)! assertComment(queriedComment2, contains: newPost) } - + func testUpdateRemovePost() async throws { await setup(withModels: PostComment8Models()) - + let post = Post(postId: UUID().uuidString, title: "title") - let comment = Comment(commentId: UUID().uuidString, - content: "content", - postId: post.postId, - postTitle: post.title) + let comment = Comment( + commentId: UUID().uuidString, + content: "content", + postId: post.postId, + postTitle: post.title + ) _ = try await mutate(.create(post)) let savedComment = try await mutate(.create(comment)) var queriedComment = try await query(.get(Comment.self, byIdentifier: .identifier(commentId: comment.commentId, content: comment.content)))! assertComment(queriedComment, contains: post) - + queriedComment.postId = nil queriedComment.postTitle = nil - + let saveCommentRemovePost = try await mutate(.update(queriedComment)) let queriedCommentNoPost = try await query(for: saveCommentRemovePost)! assertCommentDoesNotContainPost(queriedCommentNoPost) } - + func testDelete() async throws { await setup(withModels: PostComment8Models()) - + let post = Post(postId: UUID().uuidString, title: "title") - let comment = Comment(commentId: UUID().uuidString, - content: "content", - postId: post.postId, - postTitle: post.title) + let comment = Comment( + commentId: UUID().uuidString, + content: "content", + postId: post.postId, + postTitle: post.title + ) let savedPost = try await mutate(.create(post)) let savedComment = try await mutate(.create(comment)) - + try await mutate(.delete(savedPost)) try await assertModelDoesNotExist(savedPost) try await assertModelExists(savedComment) @@ -190,7 +210,7 @@ extension GraphQLLazyLoadPostComment8Tests: DefaultLogger { } extension GraphQLLazyLoadPostComment8Tests { typealias Post = Post8 typealias Comment = Comment8 - + struct PostComment8Models: AmplifyModelRegistration { public let version: String = "version" func registerModels(registry: ModelRegistry.Type) { diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL11/Post8+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL11/Post8+Schema.swift index cfe0976e51..e4fb344e00 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL11/Post8+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL11/Post8+Schema.swift @@ -1,30 +1,37 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Post8 { +public extension Post8 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case postId case title case comments case createdAt case updatedAt } - - public static let keys = CodingKeys.self + + static let keys = CodingKeys.self // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let schema = defineSchema { model in let post8 = Post8.keys - + model.pluralName = "Post8s" - + model.attributes( .index(fields: ["postId", "title"], name: nil), .primaryKey(fields: [post8.postId, post8.title]) ) - + model.fields( .field(post8.postId, is: .required, ofType: .string), .field(post8.title, is: .required, ofType: .string), @@ -33,9 +40,9 @@ extension Post8 { .field(post8.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Post8: ModelIdentifiable { @@ -43,26 +50,28 @@ extension Post8: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension Post8.IdentifierProtocol { - public static func identifier(postId: String, - title: String) -> Self { - .make(fields:[(name: "postId", value: postId), (name: "title", value: title)]) +public extension Post8.IdentifierProtocol { + static func identifier( + postId: String, + title: String + ) -> Self { + .make(fields: [(name: "postId", value: postId), (name: "title", value: title)]) } } -extension ModelPath where ModelType == Post8 { - public var postId: FieldPath { +public extension ModelPath where ModelType == Post8 { + var postId: FieldPath { string("postId") } - public var title: FieldPath { + var title: FieldPath { string("title") } - public var comments: ModelPath { + var comments: ModelPath { Comment8.Path(name: "comments", isCollection: true, parent: self) } - public var createdAt: FieldPath { + var createdAt: FieldPath { datetime("createdAt") } - public var updatedAt: FieldPath { + var updatedAt: FieldPath { datetime("updatedAt") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL11/Post8.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL11/Post8.swift index 440cd2b9d7..eb60ae8287 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL11/Post8.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL11/Post8.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct Post8: Model { public var comments: List? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(postId: String, - title: String, - comments: List? = []) { - self.init(postId: postId, + + public init( + postId: String, + title: String, + comments: List? = [] + ) { + self.init( + postId: postId, title: title, comments: comments, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(postId: String, - title: String, - comments: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + postId: String, + title: String, + comments: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.postId = postId self.title = title self.comments = comments self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/ChildSansBelongsTo+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/ChildSansBelongsTo+Schema.swift index 1f4e006ad2..e7abeb3b2a 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/ChildSansBelongsTo+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/ChildSansBelongsTo+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension ChildSansBelongsTo { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension ChildSansBelongsTo { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case childId case content case compositePKParentChildrenSansBelongsToCustomId @@ -12,21 +19,21 @@ extension ChildSansBelongsTo { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let childSansBelongsTo = ChildSansBelongsTo.keys - + model.pluralName = "ChildSansBelongsTos" - + model.attributes( .index(fields: ["childId", "content"], name: nil), .index(fields: ["compositePKParentChildrenSansBelongsToCustomId", "compositePKParentChildrenSansBelongsToContent"], name: "byParent"), .primaryKey(fields: [childSansBelongsTo.childId, childSansBelongsTo.content]) ) - + model.fields( .field(childSansBelongsTo.childId, is: .required, ofType: .string), .field(childSansBelongsTo.content, is: .required, ofType: .string), @@ -36,9 +43,9 @@ extension ChildSansBelongsTo { .field(childSansBelongsTo.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension ChildSansBelongsTo: ModelIdentifiable { @@ -46,29 +53,31 @@ extension ChildSansBelongsTo: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension ChildSansBelongsTo.IdentifierProtocol { - public static func identifier(childId: String, - content: String) -> Self { - .make(fields:[(name: "childId", value: childId), (name: "content", value: content)]) +public extension ChildSansBelongsTo.IdentifierProtocol { + static func identifier( + childId: String, + content: String + ) -> Self { + .make(fields: [(name: "childId", value: childId), (name: "content", value: content)]) } } -extension ModelPath where ModelType == ChildSansBelongsTo { - public var childId: FieldPath { - string("childId") +public extension ModelPath where ModelType == ChildSansBelongsTo { + var childId: FieldPath { + string("childId") } - public var content: FieldPath { - string("content") + var content: FieldPath { + string("content") } - public var compositePKParentChildrenSansBelongsToCustomId: FieldPath { - string("compositePKParentChildrenSansBelongsToCustomId") + var compositePKParentChildrenSansBelongsToCustomId: FieldPath { + string("compositePKParentChildrenSansBelongsToCustomId") } - public var compositePKParentChildrenSansBelongsToContent: FieldPath { - string("compositePKParentChildrenSansBelongsToContent") + var compositePKParentChildrenSansBelongsToContent: FieldPath { + string("compositePKParentChildrenSansBelongsToContent") } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/ChildSansBelongsTo.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/ChildSansBelongsTo.swift index b419195e95..b52ce8c5a9 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/ChildSansBelongsTo.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/ChildSansBelongsTo.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -9,24 +16,30 @@ public struct ChildSansBelongsTo: Model { public var compositePKParentChildrenSansBelongsToContent: String? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(childId: String, - content: String, - compositePKParentChildrenSansBelongsToCustomId: String, - compositePKParentChildrenSansBelongsToContent: String? = nil) { - self.init(childId: childId, + + public init( + childId: String, + content: String, + compositePKParentChildrenSansBelongsToCustomId: String, + compositePKParentChildrenSansBelongsToContent: String? = nil + ) { + self.init( + childId: childId, content: content, compositePKParentChildrenSansBelongsToCustomId: compositePKParentChildrenSansBelongsToCustomId, compositePKParentChildrenSansBelongsToContent: compositePKParentChildrenSansBelongsToContent, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(childId: String, - content: String, - compositePKParentChildrenSansBelongsToCustomId: String, - compositePKParentChildrenSansBelongsToContent: String? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + childId: String, + content: String, + compositePKParentChildrenSansBelongsToCustomId: String, + compositePKParentChildrenSansBelongsToContent: String? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.childId = childId self.content = content self.compositePKParentChildrenSansBelongsToCustomId = compositePKParentChildrenSansBelongsToCustomId diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/CompositePKChild+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/CompositePKChild+Schema.swift index ff29705bcc..fb7c116016 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/CompositePKChild+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/CompositePKChild+Schema.swift @@ -1,31 +1,38 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension CompositePKChild { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension CompositePKChild { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case childId case content case parent case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let compositePKChild = CompositePKChild.keys - + model.pluralName = "CompositePKChildren" - + model.attributes( .index(fields: ["childId", "content"], name: nil), .index(fields: ["parentId", "parentTitle"], name: "byParent"), .primaryKey(fields: [compositePKChild.childId, compositePKChild.content]) ) - + model.fields( .field(compositePKChild.childId, is: .required, ofType: .string), .field(compositePKChild.content, is: .required, ofType: .string), @@ -34,9 +41,9 @@ extension CompositePKChild { .field(compositePKChild.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension CompositePKChild: ModelIdentifiable { @@ -44,26 +51,28 @@ extension CompositePKChild: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension CompositePKChild.IdentifierProtocol { - public static func identifier(childId: String, - content: String) -> Self { - .make(fields:[(name: "childId", value: childId), (name: "content", value: content)]) +public extension CompositePKChild.IdentifierProtocol { + static func identifier( + childId: String, + content: String + ) -> Self { + .make(fields: [(name: "childId", value: childId), (name: "content", value: content)]) } } -extension ModelPath where ModelType == CompositePKChild { - public var childId: FieldPath { - string("childId") +public extension ModelPath where ModelType == CompositePKChild { + var childId: FieldPath { + string("childId") } - public var content: FieldPath { - string("content") + var content: FieldPath { + string("content") } - public var parent: ModelPath { - CompositePKParent.Path(name: "parent", parent: self) + var parent: ModelPath { + CompositePKParent.Path(name: "parent", parent: self) } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/CompositePKChild.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/CompositePKChild.swift index 9bb28b4dee..7e0222bdc0 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/CompositePKChild.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/CompositePKChild.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,7 +12,7 @@ import Foundation public struct CompositePKChild: Model { public let childId: String public let content: String - internal var _parent: LazyReference + var _parent: LazyReference public var parent: CompositePKParent? { get async throws { try await _parent.get() @@ -13,21 +20,27 @@ public struct CompositePKChild: Model { } public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(childId: String, - content: String, - parent: CompositePKParent? = nil) { - self.init(childId: childId, + + public init( + childId: String, + content: String, + parent: CompositePKParent? = nil + ) { + self.init( + childId: childId, content: content, parent: parent, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(childId: String, - content: String, - parent: CompositePKParent? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + childId: String, + content: String, + parent: CompositePKParent? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.childId = childId self.content = content self._parent = LazyReference(parent) @@ -35,15 +48,15 @@ public struct CompositePKChild: Model { self.updatedAt = updatedAt } public mutating func setParent(_ parent: CompositePKParent? = nil) { - self._parent = LazyReference(parent) + _parent = LazyReference(parent) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - childId = try values.decode(String.self, forKey: .childId) - content = try values.decode(String.self, forKey: .content) - _parent = try values.decodeIfPresent(LazyReference.self, forKey: .parent) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.childId = try values.decode(String.self, forKey: .childId) + self.content = try values.decode(String.self, forKey: .content) + self._parent = try values.decodeIfPresent(LazyReference.self, forKey: .parent) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/CompositePKParent+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/CompositePKParent+Schema.swift index e047f0dc3e..0b8341d9c1 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/CompositePKParent+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/CompositePKParent+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension CompositePKParent { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension CompositePKParent { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case customId case content case children @@ -14,20 +21,20 @@ extension CompositePKParent { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let compositePKParent = CompositePKParent.keys - + model.pluralName = "CompositePKParents" - + model.attributes( .index(fields: ["customId", "content"], name: nil), .primaryKey(fields: [compositePKParent.customId, compositePKParent.content]) ) - + model.fields( .field(compositePKParent.customId, is: .required, ofType: .string), .field(compositePKParent.content, is: .required, ofType: .string), @@ -39,9 +46,9 @@ extension CompositePKParent { .field(compositePKParent.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension CompositePKParent: ModelIdentifiable { @@ -49,35 +56,37 @@ extension CompositePKParent: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension CompositePKParent.IdentifierProtocol { - public static func identifier(customId: String, - content: String) -> Self { - .make(fields:[(name: "customId", value: customId), (name: "content", value: content)]) +public extension CompositePKParent.IdentifierProtocol { + static func identifier( + customId: String, + content: String + ) -> Self { + .make(fields: [(name: "customId", value: customId), (name: "content", value: content)]) } } -extension ModelPath where ModelType == CompositePKParent { - public var customId: FieldPath { - string("customId") +public extension ModelPath where ModelType == CompositePKParent { + var customId: FieldPath { + string("customId") } - public var content: FieldPath { - string("content") + var content: FieldPath { + string("content") } - public var children: ModelPath { - CompositePKChild.Path(name: "children", isCollection: true, parent: self) + var children: ModelPath { + CompositePKChild.Path(name: "children", isCollection: true, parent: self) } - public var implicitChildren: ModelPath { - ImplicitChild.Path(name: "implicitChildren", isCollection: true, parent: self) + var implicitChildren: ModelPath { + ImplicitChild.Path(name: "implicitChildren", isCollection: true, parent: self) } - public var strangeChildren: ModelPath { - StrangeExplicitChild.Path(name: "strangeChildren", isCollection: true, parent: self) + var strangeChildren: ModelPath { + StrangeExplicitChild.Path(name: "strangeChildren", isCollection: true, parent: self) } - public var childrenSansBelongsTo: ModelPath { - ChildSansBelongsTo.Path(name: "childrenSansBelongsTo", isCollection: true, parent: self) + var childrenSansBelongsTo: ModelPath { + ChildSansBelongsTo.Path(name: "childrenSansBelongsTo", isCollection: true, parent: self) } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/CompositePKParent.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/CompositePKParent.swift index d2bef97b61..12a4f511fc 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/CompositePKParent.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/CompositePKParent.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -11,30 +18,36 @@ public struct CompositePKParent: Model { public var childrenSansBelongsTo: List? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(customId: String, - content: String, - children: List? = [], - implicitChildren: List? = [], - strangeChildren: List? = [], - childrenSansBelongsTo: List? = []) { - self.init(customId: customId, + + public init( + customId: String, + content: String, + children: List? = [], + implicitChildren: List? = [], + strangeChildren: List? = [], + childrenSansBelongsTo: List? = [] + ) { + self.init( + customId: customId, content: content, children: children, implicitChildren: implicitChildren, strangeChildren: strangeChildren, childrenSansBelongsTo: childrenSansBelongsTo, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(customId: String, - content: String, - children: List? = [], - implicitChildren: List? = [], - strangeChildren: List? = [], - childrenSansBelongsTo: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + customId: String, + content: String, + children: List? = [], + implicitChildren: List? = [], + strangeChildren: List? = [], + childrenSansBelongsTo: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.customId = customId self.content = content self.children = children diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/GraphQLLazyLoadCompositePKChildSansTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/GraphQLLazyLoadCompositePKChildSansTests.swift index a98c432fa5..e49d3b3c57 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/GraphQLLazyLoadCompositePKChildSansTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/GraphQLLazyLoadCompositePKChildSansTests.swift @@ -5,34 +5,35 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Combine +import Foundation import XCTest -@testable import Amplify import AWSPluginsCore +@testable import Amplify extension GraphQLLazyLoadCompositePKTests { - + // MARK: - CompositePKParent / ChildSansBelongsTo - + func initChildSansBelongsTo(with parent: CompositePKParent) -> ChildSansBelongsTo { ChildSansBelongsTo( childId: UUID().uuidString, content: "content", compositePKParentChildrenSansBelongsToCustomId: parent.customId, - compositePKParentChildrenSansBelongsToContent: parent.content) + compositePKParentChildrenSansBelongsToContent: parent.content + ) } - + func testSaveChildSansBelongsTo() async throws { await setup(withModels: CompositePKModels()) - + let parent = initParent() let savedParent = try await mutate(.create(parent)) let child = initChildSansBelongsTo(with: savedParent) try await mutate(.create(child)) } - + func testUpdateChildSansBelongsTo() async throws { await setup(withModels: CompositePKModels()) let parent = initParent() @@ -41,7 +42,7 @@ extension GraphQLLazyLoadCompositePKTests { var savedChild = try await mutate(.create(child)) XCTAssertEqual(savedChild.compositePKParentChildrenSansBelongsToCustomId, savedParent.customId) XCTAssertEqual(savedChild.compositePKParentChildrenSansBelongsToContent, savedParent.content) - + // update the child to a new parent let newParent = initParent() let savedNewParent = try await mutate(.create(newParent)) @@ -51,56 +52,70 @@ extension GraphQLLazyLoadCompositePKTests { XCTAssertEqual(updatedChild.compositePKParentChildrenSansBelongsToCustomId, savedNewParent.customId) XCTAssertEqual(updatedChild.compositePKParentChildrenSansBelongsToContent, savedNewParent.content) } - + func testDeleteChildSansBelongsTo() async throws { await setup(withModels: CompositePKModels()) let parent = initParent() let savedParent = try await mutate(.create(parent)) let child = initChildSansBelongsTo(with: parent) let savedChild = try await mutate(.create(child)) - + try await mutate(.delete(savedChild)) try await assertModelDoesNotExist(savedChild) - + try await mutate(.delete(savedParent)) try await assertModelDoesNotExist(savedParent) } - + func testGetChildSansBelongsTo() async throws { await setup(withModels: CompositePKModels()) let parent = initParent() let savedParent = try await mutate(.create(parent)) let child = initChildSansBelongsTo(with: parent) let savedChild = try await mutate(.create(child)) - + // query parent and load the children - let queriedParent = try await query(.get(CompositePKParent.self, - byIdentifier: .identifier(customId: savedParent.customId, - content: savedParent.content)))! - - assertList(queriedParent.childrenSansBelongsTo!, state: .isNotLoaded(associatedIdentifiers: [queriedParent.customId, - queriedParent.content], - associatedFields: ["compositePKParentChildrenSansBelongsToCustomId", "compositePKParentChildrenSansBelongsToContent"])) + let queriedParent = try await query(.get( + CompositePKParent.self, + byIdentifier: .identifier( + customId: savedParent.customId, + content: savedParent.content + ) + ))! + + assertList(queriedParent.childrenSansBelongsTo!, state: .isNotLoaded( + associatedIdentifiers: [ + queriedParent.customId, + queriedParent.content + ], + associatedFields: ["compositePKParentChildrenSansBelongsToCustomId", "compositePKParentChildrenSansBelongsToContent"] + )) try await queriedParent.childrenSansBelongsTo?.fetch() assertList(queriedParent.childrenSansBelongsTo!, state: .isLoaded(count: 1)) - + // query children and verify the parent - ChildSansBelongsTo - let queriedChildSansBelongsTo = try await query(.get(ChildSansBelongsTo.self, - byIdentifier: .identifier(childId: savedChild.childId, - content: savedChild.content)))! + let queriedChildSansBelongsTo = try await query(.get( + ChildSansBelongsTo.self, + byIdentifier: .identifier( + childId: savedChild.childId, + content: savedChild.content + ) + ))! XCTAssertEqual(queriedChildSansBelongsTo.compositePKParentChildrenSansBelongsToCustomId, savedParent.customId) XCTAssertEqual(queriedChildSansBelongsTo.compositePKParentChildrenSansBelongsToContent, savedParent.content) } - + func testListChildSansBelongsTo() async throws { await setup(withModels: CompositePKModels()) let parent = initParent() let savedParent = try await mutate(.create(parent)) let child = initChildSansBelongsTo(with: savedParent) try await mutate(.create(child)) - - var queriedChild = try await listQuery(.list(ChildSansBelongsTo.self, - where: ChildSansBelongsTo.keys.childId == child.childId && ChildSansBelongsTo.keys.content == child.content)) + + var queriedChild = try await listQuery(.list( + ChildSansBelongsTo.self, + where: ChildSansBelongsTo.keys.childId == child.childId && ChildSansBelongsTo.keys.content == child.content + )) while queriedChild.hasNextPage() { queriedChild = try await queriedChild.getNextPage() } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/GraphQLLazyLoadCompositePKChildTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/GraphQLLazyLoadCompositePKChildTests.swift index d9bc6411d1..05f3b38903 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/GraphQLLazyLoadCompositePKChildTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/GraphQLLazyLoadCompositePKChildTests.swift @@ -5,30 +5,30 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Combine +import Foundation import XCTest -@testable import Amplify import AWSPluginsCore +@testable import Amplify extension GraphQLLazyLoadCompositePKTests { // MARK: - CompositePKParent / CompositePKChild - + func initChild(with parent: CompositePKParent? = nil) -> CompositePKChild { CompositePKChild(childId: UUID().uuidString, content: "content", parent: parent) } - + func testSaveCompositePKChild() async throws { await setup(withModels: CompositePKModels()) - + let parent = initParent() let savedParent = try await mutate(.create(parent)) let child = initChild(with: savedParent) try await mutate(.create(child)) } - + func testUpdateCompositePKChild() async throws { await setup(withModels: CompositePKModels()) let parent = initParent() @@ -37,7 +37,7 @@ extension GraphQLLazyLoadCompositePKTests { var savedChild = try await mutate(.create(child)) let loadedParent = try await savedChild.parent XCTAssertEqual(loadedParent?.identifier, savedParent.identifier) - + // update the child to a new parent let newParent = initParent() let savedNewParent = try await mutate(.create(newParent)) @@ -46,37 +46,37 @@ extension GraphQLLazyLoadCompositePKTests { let loadedNewParent = try await updatedChild.parent XCTAssertEqual(loadedNewParent?.identifier, savedNewParent.identifier) } - + func testUpdateFromNoParentCompositePKChild() async throws { await setup(withModels: CompositePKModels()) let parent = initParent() let savedParent = try await mutate(.create(parent)) - + let childWithoutParent = initChild() var savedChild = try await mutate(.create(childWithoutParent)) let nilParent = try await savedChild.parent XCTAssertNil(nilParent) - + // update the child to a parent savedChild.setParent(savedParent) let savedChildWithParent = try await mutate(.update(savedChild)) let loadedParent = try await savedChildWithParent.parent XCTAssertEqual(loadedParent?.identifier, savedParent.identifier) } - + func testDeleteCompositePKChild() async throws { await setup(withModels: CompositePKModels()) let parent = initParent() let savedParent = try await mutate(.create(parent)) let child = initChild(with: parent) let savedChild = try await mutate(.create(child)) - + try await mutate(.delete(savedParent)) try await assertModelDoesNotExist(savedParent) try await mutate(.delete(savedChild)) try await assertModelDoesNotExist(savedChild) } - + func testGetCompositePKChild() async throws { await setup(withModels: CompositePKModels()) @@ -86,25 +86,43 @@ extension GraphQLLazyLoadCompositePKTests { let savedCompositePKChild = try await mutate(.create(child)) // query parent and load the children - let queriedParent = try await query(.get(CompositePKParent.self, - byIdentifier: .identifier(customId: savedParent.customId, - content: savedParent.content)))! - assertList(queriedParent.children!, state: .isNotLoaded(associatedIdentifiers: [queriedParent.customId, - queriedParent.content], - associatedFields: ["parent"])) + let queriedParent = try await query(.get( + CompositePKParent.self, + byIdentifier: .identifier( + customId: savedParent.customId, + content: savedParent.content + ) + ))! + assertList(queriedParent.children!, state: .isNotLoaded( + associatedIdentifiers: [ + queriedParent.customId, + queriedParent.content + ], + associatedFields: ["parent"] + )) try await queriedParent.children?.fetch() assertList(queriedParent.children!, state: .isLoaded(count: 1)) // query child and load the parent - CompositePKChild - let queriedCompositePKChild = try await query(.get(CompositePKChild.self, - byIdentifier: .identifier(childId: savedCompositePKChild.childId, - content: savedCompositePKChild.content)))! - assertLazyReference(queriedCompositePKChild._parent, - state: .notLoaded(identifiers: [.init(name: "customId", value: savedParent.customId), - .init(name: "content", value: savedParent.content)])) + let queriedCompositePKChild = try await query(.get( + CompositePKChild.self, + byIdentifier: .identifier( + childId: savedCompositePKChild.childId, + content: savedCompositePKChild.content + ) + ))! + assertLazyReference( + queriedCompositePKChild._parent, + state: .notLoaded(identifiers: [ + .init(name: "customId", value: savedParent.customId), + .init(name: "content", value: savedParent.content) + ]) + ) let loadedParent = try await queriedCompositePKChild.parent - assertLazyReference(queriedCompositePKChild._parent, - state: .loaded(model: loadedParent)) + assertLazyReference( + queriedCompositePKChild._parent, + state: .loaded(model: loadedParent) + ) } func testListCompositePKChild() async throws { @@ -114,8 +132,10 @@ extension GraphQLLazyLoadCompositePKTests { let child = initChild(with: savedParent) try await mutate(.create(child)) - var queriedChild = try await listQuery(.list(CompositePKChild.self, - where: CompositePKChild.keys.childId == child.childId)) + var queriedChild = try await listQuery(.list( + CompositePKChild.self, + where: CompositePKChild.keys.childId == child.childId + )) while queriedChild.hasNextPage() { queriedChild = try await queriedChild.getNextPage() } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/GraphQLLazyLoadCompositePKImplicitTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/GraphQLLazyLoadCompositePKImplicitTests.swift index 694b7904f7..960e67c2c5 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/GraphQLLazyLoadCompositePKImplicitTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/GraphQLLazyLoadCompositePKImplicitTests.swift @@ -5,30 +5,30 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Combine +import Foundation import XCTest -@testable import Amplify import AWSPluginsCore +@testable import Amplify extension GraphQLLazyLoadCompositePKTests { - + // MARK: - CompositePKParent / ImplicitChild - + func initImplicitChild(with parent: CompositePKParent) -> ImplicitChild { ImplicitChild(childId: UUID().uuidString, content: "content", parent: parent) } - + func testSaveImplicitChild() async throws { await setup(withModels: CompositePKModels()) - + let parent = initParent() let savedParent = try await mutate(.create(parent)) let child = initImplicitChild(with: savedParent) try await mutate(.create(child)) } - + func testUpdateImplicitChild() async throws { await setup(withModels: CompositePKModels()) let parent = initParent() @@ -37,7 +37,7 @@ extension GraphQLLazyLoadCompositePKTests { var savedChild = try await mutate(.create(child)) let loadedParent = try await savedChild.parent XCTAssertEqual(loadedParent.identifier, savedParent.identifier) - + // update the child to a new parent let newParent = initParent() let savedNewParent = try await mutate(.create(newParent)) @@ -45,63 +45,83 @@ extension GraphQLLazyLoadCompositePKTests { let updatedChild = try await mutate(.update(savedChild)) let loadedNewParent = try await updatedChild.parent XCTAssertEqual(loadedNewParent.identifier, savedNewParent.identifier) - + } - + func testDeleteImplicitChild() async throws { await setup(withModels: CompositePKModels()) let parent = initParent() let savedParent = try await mutate(.create(parent)) let child = initImplicitChild(with: parent) let savedChild = try await mutate(.create(child)) - + try await mutate(.delete(savedChild)) try await assertModelDoesNotExist(savedChild) try await mutate(.delete(savedParent)) try await assertModelDoesNotExist(savedParent) } - + func testGetImplicitChild() async throws { await setup(withModels: CompositePKModels()) let parent = initParent() let savedParent = try await mutate(.create(parent)) let child = initImplicitChild(with: parent) let savedChild = try await mutate(.create(child)) - + // query parent and load the children - let queriedParent = try await query(.get(CompositePKParent.self, - byIdentifier: .identifier(customId: savedParent.customId, - content: savedParent.content)))! - - assertList(queriedParent.implicitChildren!, state: .isNotLoaded(associatedIdentifiers: [queriedParent.customId, - queriedParent.content], - associatedFields: ["parent"])) + let queriedParent = try await query(.get( + CompositePKParent.self, + byIdentifier: .identifier( + customId: savedParent.customId, + content: savedParent.content + ) + ))! + + assertList(queriedParent.implicitChildren!, state: .isNotLoaded( + associatedIdentifiers: [ + queriedParent.customId, + queriedParent.content + ], + associatedFields: ["parent"] + )) try await queriedParent.implicitChildren?.fetch() assertList(queriedParent.implicitChildren!, state: .isLoaded(count: 1)) - + // query child and load the parent - ImplicitChild - let queriedImplicitChild = try await query(.get(ImplicitChild.self, - byIdentifier: .identifier(childId: savedChild.childId, - content: savedChild.content)))! - assertLazyReference(queriedImplicitChild._parent, - state: .notLoaded(identifiers: [.init(name: "customId", value: savedParent.customId), - .init(name: "content", value: savedParent.content)])) + let queriedImplicitChild = try await query(.get( + ImplicitChild.self, + byIdentifier: .identifier( + childId: savedChild.childId, + content: savedChild.content + ) + ))! + assertLazyReference( + queriedImplicitChild._parent, + state: .notLoaded(identifiers: [ + .init(name: "customId", value: savedParent.customId), + .init(name: "content", value: savedParent.content) + ]) + ) let loadedParent = try await queriedImplicitChild.parent - assertLazyReference(queriedImplicitChild._parent, - state: .loaded(model: loadedParent)) + assertLazyReference( + queriedImplicitChild._parent, + state: .loaded(model: loadedParent) + ) } - + func testListImplicitChild() async throws { await setup(withModels: CompositePKModels()) let parent = initParent() let savedParent = try await mutate(.create(parent)) let child = initImplicitChild(with: savedParent) try await mutate(.create(child)) - + var queriedChild = try await listQuery( - .list(ImplicitChild.self, - where: ImplicitChild.keys.childId == child.childId && ImplicitChild.keys.content == child.content)) + .list( + ImplicitChild.self, + where: ImplicitChild.keys.childId == child.childId && ImplicitChild.keys.content == child.content + )) while queriedChild.hasNextPage() { queriedChild = try await queriedChild.getNextPage() } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/GraphQLLazyLoadCompositePKStrangeExplicitTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/GraphQLLazyLoadCompositePKStrangeExplicitTests.swift index 1b74ee70c6..435e2b49b6 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/GraphQLLazyLoadCompositePKStrangeExplicitTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/GraphQLLazyLoadCompositePKStrangeExplicitTests.swift @@ -5,30 +5,30 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Combine +import Foundation import XCTest -@testable import Amplify import AWSPluginsCore +@testable import Amplify extension GraphQLLazyLoadCompositePKTests { - + // MARK: - CompositePKParent / StrangeExplicitChild - + func initStrangeExplicitChild(with parent: CompositePKParent) -> StrangeExplicitChild { StrangeExplicitChild(strangeId: UUID().uuidString, content: "content", parent: parent) } - + func testSaveStrangeExplicitChild() async throws { await setup(withModels: CompositePKModels()) - + let parent = initParent() let savedParent = try await mutate(.create(parent)) let child = initStrangeExplicitChild(with: savedParent) try await mutate(.create(child)) } - + func testUpdateStrangeExplicitChild() async throws { await setup(withModels: CompositePKModels()) let parent = initParent() @@ -37,7 +37,7 @@ extension GraphQLLazyLoadCompositePKTests { var savedChild = try await mutate(.create(child)) let loadedParent = try await savedChild.parent XCTAssertEqual(loadedParent.identifier, savedParent.identifier) - + // update the child to a new parent let newParent = initParent() let savedNewParent = try await mutate(.create(newParent)) @@ -45,62 +45,82 @@ extension GraphQLLazyLoadCompositePKTests { let updatedChild = try await mutate(.update(savedChild)) let loadedNewParent = try await updatedChild.parent XCTAssertEqual(loadedNewParent.identifier, savedNewParent.identifier) - + } - + func testDeleteStrangeExplicitChild() async throws { await setup(withModels: CompositePKModels()) let parent = initParent() let savedParent = try await mutate(.create(parent)) let child = initStrangeExplicitChild(with: parent) let savedChild = try await mutate(.create(child)) - + try await mutate(.delete(savedChild)) try await assertModelDoesNotExist(savedChild) try await mutate(.delete(savedParent)) try await assertModelDoesNotExist(savedParent) } - + func testGetStrangeExplicitChild() async throws { await setup(withModels: CompositePKModels()) let parent = initParent() let savedParent = try await mutate(.create(parent)) let child = initStrangeExplicitChild(with: parent) let savedChild = try await mutate(.create(child)) - + // query parent and load the children - let queriedParent = try await query(.get(CompositePKParent.self, - byIdentifier: .identifier(customId: savedParent.customId, - content: savedParent.content)))! - - assertList(queriedParent.strangeChildren!, state: .isNotLoaded(associatedIdentifiers: [queriedParent.customId, - queriedParent.content], - associatedFields: ["parent"])) + let queriedParent = try await query(.get( + CompositePKParent.self, + byIdentifier: .identifier( + customId: savedParent.customId, + content: savedParent.content + ) + ))! + + assertList(queriedParent.strangeChildren!, state: .isNotLoaded( + associatedIdentifiers: [ + queriedParent.customId, + queriedParent.content + ], + associatedFields: ["parent"] + )) try await queriedParent.strangeChildren?.fetch() assertList(queriedParent.strangeChildren!, state: .isLoaded(count: 1)) - + // query children and load the parent - StrangeExplicitChild - let queriedStrangeImplicitChild = try await query(.get(StrangeExplicitChild.self, - byIdentifier: .identifier(strangeId: savedChild.strangeId, - content: savedChild.content)))! - assertLazyReference(queriedStrangeImplicitChild._parent, - state: .notLoaded(identifiers: [.init(name: "customId", value: savedParent.customId), - .init(name: "content", value: savedParent.content)])) + let queriedStrangeImplicitChild = try await query(.get( + StrangeExplicitChild.self, + byIdentifier: .identifier( + strangeId: savedChild.strangeId, + content: savedChild.content + ) + ))! + assertLazyReference( + queriedStrangeImplicitChild._parent, + state: .notLoaded(identifiers: [ + .init(name: "customId", value: savedParent.customId), + .init(name: "content", value: savedParent.content) + ]) + ) let loadedParent3 = try await queriedStrangeImplicitChild.parent - assertLazyReference(queriedStrangeImplicitChild._parent, - state: .loaded(model: loadedParent3)) + assertLazyReference( + queriedStrangeImplicitChild._parent, + state: .loaded(model: loadedParent3) + ) } - + func testListStrangeExplicitChild() async throws { await setup(withModels: CompositePKModels()) let parent = initParent() let savedParent = try await mutate(.create(parent)) let child = initStrangeExplicitChild(with: savedParent) try await mutate(.create(child)) - + var queriedChild = try await listQuery( - .list(StrangeExplicitChild.self, - where: StrangeExplicitChild.keys.strangeId == child.strangeId && StrangeExplicitChild.keys.content == child.content)) + .list( + StrangeExplicitChild.self, + where: StrangeExplicitChild.keys.strangeId == child.strangeId && StrangeExplicitChild.keys.content == child.content + )) while queriedChild.hasNextPage() { queriedChild = try await queriedChild.getNextPage() } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/GraphQLLazyLoadCompositePKTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/GraphQLLazyLoadCompositePKTests.swift index 9f7e8bbf74..0717bab822 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/GraphQLLazyLoadCompositePKTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/GraphQLLazyLoadCompositePKTests.swift @@ -5,25 +5,25 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Combine +import Foundation import XCTest -@testable import Amplify import AWSPluginsCore +@testable import Amplify final class GraphQLLazyLoadCompositePKTests: GraphQLLazyLoadBaseTest { func testConfigure() async throws { await setup(withModels: CompositePKModels()) } - + func testIncludesAllChildren() async throws { await setup(withModels: CompositePKModels()) - + let parent = initParent() let savedParent = try await mutate(.create(parent)) - + let child = initChild(with: savedParent) try await mutate(.create(child)) let implicitChild = initImplicitChild(with: savedParent) @@ -32,13 +32,17 @@ final class GraphQLLazyLoadCompositePKTests: GraphQLLazyLoadBaseTest { try await mutate(.create(explicitChild)) let sansChild = initChildSansBelongsTo(with: savedParent) try await mutate(.create(sansChild)) - - let request = GraphQLRequest.get(CompositePKParent.self, - byIdentifier: .identifier(customId: savedParent.customId, - content: savedParent.content), - includes: { parent in + + let request = GraphQLRequest.get( + CompositePKParent.self, + byIdentifier: .identifier( + customId: savedParent.customId, + content: savedParent.content + ), + includes: { parent in [parent.children, parent.implicitChildren, parent.strangeChildren, parent.childrenSansBelongsTo] - }) + } + ) let expectedDocument = """ query GetCompositePKParent($content: String!, $customId: ID!) { getCompositePKParent(content: $content, customId: $customId) { @@ -112,7 +116,7 @@ final class GraphQLLazyLoadCompositePKTests: GraphQLLazyLoadBaseTest { extension GraphQLLazyLoadCompositePKTests: DefaultLogger { } extension GraphQLLazyLoadCompositePKTests { - + struct CompositePKModels: AmplifyModelRegistration { public let version: String = "version" func registerModels(registry: ModelRegistry.Type) { @@ -123,9 +127,11 @@ extension GraphQLLazyLoadCompositePKTests { ModelRegistry.register(modelType: ChildSansBelongsTo.self) } } - + func initParent() -> CompositePKParent { - CompositePKParent(customId: UUID().uuidString, - content: "content") + CompositePKParent( + customId: UUID().uuidString, + content: "content" + ) } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/ImplicitChild+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/ImplicitChild+Schema.swift index a515819f26..cbbbd263a8 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/ImplicitChild+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/ImplicitChild+Schema.swift @@ -1,30 +1,37 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension ImplicitChild { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension ImplicitChild { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case childId case content case parent case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let implicitChild = ImplicitChild.keys - + model.pluralName = "ImplicitChildren" - + model.attributes( .index(fields: ["childId", "content"], name: nil), .primaryKey(fields: [implicitChild.childId, implicitChild.content]) ) - + model.fields( .field(implicitChild.childId, is: .required, ofType: .string), .field(implicitChild.content, is: .required, ofType: .string), @@ -33,9 +40,9 @@ extension ImplicitChild { .field(implicitChild.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension ImplicitChild: ModelIdentifiable { @@ -43,26 +50,28 @@ extension ImplicitChild: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension ImplicitChild.IdentifierProtocol { - public static func identifier(childId: String, - content: String) -> Self { - .make(fields:[(name: "childId", value: childId), (name: "content", value: content)]) +public extension ImplicitChild.IdentifierProtocol { + static func identifier( + childId: String, + content: String + ) -> Self { + .make(fields: [(name: "childId", value: childId), (name: "content", value: content)]) } } -extension ModelPath where ModelType == ImplicitChild { - public var childId: FieldPath { - string("childId") +public extension ModelPath where ModelType == ImplicitChild { + var childId: FieldPath { + string("childId") } - public var content: FieldPath { - string("content") + var content: FieldPath { + string("content") } - public var parent: ModelPath { - CompositePKParent.Path(name: "parent", parent: self) + var parent: ModelPath { + CompositePKParent.Path(name: "parent", parent: self) } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/ImplicitChild.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/ImplicitChild.swift index 78ec7c0f2d..b8f2e21ccb 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/ImplicitChild.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/ImplicitChild.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,7 +12,7 @@ import Foundation public struct ImplicitChild: Model { public let childId: String public let content: String - internal var _parent: LazyReference + var _parent: LazyReference public var parent: CompositePKParent { get async throws { try await _parent.require() @@ -13,21 +20,27 @@ public struct ImplicitChild: Model { } public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(childId: String, - content: String, - parent: CompositePKParent) { - self.init(childId: childId, + + public init( + childId: String, + content: String, + parent: CompositePKParent + ) { + self.init( + childId: childId, content: content, parent: parent, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(childId: String, - content: String, - parent: CompositePKParent, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + childId: String, + content: String, + parent: CompositePKParent, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.childId = childId self.content = content self._parent = LazyReference(parent) @@ -35,15 +48,15 @@ public struct ImplicitChild: Model { self.updatedAt = updatedAt } public mutating func setParent(_ parent: CompositePKParent) { - self._parent = LazyReference(parent) + _parent = LazyReference(parent) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - childId = try values.decode(String.self, forKey: .childId) - content = try values.decode(String.self, forKey: .content) - _parent = try values.decodeIfPresent(LazyReference.self, forKey: .parent) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.childId = try values.decode(String.self, forKey: .childId) + self.content = try values.decode(String.self, forKey: .content) + self._parent = try values.decodeIfPresent(LazyReference.self, forKey: .parent) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/StrangeExplicitChild+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/StrangeExplicitChild+Schema.swift index d4d8af24ee..172e7a9b4c 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/StrangeExplicitChild+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/StrangeExplicitChild+Schema.swift @@ -1,31 +1,38 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension StrangeExplicitChild { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension StrangeExplicitChild { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case strangeId case content case parent case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let strangeExplicitChild = StrangeExplicitChild.keys - + model.pluralName = "StrangeExplicitChildren" - + model.attributes( .index(fields: ["strangeId", "content"], name: nil), .index(fields: ["strangeParentId", "strangeParentTitle"], name: "byCompositePKParentX"), .primaryKey(fields: [strangeExplicitChild.strangeId, strangeExplicitChild.content]) ) - + model.fields( .field(strangeExplicitChild.strangeId, is: .required, ofType: .string), .field(strangeExplicitChild.content, is: .required, ofType: .string), @@ -34,9 +41,9 @@ extension StrangeExplicitChild { .field(strangeExplicitChild.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension StrangeExplicitChild: ModelIdentifiable { @@ -44,26 +51,28 @@ extension StrangeExplicitChild: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension StrangeExplicitChild.IdentifierProtocol { - public static func identifier(strangeId: String, - content: String) -> Self { - .make(fields:[(name: "strangeId", value: strangeId), (name: "content", value: content)]) +public extension StrangeExplicitChild.IdentifierProtocol { + static func identifier( + strangeId: String, + content: String + ) -> Self { + .make(fields: [(name: "strangeId", value: strangeId), (name: "content", value: content)]) } } -extension ModelPath where ModelType == StrangeExplicitChild { - public var strangeId: FieldPath { - string("strangeId") +public extension ModelPath where ModelType == StrangeExplicitChild { + var strangeId: FieldPath { + string("strangeId") } - public var content: FieldPath { - string("content") + var content: FieldPath { + string("content") } - public var parent: ModelPath { - CompositePKParent.Path(name: "parent", parent: self) + var parent: ModelPath { + CompositePKParent.Path(name: "parent", parent: self) } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/StrangeExplicitChild.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/StrangeExplicitChild.swift index 45fb1b967d..e2519d542e 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/StrangeExplicitChild.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/CompositePK/StrangeExplicitChild.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,7 +12,7 @@ import Foundation public struct StrangeExplicitChild: Model { public let strangeId: String public let content: String - internal var _parent: LazyReference + var _parent: LazyReference public var parent: CompositePKParent { get async throws { try await _parent.require() @@ -13,21 +20,27 @@ public struct StrangeExplicitChild: Model { } public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(strangeId: String, - content: String, - parent: CompositePKParent) { - self.init(strangeId: strangeId, + + public init( + strangeId: String, + content: String, + parent: CompositePKParent + ) { + self.init( + strangeId: strangeId, content: content, parent: parent, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(strangeId: String, - content: String, - parent: CompositePKParent, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + strangeId: String, + content: String, + parent: CompositePKParent, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.strangeId = strangeId self.content = content self._parent = LazyReference(parent) @@ -35,15 +48,15 @@ public struct StrangeExplicitChild: Model { self.updatedAt = updatedAt } public mutating func setParent(_ parent: CompositePKParent) { - self._parent = LazyReference(parent) + _parent = LazyReference(parent) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - strangeId = try values.decode(String.self, forKey: .strangeId) - content = try values.decode(String.self, forKey: .content) - _parent = try values.decodeIfPresent(LazyReference.self, forKey: .parent) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.strangeId = try values.decode(String.self, forKey: .strangeId) + self.content = try values.decode(String.self, forKey: .content) + self._parent = try values.decodeIfPresent(LazyReference.self, forKey: .parent) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/DefaultPK/DefaultPKChild+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/DefaultPK/DefaultPKChild+Schema.swift index 9fe9d05f4c..44da59840b 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/DefaultPK/DefaultPKChild+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/DefaultPK/DefaultPKChild+Schema.swift @@ -1,30 +1,37 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension DefaultPKChild { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension DefaultPKChild { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case content case parent case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let defaultPKChild = DefaultPKChild.keys - + model.pluralName = "DefaultPKChildren" - + model.attributes( .index(fields: ["id"], name: nil), .primaryKey(fields: [defaultPKChild.id]) ) - + model.fields( .field(defaultPKChild.id, is: .required, ofType: .string), .field(defaultPKChild.content, is: .optional, ofType: .string), @@ -33,29 +40,29 @@ extension DefaultPKChild { .field(defaultPKChild.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension DefaultPKChild: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == DefaultPKChild { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == DefaultPKChild { + var id: FieldPath { + string("id") } - public var content: FieldPath { - string("content") + var content: FieldPath { + string("content") } - public var parent: ModelPath { - DefaultPKParent.Path(name: "parent", parent: self) + var parent: ModelPath { + DefaultPKParent.Path(name: "parent", parent: self) } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/DefaultPK/DefaultPKChild.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/DefaultPK/DefaultPKChild.swift index dabbd4888e..e1ef75fd6d 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/DefaultPK/DefaultPKChild.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/DefaultPK/DefaultPKChild.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,7 +12,7 @@ import Foundation public struct DefaultPKChild: Model { public let id: String public var content: String? - internal var _parent: LazyReference + var _parent: LazyReference public var parent: DefaultPKParent? { get async throws { try await _parent.get() @@ -13,21 +20,27 @@ public struct DefaultPKChild: Model { } public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - content: String? = nil, - parent: DefaultPKParent? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + content: String? = nil, + parent: DefaultPKParent? = nil + ) { + self.init( + id: id, content: content, parent: parent, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - content: String? = nil, - parent: DefaultPKParent? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + content: String? = nil, + parent: DefaultPKParent? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self._parent = LazyReference(parent) @@ -35,15 +48,15 @@ public struct DefaultPKChild: Model { self.updatedAt = updatedAt } public mutating func setParent(_ parent: DefaultPKParent? = nil) { - self._parent = LazyReference(parent) + _parent = LazyReference(parent) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decode(String.self, forKey: .id) - content = try? values.decode(String?.self, forKey: .content) - _parent = try values.decodeIfPresent(LazyReference.self, forKey: .parent) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.id = try values.decode(String.self, forKey: .id) + self.content = try? values.decode(String?.self, forKey: .content) + self._parent = try values.decodeIfPresent(LazyReference.self, forKey: .parent) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/DefaultPK/DefaultPKParent+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/DefaultPK/DefaultPKParent+Schema.swift index d493d3a95f..39c2889c26 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/DefaultPK/DefaultPKParent+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/DefaultPK/DefaultPKParent+Schema.swift @@ -1,30 +1,37 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension DefaultPKParent { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension DefaultPKParent { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case content case children case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let defaultPKParent = DefaultPKParent.keys - + model.pluralName = "DefaultPKParents" - + model.attributes( .index(fields: ["id"], name: nil), .primaryKey(fields: [defaultPKParent.id]) ) - + model.fields( .field(defaultPKParent.id, is: .required, ofType: .string), .field(defaultPKParent.content, is: .optional, ofType: .string), @@ -33,29 +40,29 @@ extension DefaultPKParent { .field(defaultPKParent.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension DefaultPKParent: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == DefaultPKParent { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == DefaultPKParent { + var id: FieldPath { + string("id") } - public var content: FieldPath { - string("content") + var content: FieldPath { + string("content") } - public var children: ModelPath { - DefaultPKChild.Path(name: "children", isCollection: true, parent: self) + var children: ModelPath { + DefaultPKChild.Path(name: "children", isCollection: true, parent: self) } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/DefaultPK/DefaultPKParent.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/DefaultPK/DefaultPKParent.swift index 830d085e35..d2bedd8d1e 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/DefaultPK/DefaultPKParent.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/DefaultPK/DefaultPKParent.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,21 +15,27 @@ public struct DefaultPKParent: Model { public var children: List? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - content: String? = nil, - children: List? = []) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + content: String? = nil, + children: List? = [] + ) { + self.init( + id: id, content: content, children: children, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - content: String? = nil, - children: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + content: String? = nil, + children: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self.children = children diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/DefaultPK/GraphQLLazyLoadDefaultPKTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/DefaultPK/GraphQLLazyLoadDefaultPKTests.swift index a530aacb2e..96de0c34b5 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/DefaultPK/GraphQLLazyLoadDefaultPKTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/DefaultPK/GraphQLLazyLoadDefaultPKTests.swift @@ -5,100 +5,118 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Combine +import Foundation import XCTest -@testable import Amplify import AWSPluginsCore +@testable import Amplify final class GraphQLLazyLoadDefaultPKTests: GraphQLLazyLoadBaseTest { func testConfigure() async throws { await setup(withModels: DefaultPKModels()) } - + func testDefaultPKParentChild() async throws { await setup(withModels: DefaultPKModels()) let defaultPKParent = DefaultPKParent() let savedParent = try await mutate(.create(defaultPKParent)) let defaultPKChild = DefaultPKChild(parent: savedParent) let savedChild = try await mutate(.create(defaultPKChild)) - - assertLazyReference(savedChild._parent, - state: .notLoaded(identifiers: [.init(name: "id", value: savedParent.id)])) + + assertLazyReference( + savedChild._parent, + state: .notLoaded(identifiers: [.init(name: "id", value: savedParent.id)]) + ) let loadedParent = try await savedChild.parent - assertLazyReference(savedChild._parent, - state: .loaded(model: loadedParent)) + assertLazyReference( + savedChild._parent, + state: .loaded(model: loadedParent) + ) } - + func testDefaultParentChildUpdate() async throws { await setup(withModels: DefaultPKModels()) let defaultPKParent = DefaultPKParent() let savedParent = try await mutate(.create(defaultPKParent)) let defaultPKChild = DefaultPKChild(parent: savedParent) var savedChild = try await mutate(.create(defaultPKChild)) - + let newParent = DefaultPKParent() let savedNewParent = try await mutate(.create(newParent)) savedChild.setParent(savedNewParent) var updatedChild = try await mutate(.update(savedChild)) - - assertLazyReference(updatedChild._parent, - state: .notLoaded(identifiers: [.init(name: "id", value: newParent.id)])) + + assertLazyReference( + updatedChild._parent, + state: .notLoaded(identifiers: [.init(name: "id", value: newParent.id)]) + ) let loadedParent = try await updatedChild.parent - assertLazyReference(updatedChild._parent, - state: .loaded(model: loadedParent)) + assertLazyReference( + updatedChild._parent, + state: .loaded(model: loadedParent) + ) } - + func testDefaultParentChildDelete() async throws { await setup(withModels: DefaultPKModels()) let defaultPKParent = DefaultPKParent() let savedParent = try await mutate(.create(defaultPKParent)) let defaultPKChild = DefaultPKChild(parent: savedParent) let savedChild = try await mutate(.create(defaultPKChild)) - + try await mutate(.delete(savedParent)) try await assertModelDoesNotExist(savedParent) try await assertModelExists(savedChild) try await mutate(.delete(savedChild)) try await assertModelDoesNotExist(savedChild) } - + func testDefaultPKParentChildGet() async throws { await setup(withModels: DefaultPKModels()) let defaultPKParent = DefaultPKParent() let savedParent = try await mutate(.create(defaultPKParent)) let defaultPKChild = DefaultPKChild(parent: savedParent) let savedChild = try await mutate(.create(defaultPKChild)) - + let queriedParent = try await query(.get(DefaultPKParent.self, byId: savedParent.id))! - assertList(queriedParent.children!, state: .isNotLoaded(associatedIdentifiers: [queriedParent.id], - associatedFields: ["parent"])) + assertList(queriedParent.children!, state: .isNotLoaded( + associatedIdentifiers: [queriedParent.id], + associatedFields: ["parent"] + )) try await queriedParent.children?.fetch() assertList(queriedParent.children!, state: .isLoaded(count: 1)) - + let queriedChild = try await query(.get(DefaultPKChild.self, byId: savedChild.id))! - assertLazyReference(queriedChild._parent, - state: .notLoaded(identifiers: [.init(name: "id", value: savedParent.id)])) + assertLazyReference( + queriedChild._parent, + state: .notLoaded(identifiers: [.init(name: "id", value: savedParent.id)]) + ) let loadedParent = try await queriedChild.parent - assertLazyReference(queriedChild._parent, - state: .loaded(model: loadedParent)) + assertLazyReference( + queriedChild._parent, + state: .loaded(model: loadedParent) + ) } - + func testDefaultPKParentChildList() async throws { await setup(withModels: DefaultPKModels()) let defaultPKParent = DefaultPKParent() let savedParent = try await mutate(.create(defaultPKParent)) let defaultPKChild = DefaultPKChild(parent: savedParent) let savedChild = try await mutate(.create(defaultPKChild)) - - let queriedParents = try await listQuery(.list(DefaultPKParent.self, - where: DefaultPKParent.keys.id == defaultPKParent.id)) + + let queriedParents = try await listQuery(.list( + DefaultPKParent.self, + where: DefaultPKParent.keys.id == defaultPKParent.id + )) assertList(queriedParents, state: .isLoaded(count: 1)) - - let queriedChildren = try await listQuery(.list(DefaultPKChild.self, - where: DefaultPKChild.keys.id == defaultPKChild.id)) + + let queriedChildren = try await listQuery(.list( + DefaultPKChild.self, + where: DefaultPKChild.keys.id == defaultPKChild.id + )) assertList(queriedChildren, state: .isLoaded(count: 1)) } @@ -269,7 +287,7 @@ final class GraphQLLazyLoadDefaultPKTests: GraphQLLazyLoadBaseTest { extension GraphQLLazyLoadDefaultPKTests: DefaultLogger { } extension GraphQLLazyLoadDefaultPKTests { - + struct DefaultPKModels: AmplifyModelRegistration { public let version: String = "version" func registerModels(registry: ModelRegistry.Type) { diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/HasOneParentChild/GraphQLLazyLoadHasOneTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/HasOneParentChild/GraphQLLazyLoadHasOneTests.swift index 25f8a575b1..80c8fb84ff 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/HasOneParentChild/GraphQLLazyLoadHasOneTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/HasOneParentChild/GraphQLLazyLoadHasOneTests.swift @@ -5,96 +5,112 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Combine +import Foundation import XCTest -@testable import Amplify import AWSPluginsCore +@testable import Amplify final class GraphQLLazyLoadHasOneTests: GraphQLLazyLoadBaseTest { func testConfigure() async throws { await setup(withModels: HasOneParentChildModels()) } - + func testHasOneParentChild() async throws { await setup(withModels: HasOneParentChildModels()) let hasOneChild = HasOneChild() let savedChild = try await mutate(.create(hasOneChild)) let hasOneParent = HasOneParent(child: hasOneChild) let savedParent = try await mutate(.create(hasOneParent)) - - assertLazyReference(savedParent._child, - state: .notLoaded(identifiers: [.init(name: "id", value: savedChild.id)])) + + assertLazyReference( + savedParent._child, + state: .notLoaded(identifiers: [.init(name: "id", value: savedChild.id)]) + ) let loadedChild = try await savedParent.child - assertLazyReference(savedParent._child, - state: .loaded(model: loadedChild)) + assertLazyReference( + savedParent._child, + state: .loaded(model: loadedChild) + ) } - + func testHasOneParentChildUpdate() async throws { await setup(withModels: HasOneParentChildModels()) let hasOneChild = HasOneChild() let savedChild = try await mutate(.create(hasOneChild)) let hasOneParent = HasOneParent(child: hasOneChild) var savedParent = try await mutate(.create(hasOneParent)) - + let newChild = HasOneChild() let savedNewChild = try await mutate(.create(newChild)) savedParent.setChild(newChild) var updatedParent = try await mutate(.update(savedParent)) - - assertLazyReference(updatedParent._child, - state: .notLoaded(identifiers: [.init(name: "id", value: newChild.id)])) + + assertLazyReference( + updatedParent._child, + state: .notLoaded(identifiers: [.init(name: "id", value: newChild.id)]) + ) let loadedChild = try await updatedParent.child - assertLazyReference(updatedParent._child, - state: .loaded(model: loadedChild)) + assertLazyReference( + updatedParent._child, + state: .loaded(model: loadedChild) + ) } - + func testHasOneParentChildDelete() async throws { await setup(withModels: HasOneParentChildModels()) let hasOneChild = HasOneChild() let savedChild = try await mutate(.create(hasOneChild)) let hasOneParent = HasOneParent(child: hasOneChild) var savedParent = try await mutate(.create(hasOneParent)) - + try await mutate(.delete(savedParent)) try await assertModelDoesNotExist(savedParent) try await assertModelExists(savedChild) try await mutate(.delete(savedChild)) try await assertModelDoesNotExist(savedChild) } - + func testHasOneParentChildGet() async throws { await setup(withModels: HasOneParentChildModels()) let hasOneChild = HasOneChild() let savedChild = try await mutate(.create(hasOneChild)) let hasOneParent = HasOneParent(child: hasOneChild) let savedParent = try await mutate(.create(hasOneParent)) - + let queriedParent = try await query(.get(HasOneParent.self, byId: savedParent.id))! - assertLazyReference(queriedParent._child, - state: .notLoaded(identifiers: [.init(name: "id", value: savedChild.id)])) + assertLazyReference( + queriedParent._child, + state: .notLoaded(identifiers: [.init(name: "id", value: savedChild.id)]) + ) let loadedChild = try await queriedParent.child - assertLazyReference(queriedParent._child, - state: .loaded(model: loadedChild)) - + assertLazyReference( + queriedParent._child, + state: .loaded(model: loadedChild) + ) + let queriedChild = try await query(.get(HasOneChild.self, byId: savedChild.id))! } - + func testHasOneParentChildList() async throws { await setup(withModels: HasOneParentChildModels()) let hasOneChild = HasOneChild() let savedChild = try await mutate(.create(hasOneChild)) let hasOneParent = HasOneParent(child: hasOneChild) let savedParent = try await mutate(.create(hasOneParent)) - - let queriedParents = try await listQuery(.list(HasOneParent.self, - where: HasOneParent.keys.id == hasOneParent.id)) + + let queriedParents = try await listQuery(.list( + HasOneParent.self, + where: HasOneParent.keys.id == hasOneParent.id + )) assertList(queriedParents, state: .isLoaded(count: 1)) - - let queriedChildren = try await listQuery(.list(HasOneChild.self, - where: HasOneChild.keys.id == hasOneChild.id)) + + let queriedChildren = try await listQuery(.list( + HasOneChild.self, + where: HasOneChild.keys.id == hasOneChild.id + )) assertList(queriedChildren, state: .isLoaded(count: 1)) } @@ -256,7 +272,7 @@ final class GraphQLLazyLoadHasOneTests: GraphQLLazyLoadBaseTest { extension GraphQLLazyLoadHasOneTests: DefaultLogger { } extension GraphQLLazyLoadHasOneTests { - + struct HasOneParentChildModels: AmplifyModelRegistration { public let version: String = "version" func registerModels(registry: ModelRegistry.Type) { diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/HasOneParentChild/HasOneChild+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/HasOneParentChild/HasOneChild+Schema.swift index 5256e3b18a..9a67ca4452 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/HasOneParentChild/HasOneChild+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/HasOneParentChild/HasOneChild+Schema.swift @@ -1,29 +1,36 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension HasOneChild { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension HasOneChild { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case content case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let hasOneChild = HasOneChild.keys - + model.pluralName = "HasOneChildren" - + model.attributes( .index(fields: ["id"], name: nil), .primaryKey(fields: [hasOneChild.id]) ) - + model.fields( .field(hasOneChild.id, is: .required, ofType: .string), .field(hasOneChild.content, is: .optional, ofType: .string), @@ -31,26 +38,26 @@ extension HasOneChild { .field(hasOneChild.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension HasOneChild: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == HasOneChild { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == HasOneChild { + var id: FieldPath { + string("id") } - public var content: FieldPath { - string("content") + var content: FieldPath { + string("content") } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/HasOneParentChild/HasOneChild.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/HasOneParentChild/HasOneChild.swift index 20714ad8e0..1e37821e08 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/HasOneParentChild/HasOneChild.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/HasOneParentChild/HasOneChild.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -7,18 +14,24 @@ public struct HasOneChild: Model { public var content: String? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - content: String? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + content: String? = nil + ) { + self.init( + id: id, content: content, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - content: String? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + content: String? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self.createdAt = createdAt diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/HasOneParentChild/HasOneParent+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/HasOneParentChild/HasOneParent+Schema.swift index c832500224..f4b24e8e1e 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/HasOneParentChild/HasOneParent+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/HasOneParentChild/HasOneParent+Schema.swift @@ -1,30 +1,37 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension HasOneParent { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension HasOneParent { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case child case createdAt case updatedAt case hasOneParentChildId } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let hasOneParent = HasOneParent.keys - + model.pluralName = "HasOneParents" - + model.attributes( .index(fields: ["id"], name: nil), .primaryKey(fields: [hasOneParent.id]) ) - + model.fields( .field(hasOneParent.id, is: .required, ofType: .string), .hasOne(hasOneParent.child, is: .optional, ofType: HasOneChild.self, associatedWith: HasOneChild.keys.id, targetNames: ["hasOneParentChildId"]), @@ -33,29 +40,29 @@ extension HasOneParent { .field(hasOneParent.hasOneParentChildId, is: .optional, ofType: .string) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension HasOneParent: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == HasOneParent { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == HasOneParent { + var id: FieldPath { + string("id") } - public var child: ModelPath { - HasOneChild.Path(name: "child", parent: self) + var child: ModelPath { + HasOneChild.Path(name: "child", parent: self) } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } - public var hasOneParentChildId: FieldPath { - string("hasOneParentChildId") + var hasOneParentChildId: FieldPath { + string("hasOneParentChildId") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/HasOneParentChild/HasOneParent.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/HasOneParentChild/HasOneParent.swift index 887aedc67d..81931f3e97 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/HasOneParentChild/HasOneParent.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL12/HasOneParentChild/HasOneParent.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation public struct HasOneParent: Model { public let id: String - internal var _child: LazyReference + var _child: LazyReference public var child: HasOneChild? { get async throws { try await _child.get() @@ -13,21 +20,27 @@ public struct HasOneParent: Model { public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? public var hasOneParentChildId: String? - - public init(id: String = UUID().uuidString, - child: HasOneChild? = nil, - hasOneParentChildId: String? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + child: HasOneChild? = nil, + hasOneParentChildId: String? = nil + ) { + self.init( + id: id, child: child, createdAt: nil, updatedAt: nil, - hasOneParentChildId: hasOneParentChildId) + hasOneParentChildId: hasOneParentChildId + ) } - internal init(id: String = UUID().uuidString, - child: HasOneChild? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil, - hasOneParentChildId: String? = nil) { + init( + id: String = UUID().uuidString, + child: HasOneChild? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil, + hasOneParentChildId: String? = nil + ) { self.id = id self._child = LazyReference(child) self.createdAt = createdAt @@ -35,15 +48,15 @@ public struct HasOneParent: Model { self.hasOneParentChildId = hasOneParentChildId } public mutating func setChild(_ child: HasOneChild? = nil) { - self._child = LazyReference(child) + _child = LazyReference(child) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decode(String.self, forKey: .id) - _child = try values.decodeIfPresent(LazyReference.self, forKey: .child) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) - hasOneParentChildId = try? values.decode(String?.self, forKey: .hasOneParentChildId) + self.id = try values.decode(String.self, forKey: .id) + self._child = try values.decodeIfPresent(LazyReference.self, forKey: .child) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.hasOneParentChildId = try? values.decode(String?.self, forKey: .hasOneParentChildId) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/Comment14+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/Comment14+Schema.swift index 422ce7ef12..266463d581 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/Comment14+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/Comment14+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Comment14 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Comment14 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case content case post @@ -12,23 +19,23 @@ extension Comment14 { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let comment14 = Comment14.keys - + model.authRules = [ rule(allow: .public, operations: [.create, .update, .delete, .read]) ] - + model.pluralName = "Comment14s" - + model.attributes( .primaryKey(fields: [comment14.id]) ) - + model.fields( .field(comment14.id, is: .required, ofType: .string), .field(comment14.content, is: .optional, ofType: .string), @@ -38,32 +45,32 @@ extension Comment14 { .field(comment14.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Comment14: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Comment14 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == Comment14 { + var id: FieldPath { + string("id") } - public var content: FieldPath { - string("content") + var content: FieldPath { + string("content") } - public var post: ModelPath { - Post14.Path(name: "post", parent: self) + var post: ModelPath { + Post14.Path(name: "post", parent: self) } - public var author: ModelPath { - User14.Path(name: "author", parent: self) + var author: ModelPath { + User14.Path(name: "author", parent: self) } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/Comment14.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/Comment14.swift index cab42a6f0d..906b61dbe6 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/Comment14.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/Comment14.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,38 +12,44 @@ import Foundation public struct Comment14: Model { public let id: String public var content: String? - internal var _post: LazyReference + var _post: LazyReference public var post: Post14? { - get async throws { + get async throws { try await _post.get() - } + } } - internal var _author: LazyReference + var _author: LazyReference public var author: User14 { - get async throws { + get async throws { try await _author.require() - } + } } public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - content: String? = nil, - post: Post14? = nil, - author: User14) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + content: String? = nil, + post: Post14? = nil, + author: User14 + ) { + self.init( + id: id, content: content, post: post, author: author, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - content: String? = nil, - post: Post14? = nil, - author: User14, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + content: String? = nil, + post: Post14? = nil, + author: User14, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self._post = LazyReference(post) @@ -45,19 +58,19 @@ public struct Comment14: Model { self.updatedAt = updatedAt } public mutating func setPost(_ post: Post14? = nil) { - self._post = LazyReference(post) + _post = LazyReference(post) } public mutating func setAuthor(_ author: User14) { - self._author = LazyReference(author) + _author = LazyReference(author) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decode(String.self, forKey: .id) - content = try? values.decode(String?.self, forKey: .content) - _post = try values.decodeIfPresent(LazyReference.self, forKey: .post) ?? LazyReference(identifiers: nil) - _author = try values.decodeIfPresent(LazyReference.self, forKey: .author) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.id = try values.decode(String.self, forKey: .id) + self.content = try? values.decode(String?.self, forKey: .content) + self._post = try values.decodeIfPresent(LazyReference.self, forKey: .post) ?? LazyReference(identifiers: nil) + self._author = try values.decodeIfPresent(LazyReference.self, forKey: .author) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) @@ -68,4 +81,4 @@ public struct Comment14: Model { try container.encode(createdAt, forKey: .createdAt) try container.encode(updatedAt, forKey: .updatedAt) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/GraphQLLazyLoadUserPostCommentTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/GraphQLLazyLoadUserPostCommentTests.swift index 74defd8e58..b40bcb66ff 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/GraphQLLazyLoadUserPostCommentTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/GraphQLLazyLoadUserPostCommentTests.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Combine +import Foundation import XCTest @testable import Amplify @@ -22,16 +22,16 @@ final class GraphQLLazyLoadUserPostCommentTests: GraphQLLazyLoadBaseTest { let user = User(username: "name") try await mutate(.create(user)) } - + func testSaveUserSettings() async throws { await setup(withModels: UserPostCommentModels()) let user = User(username: "name") let savedUser = try await mutate(.create(user)) - + let userSettings = UserSettings(language: "en-us", user: savedUser) try await mutate(.create(userSettings)) } - + func testSavePost() async throws { await setup(withModels: UserPostCommentModels()) let user = User(username: "name") @@ -39,18 +39,18 @@ final class GraphQLLazyLoadUserPostCommentTests: GraphQLLazyLoadBaseTest { let post = Post(title: "title", rating: 1, status: .active, author: savedUser) try await mutate(.create(post)) } - + func testSaveComment() async throws { await setup(withModels: UserPostCommentModels()) let user = User(username: "name") let savedUser = try await mutate(.create(user)) let post = Post(title: "title", rating: 1, status: .active, author: savedUser) let savedPost = try await mutate(.create(post)) - + let comment = Comment(content: "content", post: savedPost, author: savedUser) try await mutate(.create(comment)) } - + /// LazyLoad from queried models /// /// - Given: Created models @@ -69,7 +69,7 @@ final class GraphQLLazyLoadUserPostCommentTests: GraphQLLazyLoadBaseTest { let savedPost = try await mutate(.create(post)) let comment = Comment(content: "content", post: savedPost, author: savedUser) try await mutate(.create(comment)) - + // Traverse from User let queriedUser = try await query(for: user)! try await queriedUser.posts?.fetch() @@ -79,7 +79,7 @@ final class GraphQLLazyLoadUserPostCommentTests: GraphQLLazyLoadBaseTest { // Cannot traverse from User to settings since no FK is set on the User //let queriedUserSettings = try await queriedUser.settings //XCTAssertNotNil(queriedUserSettings) - + // Traverse from UserSettings let queriedSettings = try await query(for: userSettings)! let queriedSettingsUser = try await queriedSettings.user @@ -109,7 +109,7 @@ final class GraphQLLazyLoadUserPostCommentTests: GraphQLLazyLoadBaseTest { try await mutate(.delete(user)) try await assertModelDoesNotExist(user) } - + func testIncludesNestedModels() async throws { await setup(withModels: UserPostCommentModels()) let user = User(username: "name") @@ -120,11 +120,15 @@ final class GraphQLLazyLoadUserPostCommentTests: GraphQLLazyLoadBaseTest { let savedPost = try await mutate(.create(post)) let comment = Comment(content: "content", post: savedPost, author: savedUser) try await mutate(.create(comment)) - - guard let queriedUser = try await query(.get(User.self, - byIdentifier: user.id, - includes: { user in [user.comments, - user.posts] })) else { + + guard let queriedUser = try await query(.get( + User.self, + byIdentifier: user.id, + includes: { user in [ + user.comments, + user.posts + ] } + )) else { XCTFail("Could not perform nested query for User") return } @@ -144,10 +148,12 @@ final class GraphQLLazyLoadUserPostCommentTests: GraphQLLazyLoadBaseTest { comments = try await comments.getNextPage() } XCTAssertEqual(comments.count, 1) - - guard let queriedPost = try await query(.get(Post.self, - byIdentifier: post.id, - includes: { post in [post.author, post.comments] })) else { + + guard let queriedPost = try await query(.get( + Post.self, + byIdentifier: post.id, + includes: { post in [post.author, post.comments] } + )) else { XCTFail("Could not perform nested query for Post") return } @@ -160,28 +166,30 @@ final class GraphQLLazyLoadUserPostCommentTests: GraphQLLazyLoadBaseTest { queriedPostComments = try await queriedPostComments.getNextPage() } XCTAssertEqual(queriedPostComments.count, 1) - - guard let queriedComment = try await query(.get(Comment.self, - byIdentifier: comment.id, - includes: { comment in [comment.author, comment.post] })) else { + + guard let queriedComment = try await query(.get( + Comment.self, + byIdentifier: comment.id, + includes: { comment in [comment.author, comment.post] } + )) else { XCTFail("Could not perform nested query for Comment") return } assertLazyReference(queriedComment._author, state: .loaded(model: user)) assertLazyReference(queriedComment._post, state: .loaded(model: post)) } - + func testSaveUserWithUserSettings() async throws { await setup(withModels: UserPostCommentModels()) let user = User(username: "name") var savedUser = try await mutate(.create(user)) let userSettings = UserSettings(language: "en-us", user: savedUser) try await mutate(.create(userSettings)) - + // Update the User with the UserSettings (this is required for bi-directional has-one belongs-to) savedUser.setSettings(userSettings) try await mutate(.update(savedUser)) - + let queriedUser = try await query(for: user)! let queriedUserSettings = try await queriedUser.settings XCTAssertNotNil(queriedUserSettings) @@ -193,7 +201,7 @@ extension GraphQLLazyLoadUserPostCommentTests { typealias Post = Post14 typealias Comment = Comment14 typealias UserSettings = UserSettings14 - + struct UserPostCommentModels: AmplifyModelRegistration { public let version: String = "version" func registerModels(registry: ModelRegistry.Type) { diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/Post14+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/Post14+Schema.swift index bf1baaa6c2..a9f698c3ef 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/Post14+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/Post14+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Post14 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Post14 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case title case rating @@ -14,23 +21,23 @@ extension Post14 { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let post14 = Post14.keys - + model.authRules = [ rule(allow: .public, operations: [.create, .update, .delete, .read]) ] - + model.pluralName = "Post14s" - + model.attributes( .primaryKey(fields: [post14.id]) ) - + model.fields( .field(post14.id, is: .required, ofType: .string), .field(post14.title, is: .required, ofType: .string), @@ -42,35 +49,35 @@ extension Post14 { .field(post14.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Post14: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == Post14 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == Post14 { + var id: FieldPath { + string("id") } - public var title: FieldPath { - string("title") + var title: FieldPath { + string("title") } - public var rating: FieldPath { - int("rating") + var rating: FieldPath { + int("rating") } - public var comments: ModelPath { - Comment14.Path(name: "comments", isCollection: true, parent: self) + var comments: ModelPath { + Comment14.Path(name: "comments", isCollection: true, parent: self) } - public var author: ModelPath { - User14.Path(name: "author", parent: self) + var author: ModelPath { + User14.Path(name: "author", parent: self) } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/Post14.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/Post14.swift index 42d308e637..c290b4e22e 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/Post14.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/Post14.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,38 +15,44 @@ public struct Post14: Model { public var rating: Int public var status: PostStatus public var comments: List? - internal var _author: LazyReference + var _author: LazyReference public var author: User14 { - get async throws { + get async throws { try await _author.require() - } + } } public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - title: String, - rating: Int, - status: PostStatus, - comments: List? = [], - author: User14) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + title: String, + rating: Int, + status: PostStatus, + comments: List? = [], + author: User14 + ) { + self.init( + id: id, title: title, rating: rating, status: status, comments: comments, author: author, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - title: String, - rating: Int, - status: PostStatus, - comments: List? = [], - author: User14, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + title: String, + rating: Int, + status: PostStatus, + comments: List? = [], + author: User14, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.title = title self.rating = rating @@ -50,18 +63,18 @@ public struct Post14: Model { self.updatedAt = updatedAt } public mutating func setAuthor(_ author: User14) { - self._author = LazyReference(author) + _author = LazyReference(author) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decode(String.self, forKey: .id) - title = try values.decode(String.self, forKey: .title) - rating = try values.decode(Int.self, forKey: .rating) - status = try values.decode(PostStatus.self, forKey: .status) - comments = try values.decodeIfPresent(List?.self, forKey: .comments) ?? .init() - _author = try values.decodeIfPresent(LazyReference.self, forKey: .author) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.id = try values.decode(String.self, forKey: .id) + self.title = try values.decode(String.self, forKey: .title) + self.rating = try values.decode(Int.self, forKey: .rating) + self.status = try values.decode(PostStatus.self, forKey: .status) + self.comments = try values.decodeIfPresent(List?.self, forKey: .comments) ?? .init() + self._author = try values.decodeIfPresent(LazyReference.self, forKey: .author) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) @@ -74,4 +87,4 @@ public struct Post14: Model { try container.encode(createdAt, forKey: .createdAt) try container.encode(updatedAt, forKey: .updatedAt) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/PostStatus.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/PostStatus.swift index 47329501d1..39a6c7f3e4 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/PostStatus.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/PostStatus.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,4 +12,4 @@ import Foundation public enum PostStatus: String, EnumPersistable { case active = "ACTIVE" case inactive = "INACTIVE" -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/User14+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/User14+Schema.swift index 87ab652572..20e2acd13b 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/User14+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/User14+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension User14 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension User14 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case username case posts @@ -14,23 +21,23 @@ extension User14 { case updatedAt case user14SettingsId } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let user14 = User14.keys - + model.authRules = [ rule(allow: .public, operations: [.create, .update, .delete, .read]) ] - + model.pluralName = "User14s" - + model.attributes( .primaryKey(fields: [user14.id]) ) - + model.fields( .field(user14.id, is: .required, ofType: .string), .field(user14.username, is: .required, ofType: .string), @@ -42,38 +49,38 @@ extension User14 { .field(user14.user14SettingsId, is: .optional, ofType: .string) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension User14: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == User14 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == User14 { + var id: FieldPath { + string("id") } - public var username: FieldPath { - string("username") + var username: FieldPath { + string("username") } - public var posts: ModelPath { - Post14.Path(name: "posts", isCollection: true, parent: self) + var posts: ModelPath { + Post14.Path(name: "posts", isCollection: true, parent: self) } - public var comments: ModelPath { - Comment14.Path(name: "comments", isCollection: true, parent: self) + var comments: ModelPath { + Comment14.Path(name: "comments", isCollection: true, parent: self) } - public var settings: ModelPath { - UserSettings14.Path(name: "settings", parent: self) + var settings: ModelPath { + UserSettings14.Path(name: "settings", parent: self) } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } - public var user14SettingsId: FieldPath { - string("user14SettingsId") + var user14SettingsId: FieldPath { + string("user14SettingsId") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/User14.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/User14.swift index b65799b382..7e075a3776 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/User14.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/User14.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -7,39 +14,45 @@ public struct User14: Model { public var username: String public var posts: List? public var comments: List? - internal var _settings: LazyReference + var _settings: LazyReference public var settings: UserSettings14? { - get async throws { + get async throws { try await _settings.get() - } + } } public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? public var user14SettingsId: String? - - public init(id: String = UUID().uuidString, - username: String, - posts: List? = [], - comments: List? = [], - settings: UserSettings14? = nil, - user14SettingsId: String? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + username: String, + posts: List? = [], + comments: List? = [], + settings: UserSettings14? = nil, + user14SettingsId: String? = nil + ) { + self.init( + id: id, username: username, posts: posts, comments: comments, settings: settings, createdAt: nil, updatedAt: nil, - user14SettingsId: user14SettingsId) + user14SettingsId: user14SettingsId + ) } - internal init(id: String = UUID().uuidString, - username: String, - posts: List? = [], - comments: List? = [], - settings: UserSettings14? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil, - user14SettingsId: String? = nil) { + init( + id: String = UUID().uuidString, + username: String, + posts: List? = [], + comments: List? = [], + settings: UserSettings14? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil, + user14SettingsId: String? = nil + ) { self.id = id self.username = username self.posts = posts @@ -50,18 +63,18 @@ public struct User14: Model { self.user14SettingsId = user14SettingsId } public mutating func setSettings(_ settings: UserSettings14? = nil) { - self._settings = LazyReference(settings) + _settings = LazyReference(settings) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decode(String.self, forKey: .id) - username = try values.decode(String.self, forKey: .username) - posts = try values.decodeIfPresent(List?.self, forKey: .posts) ?? .init() - comments = try values.decodeIfPresent(List?.self, forKey: .comments) ?? .init() - _settings = try values.decodeIfPresent(LazyReference.self, forKey: .settings) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) - user14SettingsId = try? values.decode(String?.self, forKey: .user14SettingsId) + self.id = try values.decode(String.self, forKey: .id) + self.username = try values.decode(String.self, forKey: .username) + self.posts = try values.decodeIfPresent(List?.self, forKey: .posts) ?? .init() + self.comments = try values.decodeIfPresent(List?.self, forKey: .comments) ?? .init() + self._settings = try values.decodeIfPresent(LazyReference.self, forKey: .settings) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.user14SettingsId = try? values.decode(String?.self, forKey: .user14SettingsId) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) @@ -74,4 +87,4 @@ public struct User14: Model { try container.encode(updatedAt, forKey: .updatedAt) try container.encode(user14SettingsId, forKey: .user14SettingsId) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/UserSettings14+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/UserSettings14+Schema.swift index 1bc8bcd441..2e8f1dfa0a 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/UserSettings14+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/UserSettings14+Schema.swift @@ -1,33 +1,40 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension UserSettings14 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension UserSettings14 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case language case user case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let userSettings14 = UserSettings14.keys - + model.authRules = [ rule(allow: .public, operations: [.create, .update, .delete, .read]) ] - + model.pluralName = "UserSettings14s" - + model.attributes( .primaryKey(fields: [userSettings14.id]) ) - + model.fields( .field(userSettings14.id, is: .required, ofType: .string), .field(userSettings14.language, is: .optional, ofType: .string), @@ -36,29 +43,29 @@ extension UserSettings14 { .field(userSettings14.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension UserSettings14: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == UserSettings14 { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == UserSettings14 { + var id: FieldPath { + string("id") } - public var language: FieldPath { - string("language") + var language: FieldPath { + string("language") } - public var user: ModelPath { - User14.Path(name: "user", parent: self) + var user: ModelPath { + User14.Path(name: "user", parent: self) } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/UserSettings14.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/UserSettings14.swift index b0e8cbf0ff..6cc8ae97ae 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/UserSettings14.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL14/UserSettings14.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,29 +12,35 @@ import Foundation public struct UserSettings14: Model { public let id: String public var language: String? - internal var _user: LazyReference + var _user: LazyReference public var user: User14 { - get async throws { + get async throws { try await _user.require() - } + } } public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - language: String? = nil, - user: User14) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + language: String? = nil, + user: User14 + ) { + self.init( + id: id, language: language, user: user, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - language: String? = nil, - user: User14, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + language: String? = nil, + user: User14, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.language = language self._user = LazyReference(user) @@ -35,15 +48,15 @@ public struct UserSettings14: Model { self.updatedAt = updatedAt } public mutating func setUser(_ user: User14) { - self._user = LazyReference(user) + _user = LazyReference(user) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decode(String.self, forKey: .id) - language = try? values.decode(String?.self, forKey: .language) - _user = try values.decodeIfPresent(LazyReference.self, forKey: .user) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.id = try values.decode(String.self, forKey: .id) + self.language = try? values.decode(String?.self, forKey: .language) + self._user = try values.decodeIfPresent(LazyReference.self, forKey: .user) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) @@ -53,4 +66,4 @@ public struct UserSettings14: Model { try container.encode(createdAt, forKey: .createdAt) try container.encode(updatedAt, forKey: .updatedAt) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/EnumTestModel+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/EnumTestModel+Schema.swift index 654c541c4a..a93f3181c2 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/EnumTestModel+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/EnumTestModel+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension EnumTestModel { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension EnumTestModel { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case enumVal case nullableEnumVal @@ -15,19 +22,19 @@ extension EnumTestModel { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let enumTestModel = EnumTestModel.keys - + model.pluralName = "EnumTestModels" - + model.attributes( .primaryKey(fields: [enumTestModel.id]) ) - + model.fields( .field(enumTestModel.id, is: .required, ofType: .string), .field(enumTestModel.enumVal, is: .required, ofType: .enum(type: TestEnum.self)), @@ -40,23 +47,23 @@ extension EnumTestModel { .field(enumTestModel.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension EnumTestModel: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == EnumTestModel { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == EnumTestModel { + var id: FieldPath { + string("id") } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/EnumTestModel.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/EnumTestModel.swift index 57a45cd219..de9368dd4d 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/EnumTestModel.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/EnumTestModel.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -12,15 +19,18 @@ public struct EnumTestModel: Model { public var nullableEnumNullableList: [TestEnum?]? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - enumVal: TestEnum, - nullableEnumVal: TestEnum? = nil, - enumList: [TestEnum] = [], - enumNullableList: [TestEnum]? = nil, - nullableEnumList: [TestEnum?] = [], - nullableEnumNullableList: [TestEnum?]? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + enumVal: TestEnum, + nullableEnumVal: TestEnum? = nil, + enumList: [TestEnum] = [], + enumNullableList: [TestEnum]? = nil, + nullableEnumList: [TestEnum?] = [], + nullableEnumNullableList: [TestEnum?]? = nil + ) { + self.init( + id: id, enumVal: enumVal, nullableEnumVal: nullableEnumVal, enumList: enumList, @@ -28,17 +38,20 @@ public struct EnumTestModel: Model { nullableEnumList: nullableEnumList, nullableEnumNullableList: nullableEnumNullableList, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - enumVal: TestEnum, - nullableEnumVal: TestEnum? = nil, - enumList: [TestEnum] = [], - enumNullableList: [TestEnum]? = nil, - nullableEnumList: [TestEnum?] = [], - nullableEnumNullableList: [TestEnum?]? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + enumVal: TestEnum, + nullableEnumVal: TestEnum? = nil, + enumList: [TestEnum] = [], + enumNullableList: [TestEnum]? = nil, + nullableEnumList: [TestEnum?] = [], + nullableEnumNullableList: [TestEnum?]? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.enumVal = enumVal self.nullableEnumVal = nullableEnumVal @@ -49,4 +62,4 @@ public struct EnumTestModel: Model { self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/ListIntContainer+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/ListIntContainer+Schema.swift index 45a99508b6..77b79afd91 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/ListIntContainer+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/ListIntContainer+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension ListIntContainer { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension ListIntContainer { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case test case nullableInt @@ -15,19 +22,19 @@ extension ListIntContainer { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let listIntContainer = ListIntContainer.keys - + model.pluralName = "ListIntContainers" - + model.attributes( .primaryKey(fields: [listIntContainer.id]) ) - + model.fields( .field(listIntContainer.id, is: .required, ofType: .string), .field(listIntContainer.test, is: .required, ofType: .int), @@ -40,41 +47,41 @@ extension ListIntContainer { .field(listIntContainer.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension ListIntContainer: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == ListIntContainer { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == ListIntContainer { + var id: FieldPath { + string("id") } - public var test: FieldPath { - int("test") + var test: FieldPath { + int("test") } - public var nullableInt: FieldPath { - int("nullableInt") + var nullableInt: FieldPath { + int("nullableInt") } - public var intList: FieldPath { - int("intList") + var intList: FieldPath { + int("intList") } - public var intNullableList: FieldPath { - int("intNullableList") + var intNullableList: FieldPath { + int("intNullableList") } - public var nullableIntList: FieldPath { - int("nullableIntList") + var nullableIntList: FieldPath { + int("nullableIntList") } - public var nullableIntNullableList: FieldPath { - int("nullableIntNullableList") + var nullableIntNullableList: FieldPath { + int("nullableIntNullableList") } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/ListIntContainer.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/ListIntContainer.swift index 040edd16e8..efb53081d8 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/ListIntContainer.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/ListIntContainer.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -12,15 +19,18 @@ public struct ListIntContainer: Model { public var nullableIntNullableList: [Int?]? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - test: Int, - nullableInt: Int? = nil, - intList: [Int] = [], - intNullableList: [Int]? = nil, - nullableIntList: [Int?] = [], - nullableIntNullableList: [Int?]? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + test: Int, + nullableInt: Int? = nil, + intList: [Int] = [], + intNullableList: [Int]? = nil, + nullableIntList: [Int?] = [], + nullableIntNullableList: [Int?]? = nil + ) { + self.init( + id: id, test: test, nullableInt: nullableInt, intList: intList, @@ -28,17 +38,20 @@ public struct ListIntContainer: Model { nullableIntList: nullableIntList, nullableIntNullableList: nullableIntNullableList, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - test: Int, - nullableInt: Int? = nil, - intList: [Int] = [], - intNullableList: [Int]? = nil, - nullableIntList: [Int?] = [], - nullableIntNullableList: [Int?]? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + test: Int, + nullableInt: Int? = nil, + intList: [Int] = [], + intNullableList: [Int]? = nil, + nullableIntList: [Int?] = [], + nullableIntNullableList: [Int?]? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.test = test self.nullableInt = nullableInt @@ -49,4 +62,4 @@ public struct ListIntContainer: Model { self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/ListStringContainer+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/ListStringContainer+Schema.swift index 151cfaf8c7..505e667481 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/ListStringContainer+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/ListStringContainer+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension ListStringContainer { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension ListStringContainer { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case test case nullableString @@ -15,19 +22,19 @@ extension ListStringContainer { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let listStringContainer = ListStringContainer.keys - + model.pluralName = "ListStringContainers" - + model.attributes( .primaryKey(fields: [listStringContainer.id]) ) - + model.fields( .field(listStringContainer.id, is: .required, ofType: .string), .field(listStringContainer.test, is: .required, ofType: .string), @@ -40,41 +47,41 @@ extension ListStringContainer { .field(listStringContainer.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension ListStringContainer: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == ListStringContainer { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == ListStringContainer { + var id: FieldPath { + string("id") } - public var test: FieldPath { - string("test") + var test: FieldPath { + string("test") } - public var nullableString: FieldPath { - string("nullableString") + var nullableString: FieldPath { + string("nullableString") } - public var stringList: FieldPath { - string("stringList") + var stringList: FieldPath { + string("stringList") } - public var stringNullableList: FieldPath { - string("stringNullableList") + var stringNullableList: FieldPath { + string("stringNullableList") } - public var nullableStringList: FieldPath { - string("nullableStringList") + var nullableStringList: FieldPath { + string("nullableStringList") } - public var nullableStringNullableList: FieldPath { - string("nullableStringNullableList") + var nullableStringNullableList: FieldPath { + string("nullableStringNullableList") } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/ListStringContainer.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/ListStringContainer.swift index cfe1107366..d08e28aa86 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/ListStringContainer.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/ListStringContainer.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -12,15 +19,18 @@ public struct ListStringContainer: Model { public var nullableStringNullableList: [String?]? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - test: String, - nullableString: String? = nil, - stringList: [String] = [], - stringNullableList: [String]? = nil, - nullableStringList: [String?] = [], - nullableStringNullableList: [String?]? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + test: String, + nullableString: String? = nil, + stringList: [String] = [], + stringNullableList: [String]? = nil, + nullableStringList: [String?] = [], + nullableStringNullableList: [String?]? = nil + ) { + self.init( + id: id, test: test, nullableString: nullableString, stringList: stringList, @@ -28,17 +38,20 @@ public struct ListStringContainer: Model { nullableStringList: nullableStringList, nullableStringNullableList: nullableStringNullableList, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - test: String, - nullableString: String? = nil, - stringList: [String] = [], - stringNullableList: [String]? = nil, - nullableStringList: [String?] = [], - nullableStringNullableList: [String?]? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + test: String, + nullableString: String? = nil, + stringList: [String] = [], + stringNullableList: [String]? = nil, + nullableStringList: [String?] = [], + nullableStringNullableList: [String?]? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.test = test self.nullableString = nullableString @@ -49,4 +62,4 @@ public struct ListStringContainer: Model { self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/Nested+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/Nested+Schema.swift index 1c83d051d7..d2cd8eeea4 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/Nested+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/Nested+Schema.swift @@ -1,25 +1,32 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Nested { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Nested { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case valueOne case valueTwo } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let nested = Nested.keys - + model.pluralName = "Nesteds" - + model.fields( .field(nested.valueOne, is: .optional, ofType: .int), .field(nested.valueTwo, is: .optional, ofType: .string) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/Nested.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/Nested.swift index 37415d4550..19da9762a3 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/Nested.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/Nested.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,4 +12,4 @@ import Foundation public struct Nested: Embeddable { var valueOne: Int? var valueTwo: String? -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/NestedTypeTestModel+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/NestedTypeTestModel+Schema.swift index a01c7c3046..e92577edf2 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/NestedTypeTestModel+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/NestedTypeTestModel+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension NestedTypeTestModel { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension NestedTypeTestModel { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case nestedVal case nullableNestedVal @@ -15,19 +22,19 @@ extension NestedTypeTestModel { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let nestedTypeTestModel = NestedTypeTestModel.keys - + model.pluralName = "NestedTypeTestModels" - + model.attributes( .primaryKey(fields: [nestedTypeTestModel.id]) ) - + model.fields( .field(nestedTypeTestModel.id, is: .required, ofType: .string), .field(nestedTypeTestModel.nestedVal, is: .required, ofType: .embedded(type: Nested.self)), @@ -40,23 +47,23 @@ extension NestedTypeTestModel { .field(nestedTypeTestModel.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension NestedTypeTestModel: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == NestedTypeTestModel { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == NestedTypeTestModel { + var id: FieldPath { + string("id") } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/NestedTypeTestModel.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/NestedTypeTestModel.swift index 2167581607..bd5c875239 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/NestedTypeTestModel.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/NestedTypeTestModel.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -12,15 +19,18 @@ public struct NestedTypeTestModel: Model { public var nullableNestedNullableList: [Nested?]? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - nestedVal: Nested, - nullableNestedVal: Nested? = nil, - nestedList: [Nested] = [], - nestedNullableList: [Nested]? = nil, - nullableNestedList: [Nested?] = [], - nullableNestedNullableList: [Nested?]? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + nestedVal: Nested, + nullableNestedVal: Nested? = nil, + nestedList: [Nested] = [], + nestedNullableList: [Nested]? = nil, + nullableNestedList: [Nested?] = [], + nullableNestedNullableList: [Nested?]? = nil + ) { + self.init( + id: id, nestedVal: nestedVal, nullableNestedVal: nullableNestedVal, nestedList: nestedList, @@ -28,17 +38,20 @@ public struct NestedTypeTestModel: Model { nullableNestedList: nullableNestedList, nullableNestedNullableList: nullableNestedNullableList, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - nestedVal: Nested, - nullableNestedVal: Nested? = nil, - nestedList: [Nested] = [], - nestedNullableList: [Nested]? = nil, - nullableNestedList: [Nested?] = [], - nullableNestedNullableList: [Nested?]? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + nestedVal: Nested, + nullableNestedVal: Nested? = nil, + nestedList: [Nested] = [], + nestedNullableList: [Nested]? = nil, + nullableNestedList: [Nested?] = [], + nullableNestedNullableList: [Nested?]? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.nestedVal = nestedVal self.nullableNestedVal = nullableNestedVal @@ -49,4 +62,4 @@ public struct NestedTypeTestModel: Model { self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/ScalarContainer+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/ScalarContainer+Schema.swift index a4db044062..0af1b206bc 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/ScalarContainer+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/ScalarContainer+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension ScalarContainer { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension ScalarContainer { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case myString case myInt @@ -22,19 +29,19 @@ extension ScalarContainer { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let scalarContainer = ScalarContainer.keys - + model.pluralName = "ScalarContainers" - + model.attributes( .primaryKey(fields: [scalarContainer.id]) ) - + model.fields( .field(scalarContainer.id, is: .required, ofType: .string), .field(scalarContainer.myString, is: .optional, ofType: .string), @@ -54,62 +61,62 @@ extension ScalarContainer { .field(scalarContainer.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension ScalarContainer: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == ScalarContainer { - public var id: FieldPath { - string("id") +public extension ModelPath where ModelType == ScalarContainer { + var id: FieldPath { + string("id") } - public var myString: FieldPath { - string("myString") + var myString: FieldPath { + string("myString") } - public var myInt: FieldPath { - int("myInt") + var myInt: FieldPath { + int("myInt") } - public var myDouble: FieldPath { - double("myDouble") + var myDouble: FieldPath { + double("myDouble") } - public var myBool: FieldPath { - bool("myBool") + var myBool: FieldPath { + bool("myBool") } - public var myDate: FieldPath { - date("myDate") + var myDate: FieldPath { + date("myDate") } - public var myTime: FieldPath { - time("myTime") + var myTime: FieldPath { + time("myTime") } - public var myDateTime: FieldPath { - datetime("myDateTime") + var myDateTime: FieldPath { + datetime("myDateTime") } - public var myTimeStamp: FieldPath { - int("myTimeStamp") + var myTimeStamp: FieldPath { + int("myTimeStamp") } - public var myEmail: FieldPath { - string("myEmail") + var myEmail: FieldPath { + string("myEmail") } - public var myJSON: FieldPath { - string("myJSON") + var myJSON: FieldPath { + string("myJSON") } - public var myPhone: FieldPath { - string("myPhone") + var myPhone: FieldPath { + string("myPhone") } - public var myURL: FieldPath { - string("myURL") + var myURL: FieldPath { + string("myURL") } - public var myIPAddress: FieldPath { - string("myIPAddress") + var myIPAddress: FieldPath { + string("myIPAddress") } - public var createdAt: FieldPath { - datetime("createdAt") + var createdAt: FieldPath { + datetime("createdAt") } - public var updatedAt: FieldPath { - datetime("updatedAt") + var updatedAt: FieldPath { + datetime("updatedAt") } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/ScalarContainer.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/ScalarContainer.swift index 9559211652..ee87c57ecd 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/ScalarContainer.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/ScalarContainer.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -19,22 +26,25 @@ public struct ScalarContainer: Model { public var myIPAddress: String? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - myString: String? = nil, - myInt: Int? = nil, - myDouble: Double? = nil, - myBool: Bool? = nil, - myDate: Temporal.Date? = nil, - myTime: Temporal.Time? = nil, - myDateTime: Temporal.DateTime? = nil, - myTimeStamp: Int? = nil, - myEmail: String? = nil, - myJSON: String? = nil, - myPhone: String? = nil, - myURL: String? = nil, - myIPAddress: String? = nil) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + myString: String? = nil, + myInt: Int? = nil, + myDouble: Double? = nil, + myBool: Bool? = nil, + myDate: Temporal.Date? = nil, + myTime: Temporal.Time? = nil, + myDateTime: Temporal.DateTime? = nil, + myTimeStamp: Int? = nil, + myEmail: String? = nil, + myJSON: String? = nil, + myPhone: String? = nil, + myURL: String? = nil, + myIPAddress: String? = nil + ) { + self.init( + id: id, myString: myString, myInt: myInt, myDouble: myDouble, @@ -49,24 +59,27 @@ public struct ScalarContainer: Model { myURL: myURL, myIPAddress: myIPAddress, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - myString: String? = nil, - myInt: Int? = nil, - myDouble: Double? = nil, - myBool: Bool? = nil, - myDate: Temporal.Date? = nil, - myTime: Temporal.Time? = nil, - myDateTime: Temporal.DateTime? = nil, - myTimeStamp: Int? = nil, - myEmail: String? = nil, - myJSON: String? = nil, - myPhone: String? = nil, - myURL: String? = nil, - myIPAddress: String? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + myString: String? = nil, + myInt: Int? = nil, + myDouble: Double? = nil, + myBool: Bool? = nil, + myDate: Temporal.Date? = nil, + myTime: Temporal.Time? = nil, + myDateTime: Temporal.DateTime? = nil, + myTimeStamp: Int? = nil, + myEmail: String? = nil, + myJSON: String? = nil, + myPhone: String? = nil, + myURL: String? = nil, + myIPAddress: String? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.myString = myString self.myInt = myInt @@ -84,4 +97,4 @@ public struct ScalarContainer: Model { self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/TestEnum.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/TestEnum.swift index 8c0fdf51ef..774eca554f 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/TestEnum.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL15/TestEnum.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,4 +12,4 @@ import Foundation public enum TestEnum: String, EnumPersistable { case valueOne = "VALUE_ONE" case valueTwo = "VALUE_TWO" -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/Blog8V2+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/Blog8V2+Schema.swift index ebcfd4d9ec..d7c953a7f7 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/Blog8V2+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/Blog8V2+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Blog8V2 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Blog8V2 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case name case customs @@ -13,19 +20,19 @@ extension Blog8V2 { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let blog8V2 = Blog8V2.keys - + model.pluralName = "Blog8V2s" - + model.attributes( .primaryKey(fields: [blog8V2.id]) ) - + model.fields( .field(blog8V2.id, is: .required, ofType: .string), .field(blog8V2.name, is: .required, ofType: .string), @@ -36,10 +43,10 @@ extension Blog8V2 { .field(blog8V2.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Blog8V2: ModelIdentifiable { diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/Blog8V2.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/Blog8V2.swift index 53a81844ff..c317d9f8c3 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/Blog8V2.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/Blog8V2.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -10,27 +17,33 @@ public struct Blog8V2: Model { public var posts: List? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - name: String, - customs: [MyCustomModel8?]? = nil, - notes: [String?]? = nil, - posts: List? = []) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + name: String, + customs: [MyCustomModel8?]? = nil, + notes: [String?]? = nil, + posts: List? = [] + ) { + self.init( + id: id, name: name, customs: customs, notes: notes, posts: posts, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - name: String, - customs: [MyCustomModel8?]? = nil, - notes: [String?]? = nil, - posts: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + name: String, + customs: [MyCustomModel8?]? = nil, + notes: [String?]? = nil, + posts: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.customs = customs diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/Comment8V2+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/Comment8V2+Schema.swift index 87e402536b..e512164a9e 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/Comment8V2+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/Comment8V2+Schema.swift @@ -1,30 +1,37 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Comment8V2 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Comment8V2 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case content case post case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let comment8V2 = Comment8V2.keys - + model.pluralName = "Comment8V2s" - + model.attributes( .index(fields: ["postId"], name: "commentByPost"), .primaryKey(fields: [comment8V2.id]) ) - + model.fields( .field(comment8V2.id, is: .required, ofType: .string), .field(comment8V2.content, is: .optional, ofType: .string), @@ -33,10 +40,10 @@ extension Comment8V2 { .field(comment8V2.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Comment8V2: ModelIdentifiable { diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/Comment8V2.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/Comment8V2.swift index 8e82e35b6c..594d741eb3 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/Comment8V2.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/Comment8V2.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,7 +12,7 @@ import Foundation public struct Comment8V2: Model { public let id: String public var content: String? - internal var _post: LazyReference + var _post: LazyReference public var post: Post8V2? { get async throws { try await _post.get() @@ -13,21 +20,27 @@ public struct Comment8V2: Model { } public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - content: String? = nil, - post: Post8V2? = nil) { - self.init(id: id, - content: content, - post: post, - createdAt: nil, - updatedAt: nil) + + public init( + id: String = UUID().uuidString, + content: String? = nil, + post: Post8V2? = nil + ) { + self.init( + id: id, + content: content, + post: post, + createdAt: nil, + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - content: String? = nil, - post: Post8V2? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + content: String? = nil, + post: Post8V2? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self._post = LazyReference(post) @@ -35,15 +48,15 @@ public struct Comment8V2: Model { self.updatedAt = updatedAt } public mutating func setPost(_ post: Post8V2? = nil) { - self._post = LazyReference(post) + _post = LazyReference(post) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decode(String.self, forKey: .id) - content = try? values.decode(String?.self, forKey: .content) - _post = try values.decodeIfPresent(LazyReference.self, forKey: .post) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.id = try values.decode(String.self, forKey: .id) + self.content = try? values.decode(String?.self, forKey: .content) + self._post = try values.decodeIfPresent(LazyReference.self, forKey: .post) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/GraphQLLazyLoadBlogPostComment8V2Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/GraphQLLazyLoadBlogPostComment8V2Tests.swift index 20b72550dd..8bca8f1934 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/GraphQLLazyLoadBlogPostComment8V2Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/GraphQLLazyLoadBlogPostComment8V2Tests.swift @@ -5,12 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Combine +import Foundation import XCTest -@testable import Amplify import AWSPluginsCore +@testable import Amplify final class GraphQLLazyLoadBlogPostComment8V2Tests: GraphQLLazyLoadBaseTest { @@ -23,7 +23,7 @@ final class GraphQLLazyLoadBlogPostComment8V2Tests: GraphQLLazyLoadBaseTest { try await queriedBlog.posts?.fetch() assertList(queriedBlog.posts!, state: .isLoaded(count: 0)) } - + func testSavePost() async throws { await setup(withModels: BlogPostComment8V2Models()) let post = Post(name: "name", randomId: "randomId") @@ -32,55 +32,55 @@ final class GraphQLLazyLoadBlogPostComment8V2Tests: GraphQLLazyLoadBaseTest { assertList(queriedPost.comments!, state: .isNotLoaded(associatedIdentifiers: [post.id], associatedFields: ["post"])) try await queriedPost.comments?.fetch() assertList(queriedPost.comments!, state: .isLoaded(count: 0)) - + assertLazyReference(queriedPost._blog, state: .notLoaded(identifiers: nil)) } - + func testSaveBlogThenPost() async throws { await setup(withModels: BlogPostComment8V2Models()) let blog = Blog(name: "name") let createdBlog = try await mutate(.create(blog)) let post = Post(name: "name", randomId: "randomId", blog: blog) let createdPost = try await mutate(.create(post)) - + // the blog can load the posts assertList(createdBlog.posts!, state: .isNotLoaded(associatedIdentifiers: [blog.id], associatedFields: ["blog"])) try await createdBlog.posts?.fetch() assertList(createdBlog.posts!, state: .isLoaded(count: 1)) assertLazyReference(createdBlog.posts!.first!._blog, state: .notLoaded(identifiers: [.init(name: "id", value: blog.id)])) - + // the post can load the blog assertLazyReference(createdPost._blog, state: .notLoaded(identifiers: [.init(name: "id", value: blog.id)])) let loadedBlog = try await createdPost.blog! assertLazyReference(createdPost._blog, state: .loaded(model: loadedBlog)) assertList(loadedBlog.posts!, state: .isNotLoaded(associatedIdentifiers: [blog.id], associatedFields: ["blog"])) } - + func testSaveComment() async throws { await setup(withModels: BlogPostComment8V2Models()) let comment = Comment(content: "content") let createdComment = try await mutate(.create(comment)) assertLazyReference(createdComment._post, state: .notLoaded(identifiers: nil)) } - + func testSavePostComment() async throws { await setup(withModels: BlogPostComment8V2Models()) let post = Post(name: "name", randomId: "randomId") let createdPost = try await mutate(.create(post)) let comment = Comment(content: "content", post: post) let createdComment = try await mutate(.create(comment)) - + // the comment can load the post assertLazyReference(createdComment._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id)])) let loadedPost = try await createdComment.post! assertList(loadedPost.comments!, state: .isNotLoaded(associatedIdentifiers: [post.id], associatedFields: ["post"])) - + // the post can load the comment assertList(createdPost.comments!, state: .isNotLoaded(associatedIdentifiers: [post.id], associatedFields: ["post"])) try await createdPost.comments?.fetch() assertList(createdPost.comments!, state: .isLoaded(count: 1)) } - + func testSaveBlogPostComment() async throws { await setup(withModels: BlogPostComment8V2Models()) let blog = Blog(name: "name") @@ -89,14 +89,14 @@ final class GraphQLLazyLoadBlogPostComment8V2Tests: GraphQLLazyLoadBaseTest { try await mutate(.create(post)) let comment = Comment(content: "content", post: post) let createdComment = try await mutate(.create(comment)) - + // the comment can load the post and load the blog assertLazyReference(createdComment._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id)])) let loadedPost = try await createdComment.post! assertLazyReference(loadedPost._blog, state: .notLoaded(identifiers: [.init(name: "id", value: blog.id)])) let loadedBlog = try await loadedPost.blog! assertList(loadedBlog.posts!, state: .isNotLoaded(associatedIdentifiers: [blog.id], associatedFields: ["blog"])) - + // the blog can load the post and load the comment assertList(createdBlog.posts!, state: .isNotLoaded(associatedIdentifiers: [createdBlog.id], associatedFields: ["blog"])) try await createdBlog.posts?.fetch() @@ -105,43 +105,45 @@ final class GraphQLLazyLoadBlogPostComment8V2Tests: GraphQLLazyLoadBaseTest { try await loadedPost2.comments?.fetch() assertLazyReference(loadedPost2.comments!.first!._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id)])) } - + func testBlogIncludesPostAndPostIncludesBlog() async throws { await setup(withModels: BlogPostComment8V2Models()) let blog = Blog(name: "name") try await mutate(.create(blog)) let post = Post(name: "name", randomId: "randomId", blog: blog) try await mutate(.create(post)) - + // blog includes post - let queriedBlogWithPost = try await query(.get(Blog.self, - byIdentifier: blog.id, - includes: { blog in + let queriedBlogWithPost = try await query(.get( + Blog.self, + byIdentifier: blog.id, + includes: { blog in [blog.posts] - }))! + } + ))! assertList(queriedBlogWithPost.posts!, state: .isLoaded(count: 1)) - + // post includes blog let queriedPostWithBlog = try await query(.get(Post.self, byIdentifier: post.id, includes: { post in [post.blog] }))! assertLazyReference(queriedPostWithBlog._blog, state: .loaded(model: blog)) } - + func testPostIncludesCommentAndCommentIncludesPost() async throws { await setup(withModels: BlogPostComment8V2Models()) let post = Post(name: "name", randomId: "randomId") try await mutate(.create(post)) let comment = Comment(content: "content", post: post) try await mutate(.create(comment)) - + // post includes comment let queriedPostWithComment = try await query(.get(Post.self, byIdentifier: post.id, includes: { post in [post.comments]}))! assertList(queriedPostWithComment.comments!, state: .isLoaded(count: 1)) - + // comment includes post let queriedCommentWithPost = try await query(.get(Comment.self, byIdentifier: comment.id, includes: { comment in [comment.post] }))! assertLazyReference(queriedCommentWithPost._post, state: .loaded(model: post)) } - + func testBlogIncludesPostAndCommentAndCommentIncludesPostAndBlog() async throws { await setup(withModels: BlogPostComment8V2Models()) let blog = Blog(name: "name") @@ -150,23 +152,25 @@ final class GraphQLLazyLoadBlogPostComment8V2Tests: GraphQLLazyLoadBaseTest { try await mutate(.create(post)) let comment = Comment(content: "content", post: post) try await mutate(.create(comment)) - + // blog includes post and comment - let queriedBlogWithPostComment = try await query(.get(Blog.self, - byIdentifier: blog.id, - includes: { blog in + let queriedBlogWithPostComment = try await query(.get( + Blog.self, + byIdentifier: blog.id, + includes: { blog in [blog.posts.comments] - }))! + } + ))! assertList(queriedBlogWithPostComment.posts!, state: .isLoaded(count: 1)) assertList(queriedBlogWithPostComment.posts!.first!.comments!, state: .isLoaded(count: 1)) - + // comment includes post and blog let queriedCommentWithPostBlog = try await query(.get(Comment.self, byIdentifier: comment.id, includes: { comment in [comment.post.blog] }))! assertLazyReference(queriedCommentWithPostBlog._post, state: .loaded(model: post)) let loadedPost = try await queriedCommentWithPostBlog.post! assertLazyReference(loadedPost._blog, state: .loaded(model: blog)) } - + func testListBlogListPostsListComments() async throws { await setup(withModels: BlogPostComment8V2Models()) let blog = Blog(name: "name") @@ -175,40 +179,46 @@ final class GraphQLLazyLoadBlogPostComment8V2Tests: GraphQLLazyLoadBaseTest { try await mutate(.create(post)) let comment = Comment(content: "content", post: post) try await mutate(.create(comment)) - + let queriedBlogs = try await listQuery(.list(Blog.self, where: Blog.keys.id == blog.id)) assertList(queriedBlogs, state: .isLoaded(count: 1)) - assertList(queriedBlogs.first!.posts!, - state: .isNotLoaded(associatedIdentifiers: [blog.id], associatedFields: ["blog"])) - + assertList( + queriedBlogs.first!.posts!, + state: .isNotLoaded(associatedIdentifiers: [blog.id], associatedFields: ["blog"]) + ) + let queriedPosts = try await listQuery(.list(Post.self, where: Post.keys.id == post.id)) assertList(queriedPosts, state: .isLoaded(count: 1)) - assertList(queriedPosts.first!.comments!, - state: .isNotLoaded(associatedIdentifiers: [post.id], associatedFields: ["post"])) - + assertList( + queriedPosts.first!.comments!, + state: .isNotLoaded(associatedIdentifiers: [post.id], associatedFields: ["post"]) + ) + let queriedComments = try await listQuery(.list(Comment.self, where: Comment.keys.id == comment.id)) assertList(queriedComments, state: .isLoaded(count: 1)) - assertLazyReference(queriedComments.first!._post, - state: .notLoaded(identifiers: [.init(name: "id", value: post.id)])) + assertLazyReference( + queriedComments.first!._post, + state: .notLoaded(identifiers: [.init(name: "id", value: post.id)]) + ) } - + func testUpdate() { - + } - + func testDelete() { - + } } extension GraphQLLazyLoadBlogPostComment8V2Tests: DefaultLogger { } extension GraphQLLazyLoadBlogPostComment8V2Tests { - + typealias Blog = Blog8V2 typealias Post = Post8V2 typealias Comment = Comment8V2 - + struct BlogPostComment8V2Models: AmplifyModelRegistration { public let version: String = "version" func registerModels(registry: ModelRegistry.Type) { diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/MyCustomModel8+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/MyCustomModel8+Schema.swift index 2c926d8ab8..b243eec04e 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/MyCustomModel8+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/MyCustomModel8+Schema.swift @@ -1,24 +1,31 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension MyCustomModel8 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension MyCustomModel8 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case name case desc case children } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let myCustomModel8 = MyCustomModel8.keys - + model.pluralName = "MyCustomModel8s" - + model.fields( .field(myCustomModel8.id, is: .required, ofType: .string), .field(myCustomModel8.name, is: .required, ofType: .string), @@ -26,4 +33,4 @@ extension MyCustomModel8 { .field(myCustomModel8.children, is: .optional, ofType: .embeddedCollection(of: MyNestedModel8.self)) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/MyCustomModel8.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/MyCustomModel8.swift index 6fb7a2b02d..152b045540 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/MyCustomModel8.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/MyCustomModel8.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -7,4 +14,4 @@ public struct MyCustomModel8: Embeddable { var name: String var desc: String? var children: [MyNestedModel8?]? -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/MyNestedModel8+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/MyNestedModel8+Schema.swift index da4f5f1040..871a8a25a7 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/MyNestedModel8+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/MyNestedModel8+Schema.swift @@ -1,27 +1,34 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension MyNestedModel8 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension MyNestedModel8 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case nestedName case notes } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let myNestedModel8 = MyNestedModel8.keys - + model.pluralName = "MyNestedModel8s" - + model.fields( .field(myNestedModel8.id, is: .required, ofType: .string), .field(myNestedModel8.nestedName, is: .required, ofType: .string), .field(myNestedModel8.notes, is: .optional, ofType: .embeddedCollection(of: String.self)) ) } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/MyNestedModel8.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/MyNestedModel8.swift index 9884b8a197..6a99c2e543 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/MyNestedModel8.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/MyNestedModel8.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -6,4 +13,4 @@ public struct MyNestedModel8: Embeddable { var id: String var nestedName: String var notes: [String?]? -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/Post8V2+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/Post8V2+Schema.swift index b9b747cba9..8e93eccf7e 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/Post8V2+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/Post8V2+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Post8V2 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Post8V2 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case name case randomId @@ -13,21 +20,21 @@ extension Post8V2 { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let post8V2 = Post8V2.keys - + model.pluralName = "Post8V2s" - + model.attributes( .index(fields: ["blogId"], name: "postByBlog"), .index(fields: ["randomId"], name: "byRandom"), .primaryKey(fields: [post8V2.id]) ) - + model.fields( .field(post8V2.id, is: .required, ofType: .string), .field(post8V2.name, is: .required, ofType: .string), @@ -38,10 +45,10 @@ extension Post8V2 { .field(post8V2.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Post8V2: ModelIdentifiable { diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/Post8V2.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/Post8V2.swift index 7e5805afb9..9d416ecf23 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/Post8V2.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL2/Post8V2.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -6,7 +13,7 @@ public struct Post8V2: Model { public let id: String public var name: String public var randomId: String? - internal var _blog: LazyReference + var _blog: LazyReference public var blog: Blog8V2? { get async throws { try await _blog.get() @@ -15,27 +22,33 @@ public struct Post8V2: Model { public var comments: List? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - name: String, - randomId: String? = nil, - blog: Blog8V2? = nil, - comments: List? = []) { - self.init(id: id, - name: name, - randomId: randomId, - blog: blog, - comments: comments, - createdAt: nil, - updatedAt: nil) + + public init( + id: String = UUID().uuidString, + name: String, + randomId: String? = nil, + blog: Blog8V2? = nil, + comments: List? = [] + ) { + self.init( + id: id, + name: name, + randomId: randomId, + blog: blog, + comments: comments, + createdAt: nil, + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - name: String, - randomId: String? = nil, - blog: Blog8V2? = nil, - comments: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + name: String, + randomId: String? = nil, + blog: Blog8V2? = nil, + comments: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.randomId = randomId @@ -45,17 +58,17 @@ public struct Post8V2: Model { self.updatedAt = updatedAt } public mutating func setBlog(_ blog: Blog8V2? = nil) { - self._blog = LazyReference(blog) + _blog = LazyReference(blog) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decode(String.self, forKey: .id) - name = try values.decode(String.self, forKey: .name) - randomId = try? values.decode(String?.self, forKey: .randomId) - _blog = try values.decodeIfPresent(LazyReference.self, forKey: .blog) ?? LazyReference(identifiers: nil) - comments = try values.decodeIfPresent(List?.self, forKey: .comments) ?? .init() - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.id = try values.decode(String.self, forKey: .id) + self.name = try values.decode(String.self, forKey: .name) + self.randomId = try? values.decode(String?.self, forKey: .randomId) + self._blog = try values.decodeIfPresent(LazyReference.self, forKey: .blog) ?? LazyReference(identifiers: nil) + self.comments = try values.decodeIfPresent(List?.self, forKey: .comments) ?? .init() + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL3/CommentWithCompositeKey+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL3/CommentWithCompositeKey+Schema.swift index 9b70a40965..d5835f7876 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL3/CommentWithCompositeKey+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL3/CommentWithCompositeKey+Schema.swift @@ -1,30 +1,37 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension CommentWithCompositeKey { +public extension CommentWithCompositeKey { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id case content case post case createdAt case updatedAt } - - public static let keys = CodingKeys.self + + static let keys = CodingKeys.self // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let schema = defineSchema { model in let commentWithCompositeKey = CommentWithCompositeKey.keys - + model.pluralName = "CommentWithCompositeKeys" - + model.attributes( .index(fields: ["id", "content"], name: nil), .primaryKey(fields: [commentWithCompositeKey.id, commentWithCompositeKey.content]) ) - + model.fields( .field(commentWithCompositeKey.id, is: .required, ofType: .string), .field(commentWithCompositeKey.content, is: .required, ofType: .string), @@ -33,9 +40,9 @@ extension CommentWithCompositeKey { .field(commentWithCompositeKey.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension CommentWithCompositeKey: ModelIdentifiable { @@ -43,26 +50,28 @@ extension CommentWithCompositeKey: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension CommentWithCompositeKey.IdentifierProtocol { - public static func identifier(id: String, - content: String) -> Self { - .make(fields:[(name: "id", value: id), (name: "content", value: content)]) +public extension CommentWithCompositeKey.IdentifierProtocol { + static func identifier( + id: String, + content: String + ) -> Self { + .make(fields: [(name: "id", value: id), (name: "content", value: content)]) } } -extension ModelPath where ModelType == CommentWithCompositeKey { - public var id: FieldPath { +public extension ModelPath where ModelType == CommentWithCompositeKey { + var id: FieldPath { string("id") } - public var content: FieldPath { + var content: FieldPath { string("content") } - public var post: ModelPath { + var post: ModelPath { PostWithCompositeKey.Path(name: "post", parent: self) } - public var createdAt: FieldPath { + var createdAt: FieldPath { datetime("createdAt") } - public var updatedAt: FieldPath { + var updatedAt: FieldPath { datetime("updatedAt") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL3/CommentWithCompositeKey.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL3/CommentWithCompositeKey.swift index c3db0086aa..7e483fc203 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL3/CommentWithCompositeKey.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL3/CommentWithCompositeKey.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,7 +12,7 @@ import Foundation public struct CommentWithCompositeKey: Model { public let id: String public let content: String - internal var _post: LazyReference + var _post: LazyReference public var post: PostWithCompositeKey? { get async throws { try await _post.get() @@ -13,21 +20,27 @@ public struct CommentWithCompositeKey: Model { } public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - content: String, - post: PostWithCompositeKey? = nil) { - self.init(id: id, - content: content, - post: post, - createdAt: nil, - updatedAt: nil) + + public init( + id: String = UUID().uuidString, + content: String, + post: PostWithCompositeKey? = nil + ) { + self.init( + id: id, + content: content, + post: post, + createdAt: nil, + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - content: String, - post: PostWithCompositeKey? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + content: String, + post: PostWithCompositeKey? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.content = content self._post = LazyReference(post) @@ -35,15 +48,15 @@ public struct CommentWithCompositeKey: Model { self.updatedAt = updatedAt } public mutating func setPost(_ post: PostWithCompositeKey? = nil) { - self._post = LazyReference(post) + _post = LazyReference(post) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decode(String.self, forKey: .id) - content = try values.decode(String.self, forKey: .content) - _post = try values.decodeIfPresent(LazyReference.self, forKey: .post) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.id = try values.decode(String.self, forKey: .id) + self.content = try values.decode(String.self, forKey: .content) + self._post = try values.decodeIfPresent(LazyReference.self, forKey: .post) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL3/GraphQLLazyLoadPostCommentWithCompositeKeyTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL3/GraphQLLazyLoadPostCommentWithCompositeKeyTests.swift index b3ae40b05c..f9320aa326 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL3/GraphQLLazyLoadPostCommentWithCompositeKeyTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL3/GraphQLLazyLoadPostCommentWithCompositeKeyTests.swift @@ -5,49 +5,55 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Combine +import Foundation import XCTest -@testable import Amplify import AWSPluginsCore +@testable import Amplify final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: GraphQLLazyLoadBaseTest { func testSave() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) - + let post = Post(title: "title") let comment = Comment(content: "content", post: post) let savedPost = try await mutate(.create(post)) let savedComment = try await mutate(.create(comment)) } - + func testCommentWithLazyLoadPost() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) - + let post = Post(title: "title") let comment = Comment(content: "content", post: post) let createdPost = try await mutate(.create(post)) let createdComment = try await mutate(.create(comment)) - + // The comment's post should not be loaded, since no `includes` is passed in. // And the codegenerated swift models have the new modelPath properties. - assertLazyReference(createdComment._post, state: .notLoaded(identifiers: [.init(name: "id", value: createdPost.id), - .init(name: "title", value: createdPost.title)])) + assertLazyReference(createdComment._post, state: .notLoaded(identifiers: [ + .init(name: "id", value: createdPost.id), + .init(name: "title", value: createdPost.title) + ])) let loadedPost = try await createdComment.post! XCTAssertEqual(loadedPost.id, createdPost.id) - + // The loaded post should have comments that are also not loaded let comments = loadedPost.comments! - assertList(comments, state: .isNotLoaded(associatedIdentifiers: [post.id, post.title], - associatedFields: ["post"])) + assertList(comments, state: .isNotLoaded( + associatedIdentifiers: [post.id, post.title], + associatedFields: ["post"] + )) try await comments.fetch() assertList(comments, state: .isLoaded(count: 1)) - assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [.init(name: "id", value: createdPost.id), - .init(name: "title", value: createdPost.title)])) + assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [ + .init(name: "id", value: createdPost.id), + .init(name: "title", value: createdPost.title) + ])) } - + // With `includes` on `comment.post`, the comment's post should be eager loaded. func testCommentWithEagerLoadPost() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) @@ -61,16 +67,20 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: GraphQLLazyLoadBase XCTAssertEqual(loadedPost.id, post.id) // The loaded post should have comments that are not loaded let comments = loadedPost.comments! - assertList(comments, state: .isNotLoaded(associatedIdentifiers: [post.id, post.title], - associatedFields: ["post"])) + assertList(comments, state: .isNotLoaded( + associatedIdentifiers: [post.id, post.title], + associatedFields: ["post"] + )) // load the comments try await comments.fetch() assertList(comments, state: .isLoaded(count: 1)) // further nested models should not be loaded - assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [.init(name: "id", value: createdPost.id), - .init(name: "title", value: createdPost.title)])) + assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [ + .init(name: "id", value: createdPost.id), + .init(name: "title", value: createdPost.title) + ])) } - + // With `includes` on `comment.post.comments`, func testCommentWithEagerLoadPostAndPostComments() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) @@ -118,10 +128,12 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: GraphQLLazyLoadBase let comments = loadedPost.comments! assertList(comments, state: .isLoaded(count: 1)) // further nested models should not be loaded - assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id), - .init(name: "title", value: post.title)])) + assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [ + .init(name: "id", value: post.id), + .init(name: "title", value: post.title) + ])) } - + // Without `includes` and latest codegenerated types with the model path, the post's comments should be lazy loaded func testPostWithLazyLoadComments() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) @@ -134,10 +146,12 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: GraphQLLazyLoadBase assertList(comments, state: .isNotLoaded(associatedIdentifiers: [post.id, post.title], associatedFields: ["post"])) try await comments.fetch() assertList(comments, state: .isLoaded(count: 1)) - assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id), - .init(name: "title", value: post.title)])) + assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [ + .init(name: "id", value: post.id), + .init(name: "title", value: post.title) + ])) } - + // With `includes` on `post.comments` should eager load the post's comments func testPostWithEagerLoadComments() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) @@ -148,10 +162,12 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: GraphQLLazyLoadBase let queriedPost = try await query(.get(Post.self, byIdentifier: .identifier(id: post.id, title: post.title), includes: { post in [post.comments]}))! let comments = queriedPost.comments! assertList(comments, state: .isLoaded(count: 1)) - assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id), - .init(name: "title", value: post.title)])) + assertLazyReference(comments.first!._post, state: .notLoaded(identifiers: [ + .init(name: "id", value: post.id), + .init(name: "title", value: post.title) + ])) } - + // With `includes` on `post.comments.post` should eager load the post's comments' post func testPostWithEagerLoadCommentsAndPost() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) @@ -159,35 +175,44 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: GraphQLLazyLoadBase let comment = Comment(content: "content", post: post) let createdPost = try await mutate(.create(post)) _ = try await mutate(.create(comment)) - let queriedPost = try await query(.get(Post.self, - byIdentifier: .identifier(id: post.id, - title: post.title), - includes: { post in [post.comments.post]}))! + let queriedPost = try await query(.get( + Post.self, + byIdentifier: .identifier( + id: post.id, + title: post.title + ), + includes: { post in [post.comments.post]} + ))! let comments = queriedPost.comments! assertList(comments, state: .isLoaded(count: 1)) assertLazyReference(comments.first!._post, state: .loaded(model: createdPost)) } - + func testListPostsListComments() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) let post = Post(title: "title") let comment = Comment(content: "content", post: post) try await mutate(.create(post)) try await mutate(.create(comment)) - + let queriedPosts = try await listQuery(.list(Post.self, where: Post.keys.id == post.id)) assertList(queriedPosts, state: .isLoaded(count: 1)) - assertList(queriedPosts.first!.comments!, - state: .isNotLoaded(associatedIdentifiers: [post.id, post.title], associatedFields: ["post"])) - + assertList( + queriedPosts.first!.comments!, + state: .isNotLoaded(associatedIdentifiers: [post.id, post.title], associatedFields: ["post"]) + ) + let queriedComments = try await listQuery(.list(Comment.self, where: Comment.keys.id == comment.id)) assertList(queriedComments, state: .isLoaded(count: 1)) - assertLazyReference(queriedComments.first!._post, - state: .notLoaded(identifiers: [ - .init(name: "id", value: post.id), - .init(name: "title", value: "title")])) + assertLazyReference( + queriedComments.first!._post, + state: .notLoaded(identifiers: [ + .init(name: "id", value: post.id), + .init(name: "title", value: "title") + ]) + ) } - + func testCreateWithoutPost() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) let comment = Comment(content: "content") @@ -198,18 +223,28 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: GraphQLLazyLoadBase let createdPost = try await mutate(.create(post)) queriedComment.setPost(createdPost) let updateCommentWithPost = try await mutate(.update(queriedComment)) - let queriedCommentAfterUpdate = try await query(.get(Comment.self, - byIdentifier: .identifier(id: updateCommentWithPost.id, - content: updateCommentWithPost.content)))! - assertLazyReference(queriedCommentAfterUpdate._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id), - .init(name: "title", value: post.title)])) - let queriedCommentWithPost = try await query(.get(Comment.self, - byIdentifier: .identifier(id: queriedCommentAfterUpdate.id, - content: queriedCommentAfterUpdate.content), - includes: { comment in [comment.post]}))! + let queriedCommentAfterUpdate = try await query(.get( + Comment.self, + byIdentifier: .identifier( + id: updateCommentWithPost.id, + content: updateCommentWithPost.content + ) + ))! + assertLazyReference(queriedCommentAfterUpdate._post, state: .notLoaded(identifiers: [ + .init(name: "id", value: post.id), + .init(name: "title", value: post.title) + ])) + let queriedCommentWithPost = try await query(.get( + Comment.self, + byIdentifier: .identifier( + id: queriedCommentAfterUpdate.id, + content: queriedCommentAfterUpdate.content + ), + includes: { comment in [comment.post]} + ))! assertLazyReference(queriedCommentWithPost._post, state: .loaded(model: createdPost)) } - + func testUpdateToNewPost() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) let post = Post(title: "title") @@ -217,25 +252,37 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: GraphQLLazyLoadBase try await mutate(.create(post)) try await mutate(.create(comment)) var queriedComment = try await query(.get(Comment.self, byIdentifier: .identifier(id: comment.id, content: comment.content)))! - assertLazyReference(queriedComment._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id), - .init(name: "title", value: post.title)])) - + assertLazyReference(queriedComment._post, state: .notLoaded(identifiers: [ + .init(name: "id", value: post.id), + .init(name: "title", value: post.title) + ])) + let newPost = Post(title: "title") let createdNewPost = try await mutate(.create(newPost)) queriedComment.setPost(newPost) let updateCommentWithPost = try await mutate(.update(queriedComment)) - let queriedCommentAfterUpdate = try await query(.get(Comment.self, - byIdentifier: .identifier(id: updateCommentWithPost.id, - content: updateCommentWithPost.content)))! - assertLazyReference(queriedCommentAfterUpdate._post, state: .notLoaded(identifiers: [.init(name: "id", value: newPost.id), - .init(name: "title", value: newPost.title)])) - let queriedCommentWithPost = try await query(.get(Comment.self, - byIdentifier: .identifier(id: queriedCommentAfterUpdate.id, - content: queriedCommentAfterUpdate.content), - includes: { comment in [comment.post]}))! + let queriedCommentAfterUpdate = try await query(.get( + Comment.self, + byIdentifier: .identifier( + id: updateCommentWithPost.id, + content: updateCommentWithPost.content + ) + ))! + assertLazyReference(queriedCommentAfterUpdate._post, state: .notLoaded(identifiers: [ + .init(name: "id", value: newPost.id), + .init(name: "title", value: newPost.title) + ])) + let queriedCommentWithPost = try await query(.get( + Comment.self, + byIdentifier: .identifier( + id: queriedCommentAfterUpdate.id, + content: queriedCommentAfterUpdate.content + ), + includes: { comment in [comment.post]} + ))! assertLazyReference(queriedCommentWithPost._post, state: .loaded(model: createdNewPost)) } - + func testUpdateRemovePost() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) let post = Post(title: "title") @@ -243,22 +290,24 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: GraphQLLazyLoadBase try await mutate(.create(post)) try await mutate(.create(comment)) var queriedComment = try await query(.get(Comment.self, byIdentifier: .identifier(id: comment.id, content: comment.content)))! - assertLazyReference(queriedComment._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id), - .init(name: "title", value: post.title)])) - + assertLazyReference(queriedComment._post, state: .notLoaded(identifiers: [ + .init(name: "id", value: post.id), + .init(name: "title", value: post.title) + ])) + queriedComment.setPost(nil) let updateCommentRemovePost = try await mutate(.update(queriedComment)) let queriedCommentAfterUpdate = try await query(.get(Comment.self, byIdentifier: .identifier(id: updateCommentRemovePost.id, content: updateCommentRemovePost.content)))! assertLazyReference(queriedCommentAfterUpdate._post, state: .notLoaded(identifiers: nil)) } - + func testDelete() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) let post = Post(title: "title") let comment = Comment(content: "content", post: post) let createdPost = try await mutate(.create(post)) try await mutate(.create(comment)) - + try await mutate(.delete(createdPost)) let queriedPost = try await query(.get(Post.self, byIdentifier: .identifier(id: post.id, title: post.title))) XCTAssertNil(queriedPost) @@ -268,7 +317,7 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: GraphQLLazyLoadBase let queryDeletedComment = try await query(.get(Comment.self, byIdentifier: .identifier(id: comment.id, content: comment.content))) XCTAssertNil(queryDeletedComment) } - + func testSubscribeToComments() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) let post = Post(title: "title") @@ -289,8 +338,10 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: GraphQLLazyLoadBase switch result { case .success(let createdComment): log.verbose("Successfully got createdComment from subscription: \(createdComment)") - assertLazyReference(createdComment._post, state: .notLoaded(identifiers: [.init(name: "id", value: post.id), - .init(name: "title", value: post.title)])) + assertLazyReference(createdComment._post, state: .notLoaded(identifiers: [ + .init(name: "id", value: post.id), + .init(name: "title", value: post.title) + ])) onCreatedComment.fulfill() case .failure(let error): XCTFail("Got failed result with \(error.errorDescription)") @@ -301,14 +352,14 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: GraphQLLazyLoadBase XCTFail("Subscription has terminated with \(error)") } } - + await fulfillment(of: [connected], timeout: 10) let comment = Comment(content: "content", post: post) try await mutate(.create(comment)) await fulfillment(of: [onCreatedComment], timeout: 10) subscription.cancel() } - + // The identical `includes` parameter should be used because the selection set of the mutation // has to match the selection set of the subscription. func testSubscribeToCommentsIncludesPost() async throws { @@ -317,9 +368,11 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: GraphQLLazyLoadBase try await mutate(.create(post)) let connected = expectation(description: "subscription connected") let onCreatedComment = expectation(description: "onCreatedComment received") - let subscriptionIncludes = Amplify.API.subscribe(request: .subscription(of: Comment.self, - type: .onCreate, - includes: { comment in [comment.post]})) + let subscriptionIncludes = Amplify.API.subscribe(request: .subscription( + of: Comment.self, + type: .onCreate, + includes: { comment in [comment.post]} + )) Task { do { for try await subscriptionEvent in subscriptionIncludes { @@ -344,18 +397,18 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: GraphQLLazyLoadBase XCTFail("Subscription has terminated with \(error)") } } - + await fulfillment(of: [connected], timeout: 20) let comment = Comment(content: "content", post: post) try await mutate(.create(comment, includes: { comment in [comment.post] })) await fulfillment(of: [onCreatedComment], timeout: 20) subscriptionIncludes.cancel() } - + func testSubscribeToPosts() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) let post = Post(title: "title") - + let connected = expectation(description: "subscription connected") let onCreatedPost = expectation(description: "onCreatedPost received") let subscription = Amplify.API.subscribe(request: .subscription(of: Post.self, type: .onCreate)) @@ -383,22 +436,24 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: GraphQLLazyLoadBase XCTFail("Subscription has terminated with \(error)") } } - + await fulfillment(of: [connected], timeout: 10) try await mutate(.create(post)) await fulfillment(of: [onCreatedPost], timeout: 10) subscription.cancel() } - + func testSubscribeToPostsIncludes() async throws { await setup(withModels: PostCommentWithCompositeKeyModels()) let post = Post(title: "title") - + let connected = expectation(description: "subscription connected") let onCreatedPost = expectation(description: "onCreatedPost received") - let subscriptionIncludes = Amplify.API.subscribe(request: .subscription(of: Post.self, - type: .onCreate, - includes: { post in [post.comments]})) + let subscriptionIncludes = Amplify.API.subscribe(request: .subscription( + of: Post.self, + type: .onCreate, + includes: { post in [post.comments]} + )) Task { do { for try await subscriptionEvent in subscriptionIncludes { @@ -423,7 +478,7 @@ final class GraphQLLazyLoadPostCommentWithCompositeKeyTests: GraphQLLazyLoadBase XCTFail("Subscription has terminated with \(error)") } } - + await fulfillment(of: [connected], timeout: 10) try await mutate(.create(post, includes: { post in [post.comments]})) await fulfillment(of: [onCreatedPost], timeout: 10) @@ -436,7 +491,7 @@ extension GraphQLLazyLoadPostCommentWithCompositeKeyTests: DefaultLogger { } extension GraphQLLazyLoadPostCommentWithCompositeKeyTests { typealias Post = PostWithCompositeKey typealias Comment = CommentWithCompositeKey - + struct PostCommentWithCompositeKeyModels: AmplifyModelRegistration { public let version: String = "version" func registerModels(registry: ModelRegistry.Type) { diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL3/PostWithCompositeKey+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL3/PostWithCompositeKey+Schema.swift index 04c89f21f1..a7061afc79 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL3/PostWithCompositeKey+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL3/PostWithCompositeKey+Schema.swift @@ -1,30 +1,37 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension PostWithCompositeKey { +public extension PostWithCompositeKey { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id case title case comments case createdAt case updatedAt } - - public static let keys = CodingKeys.self + + static let keys = CodingKeys.self // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let schema = defineSchema { model in let postWithCompositeKey = PostWithCompositeKey.keys - + model.pluralName = "PostWithCompositeKeys" - + model.attributes( .index(fields: ["id", "title"], name: nil), .primaryKey(fields: [postWithCompositeKey.id, postWithCompositeKey.title]) ) - + model.fields( .field(postWithCompositeKey.id, is: .required, ofType: .string), .field(postWithCompositeKey.title, is: .required, ofType: .string), @@ -33,9 +40,9 @@ extension PostWithCompositeKey { .field(postWithCompositeKey.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension PostWithCompositeKey: ModelIdentifiable { @@ -43,26 +50,28 @@ extension PostWithCompositeKey: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension PostWithCompositeKey.IdentifierProtocol { - public static func identifier(id: String, - title: String) -> Self { - .make(fields:[(name: "id", value: id), (name: "title", value: title)]) +public extension PostWithCompositeKey.IdentifierProtocol { + static func identifier( + id: String, + title: String + ) -> Self { + .make(fields: [(name: "id", value: id), (name: "title", value: title)]) } } -extension ModelPath where ModelType == PostWithCompositeKey { - public var id: FieldPath { +public extension ModelPath where ModelType == PostWithCompositeKey { + var id: FieldPath { string("id") } - public var title: FieldPath { + var title: FieldPath { string("title") } - public var comments: ModelPath { + var comments: ModelPath { CommentWithCompositeKey.Path(name: "comments", isCollection: true, parent: self) } - public var createdAt: FieldPath { + var createdAt: FieldPath { datetime("createdAt") } - public var updatedAt: FieldPath { + var updatedAt: FieldPath { datetime("updatedAt") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL3/PostWithCompositeKey.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL3/PostWithCompositeKey.swift index e9de7de986..ac441cae5d 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL3/PostWithCompositeKey.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL3/PostWithCompositeKey.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct PostWithCompositeKey: Model { public var comments: List? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - title: String, - comments: List? = []) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + title: String, + comments: List? = [] + ) { + self.init( + id: id, title: title, comments: comments, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - title: String, - comments: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + title: String, + comments: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.title = title self.comments = comments self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/GraphQLLazyLoadPostTagTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/GraphQLLazyLoadPostTagTests.swift index 2448dc2970..c0353c5e7c 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/GraphQLLazyLoadPostTagTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/GraphQLLazyLoadPostTagTests.swift @@ -5,15 +5,15 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Combine +import Foundation import XCTest -@testable import Amplify import AWSPluginsCore +@testable import Amplify final class GraphQLLazyLoadPostTagTests: GraphQLLazyLoadBaseTest { - + func testLazyLoad() async throws { await setup(withModels: PostTagModels()) let post = Post(postId: UUID().uuidString, title: "title") @@ -22,11 +22,11 @@ final class GraphQLLazyLoadPostTagTests: GraphQLLazyLoadBaseTest { let savedPost = try await mutate(.create(post)) let savedTag = try await mutate(.create(tag)) let savedPostTag = try await mutate(.create(postTag)) - + try await assertPost(savedPost, canLazyLoad: savedPostTag) try await assertTag(savedTag, canLazyLoad: savedPostTag) try await assertPostTag(savedPostTag, canLazyLoadTag: savedTag, canLazyLoadPost: savedPost) - + let queriedPost = try await query(.get(Post.self, byIdentifier: .identifier(postId: post.postId, title: post.title)))! try await assertPost(queriedPost, canLazyLoad: savedPostTag) let queriedTag = try await query(for: savedTag)! @@ -54,39 +54,51 @@ final class GraphQLLazyLoadPostTagTests: GraphQLLazyLoadBaseTest { """ XCTAssertEqual(request.document, expectedDocument) let queriedPostTag = try await query(request)! - + try await assertPostTag(queriedPostTag, canLazyLoadTag: savedTag, canLazyLoadPost: savedPost) } - - func assertPost(_ post: Post, - canLazyLoad postTag: PostTag) async throws { + + func assertPost( + _ post: Post, + canLazyLoad postTag: PostTag + ) async throws { guard let postTags = post.tags else { XCTFail("Missing postTags on post") return } - assertList(postTags, state: .isNotLoaded(associatedIdentifiers: [post.postId, post.title], - associatedFields: ["postWithTagsCompositeKey"])) + assertList(postTags, state: .isNotLoaded( + associatedIdentifiers: [post.postId, post.title], + associatedFields: ["postWithTagsCompositeKey"] + )) try await postTags.fetch() assertList(postTags, state: .isLoaded(count: 1)) } - - func assertTag(_ tag: Tag, - canLazyLoad postTag: PostTag) async throws { + + func assertTag( + _ tag: Tag, + canLazyLoad postTag: PostTag + ) async throws { guard let postTags = tag.posts else { XCTFail("Missing postTags on post") return } - assertList(postTags, state: .isNotLoaded(associatedIdentifiers: [tag.id, tag.name], - associatedFields: ["tagWithCompositeKey"])) + assertList(postTags, state: .isNotLoaded( + associatedIdentifiers: [tag.id, tag.name], + associatedFields: ["tagWithCompositeKey"] + )) try await postTags.fetch() assertList(postTags, state: .isLoaded(count: 1)) } - + func assertPostTag(_ postTag: PostTag, canLazyLoadTag tag: Tag, canLazyLoadPost post: Post) async throws { - assertLazyReference(postTag._tagWithCompositeKey, state: .notLoaded(identifiers: [.init(name: "id", value: tag.id), - .init(name: "name", value: tag.name)])) - assertLazyReference(postTag._postWithTagsCompositeKey, state: .notLoaded(identifiers: [.init(name: "postId", value: post.postId), - .init(name: "title", value: post.title)])) + assertLazyReference(postTag._tagWithCompositeKey, state: .notLoaded(identifiers: [ + .init(name: "id", value: tag.id), + .init(name: "name", value: tag.name) + ])) + assertLazyReference(postTag._postWithTagsCompositeKey, state: .notLoaded(identifiers: [ + .init(name: "postId", value: post.postId), + .init(name: "title", value: post.title) + ])) let loadedTag = try await postTag.tagWithCompositeKey assertLazyReference(postTag._tagWithCompositeKey, state: .loaded(model: loadedTag)) try await assertTag(loadedTag, canLazyLoad: postTag) @@ -94,7 +106,7 @@ final class GraphQLLazyLoadPostTagTests: GraphQLLazyLoadBaseTest { assertLazyReference(postTag._postWithTagsCompositeKey, state: .loaded(model: loadedPost)) try await assertPost(loadedPost, canLazyLoad: postTag) } - + func testIncludesNestedModel() async throws { await setup(withModels: PostTagModels()) let post = Post(postId: UUID().uuidString, title: "title") @@ -103,11 +115,15 @@ final class GraphQLLazyLoadPostTagTests: GraphQLLazyLoadBaseTest { try await mutate(.create(post)) try await mutate(.create(tag)) try await mutate(.create(postTag)) - - guard let queriedPost = try await query(.get(Post.self, - byIdentifier: .identifier(postId: post.postId, - title: post.title), - includes: { post in [post.tags] })) else { + + guard let queriedPost = try await query(.get( + Post.self, + byIdentifier: .identifier( + postId: post.postId, + title: post.title + ), + includes: { post in [post.tags] } + )) else { XCTFail("Could not perform nested query for Post") return } @@ -119,11 +135,15 @@ final class GraphQLLazyLoadPostTagTests: GraphQLLazyLoadBaseTest { tags = try await tags.getNextPage() } XCTAssertEqual(tags.count, 1) - - guard let queriedTag = try await query(.get(Tag.self, - byIdentifier: .identifier(id: tag.id, - name: tag.name), - includes: { tag in [tag.posts] })) else { + + guard let queriedTag = try await query(.get( + Tag.self, + byIdentifier: .identifier( + id: tag.id, + name: tag.name + ), + includes: { tag in [tag.posts] } + )) else { XCTFail("Could not perform nested query for Tag") return } @@ -135,20 +155,23 @@ final class GraphQLLazyLoadPostTagTests: GraphQLLazyLoadBaseTest { posts = try await posts.getNextPage() } XCTAssertEqual(posts.count, 1) - - guard let queriedPostTag = try await query(.get(PostTag.self, - byIdentifier: postTag.id, - includes: { postTag in [ - postTag.postWithTagsCompositeKey, - postTag.tagWithCompositeKey] })) else { + + guard let queriedPostTag = try await query(.get( + PostTag.self, + byIdentifier: postTag.id, + includes: { postTag in [ + postTag.postWithTagsCompositeKey, + postTag.tagWithCompositeKey + ] } + )) else { XCTFail("Could not perform nested query for PostTag") return } - + assertLazyReference(queriedPostTag._postWithTagsCompositeKey, state: .loaded(model: post)) assertLazyReference(queriedPostTag._tagWithCompositeKey, state: .loaded(model: tag)) } - + func testListPostListTagListPostTag() async throws { await setup(withModels: PostTagModels()) let post = Post(postId: UUID().uuidString, title: "title") @@ -157,29 +180,39 @@ final class GraphQLLazyLoadPostTagTests: GraphQLLazyLoadBaseTest { try await mutate(.create(post)) try await mutate(.create(tag)) try await mutate(.create(postTag)) - + let queriedPosts = try await listQuery(.list(Post.self, where: Post.keys.postId == post.postId)) assertList(queriedPosts, state: .isLoaded(count: 1)) - assertList(queriedPosts.first!.tags!, - state: .isNotLoaded(associatedIdentifiers: [post.postId, post.title], associatedFields: ["postWithTagsCompositeKey"])) - + assertList( + queriedPosts.first!.tags!, + state: .isNotLoaded(associatedIdentifiers: [post.postId, post.title], associatedFields: ["postWithTagsCompositeKey"]) + ) + let queriedTags = try await listQuery(.list(Tag.self, where: Tag.keys.id == tag.id)) assertList(queriedTags, state: .isLoaded(count: 1)) - assertList(queriedTags.first!.posts!, - state: .isNotLoaded(associatedIdentifiers: [tag.id, tag.name], associatedFields: ["tagWithCompositeKey"])) - + assertList( + queriedTags.first!.posts!, + state: .isNotLoaded(associatedIdentifiers: [tag.id, tag.name], associatedFields: ["tagWithCompositeKey"]) + ) + let queriedPostTags = try await listQuery(.list(PostTag.self, where: PostTag.keys.id == postTag.id)) assertList(queriedPostTags, state: .isLoaded(count: 1)) - assertLazyReference(queriedPostTags.first!._postWithTagsCompositeKey, - state: .notLoaded(identifiers: [ - .init(name: "postId", value: post.postId), - .init(name: "title", value: post.title)])) - assertLazyReference(queriedPostTags.first!._tagWithCompositeKey, - state: .notLoaded(identifiers: [ - .init(name: "id", value: tag.id), - .init(name: "name", value: tag.name)])) + assertLazyReference( + queriedPostTags.first!._postWithTagsCompositeKey, + state: .notLoaded(identifiers: [ + .init(name: "postId", value: post.postId), + .init(name: "title", value: post.title) + ]) + ) + assertLazyReference( + queriedPostTags.first!._tagWithCompositeKey, + state: .notLoaded(identifiers: [ + .init(name: "id", value: tag.id), + .init(name: "name", value: tag.name) + ]) + ) } - + func testUpdate() async throws { await setup(withModels: PostTagModels()) let post = Post(postId: UUID().uuidString, title: "title") @@ -188,7 +221,7 @@ final class GraphQLLazyLoadPostTagTests: GraphQLLazyLoadBaseTest { let savedPost = try await mutate(.create(post)) let savedTag = try await mutate(.create(tag)) let savedPostTag = try await mutate(.create(postTag)) - + // update the post tag with a new post var queriedPostTag = try await query(for: savedPostTag)! let newPost = Post(postId: UUID().uuidString, title: "title") @@ -198,7 +231,7 @@ final class GraphQLLazyLoadPostTagTests: GraphQLLazyLoadBaseTest { assertLazyReference(savedPostTagWithNewPost._postWithTagsCompositeKey, state: .loaded(model: newPost)) let queriedPreviousPost = try await query(for: post)! try await assertPostWithNoPostTag(queriedPreviousPost) - + // update the post tag with a new tag var queriedPostTagWithNewPost = try await query(for: savedPostTagWithNewPost)! let newTag = Tag(name: "name") @@ -209,47 +242,51 @@ final class GraphQLLazyLoadPostTagTests: GraphQLLazyLoadBaseTest { let queriedPreviousTag = try await query(for: savedTag)! try await assertTagWithNoPostTag(queriedPreviousTag) } - + func assertPostWithNoPostTag(_ post: Post) async throws { guard let postTags = post.tags else { XCTFail("Missing postTags on post") return } - assertList(postTags, state: .isNotLoaded(associatedIdentifiers: [post.postId, post.title], - associatedFields: ["postWithTagsCompositeKey"])) + assertList(postTags, state: .isNotLoaded( + associatedIdentifiers: [post.postId, post.title], + associatedFields: ["postWithTagsCompositeKey"] + )) try await postTags.fetch() assertList(postTags, state: .isLoaded(count: 0)) } - + func assertTagWithNoPostTag(_ tag: Tag) async throws { guard let postTags = tag.posts else { XCTFail("Missing postTags on post") return } - assertList(postTags, state: .isNotLoaded(associatedIdentifiers: [tag.id, tag.name], - associatedFields: ["tagWithCompositeKey"])) + assertList(postTags, state: .isNotLoaded( + associatedIdentifiers: [tag.id, tag.name], + associatedFields: ["tagWithCompositeKey"] + )) try await postTags.fetch() assertList(postTags, state: .isLoaded(count: 0)) } - + func testDeletePost() async throws { await setup(withModels: PostTagModels()) let post = Post(postId: UUID().uuidString, title: "title") let savedPost = try await mutate(.create(post)) - + try await mutate(.delete(savedPost)) try await assertModelDoesNotExist(savedPost) } - + func testDeleteTag() async throws { await setup(withModels: PostTagModels()) let tag = Tag(name: "name") let savedTag = try await mutate(.create(tag)) - + try await mutate(.delete(savedTag)) try await assertModelDoesNotExist(savedTag) } - + func testDeletePostTag() async throws { await setup(withModels: PostTagModels()) let post = Post(postId: UUID().uuidString, title: "title") @@ -258,9 +295,9 @@ final class GraphQLLazyLoadPostTagTests: GraphQLLazyLoadBaseTest { let savedPost = try await mutate(.create(post)) let savedTag = try await mutate(.create(tag)) let savedPostTag = try await mutate(.create(postTag)) - + try await mutate(.delete(savedPostTag)) - + try await assertModelExists(savedPost) try await assertModelExists(savedTag) try await assertModelDoesNotExist(savedPostTag) @@ -273,7 +310,7 @@ extension GraphQLLazyLoadPostTagTests { typealias Post = PostWithTagsCompositeKey typealias Tag = TagWithCompositeKey typealias PostTag = PostTagsWithCompositeKey - + struct PostTagModels: AmplifyModelRegistration { public let version: String = "version" func registerModels(registry: ModelRegistry.Type) { diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/PostTagsWithCompositeKey+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/PostTagsWithCompositeKey+Schema.swift index 59cd80dd74..9ea2ee8d95 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/PostTagsWithCompositeKey+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/PostTagsWithCompositeKey+Schema.swift @@ -1,31 +1,38 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension PostTagsWithCompositeKey { +public extension PostTagsWithCompositeKey { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id case postWithTagsCompositeKey case tagWithCompositeKey case createdAt case updatedAt } - - public static let keys = CodingKeys.self + + static let keys = CodingKeys.self // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let schema = defineSchema { model in let postTagsWithCompositeKey = PostTagsWithCompositeKey.keys - + model.pluralName = "PostTagsWithCompositeKeys" - + model.attributes( .index(fields: ["postWithTagsCompositeKeyPostId", "postWithTagsCompositeKeytitle"], name: "byPostWithTagsCompositeKey"), .index(fields: ["tagWithCompositeKeyId", "tagWithCompositeKeyname"], name: "byTagWithCompositeKey"), .primaryKey(fields: [postTagsWithCompositeKey.id]) ) - + model.fields( .field(postTagsWithCompositeKey.id, is: .required, ofType: .string), .belongsTo(postTagsWithCompositeKey.postWithTagsCompositeKey, is: .required, ofType: PostWithTagsCompositeKey.self, targetNames: ["postWithTagsCompositeKeyPostId", "postWithTagsCompositeKeytitle"]), @@ -34,29 +41,29 @@ extension PostTagsWithCompositeKey { .field(postTagsWithCompositeKey.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension PostTagsWithCompositeKey: ModelIdentifiable { public typealias IdentifierFormat = ModelIdentifierFormat.Default public typealias IdentifierProtocol = DefaultModelIdentifier } -extension ModelPath where ModelType == PostTagsWithCompositeKey { - public var id: FieldPath { +public extension ModelPath where ModelType == PostTagsWithCompositeKey { + var id: FieldPath { string("id") } - public var postWithTagsCompositeKey: ModelPath { + var postWithTagsCompositeKey: ModelPath { PostWithTagsCompositeKey.Path(name: "postWithTagsCompositeKey", parent: self) } - public var tagWithCompositeKey: ModelPath { + var tagWithCompositeKey: ModelPath { TagWithCompositeKey.Path(name: "tagWithCompositeKey", parent: self) } - public var createdAt: FieldPath { + var createdAt: FieldPath { datetime("createdAt") } - public var updatedAt: FieldPath { + var updatedAt: FieldPath { datetime("updatedAt") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/PostTagsWithCompositeKey.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/PostTagsWithCompositeKey.swift index a248ebe072..45108cf5a8 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/PostTagsWithCompositeKey.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/PostTagsWithCompositeKey.swift @@ -1,16 +1,23 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation public struct PostTagsWithCompositeKey: Model { public let id: String - internal var _postWithTagsCompositeKey: LazyReference + var _postWithTagsCompositeKey: LazyReference public var postWithTagsCompositeKey: PostWithTagsCompositeKey { get async throws { try await _postWithTagsCompositeKey.require() } } - internal var _tagWithCompositeKey: LazyReference + var _tagWithCompositeKey: LazyReference public var tagWithCompositeKey: TagWithCompositeKey { get async throws { try await _tagWithCompositeKey.require() @@ -18,21 +25,27 @@ public struct PostTagsWithCompositeKey: Model { } public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - postWithTagsCompositeKey: PostWithTagsCompositeKey, - tagWithCompositeKey: TagWithCompositeKey) { - self.init(id: id, - postWithTagsCompositeKey: postWithTagsCompositeKey, - tagWithCompositeKey: tagWithCompositeKey, - createdAt: nil, - updatedAt: nil) + + public init( + id: String = UUID().uuidString, + postWithTagsCompositeKey: PostWithTagsCompositeKey, + tagWithCompositeKey: TagWithCompositeKey + ) { + self.init( + id: id, + postWithTagsCompositeKey: postWithTagsCompositeKey, + tagWithCompositeKey: tagWithCompositeKey, + createdAt: nil, + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - postWithTagsCompositeKey: PostWithTagsCompositeKey, - tagWithCompositeKey: TagWithCompositeKey, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + postWithTagsCompositeKey: PostWithTagsCompositeKey, + tagWithCompositeKey: TagWithCompositeKey, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self._postWithTagsCompositeKey = LazyReference(postWithTagsCompositeKey) self._tagWithCompositeKey = LazyReference(tagWithCompositeKey) @@ -40,18 +53,18 @@ public struct PostTagsWithCompositeKey: Model { self.updatedAt = updatedAt } public mutating func setPostWithTagsCompositeKey(_ postWithTagsCompositeKey: PostWithTagsCompositeKey) { - self._postWithTagsCompositeKey = LazyReference(postWithTagsCompositeKey) + _postWithTagsCompositeKey = LazyReference(postWithTagsCompositeKey) } public mutating func setTagWithCompositeKey(_ tagWithCompositeKey: TagWithCompositeKey) { - self._tagWithCompositeKey = LazyReference(tagWithCompositeKey) + _tagWithCompositeKey = LazyReference(tagWithCompositeKey) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - id = try values.decode(String.self, forKey: .id) - _postWithTagsCompositeKey = try values.decodeIfPresent(LazyReference.self, forKey: .postWithTagsCompositeKey) ?? LazyReference(identifiers: nil) - _tagWithCompositeKey = try values.decodeIfPresent(LazyReference.self, forKey: .tagWithCompositeKey) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.id = try values.decode(String.self, forKey: .id) + self._postWithTagsCompositeKey = try values.decodeIfPresent(LazyReference.self, forKey: .postWithTagsCompositeKey) ?? LazyReference(identifiers: nil) + self._tagWithCompositeKey = try values.decodeIfPresent(LazyReference.self, forKey: .tagWithCompositeKey) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/PostWithTagsCompositeKey+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/PostWithTagsCompositeKey+Schema.swift index 888c9b969a..eeb2570973 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/PostWithTagsCompositeKey+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/PostWithTagsCompositeKey+Schema.swift @@ -1,30 +1,37 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension PostWithTagsCompositeKey { +public extension PostWithTagsCompositeKey { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case postId case title case tags case createdAt case updatedAt } - - public static let keys = CodingKeys.self + + static let keys = CodingKeys.self // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let schema = defineSchema { model in let postWithTagsCompositeKey = PostWithTagsCompositeKey.keys - + model.pluralName = "PostWithTagsCompositeKeys" - + model.attributes( .index(fields: ["postId", "title"], name: nil), .primaryKey(fields: [postWithTagsCompositeKey.postId, postWithTagsCompositeKey.title]) ) - + model.fields( .field(postWithTagsCompositeKey.postId, is: .required, ofType: .string), .field(postWithTagsCompositeKey.title, is: .required, ofType: .string), @@ -33,9 +40,9 @@ extension PostWithTagsCompositeKey { .field(postWithTagsCompositeKey.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension PostWithTagsCompositeKey: ModelIdentifiable { @@ -43,26 +50,28 @@ extension PostWithTagsCompositeKey: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension PostWithTagsCompositeKey.IdentifierProtocol { - public static func identifier(postId: String, - title: String) -> Self { - .make(fields:[(name: "postId", value: postId), (name: "title", value: title)]) +public extension PostWithTagsCompositeKey.IdentifierProtocol { + static func identifier( + postId: String, + title: String + ) -> Self { + .make(fields: [(name: "postId", value: postId), (name: "title", value: title)]) } } -extension ModelPath where ModelType == PostWithTagsCompositeKey { - public var postId: FieldPath { +public extension ModelPath where ModelType == PostWithTagsCompositeKey { + var postId: FieldPath { string("postId") } - public var title: FieldPath { + var title: FieldPath { string("title") } - public var tags: ModelPath { + var tags: ModelPath { PostTagsWithCompositeKey.Path(name: "tags", isCollection: true, parent: self) } - public var createdAt: FieldPath { + var createdAt: FieldPath { datetime("createdAt") } - public var updatedAt: FieldPath { + var updatedAt: FieldPath { datetime("updatedAt") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/PostWithTagsCompositeKey.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/PostWithTagsCompositeKey.swift index c739bc9c22..73e3e3cd7c 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/PostWithTagsCompositeKey.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/PostWithTagsCompositeKey.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct PostWithTagsCompositeKey: Model { public var tags: List? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(postId: String, - title: String, - tags: List? = []) { - self.init(postId: postId, + + public init( + postId: String, + title: String, + tags: List? = [] + ) { + self.init( + postId: postId, title: title, tags: tags, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(postId: String, - title: String, - tags: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + postId: String, + title: String, + tags: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.postId = postId self.title = title self.tags = tags self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/TagWithCompositeKey+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/TagWithCompositeKey+Schema.swift index 95a6c9bf82..c6dc88f2f2 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/TagWithCompositeKey+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/TagWithCompositeKey+Schema.swift @@ -1,30 +1,37 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension TagWithCompositeKey { +public extension TagWithCompositeKey { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id case name case posts case createdAt case updatedAt } - - public static let keys = CodingKeys.self + + static let keys = CodingKeys.self // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let schema = defineSchema { model in let tagWithCompositeKey = TagWithCompositeKey.keys - + model.pluralName = "TagWithCompositeKeys" - + model.attributes( .index(fields: ["id", "name"], name: nil), .primaryKey(fields: [tagWithCompositeKey.id, tagWithCompositeKey.name]) ) - + model.fields( .field(tagWithCompositeKey.id, is: .required, ofType: .string), .field(tagWithCompositeKey.name, is: .required, ofType: .string), @@ -33,9 +40,9 @@ extension TagWithCompositeKey { .field(tagWithCompositeKey.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension TagWithCompositeKey: ModelIdentifiable { @@ -43,26 +50,28 @@ extension TagWithCompositeKey: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension TagWithCompositeKey.IdentifierProtocol { - public static func identifier(id: String, - name: String) -> Self { - .make(fields:[(name: "id", value: id), (name: "name", value: name)]) +public extension TagWithCompositeKey.IdentifierProtocol { + static func identifier( + id: String, + name: String + ) -> Self { + .make(fields: [(name: "id", value: id), (name: "name", value: name)]) } } -extension ModelPath where ModelType == TagWithCompositeKey { - public var id: FieldPath { +public extension ModelPath where ModelType == TagWithCompositeKey { + var id: FieldPath { string("id") } - public var name: FieldPath { + var name: FieldPath { string("name") } - public var posts: ModelPath { + var posts: ModelPath { PostTagsWithCompositeKey.Path(name: "posts", isCollection: true, parent: self) } - public var createdAt: FieldPath { + var createdAt: FieldPath { datetime("createdAt") } - public var updatedAt: FieldPath { + var updatedAt: FieldPath { datetime("updatedAt") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/TagWithCompositeKey.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/TagWithCompositeKey.swift index 8d8bbf9f26..b913c944db 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/TagWithCompositeKey.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL4/TagWithCompositeKey.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct TagWithCompositeKey: Model { public var posts: List? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - name: String, - posts: List? = []) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + name: String, + posts: List? = [] + ) { + self.init( + id: id, name: name, posts: posts, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - name: String, - posts: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + name: String, + posts: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.name = name self.posts = posts self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL5/GraphQLLazyLoadProjectTeam1Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL5/GraphQLLazyLoadProjectTeam1Tests.swift index 3752dd1c72..59d1b586f9 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL5/GraphQLLazyLoadProjectTeam1Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL5/GraphQLLazyLoadProjectTeam1Tests.swift @@ -5,114 +5,124 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Combine +import Foundation import XCTest @testable import Amplify @testable import AWSPluginsCore class GraphQLLazyLoadProjectTeam1Tests: GraphQLLazyLoadBaseTest { - + func testSaveTeam() async throws { await setup(withModels: ProjectTeam1Models()) let team = Team(teamId: UUID().uuidString, name: "name") let savedTeam = try await mutate(.create(team)) try await assertModelExists(savedTeam) } - + func testSaveProject() async throws { await setup(withModels: ProjectTeam1Models()) - let project = Project(projectId: UUID().uuidString, - name: "name") + let project = Project( + projectId: UUID().uuidString, + name: "name" + ) let savedProject = try await mutate(.create(project)) try await assertModelExists(savedProject) assertProjectDoesNotContainTeam(savedProject) } - + func testSaveProjectWithTeam() async throws { await setup(withModels: ProjectTeam1Models()) let team = Team(teamId: UUID().uuidString, name: "name") let savedTeam = try await mutate(.create(team)) - + // Project initializer variation #1 (pass both team reference and fields in) - let project = Project(projectId: UUID().uuidString, - name: "name", - team: team, - project1TeamTeamId: team.teamId, - project1TeamName: team.name) + let project = Project( + projectId: UUID().uuidString, + name: "name", + team: team, + project1TeamTeamId: team.teamId, + project1TeamName: team.name + ) let savedProject = try await mutate(.create(project)) let queriedProject = try await query(for: savedProject)! try await assertProject(queriedProject, hasTeam: savedTeam) - + // Project initializer variation #2 (pass only team reference) - let project2 = Project(projectId: UUID().uuidString, - name: "name", - team: team) + let project2 = Project( + projectId: UUID().uuidString, + name: "name", + team: team + ) let savedProject2 = try await mutate(.create(project2)) let queriedProject2 = try await query(for: savedProject2)! try await assertProject(queriedProject2, hasTeam: savedTeam) - + // Project initializer variation #3 (pass fields in) - let project3 = Project(projectId: UUID().uuidString, - name: "name", - project1TeamTeamId: team.teamId, - project1TeamName: team.name) + let project3 = Project( + projectId: UUID().uuidString, + name: "name", + project1TeamTeamId: team.teamId, + project1TeamName: team.name + ) let savedProject3 = try await mutate(.create(project3)) let queriedProject3 = try await query(for: savedProject3)! try await assertProject(queriedProject3, hasTeam: savedTeam) } - + // The team has a FK referencing the Project and a project has a FK referencing the Team // Saving the Project with the team does not save the team on the project. // This test shows that by saving a project with a team, checking that the team doesn't have the project // Then updating the team with the project, and checking that the team has the project. func testSaveProjectWithTeamThenAccessProjectFromTeamAndTeamFromProject() async throws { await setup(withModels: ProjectTeam1Models()) - + // save project with team let team = Team(teamId: UUID().uuidString, name: "name") let savedTeam = try await mutate(.create(team)) let project = initializeProjectWithTeam(savedTeam) let savedProject = try await mutate(.create(project)) - + let queriedProject = try await query(for: savedProject)! var queriedTeam = try await query(for: savedTeam)! - + // Access team from project try await assertProject(queriedProject, hasTeam: savedTeam) // The team does not have the project because we need to save the team with the project. assertTeamDoesNotContainProject(queriedTeam) - + queriedTeam.setProject(queriedProject) let teamWithProject = try await mutate(.update(queriedTeam)) assertTeam(teamWithProject, hasProject: queriedProject) } - + func assertProject(_ project: Project, hasTeam team: Team) async throws { XCTAssertEqual(project.project1TeamTeamId, team.teamId) XCTAssertEqual(project.project1TeamName, team.name) - assertLazyReference(project._team, state: .notLoaded(identifiers: [.init(name: "teamId", value: team.teamId), - .init(name: "name", value: team.name)])) - + assertLazyReference(project._team, state: .notLoaded(identifiers: [ + .init(name: "teamId", value: team.teamId), + .init(name: "name", value: team.name) + ])) + let loadedTeam = try await project.team! XCTAssertEqual(loadedTeam.teamId, team.teamId) } - + func assertProjectDoesNotContainTeam(_ project: Project) { XCTAssertNil(project.project1TeamTeamId) XCTAssertNil(project.project1TeamName) assertLazyReference(project._team, state: .notLoaded(identifiers: nil)) } - + func assertTeam(_ team: Team, hasProject project: Project) { assertLazyReference(team._project, state: .notLoaded(identifiers: [.init(name: "projectId", value: project.projectId), .init(name: "name", value: project.name)])) } - + func assertTeamDoesNotContainProject(_ team: Team) { assertLazyReference(team._project, state: .notLoaded(identifiers: nil)) } - + func testIncludesNestedModels() async throws { await setup(withModels: ProjectTeam1Models()) let team = Team(teamId: UUID().uuidString, name: "name") @@ -121,28 +131,36 @@ class GraphQLLazyLoadProjectTeam1Tests: GraphQLLazyLoadBaseTest { let savedProject = try await mutate(.create(project)) savedTeam.setProject(savedProject) try await mutate(.update(savedTeam)) - - guard let queriedTeam = try await query(.get(Team.self, - byIdentifier: .identifier(teamId: team.teamId, - name: team.name), - includes: { team in [team.project]})) else { + + guard let queriedTeam = try await query(.get( + Team.self, + byIdentifier: .identifier( + teamId: team.teamId, + name: team.name + ), + includes: { team in [team.project]} + )) else { XCTFail("Could not perform nested query for Team") return } - + assertLazyReference(queriedTeam._project, state: .loaded(model: project)) - - guard let queriedProject = try await query(.get(Project.self, - byIdentifier: .identifier(projectId: project.projectId, - name: project.name), - includes: { project in [project.team]})) else { + + guard let queriedProject = try await query(.get( + Project.self, + byIdentifier: .identifier( + projectId: project.projectId, + name: project.name + ), + includes: { project in [project.team]} + )) else { XCTFail("Could not perform nested query for Project") return } - + assertLazyReference(queriedProject._team, state: .loaded(model: team)) } - + func testListProjectListTeam() async throws { await setup(withModels: ProjectTeam1Models()) let team = Team(teamId: UUID().uuidString, name: "name") @@ -151,21 +169,25 @@ class GraphQLLazyLoadProjectTeam1Tests: GraphQLLazyLoadBaseTest { let savedProject = try await mutate(.create(project)) savedTeam.setProject(savedProject) try await mutate(.update(savedTeam)) - + let queriedProjects = try await listQuery(.list(Project.self, where: Project.keys.projectId == project.projectId)) assertList(queriedProjects, state: .isLoaded(count: 1)) assertLazyReference(queriedProjects.first!._team, state: .notLoaded(identifiers: [ .init(name: "teamId", value: team.teamId), - .init(name: "name", value: team.name)])) - + .init(name: "name", value: team.name) + ])) + let queriedTeams = try await listQuery(.list(Team.self, where: Team.keys.teamId == team.teamId)) assertList(queriedTeams, state: .isLoaded(count: 1)) - assertLazyReference(queriedTeams.first!._project, - state: .notLoaded(identifiers: [ - .init(name: "projectId", value: project.projectId), - .init(name: "name", value: project.name)])) + assertLazyReference( + queriedTeams.first!._project, + state: .notLoaded(identifiers: [ + .init(name: "projectId", value: project.projectId), + .init(name: "name", value: project.name) + ]) + ) } - + func testSaveProjectWithTeamThenUpdate() async throws { await setup(withModels: ProjectTeam1Models()) let team = Team(teamId: UUID().uuidString, name: "name") @@ -178,13 +200,13 @@ class GraphQLLazyLoadProjectTeam1Tests: GraphQLLazyLoadBaseTest { let updatedProject = try await mutate(.update(project)) try await assertProject(updatedProject, hasTeam: savedTeam) } - + func testSaveProjectWithoutTeamUpdateProjectWithTeam() async throws { await setup(withModels: ProjectTeam1Models()) let project = Project(projectId: UUID().uuidString, name: "name") let savedProject = try await mutate(.create(project)) assertProjectDoesNotContainTeam(savedProject) - + let team = Team(teamId: UUID().uuidString, name: "name") let savedTeam = try await mutate(.create(team)) var queriedProject = try await query(for: savedProject)! @@ -195,7 +217,7 @@ class GraphQLLazyLoadProjectTeam1Tests: GraphQLLazyLoadBaseTest { let savedProjectWithNewTeam = try await mutate(.update(queriedProject)) try await assertProject(savedProjectWithNewTeam, hasTeam: savedTeam) } - + func testSaveTeamSaveProjectWithTeamUpdateProjectToNoTeam() async throws { await setup(withModels: ProjectTeam1Models()) let team = Team(teamId: UUID().uuidString, name: "name") @@ -211,7 +233,7 @@ class GraphQLLazyLoadProjectTeam1Tests: GraphQLLazyLoadBaseTest { let savedProjectWithNoTeam = try await mutate(.update(queriedProject)) assertProjectDoesNotContainTeam(savedProjectWithNoTeam) } - + func testSaveProjectWithTeamUpdateProjectToNewTeam() async throws { await setup(withModels: ProjectTeam1Models()) let team = Team(teamId: UUID().uuidString, name: "name") @@ -229,7 +251,7 @@ class GraphQLLazyLoadProjectTeam1Tests: GraphQLLazyLoadBaseTest { let savedProjectWithNewTeam = try await mutate(.update(queriedProject)) try await assertProject(savedProjectWithNewTeam, hasTeam: savedNewTeam) } - + func testDeleteTeam() async throws { await setup(withModels: ProjectTeam1Models()) let team = Team(teamId: UUID().uuidString, name: "name") @@ -238,7 +260,7 @@ class GraphQLLazyLoadProjectTeam1Tests: GraphQLLazyLoadBaseTest { try await mutate(.delete(savedTeam)) try await assertModelDoesNotExist(savedTeam) } - + func testDeleteProject() async throws { await setup(withModels: ProjectTeam1Models()) let project = Project(projectId: UUID().uuidString, name: "name") @@ -247,22 +269,22 @@ class GraphQLLazyLoadProjectTeam1Tests: GraphQLLazyLoadBaseTest { try await mutate(.delete(savedProject)) try await assertModelDoesNotExist(savedProject) } - + func testDeleteProjectWithTeam() async throws { await setup(withModels: ProjectTeam1Models()) let team = Team(teamId: UUID().uuidString, name: "name") let savedTeam = try await mutate(.create(team)) let project = initializeProjectWithTeam(team) let savedProject = try await mutate(.create(project)) - + try await assertModelExists(savedProject) try await assertModelExists(savedTeam) - + try await mutate(.delete(savedProject)) - + try await assertModelDoesNotExist(savedProject) try await assertModelExists(savedTeam) - + try await mutate(.delete(savedTeam)) try await assertModelDoesNotExist(savedTeam) } @@ -273,7 +295,7 @@ extension GraphQLLazyLoadProjectTeam1Tests: DefaultLogger { } extension GraphQLLazyLoadProjectTeam1Tests { typealias Project = Project1 typealias Team = Team1 - + struct ProjectTeam1Models: AmplifyModelRegistration { public let version: String = "version" func registerModels(registry: ModelRegistry.Type) { @@ -281,12 +303,14 @@ extension GraphQLLazyLoadProjectTeam1Tests { ModelRegistry.register(modelType: Team1.self) } } - + func initializeProjectWithTeam(_ team: Team) -> Project { - return Project(projectId: UUID().uuidString, - name: "name", - team: team, - project1TeamTeamId: team.teamId, - project1TeamName: team.name) + return Project( + projectId: UUID().uuidString, + name: "name", + team: team, + project1TeamTeamId: team.teamId, + project1TeamName: team.name + ) } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL5/Project1+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL5/Project1+Schema.swift index cb052507f7..68ffadac0f 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL5/Project1+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL5/Project1+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Project1 { +public extension Project1 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case projectId case name case team @@ -13,20 +20,20 @@ extension Project1 { case project1TeamTeamId case project1TeamName } - - public static let keys = CodingKeys.self + + static let keys = CodingKeys.self // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let schema = defineSchema { model in let project1 = Project1.keys - + model.pluralName = "Project1s" - + model.attributes( .index(fields: ["projectId", "name"], name: nil), .primaryKey(fields: [project1.projectId, project1.name]) ) - + model.fields( .field(project1.projectId, is: .required, ofType: .string), .field(project1.name, is: .required, ofType: .string), @@ -37,9 +44,9 @@ extension Project1 { .field(project1.project1TeamName, is: .optional, ofType: .string) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Project1: ModelIdentifiable { @@ -47,32 +54,34 @@ extension Project1: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension Project1.IdentifierProtocol { - public static func identifier(projectId: String, - name: String) -> Self { - .make(fields:[(name: "projectId", value: projectId), (name: "name", value: name)]) +public extension Project1.IdentifierProtocol { + static func identifier( + projectId: String, + name: String + ) -> Self { + .make(fields: [(name: "projectId", value: projectId), (name: "name", value: name)]) } } -extension ModelPath where ModelType == Project1 { - public var projectId: FieldPath { +public extension ModelPath where ModelType == Project1 { + var projectId: FieldPath { string("projectId") } - public var name: FieldPath { + var name: FieldPath { string("name") } - public var team: ModelPath { + var team: ModelPath { Team1.Path(name: "team", parent: self) } - public var createdAt: FieldPath { + var createdAt: FieldPath { datetime("createdAt") } - public var updatedAt: FieldPath { + var updatedAt: FieldPath { datetime("updatedAt") } - public var project1TeamTeamId: FieldPath { + var project1TeamTeamId: FieldPath { string("project1TeamTeamId") } - public var project1TeamName: FieldPath { + var project1TeamName: FieldPath { string("project1TeamName") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL5/Project1.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL5/Project1.swift index a36917b1ba..550860a378 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL5/Project1.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL5/Project1.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,7 +12,7 @@ import Foundation public struct Project1: Model { public let projectId: String public let name: String - internal var _team: LazyReference + var _team: LazyReference public var team: Team1? { get async throws { try await _team.get() @@ -15,27 +22,33 @@ public struct Project1: Model { public var updatedAt: Temporal.DateTime? public var project1TeamTeamId: String? public var project1TeamName: String? - - public init(projectId: String, - name: String, - team: Team1? = nil, - project1TeamTeamId: String? = nil, - project1TeamName: String? = nil) { - self.init(projectId: projectId, - name: name, - team: team, - createdAt: nil, - updatedAt: nil, - project1TeamTeamId: project1TeamTeamId, - project1TeamName: project1TeamName) + + public init( + projectId: String, + name: String, + team: Team1? = nil, + project1TeamTeamId: String? = nil, + project1TeamName: String? = nil + ) { + self.init( + projectId: projectId, + name: name, + team: team, + createdAt: nil, + updatedAt: nil, + project1TeamTeamId: project1TeamTeamId, + project1TeamName: project1TeamName + ) } - internal init(projectId: String, - name: String, - team: Team1? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil, - project1TeamTeamId: String? = nil, - project1TeamName: String? = nil) { + init( + projectId: String, + name: String, + team: Team1? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil, + project1TeamTeamId: String? = nil, + project1TeamName: String? = nil + ) { self.projectId = projectId self.name = name self._team = LazyReference(team) @@ -45,17 +58,17 @@ public struct Project1: Model { self.project1TeamName = project1TeamName } public mutating func setTeam(_ team: Team1? = nil) { - self._team = LazyReference(team) + _team = LazyReference(team) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - projectId = try values.decode(String.self, forKey: .projectId) - name = try values.decode(String.self, forKey: .name) - _team = try values.decodeIfPresent(LazyReference.self, forKey: .team) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) - project1TeamTeamId = try? values.decode(String?.self, forKey: .project1TeamTeamId) - project1TeamName = try? values.decode(String?.self, forKey: .project1TeamName) + self.projectId = try values.decode(String.self, forKey: .projectId) + self.name = try values.decode(String.self, forKey: .name) + self._team = try values.decodeIfPresent(LazyReference.self, forKey: .team) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.project1TeamTeamId = try? values.decode(String?.self, forKey: .project1TeamTeamId) + self.project1TeamName = try? values.decode(String?.self, forKey: .project1TeamName) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL5/Team1+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL5/Team1+Schema.swift index 1ac9b09f53..c29406367b 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL5/Team1+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL5/Team1+Schema.swift @@ -1,30 +1,37 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Team1 { +public extension Team1 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case teamId case name case project case createdAt case updatedAt } - - public static let keys = CodingKeys.self + + static let keys = CodingKeys.self // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let schema = defineSchema { model in let team1 = Team1.keys - + model.pluralName = "Team1s" - + model.attributes( .index(fields: ["teamId", "name"], name: nil), .primaryKey(fields: [team1.teamId, team1.name]) ) - + model.fields( .field(team1.teamId, is: .required, ofType: .string), .field(team1.name, is: .required, ofType: .string), @@ -33,9 +40,9 @@ extension Team1 { .field(team1.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Team1: ModelIdentifiable { @@ -43,26 +50,28 @@ extension Team1: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension Team1.IdentifierProtocol { - public static func identifier(teamId: String, - name: String) -> Self { - .make(fields:[(name: "teamId", value: teamId), (name: "name", value: name)]) +public extension Team1.IdentifierProtocol { + static func identifier( + teamId: String, + name: String + ) -> Self { + .make(fields: [(name: "teamId", value: teamId), (name: "name", value: name)]) } } -extension ModelPath where ModelType == Team1 { - public var teamId: FieldPath { +public extension ModelPath where ModelType == Team1 { + var teamId: FieldPath { string("teamId") } - public var name: FieldPath { + var name: FieldPath { string("name") } - public var project: ModelPath { + var project: ModelPath { Project1.Path(name: "project", parent: self) } - public var createdAt: FieldPath { + var createdAt: FieldPath { datetime("createdAt") } - public var updatedAt: FieldPath { + var updatedAt: FieldPath { datetime("updatedAt") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL5/Team1.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL5/Team1.swift index c29c0e2252..8483e5515c 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL5/Team1.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL5/Team1.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,7 +12,7 @@ import Foundation public struct Team1: Model { public let teamId: String public let name: String - internal var _project: LazyReference + var _project: LazyReference public var project: Project1? { get async throws { try await _project.get() @@ -13,21 +20,27 @@ public struct Team1: Model { } public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(teamId: String, - name: String, - project: Project1? = nil) { - self.init(teamId: teamId, - name: name, - project: project, - createdAt: nil, - updatedAt: nil) + + public init( + teamId: String, + name: String, + project: Project1? = nil + ) { + self.init( + teamId: teamId, + name: name, + project: project, + createdAt: nil, + updatedAt: nil + ) } - internal init(teamId: String, - name: String, - project: Project1? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + teamId: String, + name: String, + project: Project1? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.teamId = teamId self.name = name self._project = LazyReference(project) @@ -35,15 +48,15 @@ public struct Team1: Model { self.updatedAt = updatedAt } public mutating func setProject(_ project: Project1? = nil) { - self._project = LazyReference(project) + _project = LazyReference(project) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - teamId = try values.decode(String.self, forKey: .teamId) - name = try values.decode(String.self, forKey: .name) - _project = try values.decodeIfPresent(LazyReference.self, forKey: .project) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.teamId = try values.decode(String.self, forKey: .teamId) + self.name = try values.decode(String.self, forKey: .name) + self._project = try values.decodeIfPresent(LazyReference.self, forKey: .project) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL6/GraphQLLazyLoadProjectTeam2Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL6/GraphQLLazyLoadProjectTeam2Tests.swift index 2fd54bcea0..92c62a47bb 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL6/GraphQLLazyLoadProjectTeam2Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL6/GraphQLLazyLoadProjectTeam2Tests.swift @@ -5,12 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Combine +import Foundation import XCTest -@testable import Amplify import AWSPluginsCore +@testable import Amplify class GraphQLLazyLoadProjectTeam2Tests: GraphQLLazyLoadBaseTest { @@ -20,105 +20,120 @@ class GraphQLLazyLoadProjectTeam2Tests: GraphQLLazyLoadBaseTest { let savedTeam = try await mutate(.create(team)) try await assertModelExists(savedTeam) } - + func testSaveProject() async throws { await setup(withModels: ProjectTeam2Models()) - let project = Project(projectId: UUID().uuidString, - name: "name") + let project = Project( + projectId: UUID().uuidString, + name: "name" + ) let savedProject = try await mutate(.create(project)) try await assertModelExists(savedProject) assertProjectDoesNotContainTeam(savedProject) } - + func testSaveProjectWithTeam() async throws { await setup(withModels: ProjectTeam2Models()) let team = Team(teamId: UUID().uuidString, name: "name") let savedTeam = try await mutate(.create(team)) - + // Project initializer variation #1 (pass both team reference and fields in) - let project = Project(projectId: UUID().uuidString, - name: "name", - team: team, - project2TeamTeamId: team.teamId, - project2TeamName: team.name) + let project = Project( + projectId: UUID().uuidString, + name: "name", + team: team, + project2TeamTeamId: team.teamId, + project2TeamName: team.name + ) let savedProject = try await mutate(.create(project)) let queriedProject = try await query(for: savedProject)! try await assertProject(queriedProject, hasTeam: savedTeam) - + // Project initializer variation #2 (pass only team reference) - let project2 = Project(projectId: UUID().uuidString, - name: "name", - team: team) + let project2 = Project( + projectId: UUID().uuidString, + name: "name", + team: team + ) let savedProject2 = try await mutate(.create(project2)) let queriedProject2 = try await query(for: savedProject2)! try await assertProject(queriedProject2, hasTeam: savedTeam) - + // Project initializer variation #3 (pass fields in) - let project3 = Project(projectId: UUID().uuidString, - name: "name", - project2TeamTeamId: team.teamId, - project2TeamName: team.name) + let project3 = Project( + projectId: UUID().uuidString, + name: "name", + project2TeamTeamId: team.teamId, + project2TeamName: team.name + ) let savedProject3 = try await mutate(.create(project3)) let queriedProject3 = try await query(for: savedProject3)! try await assertProject(queriedProject3, hasTeam: savedTeam) } - + func assertProject(_ project: Project, hasTeam team: Team) async throws { XCTAssertEqual(project.project2TeamTeamId, team.teamId) XCTAssertEqual(project.project2TeamName, team.name) - assertLazyReference(project._team, state: .notLoaded(identifiers: [.init(name: "teamId", value: team.teamId), - .init(name: "name", value: team.name)])) - + assertLazyReference(project._team, state: .notLoaded(identifiers: [ + .init(name: "teamId", value: team.teamId), + .init(name: "name", value: team.name) + ])) + let loadedTeam = try await project.team! XCTAssertEqual(loadedTeam.teamId, team.teamId) } - + func assertProjectDoesNotContainTeam(_ project: Project) { XCTAssertNil(project.project2TeamTeamId) XCTAssertNil(project.project2TeamName) assertLazyReference(project._team, state: .notLoaded(identifiers: nil)) } - + func testIncludesNestedModels() async throws { await setup(withModels: ProjectTeam2Models()) let team = Team(teamId: UUID().uuidString, name: "name") try await mutate(.create(team)) let project = initializeProjectWithTeam(team) try await mutate(.create(project)) - - guard let queriedProject = try await query(.get(Project.self, - byIdentifier: .identifier(projectId: project.projectId, - name: project.name), - includes: { project in [project.team]})) else { + + guard let queriedProject = try await query(.get( + Project.self, + byIdentifier: .identifier( + projectId: project.projectId, + name: project.name + ), + includes: { project in [project.team]} + )) else { XCTFail("Could not perform nested query for Project") return } - + assertLazyReference(queriedProject._team, state: .loaded(model: team)) } - + func testListProjectListTeam() async throws { await setup(withModels: ProjectTeam2Models()) let team = Team(teamId: UUID().uuidString, name: "name") try await mutate(.create(team)) let project = initializeProjectWithTeam(team) try await mutate(.create(project)) - + let queriedProjects = try await listQuery(.list(Project.self, where: Project.keys.projectId == project.projectId)) assertList(queriedProjects, state: .isLoaded(count: 1)) assertLazyReference(queriedProjects.first!._team, state: .notLoaded(identifiers: [ .init(name: "teamId", value: team.teamId), - .init(name: "name", value: team.name)])) - + .init(name: "name", value: team.name) + ])) + let queriedTeams = try await listQuery(.list(Team.self, where: Team.keys.teamId == team.teamId)) assertList(queriedTeams, state: .isLoaded(count: 1)) } - + func testSaveProjectWithTeamThenUpdate() async throws { await setup(withModels: ProjectTeam2Models()) let team = Team(teamId: UUID().uuidString, name: "name") let savedTeam = try await mutate(.create(team)) - + let project = initializeProjectWithTeam(team) let savedProject = try await mutate(.create(project)) try await assertProject(savedProject, hasTeam: savedTeam) @@ -127,13 +142,13 @@ class GraphQLLazyLoadProjectTeam2Tests: GraphQLLazyLoadBaseTest { let updatedProject = try await mutate(.update(project)) try await assertProject(updatedProject, hasTeam: savedTeam) } - + func testSaveProjectWithoutTeamUpdateProjectWithTeam() async throws { await setup(withModels: ProjectTeam2Models()) let project = Project(projectId: UUID().uuidString, name: "name") let savedProject = try await mutate(.create(project)) assertProjectDoesNotContainTeam(savedProject) - + let team = Team(teamId: UUID().uuidString, name: "name") let savedTeam = try await mutate(.create(team)) var queriedProject = try await query(for: savedProject)! @@ -144,7 +159,7 @@ class GraphQLLazyLoadProjectTeam2Tests: GraphQLLazyLoadBaseTest { let savedProjectWithNewTeam = try await mutate(.update(queriedProject)) try await assertProject(savedProjectWithNewTeam, hasTeam: savedTeam) } - + func testSaveTeamSaveProjectWithTeamUpdateProjectToNoTeam() async throws { await setup(withModels: ProjectTeam2Models()) let team = Team(teamId: UUID().uuidString, name: "name") @@ -160,7 +175,7 @@ class GraphQLLazyLoadProjectTeam2Tests: GraphQLLazyLoadBaseTest { let savedProjectWithNoTeam = try await mutate(.update(queriedProject)) assertProjectDoesNotContainTeam(savedProjectWithNoTeam) } - + func testSaveProjectWithTeamUpdateProjectToNewTeam() async throws { await setup(withModels: ProjectTeam2Models()) let team = Team(teamId: UUID().uuidString, name: "name") @@ -178,7 +193,7 @@ class GraphQLLazyLoadProjectTeam2Tests: GraphQLLazyLoadBaseTest { let savedProjectWithNewTeam = try await mutate(.update(queriedProject)) try await assertProject(savedProjectWithNewTeam, hasTeam: savedNewTeam) } - + func testDeleteTeam() async throws { await setup(withModels: ProjectTeam2Models()) let team = Team(teamId: UUID().uuidString, name: "name") @@ -187,7 +202,7 @@ class GraphQLLazyLoadProjectTeam2Tests: GraphQLLazyLoadBaseTest { try await mutate(.delete(savedTeam)) try await assertModelDoesNotExist(savedTeam) } - + func testDeleteProject() async throws { await setup(withModels: ProjectTeam2Models()) let project = Project(projectId: UUID().uuidString, name: "name") @@ -196,22 +211,22 @@ class GraphQLLazyLoadProjectTeam2Tests: GraphQLLazyLoadBaseTest { try await mutate(.delete(savedProject)) try await assertModelDoesNotExist(savedProject) } - + func testDeleteProjectWithTeam() async throws { await setup(withModels: ProjectTeam2Models()) let team = Team(teamId: UUID().uuidString, name: "name") let savedTeam = try await mutate(.create(team)) let project = initializeProjectWithTeam(team) let savedProject = try await mutate(.create(project)) - + try await assertModelExists(savedProject) try await assertModelExists(savedTeam) - + try await mutate(.delete(savedProject)) - + try await assertModelDoesNotExist(savedProject) try await assertModelExists(savedTeam) - + try await mutate(.delete(savedTeam)) try await assertModelDoesNotExist(savedTeam) } @@ -220,10 +235,10 @@ class GraphQLLazyLoadProjectTeam2Tests: GraphQLLazyLoadBaseTest { extension GraphQLLazyLoadProjectTeam2Tests: DefaultLogger { } extension GraphQLLazyLoadProjectTeam2Tests { - + typealias Project = Project2 typealias Team = Team2 - + struct ProjectTeam2Models: AmplifyModelRegistration { public let version: String = "version" func registerModels(registry: ModelRegistry.Type) { @@ -231,12 +246,14 @@ extension GraphQLLazyLoadProjectTeam2Tests { ModelRegistry.register(modelType: Team2.self) } } - + func initializeProjectWithTeam(_ team: Team) -> Project { - return Project(projectId: UUID().uuidString, - name: "name", - team: team, - project2TeamTeamId: team.teamId, - project2TeamName: team.name) + return Project( + projectId: UUID().uuidString, + name: "name", + team: team, + project2TeamTeamId: team.teamId, + project2TeamName: team.name + ) } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL6/Project2+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL6/Project2+Schema.swift index 79361d58a5..4d90db0806 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL6/Project2+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL6/Project2+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Project2 { +public extension Project2 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case projectId case name case team @@ -14,10 +21,10 @@ extension Project2 { case project2TeamName } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self // MARK: - ModelSchema - public static let schema = defineSchema { model in + static let schema = defineSchema { model in let project2 = Project2.keys model.pluralName = "Project2s" @@ -37,10 +44,10 @@ extension Project2 { .field(project2.project2TeamName, is: .optional, ofType: .string) ) } - - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Project2: ModelIdentifiable { @@ -48,10 +55,12 @@ extension Project2: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension Project2.IdentifierProtocol { - public static func identifier(projectId: String, - name: String) -> Self { - .make(fields:[(name: "projectId", value: projectId), (name: "name", value: name)]) +public extension Project2.IdentifierProtocol { + static func identifier( + projectId: String, + name: String + ) -> Self { + .make(fields: [(name: "projectId", value: projectId), (name: "name", value: name)]) } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL6/Project2.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL6/Project2.swift index e18996f773..298dc8449e 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL6/Project2.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL6/Project2.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,7 +12,7 @@ import Foundation public struct Project2: Model { public let projectId: String public let name: String - internal var _team: LazyReference + var _team: LazyReference public var team: Team2? { get async throws { try await _team.get() @@ -15,27 +22,33 @@ public struct Project2: Model { public var updatedAt: Temporal.DateTime? public var project2TeamTeamId: String? public var project2TeamName: String? - - public init(projectId: String, - name: String, - team: Team2? = nil, - project2TeamTeamId: String? = nil, - project2TeamName: String? = nil) { - self.init(projectId: projectId, - name: name, - team: team, - createdAt: nil, - updatedAt: nil, - project2TeamTeamId: project2TeamTeamId, - project2TeamName: project2TeamName) + + public init( + projectId: String, + name: String, + team: Team2? = nil, + project2TeamTeamId: String? = nil, + project2TeamName: String? = nil + ) { + self.init( + projectId: projectId, + name: name, + team: team, + createdAt: nil, + updatedAt: nil, + project2TeamTeamId: project2TeamTeamId, + project2TeamName: project2TeamName + ) } - internal init(projectId: String, - name: String, - team: Team2? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil, - project2TeamTeamId: String? = nil, - project2TeamName: String? = nil) { + init( + projectId: String, + name: String, + team: Team2? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil, + project2TeamTeamId: String? = nil, + project2TeamName: String? = nil + ) { self.projectId = projectId self.name = name self._team = LazyReference(team) @@ -45,17 +58,17 @@ public struct Project2: Model { self.project2TeamName = project2TeamName } public mutating func setTeam(_ team: Team2? = nil) { - self._team = LazyReference(team) + _team = LazyReference(team) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - projectId = try values.decode(String.self, forKey: .projectId) - name = try values.decode(String.self, forKey: .name) - _team = try values.decodeIfPresent(LazyReference.self, forKey: .team) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) - project2TeamTeamId = try? values.decode(String?.self, forKey: .project2TeamTeamId) - project2TeamName = try? values.decode(String?.self, forKey: .project2TeamName) + self.projectId = try values.decode(String.self, forKey: .projectId) + self.name = try values.decode(String.self, forKey: .name) + self._team = try values.decodeIfPresent(LazyReference.self, forKey: .team) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.project2TeamTeamId = try? values.decode(String?.self, forKey: .project2TeamTeamId) + self.project2TeamName = try? values.decode(String?.self, forKey: .project2TeamName) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL6/Team2+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL6/Team2+Schema.swift index 58ae64d03a..bcb5656050 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL6/Team2+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL6/Team2+Schema.swift @@ -1,29 +1,36 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Team2 { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Team2 { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case teamId case name case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let team2 = Team2.keys - + model.pluralName = "Team2s" - + model.attributes( .index(fields: ["teamId", "name"], name: nil), .primaryKey(fields: [team2.teamId, team2.name]) ) - + model.fields( .field(team2.teamId, is: .required, ofType: .string), .field(team2.name, is: .required, ofType: .string), @@ -31,10 +38,10 @@ extension Team2 { .field(team2.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Team2: ModelIdentifiable { @@ -42,10 +49,12 @@ extension Team2: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension Team2.IdentifierProtocol { - public static func identifier(teamId: String, - name: String) -> Self { - .make(fields:[(name: "teamId", value: teamId), (name: "name", value: name)]) +public extension Team2.IdentifierProtocol { + static func identifier( + teamId: String, + name: String + ) -> Self { + .make(fields: [(name: "teamId", value: teamId), (name: "name", value: name)]) } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL6/Team2.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL6/Team2.swift index 90d68caa79..f58e821d6e 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL6/Team2.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL6/Team2.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -7,21 +14,27 @@ public struct Team2: Model { public let name: String public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(teamId: String, - name: String) { - self.init(teamId: teamId, + + public init( + teamId: String, + name: String + ) { + self.init( + teamId: teamId, name: name, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(teamId: String, - name: String, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + teamId: String, + name: String, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.teamId = teamId self.name = name self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL7/Comment4+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL7/Comment4+Schema.swift index 0c2cc0b6bb..421e5b158c 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL7/Comment4+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL7/Comment4+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Comment4 { +public extension Comment4 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case commentId case content case createdAt @@ -12,20 +19,20 @@ extension Comment4 { case post4CommentsPostId case post4CommentsTitle } - - public static let keys = CodingKeys.self + + static let keys = CodingKeys.self // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let schema = defineSchema { model in let comment4 = Comment4.keys - + model.pluralName = "Comment4s" - + model.attributes( .index(fields: ["commentId", "content"], name: nil), .primaryKey(fields: [comment4.commentId, comment4.content]) ) - + model.fields( .field(comment4.commentId, is: .required, ofType: .string), .field(comment4.content, is: .required, ofType: .string), @@ -35,9 +42,9 @@ extension Comment4 { .field(comment4.post4CommentsTitle, is: .optional, ofType: .string) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Comment4: ModelIdentifiable { @@ -45,29 +52,31 @@ extension Comment4: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension Comment4.IdentifierProtocol { - public static func identifier(commentId: String, - content: String) -> Self { - .make(fields:[(name: "commentId", value: commentId), (name: "content", value: content)]) +public extension Comment4.IdentifierProtocol { + static func identifier( + commentId: String, + content: String + ) -> Self { + .make(fields: [(name: "commentId", value: commentId), (name: "content", value: content)]) } } -extension ModelPath where ModelType == Comment4 { - public var commentId: FieldPath { +public extension ModelPath where ModelType == Comment4 { + var commentId: FieldPath { string("commentId") } - public var content: FieldPath { + var content: FieldPath { string("content") } - public var createdAt: FieldPath { + var createdAt: FieldPath { datetime("createdAt") } - public var updatedAt: FieldPath { + var updatedAt: FieldPath { datetime("updatedAt") } - public var post4CommentsPostId: FieldPath { + var post4CommentsPostId: FieldPath { string("post4CommentsPostId") } - public var post4CommentsTitle: FieldPath { + var post4CommentsTitle: FieldPath { string("post4CommentsTitle") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL7/Comment4.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL7/Comment4.swift index 8e9cc84bce..593b1efc60 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL7/Comment4.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL7/Comment4.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -9,24 +16,30 @@ public struct Comment4: Model { public var updatedAt: Temporal.DateTime? public var post4CommentsPostId: String? public var post4CommentsTitle: String? - - public init(commentId: String, - content: String, - post4CommentsPostId: String? = nil, - post4CommentsTitle: String? = nil) { - self.init(commentId: commentId, + + public init( + commentId: String, + content: String, + post4CommentsPostId: String? = nil, + post4CommentsTitle: String? = nil + ) { + self.init( + commentId: commentId, content: content, createdAt: nil, updatedAt: nil, post4CommentsPostId: post4CommentsPostId, - post4CommentsTitle: post4CommentsTitle) + post4CommentsTitle: post4CommentsTitle + ) } - internal init(commentId: String, - content: String, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil, - post4CommentsPostId: String? = nil, - post4CommentsTitle: String? = nil) { + init( + commentId: String, + content: String, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil, + post4CommentsPostId: String? = nil, + post4CommentsTitle: String? = nil + ) { self.commentId = commentId self.content = content self.createdAt = createdAt diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL7/GraphQLLazyLoadPostComment4Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL7/GraphQLLazyLoadPostComment4Tests.swift index 4743a822f9..4fde13229e 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL7/GraphQLLazyLoadPostComment4Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL7/GraphQLLazyLoadPostComment4Tests.swift @@ -5,12 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Combine +import Foundation import XCTest -@testable import Amplify import AWSPluginsCore +@testable import Amplify final class GraphQLLazyLoadPostComment4Tests: GraphQLLazyLoadBaseTest { @@ -21,7 +21,7 @@ final class GraphQLLazyLoadPostComment4Tests: GraphQLLazyLoadBaseTest { try await mutate(.create(post)) try await mutate(.create(comment)) } - + // Without `includes` and latest codegenerated types with the model path, the post should be lazy loaded func testCommentWithLazyLoadPost() async throws { await setup(withModels: PostComment4Models()) @@ -29,21 +29,23 @@ final class GraphQLLazyLoadPostComment4Tests: GraphQLLazyLoadBaseTest { let comment = Comment(content: "content", post: post) let createdPost = try await mutate(.create(post)) let createdComment = try await mutate(.create(comment)) - + XCTAssertEqual(createdComment.post4CommentsPostId, post.postId) XCTAssertEqual(createdComment.post4CommentsTitle, post.title) - + // The created post should have comments that are also not loaded let comments = createdPost.comments! - assertList(comments, state: .isNotLoaded(associatedIdentifiers: [createdPost.postId, createdPost.title], - associatedFields: ["post4CommentsPostId", "post4CommentsTitle"])) + assertList(comments, state: .isNotLoaded( + associatedIdentifiers: [createdPost.postId, createdPost.title], + associatedFields: ["post4CommentsPostId", "post4CommentsTitle"] + )) // load the comments try await comments.fetch() assertList(comments, state: .isLoaded(count: 1)) XCTAssertEqual(comments.first!.post4CommentsPostId, post.postId) XCTAssertEqual(comments.first!.post4CommentsTitle, post.title) } - + // Without `includes` and latest codegenerated types with the model path, the post's comments should be lazy loaded func testPostWithLazyLoadComments() async throws { await setup(withModels: PostComment4Models()) @@ -53,14 +55,16 @@ final class GraphQLLazyLoadPostComment4Tests: GraphQLLazyLoadBaseTest { _ = try await mutate(.create(comment)) let queriedPost = try await query(.get(Post.self, byIdentifier: .identifier(postId: post.postId, title: post.title)))! let comments = queriedPost.comments! - assertList(comments, state: .isNotLoaded(associatedIdentifiers: [post.postId, post.title], - associatedFields: ["post4CommentsPostId", "post4CommentsTitle"])) + assertList(comments, state: .isNotLoaded( + associatedIdentifiers: [post.postId, post.title], + associatedFields: ["post4CommentsPostId", "post4CommentsTitle"] + )) try await comments.fetch() assertList(comments, state: .isLoaded(count: 1)) XCTAssertEqual(comments.first!.post4CommentsPostId, post.postId) XCTAssertEqual(comments.first!.post4CommentsTitle, post.title) } - + // With `includes` on `post.comments` should eager load the post's comments func testPostWithEagerLoadComments() async throws { await setup(withModels: PostComment4Models()) @@ -74,26 +78,30 @@ final class GraphQLLazyLoadPostComment4Tests: GraphQLLazyLoadBaseTest { XCTAssertEqual(comments.first!.post4CommentsPostId, post.postId) XCTAssertEqual(comments.first!.post4CommentsTitle, post.title) } - + func testListPostsListComments() async throws { await setup(withModels: PostComment4Models()) let post = Post(title: "title") let comment = Comment(content: "content", post: post) _ = try await mutate(.create(post)) _ = try await mutate(.create(comment)) - + let queriedPosts = try await listQuery(.list(Post.self, where: Post.keys.postId == post.postId)) assertList(queriedPosts, state: .isLoaded(count: 1)) - assertList(queriedPosts.first!.comments!, - state: .isNotLoaded(associatedIdentifiers: [post.postId, post.title], - associatedFields: ["post4CommentsPostId", "post4CommentsTitle"])) - + assertList( + queriedPosts.first!.comments!, + state: .isNotLoaded( + associatedIdentifiers: [post.postId, post.title], + associatedFields: ["post4CommentsPostId", "post4CommentsTitle"] + ) + ) + let queriedComments = try await listQuery(.list(Comment.self, where: Comment.keys.commentId == comment.commentId)) assertList(queriedComments, state: .isLoaded(count: 1)) XCTAssertEqual(queriedComments.first!.post4CommentsPostId, post.postId) XCTAssertEqual(queriedComments.first!.post4CommentsTitle, post.title) } - + func testCreateWithoutPost() async throws { await setup(withModels: PostComment4Models()) let comment = Comment(content: "content") @@ -110,15 +118,17 @@ final class GraphQLLazyLoadPostComment4Tests: GraphQLLazyLoadBaseTest { XCTAssertEqual(queriedCommentAfterUpdate.post4CommentsPostId, post.postId) XCTAssertEqual(queriedCommentAfterUpdate.post4CommentsTitle, post.title) } - + func testUpdateToNewPost() async throws { await setup(withModels: PostComment4Models()) let post = Post(title: "title") let comment = Comment(content: "content", post: post) try await mutate(.create(post)) try await mutate(.create(comment)) - var queriedComment = try await query(.get(Comment.self, byIdentifier: .identifier(commentId: comment.commentId, - content: comment.content)))! + var queriedComment = try await query(.get(Comment.self, byIdentifier: .identifier( + commentId: comment.commentId, + content: comment.content + )))! XCTAssertEqual(queriedComment.post4CommentsPostId, post.postId) XCTAssertEqual(queriedComment.post4CommentsTitle, post.title) let newPost = Post(title: "title") @@ -130,7 +140,7 @@ final class GraphQLLazyLoadPostComment4Tests: GraphQLLazyLoadBaseTest { XCTAssertEqual(queriedCommentAfterUpdate.post4CommentsPostId, newPost.postId) XCTAssertEqual(queriedCommentAfterUpdate.post4CommentsTitle, newPost.title) } - + func testUpdateRemovePost() async throws { await setup(withModels: PostComment4Models()) let post = Post(title: "title") @@ -140,7 +150,7 @@ final class GraphQLLazyLoadPostComment4Tests: GraphQLLazyLoadBaseTest { var queriedComment = try await query(for: comment)! XCTAssertEqual(queriedComment.post4CommentsPostId, post.postId) XCTAssertEqual(queriedComment.post4CommentsTitle, post.title) - + queriedComment.post4CommentsPostId = nil queriedComment.post4CommentsTitle = nil let updateCommentRemovePost = try await mutate(.update(queriedComment)) @@ -148,14 +158,14 @@ final class GraphQLLazyLoadPostComment4Tests: GraphQLLazyLoadBaseTest { XCTAssertEqual(queriedCommentAfterUpdate.post4CommentsPostId, nil) XCTAssertEqual(queriedCommentAfterUpdate.post4CommentsTitle, nil) } - + func testDelete() async throws { await setup(withModels: PostComment4Models()) let post = Post(title: "title") let comment = Comment(content: "content", post: post) let createdPost = try await mutate(.create(post)) try await mutate(.create(comment)) - + try await mutate(.delete(createdPost)) let queriedPost = try await query(for: post) XCTAssertNil(queriedPost) @@ -166,7 +176,7 @@ final class GraphQLLazyLoadPostComment4Tests: GraphQLLazyLoadBaseTest { let queryDeletedComment = try await query(for: comment) XCTAssertNil(queryDeletedComment) } - + func testSubscribeToComments() async throws { await setup(withModels: PostComment4Models()) let post = Post(title: "title") @@ -199,18 +209,18 @@ final class GraphQLLazyLoadPostComment4Tests: GraphQLLazyLoadBaseTest { XCTFail("Subscription has terminated with \(error)") } } - + await fulfillment(of: [connected], timeout: 10) let comment = Comment(content: "content", post: post) try await mutate(.create(comment)) await fulfillment(of: [onCreatedComment], timeout: 10) subscription.cancel() } - + func testSubscribeToPosts() async throws { await setup(withModels: PostComment4Models()) let post = Post(title: "title") - + let connected = expectation(description: "subscription connected") let onCreatedPost = expectation(description: "onCreatedPost received") let subscription = Amplify.API.subscribe(request: .subscription(of: Post.self, type: .onCreate)) @@ -227,10 +237,16 @@ final class GraphQLLazyLoadPostComment4Tests: GraphQLLazyLoadBaseTest { switch result { case .success(let createdPost): log.verbose("Successfully got createdPost from subscription: \(createdPost)") - assertList(createdPost.comments!, state: .isNotLoaded(associatedIdentifiers: [post.postId, - post.title], - associatedFields: ["post4CommentsPostId", - "post4CommentsTitle"])) + assertList(createdPost.comments!, state: .isNotLoaded( + associatedIdentifiers: [ + post.postId, + post.title + ], + associatedFields: [ + "post4CommentsPostId", + "post4CommentsTitle" + ] + )) onCreatedPost.fulfill() case .failure(let error): XCTFail("Got failed result with \(error.errorDescription)") @@ -241,22 +257,24 @@ final class GraphQLLazyLoadPostComment4Tests: GraphQLLazyLoadBaseTest { XCTFail("Subscription has terminated with \(error)") } } - + await fulfillment(of: [connected], timeout: 10) try await mutate(.create(post)) await fulfillment(of: [onCreatedPost], timeout: 10) subscription.cancel() } - + func testSubscribeToPostsIncludes() async throws { await setup(withModels: PostComment4Models()) let post = Post(title: "title") - + let connected = expectation(description: "subscription connected") let onCreatedPost = expectation(description: "onCreatedPost received") - let subscriptionIncludes = Amplify.API.subscribe(request: .subscription(of: Post.self, - type: .onCreate, - includes: { post in [post.comments]})) + let subscriptionIncludes = Amplify.API.subscribe(request: .subscription( + of: Post.self, + type: .onCreate, + includes: { post in [post.comments]} + )) Task { do { for try await subscriptionEvent in subscriptionIncludes { @@ -281,7 +299,7 @@ final class GraphQLLazyLoadPostComment4Tests: GraphQLLazyLoadBaseTest { XCTFail("Subscription has terminated with \(error)") } } - + await fulfillment(of: [connected], timeout: 10) try await mutate(.create(post, includes: { post in [post.comments]})) await fulfillment(of: [onCreatedPost], timeout: 10) @@ -294,7 +312,7 @@ extension GraphQLLazyLoadPostComment4Tests: DefaultLogger { } extension GraphQLLazyLoadPostComment4Tests { typealias Post = Post4 typealias Comment = Comment4 - + struct PostComment4Models: AmplifyModelRegistration { public let version: String = "version" func registerModels(registry: ModelRegistry.Type) { @@ -311,11 +329,15 @@ extension Post4 { } extension Comment4 { - init(content: String, - post: Post4? = nil) { - self.init(commentId: UUID().uuidString, - content: content, - post4CommentsPostId: post?.postId, - post4CommentsTitle: post?.title) + init( + content: String, + post: Post4? = nil + ) { + self.init( + commentId: UUID().uuidString, + content: content, + post4CommentsPostId: post?.postId, + post4CommentsTitle: post?.title + ) } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL7/Post4+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL7/Post4+Schema.swift index fa09945d0d..c2d1b4f3bb 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL7/Post4+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL7/Post4+Schema.swift @@ -1,30 +1,37 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Post4 { +public extension Post4 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case postId case title case comments case createdAt case updatedAt } - - public static let keys = CodingKeys.self + + static let keys = CodingKeys.self // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let schema = defineSchema { model in let post4 = Post4.keys - + model.pluralName = "Post4s" - + model.attributes( .index(fields: ["postId", "title"], name: nil), .primaryKey(fields: [post4.postId, post4.title]) ) - + model.fields( .field(post4.postId, is: .required, ofType: .string), .field(post4.title, is: .required, ofType: .string), @@ -33,9 +40,9 @@ extension Post4 { .field(post4.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Post4: ModelIdentifiable { @@ -43,26 +50,28 @@ extension Post4: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension Post4.IdentifierProtocol { - public static func identifier(postId: String, - title: String) -> Self { - .make(fields:[(name: "postId", value: postId), (name: "title", value: title)]) +public extension Post4.IdentifierProtocol { + static func identifier( + postId: String, + title: String + ) -> Self { + .make(fields: [(name: "postId", value: postId), (name: "title", value: title)]) } } -extension ModelPath where ModelType == Post4 { - public var postId: FieldPath { +public extension ModelPath where ModelType == Post4 { + var postId: FieldPath { string("postId") } - public var title: FieldPath { + var title: FieldPath { string("title") } - public var comments: ModelPath { + var comments: ModelPath { Comment4.Path(name: "comments", isCollection: true, parent: self) } - public var createdAt: FieldPath { + var createdAt: FieldPath { datetime("createdAt") } - public var updatedAt: FieldPath { + var updatedAt: FieldPath { datetime("updatedAt") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL7/Post4.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL7/Post4.swift index a50849704b..1d08640c37 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL7/Post4.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL7/Post4.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -8,25 +15,31 @@ public struct Post4: Model { public var comments: List? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(postId: String, - title: String, - comments: List? = []) { - self.init(postId: postId, + + public init( + postId: String, + title: String, + comments: List? = [] + ) { + self.init( + postId: postId, title: title, comments: comments, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(postId: String, - title: String, - comments: List? = [], - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + postId: String, + title: String, + comments: List? = [], + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.postId = postId self.title = title self.comments = comments self.createdAt = createdAt self.updatedAt = updatedAt } -} \ No newline at end of file +} diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL8/GraphQLLazyLoadProjectTeam5Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL8/GraphQLLazyLoadProjectTeam5Tests.swift index d6fc3c3de6..d6f81a79d7 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL8/GraphQLLazyLoadProjectTeam5Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL8/GraphQLLazyLoadProjectTeam5Tests.swift @@ -5,64 +5,72 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Combine +import Foundation import XCTest -@testable import Amplify import AWSPluginsCore +@testable import Amplify class GraphQLLazyLoadProjectTeam5Tests: GraphQLLazyLoadBaseTest { - + func testSaveTeam() async throws { await setup(withModels: ProjectTeam5Models()) let team = Team(teamId: UUID().uuidString, name: "name") let savedTeam = try await mutate(.create(team)) try await assertModelExists(savedTeam) } - + func testSaveProject() async throws { await setup(withModels: ProjectTeam5Models()) - let project = Project(projectId: UUID().uuidString, - name: "name") + let project = Project( + projectId: UUID().uuidString, + name: "name" + ) let savedProject = try await mutate(.create(project)) try await assertModelExists(savedProject) assertProjectDoesNotContainTeam(savedProject) } - + func testSaveProjectWithTeam() async throws { await setup(withModels: ProjectTeam5Models()) let team = Team(teamId: UUID().uuidString, name: "name") let savedTeam = try await mutate(.create(team)) - + // Project initializer variation #1 (pass both team reference and fields in) - let project = Project(projectId: UUID().uuidString, - name: "name", - team: team, - teamId: team.teamId, - teamName: team.name) + let project = Project( + projectId: UUID().uuidString, + name: "name", + team: team, + teamId: team.teamId, + teamName: team.name + ) let savedProject = try await mutate(.create(project)) let queriedProject = try await query(for: savedProject)! assertProject(queriedProject, hasTeam: savedTeam) - + // Project initializer variation #2 (pass only team reference) - let project2 = Project(projectId: UUID().uuidString, - name: "name", - team: team) + let project2 = Project( + projectId: UUID().uuidString, + name: "name", + team: team + ) let savedProject2 = try await mutate(.create(project2)) let queriedProject2 = try await query(for: savedProject2)! assertProject(queriedProject2, hasTeam: savedTeam) - + // Project initializer variation #3 (pass fields in) - let project3 = Project(projectId: UUID().uuidString, - name: "name", - teamId: team.teamId, - teamName: team.name) + let project3 = Project( + projectId: UUID().uuidString, + name: "name", + teamId: team.teamId, + teamName: team.name + ) let savedProject3 = try await mutate(.create(project3)) let queriedProject3 = try await query(for: savedProject3)! assertProject(queriedProject3, hasTeam: savedTeam) } - + // One-to-One relationships do not create a foreign key for the Team or Project table // So the LazyModel does not have the FK value to be instantiated as metadata for lazy loading. // We only assert the FK fields on the Project exist and are equal to the Team's PK. @@ -70,78 +78,94 @@ class GraphQLLazyLoadProjectTeam5Tests: GraphQLLazyLoadBaseTest { XCTAssertEqual(project.teamId, team.teamId) XCTAssertEqual(project.teamName, team.name) } - + func assertProjectDoesNotContainTeam(_ project: Project) { XCTAssertNil(project.teamId) XCTAssertNil(project.teamName) } - + func testIncludesNestedModels() async throws { await setup(withModels: ProjectTeam5Models()) let team = Team(teamId: UUID().uuidString, name: "name") var savedTeam = try await mutate(.create(team)) - let project = Project(projectId: UUID().uuidString, - name: "name", - team: team, - teamId: team.teamId, - teamName: team.name) + let project = Project( + projectId: UUID().uuidString, + name: "name", + team: team, + teamId: team.teamId, + teamName: team.name + ) let savedProject = try await mutate(.create(project)) savedTeam.setProject(savedProject) try await mutate(.update(savedTeam)) - - guard let queriedTeam = try await query(.get(Team.self, - byIdentifier: .identifier(teamId: team.teamId, - name: team.name), - includes: { team in [team.project]})) else { + + guard let queriedTeam = try await query(.get( + Team.self, + byIdentifier: .identifier( + teamId: team.teamId, + name: team.name + ), + includes: { team in [team.project]} + )) else { XCTFail("Could not perform nested query for Team") return } - + assertLazyReference(queriedTeam._project, state: .loaded(model: project)) - - guard let queriedProject = try await query(.get(Project.self, - byIdentifier: .identifier(projectId: project.projectId, - name: project.name), - includes: { project in [project.team]})) else { + + guard let queriedProject = try await query(.get( + Project.self, + byIdentifier: .identifier( + projectId: project.projectId, + name: project.name + ), + includes: { project in [project.team]} + )) else { XCTFail("Could not perform nested query for Project") return } - + assertLazyReference(queriedProject._team, state: .loaded(model: team)) } - + func testListProjectListTeam() async throws { await setup(withModels: ProjectTeam5Models()) let team = Team(teamId: UUID().uuidString, name: "name") var savedTeam = try await mutate(.create(team)) - let project = Project(projectId: UUID().uuidString, - name: "name", - team: team, - teamId: team.teamId, - teamName: team.name) + let project = Project( + projectId: UUID().uuidString, + name: "name", + team: team, + teamId: team.teamId, + teamName: team.name + ) let savedProject = try await mutate(.create(project)) savedTeam.setProject(savedProject) try await mutate(.update(savedTeam)) - + let queriedProjects = try await listQuery(.list(Project.self, where: Project.keys.projectId == project.projectId)) assertList(queriedProjects, state: .isLoaded(count: 1)) assertLazyReference(queriedProjects.first!._team, state: .notLoaded(identifiers: [ .init(name: "teamId", value: team.teamId), - .init(name: "name", value: team.name)])) - + .init(name: "name", value: team.name) + ])) + let queriedTeams = try await listQuery(.list(Team.self, where: Team.keys.teamId == team.teamId)) assertList(queriedTeams, state: .isLoaded(count: 1)) - assertLazyReference(queriedTeams.first!._project, - state: .notLoaded(identifiers: [ - .init(name: "projectId", value: project.projectId), - .init(name: "name", value: project.name)])) + assertLazyReference( + queriedTeams.first!._project, + state: .notLoaded(identifiers: [ + .init(name: "projectId", value: project.projectId), + .init(name: "name", value: project.name) + ]) + ) } - + func testSaveProjectWithTeamThenUpdate() async throws { await setup(withModels: ProjectTeam5Models()) let team = Team(teamId: UUID().uuidString, name: "name") let savedTeam = try await mutate(.create(team)) - + let project = initializeProjectWithTeam(team) let savedProject = try await mutate(.create(project)) assertProject(savedProject, hasTeam: savedTeam) @@ -150,13 +174,13 @@ class GraphQLLazyLoadProjectTeam5Tests: GraphQLLazyLoadBaseTest { let updatedProject = try await mutate(.update(project)) assertProject(updatedProject, hasTeam: savedTeam) } - + func testSaveProjectWithoutTeamUpdateProjectWithTeam() async throws { await setup(withModels: ProjectTeam5Models()) let project = Project(projectId: UUID().uuidString, name: "name") let savedProject = try await mutate(.create(project)) assertProjectDoesNotContainTeam(savedProject) - + let team = Team(teamId: UUID().uuidString, name: "name") let savedTeam = try await mutate(.create(team)) var queriedProject = try await query(for: savedProject)! @@ -164,7 +188,7 @@ class GraphQLLazyLoadProjectTeam5Tests: GraphQLLazyLoadBaseTest { let savedProjectWithNewTeam = try await mutate(.update(queriedProject)) assertProject(savedProjectWithNewTeam, hasTeam: savedTeam) } - + func testSaveTeamSaveProjectWithTeamUpdateProjectToNoTeam() async throws { await setup(withModels: ProjectTeam5Models()) let team = Team(teamId: UUID().uuidString, name: "name") @@ -177,7 +201,7 @@ class GraphQLLazyLoadProjectTeam5Tests: GraphQLLazyLoadBaseTest { let savedProjectWithNoTeam = try await mutate(.update(queriedProject)) assertProjectDoesNotContainTeam(savedProjectWithNoTeam) } - + func testSaveProjectWithTeamUpdateProjectToNewTeam() async throws { await setup(withModels: ProjectTeam5Models()) let team = Team(teamId: UUID().uuidString, name: "name") @@ -192,7 +216,7 @@ class GraphQLLazyLoadProjectTeam5Tests: GraphQLLazyLoadBaseTest { let savedProjectWithNewTeam = try await mutate(.update(queriedProject)) assertProject(savedProjectWithNewTeam, hasTeam: savedNewTeam) } - + func testDeleteTeam() async throws { await setup(withModels: ProjectTeam5Models()) let team = Team(teamId: UUID().uuidString, name: "name") @@ -201,7 +225,7 @@ class GraphQLLazyLoadProjectTeam5Tests: GraphQLLazyLoadBaseTest { try await mutate(.delete(savedTeam)) try await assertModelDoesNotExist(savedTeam) } - + func testDeleteProject() async throws { await setup(withModels: ProjectTeam5Models()) let project = Project(projectId: UUID().uuidString, name: "name") @@ -210,30 +234,32 @@ class GraphQLLazyLoadProjectTeam5Tests: GraphQLLazyLoadBaseTest { try await mutate(.delete(savedProject)) try await assertModelDoesNotExist(savedProject) } - + func testDeleteProjectWithTeam() async throws { await setup(withModels: ProjectTeam5Models()) let team = Team(teamId: UUID().uuidString, name: "name") let savedTeam = try await mutate(.create(team)) - let project = Project(projectId: UUID().uuidString, - name: "name", - team: team, - teamId: team.teamId, - teamName: team.name) + let project = Project( + projectId: UUID().uuidString, + name: "name", + team: team, + teamId: team.teamId, + teamName: team.name + ) let savedProject = try await mutate(.create(project)) - + try await assertModelExists(savedProject) try await assertModelExists(savedTeam) - + try await mutate(.delete(savedProject)) - + try await assertModelDoesNotExist(savedProject) try await assertModelExists(savedTeam) - + try await mutate(.delete(savedTeam)) try await assertModelDoesNotExist(savedTeam) } - + func testSubscribeToTeam() async throws { await setup(withModels: ProjectTeam5Models()) let connected = expectation(description: "subscription connected") @@ -262,16 +288,16 @@ class GraphQLLazyLoadProjectTeam5Tests: GraphQLLazyLoadBaseTest { XCTFail("Subscription has terminated with \(error)") } } - + await fulfillment(of: [connected], timeout: 10) - + let team = Team(teamId: UUID().uuidString, name: "name") let savedTeam = try await mutate(.create(team)) _ = savedTeam await fulfillment(of: [onCreatedTeam], timeout: 10) subscription.cancel() } - + func testSubscribeProject() async throws { await setup(withModels: ProjectTeam5Models()) let connected = expectation(description: "subscription connected") @@ -300,11 +326,13 @@ class GraphQLLazyLoadProjectTeam5Tests: GraphQLLazyLoadBaseTest { XCTFail("Subscription has terminated with \(error)") } } - + await fulfillment(of: [connected], timeout: 10) - - let project = Project(projectId: UUID().uuidString, - name: "name") + + let project = Project( + projectId: UUID().uuidString, + name: "name" + ) let savedProject = try await mutate(.create(project)) _ = savedProject @@ -316,10 +344,10 @@ class GraphQLLazyLoadProjectTeam5Tests: GraphQLLazyLoadBaseTest { extension GraphQLLazyLoadProjectTeam5Tests: DefaultLogger { } extension GraphQLLazyLoadProjectTeam5Tests { - + typealias Project = Project5 typealias Team = Team5 - + struct ProjectTeam5Models: AmplifyModelRegistration { public let version: String = "version" func registerModels(registry: ModelRegistry.Type) { @@ -327,12 +355,14 @@ extension GraphQLLazyLoadProjectTeam5Tests { ModelRegistry.register(modelType: Team5.self) } } - + func initializeProjectWithTeam(_ team: Team) -> Project { - return Project(projectId: UUID().uuidString, - name: "name", - team: team, - teamId: team.teamId, - teamName: team.name) + return Project( + projectId: UUID().uuidString, + name: "name", + team: team, + teamId: team.teamId, + teamName: team.name + ) } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL8/Project5+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL8/Project5+Schema.swift index 16137a68f5..2874eefe08 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL8/Project5+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL8/Project5+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Project5 { +public extension Project5 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case projectId case name case team @@ -13,20 +20,20 @@ extension Project5 { case createdAt case updatedAt } - - public static let keys = CodingKeys.self + + static let keys = CodingKeys.self // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let schema = defineSchema { model in let project5 = Project5.keys - + model.pluralName = "Project5s" - + model.attributes( .index(fields: ["projectId", "name"], name: nil), .primaryKey(fields: [project5.projectId, project5.name]) ) - + model.fields( .field(project5.projectId, is: .required, ofType: .string), .field(project5.name, is: .required, ofType: .string), @@ -37,9 +44,9 @@ extension Project5 { .field(project5.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Project5: ModelIdentifiable { @@ -47,32 +54,34 @@ extension Project5: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension Project5.IdentifierProtocol { - public static func identifier(projectId: String, - name: String) -> Self { - .make(fields:[(name: "projectId", value: projectId), (name: "name", value: name)]) +public extension Project5.IdentifierProtocol { + static func identifier( + projectId: String, + name: String + ) -> Self { + .make(fields: [(name: "projectId", value: projectId), (name: "name", value: name)]) } } -extension ModelPath where ModelType == Project5 { - public var projectId: FieldPath { +public extension ModelPath where ModelType == Project5 { + var projectId: FieldPath { string("projectId") } - public var name: FieldPath { + var name: FieldPath { string("name") } - public var team: ModelPath { + var team: ModelPath { Team5.Path(name: "team", parent: self) } - public var teamId: FieldPath { + var teamId: FieldPath { string("teamId") } - public var teamName: FieldPath { + var teamName: FieldPath { string("teamName") } - public var createdAt: FieldPath { + var createdAt: FieldPath { datetime("createdAt") } - public var updatedAt: FieldPath { + var updatedAt: FieldPath { datetime("updatedAt") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL8/Project5.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL8/Project5.swift index 7dcf7a8e48..7a1f82a8bf 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL8/Project5.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL8/Project5.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,7 +12,7 @@ import Foundation public struct Project5: Model { public let projectId: String public let name: String - internal var _team: LazyReference + var _team: LazyReference public var team: Team5? { get async throws { try await _team.get() @@ -15,27 +22,33 @@ public struct Project5: Model { public var teamName: String? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(projectId: String, - name: String, - team: Team5? = nil, - teamId: String? = nil, - teamName: String? = nil) { - self.init(projectId: projectId, + + public init( + projectId: String, + name: String, + team: Team5? = nil, + teamId: String? = nil, + teamName: String? = nil + ) { + self.init( + projectId: projectId, name: name, team: team, teamId: teamId, teamName: teamName, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(projectId: String, - name: String, - team: Team5? = nil, - teamId: String? = nil, - teamName: String? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + projectId: String, + name: String, + team: Team5? = nil, + teamId: String? = nil, + teamName: String? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.projectId = projectId self.name = name self._team = LazyReference(team) @@ -45,17 +58,17 @@ public struct Project5: Model { self.updatedAt = updatedAt } public mutating func setTeam(_ team: Team5? = nil) { - self._team = LazyReference(team) + _team = LazyReference(team) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - projectId = try values.decode(String.self, forKey: .projectId) - name = try values.decode(String.self, forKey: .name) - _team = try values.decodeIfPresent(LazyReference.self, forKey: .team) ?? LazyReference(identifiers: nil) - teamId = try? values.decode(String?.self, forKey: .teamId) - teamName = try? values.decode(String?.self, forKey: .teamName) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.projectId = try values.decode(String.self, forKey: .projectId) + self.name = try values.decode(String.self, forKey: .name) + self._team = try values.decodeIfPresent(LazyReference.self, forKey: .team) ?? LazyReference(identifiers: nil) + self.teamId = try? values.decode(String?.self, forKey: .teamId) + self.teamName = try? values.decode(String?.self, forKey: .teamName) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL8/Team5+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL8/Team5+Schema.swift index e1f3f56c0d..3af6bcdc9c 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL8/Team5+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL8/Team5+Schema.swift @@ -1,30 +1,37 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Team5 { +public extension Team5 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case teamId case name case project case createdAt case updatedAt } - - public static let keys = CodingKeys.self + + static let keys = CodingKeys.self // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let schema = defineSchema { model in let team5 = Team5.keys - + model.pluralName = "Team5s" - + model.attributes( .index(fields: ["teamId", "name"], name: nil), .primaryKey(fields: [team5.teamId, team5.name]) ) - + model.fields( .field(team5.teamId, is: .required, ofType: .string), .field(team5.name, is: .required, ofType: .string), @@ -33,9 +40,9 @@ extension Team5 { .field(team5.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Team5: ModelIdentifiable { @@ -43,26 +50,28 @@ extension Team5: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension Team5.IdentifierProtocol { - public static func identifier(teamId: String, - name: String) -> Self { - .make(fields:[(name: "teamId", value: teamId), (name: "name", value: name)]) +public extension Team5.IdentifierProtocol { + static func identifier( + teamId: String, + name: String + ) -> Self { + .make(fields: [(name: "teamId", value: teamId), (name: "name", value: name)]) } } -extension ModelPath where ModelType == Team5 { - public var teamId: FieldPath { +public extension ModelPath where ModelType == Team5 { + var teamId: FieldPath { string("teamId") } - public var name: FieldPath { + var name: FieldPath { string("name") } - public var project: ModelPath { + var project: ModelPath { Project5.Path(name: "project", parent: self) } - public var createdAt: FieldPath { + var createdAt: FieldPath { datetime("createdAt") } - public var updatedAt: FieldPath { + var updatedAt: FieldPath { datetime("updatedAt") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL8/Team5.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL8/Team5.swift index a537b5305e..1dbd1fd397 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL8/Team5.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL8/Team5.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,7 +12,7 @@ import Foundation public struct Team5: Model { public let teamId: String public let name: String - internal var _project: LazyReference + var _project: LazyReference public var project: Project5? { get async throws { try await _project.get() @@ -13,21 +20,27 @@ public struct Team5: Model { } public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(teamId: String, - name: String, - project: Project5? = nil) { - self.init(teamId: teamId, + + public init( + teamId: String, + name: String, + project: Project5? = nil + ) { + self.init( + teamId: teamId, name: name, project: project, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(teamId: String, - name: String, - project: Project5? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + teamId: String, + name: String, + project: Project5? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.teamId = teamId self.name = name self._project = LazyReference(project) @@ -35,15 +48,15 @@ public struct Team5: Model { self.updatedAt = updatedAt } public mutating func setProject(_ project: Project5? = nil) { - self._project = LazyReference(project) + _project = LazyReference(project) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - teamId = try values.decode(String.self, forKey: .teamId) - name = try values.decode(String.self, forKey: .name) - _project = try values.decodeIfPresent(LazyReference.self, forKey: .project) ?? LazyReference(identifiers: nil) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.teamId = try values.decode(String.self, forKey: .teamId) + self.name = try values.decode(String.self, forKey: .name) + self._project = try values.decodeIfPresent(LazyReference.self, forKey: .project) ?? LazyReference(identifiers: nil) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL9/GraphQLLazyLoadProjectTeam6Tests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL9/GraphQLLazyLoadProjectTeam6Tests.swift index f3f89ae3b2..a047e1adf6 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL9/GraphQLLazyLoadProjectTeam6Tests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL9/GraphQLLazyLoadProjectTeam6Tests.swift @@ -5,64 +5,72 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Combine +import Foundation import XCTest -@testable import Amplify import AWSPluginsCore +@testable import Amplify class GraphQLLazyLoadProjectTeam6Tests: GraphQLLazyLoadBaseTest { - + func testSaveTeam() async throws { await setup(withModels: ProjectTeam6Models()) let team = Team(teamId: UUID().uuidString, name: "name") let savedTeam = try await mutate(.create(team)) try await assertModelExists(savedTeam) } - + func testSaveProject() async throws { await setup(withModels: ProjectTeam6Models()) - let project = Project(projectId: UUID().uuidString, - name: "name") + let project = Project( + projectId: UUID().uuidString, + name: "name" + ) let savedProject = try await mutate(.create(project)) try await assertModelExists(savedProject) assertProjectDoesNotContainTeam(savedProject) } - + func testSaveProjectWithTeam() async throws { await setup(withModels: ProjectTeam6Models()) let team = Team(teamId: UUID().uuidString, name: "name") let savedTeam = try await mutate(.create(team)) - + // Project initializer variation #1 (pass both team reference and fields in) - let project = Project(projectId: UUID().uuidString, - name: "name", - team: team, - teamId: team.teamId, - teamName: team.name) + let project = Project( + projectId: UUID().uuidString, + name: "name", + team: team, + teamId: team.teamId, + teamName: team.name + ) let savedProject = try await mutate(.create(project)) let queriedProject = try await query(for: savedProject)! assertProject(queriedProject, hasTeam: savedTeam) - + // Project initializer variation #2 (pass only team reference) - let project2 = Project(projectId: UUID().uuidString, - name: "name", - team: team) + let project2 = Project( + projectId: UUID().uuidString, + name: "name", + team: team + ) let savedProject2 = try await mutate(.create(project2)) let queriedProject2 = try await query(for: savedProject2)! assertProject(queriedProject2, hasTeam: savedTeam) - + // Project initializer variation #3 (pass fields in) - let project3 = Project(projectId: UUID().uuidString, - name: "name", - teamId: team.teamId, - teamName: team.name) + let project3 = Project( + projectId: UUID().uuidString, + name: "name", + teamId: team.teamId, + teamName: team.name + ) let savedProject3 = try await mutate(.create(project3)) let queriedProject3 = try await query(for: savedProject3)! assertProject(queriedProject3, hasTeam: savedTeam) } - + // One-to-One relationships do not create a foreign key for the Team or Project table // So the LazyModel does not have the FK value to be instantiated as metadata for lazy loading. // We only assert the FK fields on the Project exist and are equal to the Team's PK. @@ -70,52 +78,57 @@ class GraphQLLazyLoadProjectTeam6Tests: GraphQLLazyLoadBaseTest { XCTAssertEqual(project.teamId, team.teamId) XCTAssertEqual(project.teamName, team.name) } - + func assertProjectDoesNotContainTeam(_ project: Project) { XCTAssertNil(project.teamId) XCTAssertNil(project.teamName) } - + func testIncludesNestedModels() async throws { await setup(withModels: ProjectTeam6Models()) let team = Team(teamId: UUID().uuidString, name: "name") try await mutate(.create(team)) let project = initializeProjectWithTeam(team) try await mutate(.create(project)) - - guard let queriedProject = try await query(.get(Project.self, - byIdentifier: .identifier(projectId: project.projectId, - name: project.name), - includes: { project in [project.team]})) else { + + guard let queriedProject = try await query(.get( + Project.self, + byIdentifier: .identifier( + projectId: project.projectId, + name: project.name + ), + includes: { project in [project.team]} + )) else { XCTFail("Could not perform nested query for Project") return } - + assertLazyReference(queriedProject._team, state: .loaded(model: team)) } - + func testListProjectListTeam() async throws { await setup(withModels: ProjectTeam6Models()) let team = Team(teamId: UUID().uuidString, name: "name") try await mutate(.create(team)) let project = initializeProjectWithTeam(team) try await mutate(.create(project)) - + let queriedProjects = try await listQuery(.list(Project.self, where: Project.keys.projectId == project.projectId)) assertList(queriedProjects, state: .isLoaded(count: 1)) assertLazyReference(queriedProjects.first!._team, state: .notLoaded(identifiers: [ .init(name: "teamId", value: team.teamId), - .init(name: "name", value: team.name)])) - + .init(name: "name", value: team.name) + ])) + let queriedTeams = try await listQuery(.list(Team.self, where: Team.keys.teamId == team.teamId)) assertList(queriedTeams, state: .isLoaded(count: 1)) } - + func testSaveProjectWithTeamThenUpdate() async throws { await setup(withModels: ProjectTeam6Models()) let team = Team(teamId: UUID().uuidString, name: "name") let savedTeam = try await mutate(.create(team)) - + let project = initializeProjectWithTeam(team) let savedProject = try await mutate(.create(project)) assertProject(savedProject, hasTeam: savedTeam) @@ -124,13 +137,13 @@ class GraphQLLazyLoadProjectTeam6Tests: GraphQLLazyLoadBaseTest { let updatedProject = try await mutate(.update(project)) assertProject(updatedProject, hasTeam: savedTeam) } - + func testSaveProjectWithoutTeamUpdateProjectWithTeam() async throws { await setup(withModels: ProjectTeam6Models()) let project = Project(projectId: UUID().uuidString, name: "name") let savedProject = try await mutate(.create(project)) assertProjectDoesNotContainTeam(savedProject) - + let team = Team(teamId: UUID().uuidString, name: "name") let savedTeam = try await mutate(.create(team)) var queriedProject = try await query(for: savedProject)! @@ -138,7 +151,7 @@ class GraphQLLazyLoadProjectTeam6Tests: GraphQLLazyLoadBaseTest { let savedProjectWithNewTeam = try await mutate(.update(queriedProject)) assertProject(savedProjectWithNewTeam, hasTeam: savedTeam) } - + func testSaveTeamSaveProjectWithTeamUpdateProjectToNoTeam() async throws { await setup(withModels: ProjectTeam6Models()) let team = Team(teamId: UUID().uuidString, name: "name") @@ -151,7 +164,7 @@ class GraphQLLazyLoadProjectTeam6Tests: GraphQLLazyLoadBaseTest { let savedProjectWithNoTeam = try await mutate(.update(queriedProject)) assertProjectDoesNotContainTeam(savedProjectWithNoTeam) } - + func testSaveProjectWithTeamUpdateProjectToNewTeam() async throws { await setup(withModels: ProjectTeam6Models()) let team = Team(teamId: UUID().uuidString, name: "name") @@ -167,7 +180,7 @@ class GraphQLLazyLoadProjectTeam6Tests: GraphQLLazyLoadBaseTest { let savedProjectWithNewTeam = try await mutate(.update(queriedProject)) assertProject(queriedProject, hasTeam: savedNewTeam) } - + func testDeleteTeam() async throws { await setup(withModels: ProjectTeam6Models()) let team = Team(teamId: UUID().uuidString, name: "name") @@ -176,7 +189,7 @@ class GraphQLLazyLoadProjectTeam6Tests: GraphQLLazyLoadBaseTest { try await mutate(.delete(savedTeam)) try await assertModelDoesNotExist(savedTeam) } - + func testDeleteProject() async throws { await setup(withModels: ProjectTeam6Models()) let project = Project(projectId: UUID().uuidString, name: "name") @@ -185,26 +198,26 @@ class GraphQLLazyLoadProjectTeam6Tests: GraphQLLazyLoadBaseTest { try await mutate(.delete(savedProject)) try await assertModelDoesNotExist(savedProject) } - + func testDeleteProjectWithTeam() async throws { await setup(withModels: ProjectTeam6Models()) let team = Team(teamId: UUID().uuidString, name: "name") let savedTeam = try await mutate(.create(team)) let project = initializeProjectWithTeam(team) let savedProject = try await mutate(.create(project)) - + try await assertModelExists(savedProject) try await assertModelExists(savedTeam) - + try await mutate(.delete(savedProject)) - + try await assertModelDoesNotExist(savedProject) try await assertModelExists(savedTeam) - + try await mutate(.delete(savedTeam)) try await assertModelDoesNotExist(savedTeam) } - + func testSubscribeToTeam() async throws { await setup(withModels: ProjectTeam6Models()) let connected = expectation(description: "subscription connected") @@ -233,15 +246,15 @@ class GraphQLLazyLoadProjectTeam6Tests: GraphQLLazyLoadBaseTest { XCTFail("Subscription has terminated with \(error)") } } - + await fulfillment(of: [connected], timeout: 10) - + let team = Team(teamId: UUID().uuidString, name: "name") let savedTeam = try await mutate(.create(team)) await fulfillment(of: [onCreatedTeam], timeout: 10) subscription.cancel() } - + func testSubscribeProject() async throws { await setup(withModels: ProjectTeam6Models()) let connected = expectation(description: "subscription connected") @@ -270,11 +283,13 @@ class GraphQLLazyLoadProjectTeam6Tests: GraphQLLazyLoadBaseTest { XCTFail("Subscription has terminated with \(error)") } } - + await fulfillment(of: [connected], timeout: 10) - - let project = Project(projectId: UUID().uuidString, - name: "name") + + let project = Project( + projectId: UUID().uuidString, + name: "name" + ) let savedProject = try await mutate(.create(project)) _ = savedProject @@ -286,10 +301,10 @@ class GraphQLLazyLoadProjectTeam6Tests: GraphQLLazyLoadBaseTest { extension GraphQLLazyLoadProjectTeam6Tests: DefaultLogger { } extension GraphQLLazyLoadProjectTeam6Tests { - + typealias Project = Project6 typealias Team = Team6 - + struct ProjectTeam6Models: AmplifyModelRegistration { public let version: String = "version" func registerModels(registry: ModelRegistry.Type) { @@ -297,12 +312,14 @@ extension GraphQLLazyLoadProjectTeam6Tests { ModelRegistry.register(modelType: Team6.self) } } - + func initializeProjectWithTeam(_ team: Team) -> Project { - return Project(projectId: UUID().uuidString, - name: "name", - team: team, - teamId: team.teamId, - teamName: team.name) + return Project( + projectId: UUID().uuidString, + name: "name", + team: team, + teamId: team.teamId, + teamName: team.name + ) } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL9/Project6+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL9/Project6+Schema.swift index 42f4e459b9..7b3851e013 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL9/Project6+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL9/Project6+Schema.swift @@ -1,10 +1,17 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Project6 { +public extension Project6 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case projectId case name case team @@ -13,20 +20,20 @@ extension Project6 { case createdAt case updatedAt } - - public static let keys = CodingKeys.self + + static let keys = CodingKeys.self // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let schema = defineSchema { model in let project6 = Project6.keys - + model.pluralName = "Project6s" - + model.attributes( .index(fields: ["projectId", "name"], name: nil), .primaryKey(fields: [project6.projectId, project6.name]) ) - + model.fields( .field(project6.projectId, is: .required, ofType: .string), .field(project6.name, is: .required, ofType: .string), @@ -37,9 +44,9 @@ extension Project6 { .field(project6.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Project6: ModelIdentifiable { @@ -47,32 +54,34 @@ extension Project6: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension Project6.IdentifierProtocol { - public static func identifier(projectId: String, - name: String) -> Self { - .make(fields:[(name: "projectId", value: projectId), (name: "name", value: name)]) +public extension Project6.IdentifierProtocol { + static func identifier( + projectId: String, + name: String + ) -> Self { + .make(fields: [(name: "projectId", value: projectId), (name: "name", value: name)]) } } -extension ModelPath where ModelType == Project6 { - public var projectId: FieldPath { +public extension ModelPath where ModelType == Project6 { + var projectId: FieldPath { string("projectId") } - public var name: FieldPath { + var name: FieldPath { string("name") } - public var team: ModelPath { + var team: ModelPath { Team6.Path(name: "team", parent: self) } - public var teamId: FieldPath { + var teamId: FieldPath { string("teamId") } - public var teamName: FieldPath { + var teamName: FieldPath { string("teamName") } - public var createdAt: FieldPath { + var createdAt: FieldPath { datetime("createdAt") } - public var updatedAt: FieldPath { + var updatedAt: FieldPath { datetime("updatedAt") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL9/Project6.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL9/Project6.swift index 3d1edb33d0..5ca78076b4 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL9/Project6.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL9/Project6.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -5,7 +12,7 @@ import Foundation public struct Project6: Model { public let projectId: String public let name: String - internal var _team: LazyReference + var _team: LazyReference public var team: Team6? { get async throws { try await _team.get() @@ -15,27 +22,33 @@ public struct Project6: Model { public var teamName: String? public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(projectId: String, - name: String, - team: Team6? = nil, - teamId: String? = nil, - teamName: String? = nil) { - self.init(projectId: projectId, + + public init( + projectId: String, + name: String, + team: Team6? = nil, + teamId: String? = nil, + teamName: String? = nil + ) { + self.init( + projectId: projectId, name: name, team: team, teamId: teamId, teamName: teamName, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(projectId: String, - name: String, - team: Team6? = nil, - teamId: String? = nil, - teamName: String? = nil, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + projectId: String, + name: String, + team: Team6? = nil, + teamId: String? = nil, + teamName: String? = nil, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.projectId = projectId self.name = name self._team = LazyReference(team) @@ -45,17 +58,17 @@ public struct Project6: Model { self.updatedAt = updatedAt } public mutating func setTeam(_ team: Team6? = nil) { - self._team = LazyReference(team) + _team = LazyReference(team) } public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) - projectId = try values.decode(String.self, forKey: .projectId) - name = try values.decode(String.self, forKey: .name) - _team = try values.decodeIfPresent(LazyReference.self, forKey: .team) ?? LazyReference(identifiers: nil) - teamId = try? values.decode(String?.self, forKey: .teamId) - teamName = try? values.decode(String?.self, forKey: .teamName) - createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) - updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) + self.projectId = try values.decode(String.self, forKey: .projectId) + self.name = try values.decode(String.self, forKey: .name) + self._team = try values.decodeIfPresent(LazyReference.self, forKey: .team) ?? LazyReference(identifiers: nil) + self.teamId = try? values.decode(String?.self, forKey: .teamId) + self.teamName = try? values.decode(String?.self, forKey: .teamName) + self.createdAt = try? values.decode(Temporal.DateTime?.self, forKey: .createdAt) + self.updatedAt = try? values.decode(Temporal.DateTime?.self, forKey: .updatedAt) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL9/Team6+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL9/Team6+Schema.swift index 43413e34c5..22b66249ec 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL9/Team6+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL9/Team6+Schema.swift @@ -1,29 +1,36 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation -extension Team6 { +public extension Team6 { // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case teamId case name case createdAt case updatedAt } - - public static let keys = CodingKeys.self + + static let keys = CodingKeys.self // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let schema = defineSchema { model in let team6 = Team6.keys - + model.pluralName = "Team6s" - + model.attributes( .index(fields: ["teamId", "name"], name: nil), .primaryKey(fields: [team6.teamId, team6.name]) ) - + model.fields( .field(team6.teamId, is: .required, ofType: .string), .field(team6.name, is: .required, ofType: .string), @@ -31,9 +38,9 @@ extension Team6 { .field(team6.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime) ) } - public class Path: ModelPath { } - - public static var rootPath: PropertyContainerPath? { Path() } + class Path: ModelPath { } + + static var rootPath: PropertyContainerPath? { Path() } } extension Team6: ModelIdentifiable { @@ -41,23 +48,25 @@ extension Team6: ModelIdentifiable { public typealias IdentifierProtocol = ModelIdentifier } -extension Team6.IdentifierProtocol { - public static func identifier(teamId: String, - name: String) -> Self { - .make(fields:[(name: "teamId", value: teamId), (name: "name", value: name)]) +public extension Team6.IdentifierProtocol { + static func identifier( + teamId: String, + name: String + ) -> Self { + .make(fields: [(name: "teamId", value: teamId), (name: "name", value: name)]) } } -extension ModelPath where ModelType == Team6 { - public var teamId: FieldPath { +public extension ModelPath where ModelType == Team6 { + var teamId: FieldPath { string("teamId") } - public var name: FieldPath { + var name: FieldPath { string("name") } - public var createdAt: FieldPath { + var createdAt: FieldPath { datetime("createdAt") } - public var updatedAt: FieldPath { + var updatedAt: FieldPath { datetime("updatedAt") } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL9/Team6.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL9/Team6.swift index b247d9bffd..3a45fc3f04 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL9/Team6.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginLazyLoadTests/LL9/Team6.swift @@ -1,3 +1,10 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // swiftlint:disable all import Amplify import Foundation @@ -7,18 +14,24 @@ public struct Team6: Model { public let name: String public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(teamId: String, - name: String) { - self.init(teamId: teamId, + + public init( + teamId: String, + name: String + ) { + self.init( + teamId: teamId, name: name, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(teamId: String, - name: String, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + teamId: String, + name: String, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.teamId = teamId self.name = name self.createdAt = createdAt diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginRESTIAMTests/RESTWithIAMIntegrationTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginRESTIAMTests/RESTWithIAMIntegrationTests.swift index b63c8d2fda..409adefe90 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginRESTIAMTests/RESTWithIAMIntegrationTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginRESTIAMTests/RESTWithIAMIntegrationTests.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import AWSAPIPlugin import AWSCognitoAuthPlugin +import XCTest @testable import Amplify #if os(watchOS) @@ -19,7 +19,7 @@ import AWSCognitoAuthPlugin class RESTWithIAMIntegrationTests: XCTestCase { static let amplifyConfiguration = "testconfiguration/RESTWithIAMIntegrationTests-amplifyconfiguration" - + override func setUp() async throws { do { @@ -58,7 +58,7 @@ class RESTWithIAMIntegrationTests: XCTestCase { XCTFail("Error should be APIError") return } - + guard case let .httpStatusError(statusCode, response) = apiError else { XCTFail("Error should be httpStatusError") return @@ -80,22 +80,26 @@ class RESTWithIAMIntegrationTests: XCTestCase { // TODO: Should not be HTTPStatusError func testGetAPIWithQueryParamsSuccess() async throws { - let request = RESTRequest(path: "/items", - queryParameters: [ - "user": "hello@email.com", - "created": "2021-06-18T09:00:00Z" - ]) + let request = RESTRequest( + path: "/items", + queryParameters: [ + "user": "hello@email.com", + "created": "2021-06-18T09:00:00Z" + ] + ) let data = try await Amplify.API.get(request: request) let result = String(decoding: data, as: UTF8.self) log.info(result) } func testGetAPIWithEncodedQueryParamsSuccess() async throws { - let request = RESTRequest(path: "/items", - queryParameters: [ - "user": "hello%40email.com", - "created": "2021-06-18T09%3A00%3A00Z" - ]) + let request = RESTRequest( + path: "/items", + queryParameters: [ + "user": "hello%40email.com", + "created": "2021-06-18T09%3A00%3A00Z" + ] + ) let data = try await Amplify.API.get(request: request) let result = String(decoding: data, as: UTF8.self) log.info(result) @@ -136,7 +140,7 @@ class RESTWithIAMIntegrationTests: XCTestCase { XCTFail("Error should be httpStatusError") return } - + XCTAssertEqual(statusCode, 403) } } @@ -155,7 +159,7 @@ class RESTWithIAMIntegrationTests: XCTestCase { XCTFail("Error should be httpStatusError") return } - + XCTAssertEqual(statusCode, 404) } } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginRESTUserPoolTests/RESTWithUserPoolIntegrationTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginRESTUserPoolTests/RESTWithUserPoolIntegrationTests.swift index a60d362d98..2ed35f9a7e 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginRESTUserPoolTests/RESTWithUserPoolIntegrationTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginRESTUserPoolTests/RESTWithUserPoolIntegrationTests.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import AWSAPIPlugin import AWSCognitoAuthPlugin import AWSPluginsCore +import XCTest @testable import Amplify @testable import APIHostApp @@ -27,7 +27,7 @@ class RESTWithUserPoolIntegrationTests: XCTestCase { try Amplify.add(plugin: AWSAPIPlugin()) try Amplify.add(plugin: AWSCognitoAuthPlugin()) let amplifyConfig = try TestConfigHelper.retrieveAmplifyConfiguration( - forResource:RESTWithUserPoolIntegrationTests.amplifyConfigurationFile) + forResource: RESTWithUserPoolIntegrationTests.amplifyConfigurationFile) try Amplify.configure(amplifyConfig) } catch { XCTFail("Error during setup: \(error)") @@ -40,7 +40,7 @@ class RESTWithUserPoolIntegrationTests: XCTestCase { } await Amplify.reset() } - + func testSetUp() { XCTAssertTrue(true) } @@ -48,7 +48,7 @@ class RESTWithUserPoolIntegrationTests: XCTestCase { func testCreateUser() async throws { try await createAuthenticatedUser() } - + func testCreateUserAndGetToken() async throws { try await createAuthenticatedUser() let session = try await Amplify.Auth.fetchAuthSession() @@ -59,7 +59,7 @@ class RESTWithUserPoolIntegrationTests: XCTestCase { print("Access token - \(tokens.accessToken) ") } } - + func testGetAPISuccess() async throws { try await createAuthenticatedUser() let request = RESTRequest(path: "/items") @@ -70,11 +70,13 @@ class RESTWithUserPoolIntegrationTests: XCTestCase { func testGetAPIWithQueryParamsSuccess() async throws { try await createAuthenticatedUser() - let request = RESTRequest(path: "/items", - queryParameters: [ - "user": "hello@email.com", - "created": "2021-06-18T09:00:00Z" - ]) + let request = RESTRequest( + path: "/items", + queryParameters: [ + "user": "hello@email.com", + "created": "2021-06-18T09:00:00Z" + ] + ) let data = try await Amplify.API.get(request: request) let result = String(decoding: data, as: UTF8.self) print(result) @@ -82,11 +84,13 @@ class RESTWithUserPoolIntegrationTests: XCTestCase { func testGetAPIWithEncodedQueryParamsSuccess() async throws { try await createAuthenticatedUser() - let request = RESTRequest(path: "/items", - queryParameters: [ - "user": "hello%40email.com", - "created": "2021-06-18T09%3A00%3A00Z" - ]) + let request = RESTRequest( + path: "/items", + queryParameters: [ + "user": "hello%40email.com", + "created": "2021-06-18T09%3A00%3A00Z" + ] + ) let data = try await Amplify.API.get(request: request) let result = String(decoding: data, as: UTF8.self) print(result) @@ -103,7 +107,7 @@ class RESTWithUserPoolIntegrationTests: XCTestCase { XCTFail("Should be APIError") return } - + guard case let .operationError(_, _, underlyingError) = apiError else { XCTFail("Error should be operationError") return @@ -120,9 +124,9 @@ class RESTWithUserPoolIntegrationTests: XCTestCase { } } } - + // MARK: - Auth Helpers - + func createAuthenticatedUser() async throws { if try await isSignedIn() { await signOut() @@ -130,12 +134,12 @@ class RESTWithUserPoolIntegrationTests: XCTestCase { try await signUp() try await signIn() } - + func isSignedIn() async throws -> Bool { let authSession = try await Amplify.Auth.fetchAuthSession() return authSession.isSignedIn } - + func signUp() async throws { let signUpResult = try await Amplify.Auth.signUp(username: username, password: password) guard signUpResult.isSignUpComplete else { @@ -144,16 +148,18 @@ class RESTWithUserPoolIntegrationTests: XCTestCase { } } - + func signIn() async throws { - let signInResult = try await Amplify.Auth.signIn(username: username, - password: password) + let signInResult = try await Amplify.Auth.signIn( + username: username, + password: password + ) guard signInResult.isSignedIn else { XCTFail("Sign in successful but not complete") return } } - + func signOut() async { _ = await Amplify.Auth.signOut() } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/GraphQLAPIStressTests/GraphQLAPIStressTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/GraphQLAPIStressTests/GraphQLAPIStressTests.swift index 2746a5fea3..219783795d 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/GraphQLAPIStressTests/GraphQLAPIStressTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/GraphQLAPIStressTests/GraphQLAPIStressTests.swift @@ -6,48 +6,48 @@ // import XCTest -@testable import AWSAPIPlugin @testable import Amplify @testable import APIHostApp +@testable import AWSAPIPlugin /* Model Schema - + type Post @model @auth(rules: [{ allow: public }]) { id: ID! title: String! status: PostStatus! content: String! } - + enum PostStatus { ACTIVE INACTIVE } - + */ final class APIStressTests: XCTestCase { static let amplifyConfiguration = "testconfiguration/AWSGraphQLAPIStressTests-amplifyconfiguration" let concurrencyLimit = 50 - - final public class TestModelRegistration: AmplifyModelRegistration { + + public final class TestModelRegistration: AmplifyModelRegistration { public func registerModels(registry: ModelRegistry.Type) { ModelRegistry.register(modelType: Post.self) } - + public let version: String = "1" } - + override func setUp() async throws { await Amplify.reset() Amplify.Logging.logLevel = .verbose let plugin = AWSAPIPlugin(modelRegistration: TestModelRegistration()) - + do { try Amplify.add(plugin: plugin) - + let amplifyConfig = try TestConfigHelper.retrieveAmplifyConfiguration( forResource: Self.amplifyConfiguration) try Amplify.configure(amplifyConfig) @@ -55,13 +55,13 @@ final class APIStressTests: XCTestCase { XCTFail("Error during setup: \(error)") } } - + override func tearDown() async throws { await Amplify.reset() } // MARK: - Stress tests - + /// - Given: APIPlugin configured with valid configuration and schema /// - When: I create 50 subsciptions on createPost mutation and then create a Post /// - Then: Subscriptions should receive connected, disconnected and progress events correctly @@ -108,23 +108,23 @@ final class APIStressTests: XCTestCase { } completedInvoked.fulfill() } - + await sequenceActor.append(sequence: subscription) } } - + await fulfillment(of: [connectedInvoked], timeout: TestCommonConstants.networkTimeout) - + let sequenceCount = await sequenceActor.sequences.count XCTAssertEqual(sequenceCount, concurrencyLimit) - + guard try await createPost(id: uuid, title: title) != nil else { XCTFail("Failed to create post") return } await fulfillment(of: [progressInvoked], timeout: TestCommonConstants.networkTimeout) - + DispatchQueue.concurrentPerform(iterations: concurrencyLimit) { index in Task { await sequenceActor.sequences[index].cancel() @@ -133,7 +133,7 @@ final class APIStressTests: XCTestCase { await fulfillment(of: [disconnectedInvoked, completedInvoked], timeout: TestCommonConstants.networkTimeout) } - + /// - Given: APIPlugin configured with valid configuration and schema /// - When: I create 50 posts simultaneously /// - Then: Operation should succeed @@ -151,10 +151,10 @@ final class APIStressTests: XCTestCase { postCreateExpectation.fulfill() } } - + await fulfillment(of: [postCreateExpectation], timeout: TestCommonConstants.networkTimeout) } - + /// - Given: APIPlugin configured with valid configuration and schema and 50 posts saved /// - When: I update 50 post simultaneously /// - Then: Operation should succeed @@ -164,7 +164,7 @@ final class APIStressTests: XCTestCase { let postUpdateExpectation = expectation(description: "Post was updated successfully") postUpdateExpectation.expectedFulfillmentCount = concurrencyLimit let postActor = PostActor() - + DispatchQueue.concurrentPerform(iterations: concurrencyLimit) { index in Task { let id = UUID().uuidString @@ -179,7 +179,7 @@ final class APIStressTests: XCTestCase { } await fulfillment(of: [postCreateExpectation], timeout: TestCommonConstants.networkTimeout) - + DispatchQueue.concurrentPerform(iterations: concurrencyLimit) { index in Task { var post = await postActor.posts[index] @@ -191,10 +191,10 @@ final class APIStressTests: XCTestCase { postUpdateExpectation.fulfill() } } - + await fulfillment(of: [postUpdateExpectation], timeout: TestCommonConstants.networkTimeout) } - + /// - Given: APIPlugin configured with valid configuration, schema and 50 posts saved /// - When: I delete 50 post simultaneously /// - Then: Operation should succeed @@ -206,7 +206,7 @@ final class APIStressTests: XCTestCase { postDeleteExpectation.expectedFulfillmentCount = concurrencyLimit let postActor = PostActor() - + DispatchQueue.concurrentPerform(iterations: concurrencyLimit) { index in Task { let id = UUID().uuidString @@ -221,7 +221,7 @@ final class APIStressTests: XCTestCase { } await fulfillment(of: [postCreateExpectation], timeout: TestCommonConstants.networkTimeout) - + DispatchQueue.concurrentPerform(iterations: concurrencyLimit) { index in Task { let post = await postActor.posts[index] @@ -232,10 +232,10 @@ final class APIStressTests: XCTestCase { postDeleteExpectation.fulfill() } } - + await fulfillment(of: [postDeleteExpectation], timeout: TestCommonConstants.networkTimeout) } - + /// - Given: APIPlugin configured with valid configuration, schema and 50 posts saved /// - When: I query for 50 posts simultaneously /// - Then: Operation should succeed @@ -247,7 +247,7 @@ final class APIStressTests: XCTestCase { postQueryExpectation.expectedFulfillmentCount = concurrencyLimit let postActor = PostActor() - + DispatchQueue.concurrentPerform(iterations: concurrencyLimit) { index in Task { let id = UUID().uuidString @@ -262,7 +262,7 @@ final class APIStressTests: XCTestCase { } await fulfillment(of: [postCreateExpectation], timeout: TestCommonConstants.networkTimeout) - + DispatchQueue.concurrentPerform(iterations: concurrencyLimit) { index in Task { let post = await postActor.posts[index] @@ -281,24 +281,24 @@ final class APIStressTests: XCTestCase { postQueryExpectation.fulfill() } } - + await fulfillment(of: [postQueryExpectation], timeout: TestCommonConstants.networkTimeout) } - + actor PostActor { var posts: [Post] = [] func append(post: Post) { posts.append(post) } } - + actor SequenceActor { var sequences: [AmplifyAsyncThrowingSequence>] = [] func append(sequence: AmplifyAsyncThrowingSequence>) { sequences.append(sequence) } } - + // MARK: - Helpers func createPost(id: String, title: String) async throws -> Post? { diff --git a/AmplifyPlugins/API/Tests/APIHostApp/GraphQLAPIStressTests/Models/AmplifyModels.swift b/AmplifyPlugins/API/Tests/APIHostApp/GraphQLAPIStressTests/Models/AmplifyModels.swift index 96eef29957..167804f3b4 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/GraphQLAPIStressTests/Models/AmplifyModels.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/GraphQLAPIStressTests/Models/AmplifyModels.swift @@ -9,11 +9,11 @@ import Amplify import Foundation -// Contains the set of classes that conforms to the `Model` protocol. +// Contains the set of classes that conforms to the `Model` protocol. -final public class AmplifyModels: AmplifyModelRegistration { +public final class AmplifyModels: AmplifyModelRegistration { public let version: String = "9ddf09113aaee75fdec53f41fd7a73d7" - + public func registerModels(registry: ModelRegistry.Type) { ModelRegistry.register(modelType: Post.self) } diff --git a/AmplifyPlugins/API/Tests/APIHostApp/GraphQLAPIStressTests/Models/Post+Schema.swift b/AmplifyPlugins/API/Tests/APIHostApp/GraphQLAPIStressTests/Models/Post+Schema.swift index 96d24f0a99..a1b369d614 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/GraphQLAPIStressTests/Models/Post+Schema.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/GraphQLAPIStressTests/Models/Post+Schema.swift @@ -9,9 +9,9 @@ import Amplify import Foundation -extension Post { - // MARK: - CodingKeys - public enum CodingKeys: String, ModelKey { +public extension Post { + // MARK: - CodingKeys + enum CodingKeys: String, ModelKey { case id case title case status @@ -19,23 +19,23 @@ extension Post { case createdAt case updatedAt } - - public static let keys = CodingKeys.self - // MARK: - ModelSchema - - public static let schema = defineSchema { model in + + static let keys = CodingKeys.self + // MARK: - ModelSchema + + static let schema = defineSchema { model in let post = Post.keys - + model.authRules = [ rule(allow: .public, operations: [.create, .update, .delete, .read]) ] - + model.pluralName = "Posts" - + model.attributes( .primaryKey(fields: [post.id]) ) - + model.fields( .field(post.id, is: .required, ofType: .string), .field(post.title, is: .required, ofType: .string), diff --git a/AmplifyPlugins/API/Tests/APIHostApp/GraphQLAPIStressTests/Models/Post.swift b/AmplifyPlugins/API/Tests/APIHostApp/GraphQLAPIStressTests/Models/Post.swift index 3658db511f..c5a0adeaac 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/GraphQLAPIStressTests/Models/Post.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/GraphQLAPIStressTests/Models/Post.swift @@ -16,24 +16,30 @@ public struct Post: Model { public var content: String public var createdAt: Temporal.DateTime? public var updatedAt: Temporal.DateTime? - - public init(id: String = UUID().uuidString, - title: String, - status: PostStatus, - content: String) { - self.init(id: id, + + public init( + id: String = UUID().uuidString, + title: String, + status: PostStatus, + content: String + ) { + self.init( + id: id, title: title, status: status, content: content, createdAt: nil, - updatedAt: nil) + updatedAt: nil + ) } - internal init(id: String = UUID().uuidString, - title: String, - status: PostStatus, - content: String, - createdAt: Temporal.DateTime? = nil, - updatedAt: Temporal.DateTime? = nil) { + init( + id: String = UUID().uuidString, + title: String, + status: PostStatus, + content: String, + createdAt: Temporal.DateTime? = nil, + updatedAt: Temporal.DateTime? = nil + ) { self.id = id self.title = title self.status = status diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTestCommon/Model/Todo.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTestCommon/Model/Todo.swift index 90ef943ad5..67bb6fb833 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTestCommon/Model/Todo.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTestCommon/Model/Todo.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import Amplify +import Foundation /// TODO: Replace with AmplifyTestCommon's DataStore's geneated model /// This model corresponds to the resources created for the Todo graphQL endpoint. As a developer, this is @@ -51,13 +51,13 @@ class CreateTodoMutation { static func variables(id: String? = nil, name: String, description: String? = nil) -> [String: Any] { var input: [String: Any] = [:] - if let id = id { + if let id { input.updateValue(id, forKey: "id") } input.updateValue(name, forKey: "name") - if let description = description { + if let description { input.updateValue(description, forKey: "description") } @@ -93,10 +93,10 @@ class UpdateTodoMutation { static func variables(id: String, name: String? = nil, description: String? = nil) -> [String: Any] { var input: [String: Any] = [:] input.updateValue(id, forKey: "id") - if let name = name { + if let name { input.updateValue(name, forKey: "name") } - if let description = description { + if let description { input.updateValue(description, forKey: "description") } return ["input": input] @@ -120,7 +120,7 @@ class DeleteTodoMutation { static func variables(id: String?) -> [String: Any] { var input: [String: Any] = [:] - if let id = id { + if let id { input.updateValue(id, forKey: "id") } @@ -167,20 +167,22 @@ class ListTodosQuery { }\n} """ - static func variables(filter: [String: Any]? = nil, - limit: Int? = nil, - nextToken: String? = nil) -> [String: Any] { + static func variables( + filter: [String: Any]? = nil, + limit: Int? = nil, + nextToken: String? = nil + ) -> [String: Any] { var input: [String: Any] = [:] - if let filter = filter { + if let filter { input.updateValue(filter, forKey: "filter") } - if let limit = limit { + if let limit { input.updateValue(limit, forKey: "limit") } - if let nextToken = nextToken { + if let nextToken { input.updateValue(nextToken, forKey: "nextToken") } diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/APISwiftCompatibility/API.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/APISwiftCompatibility/API.swift index 30ac29f279..e6d668e899 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/APISwiftCompatibility/API.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/APISwiftCompatibility/API.swift @@ -1,11 +1,20 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + // This file was automatically generated and should not be edited. +// swiftlint:disable all +// swiftformat:disable all #if canImport(AWSAPIPlugin) import Foundation public protocol GraphQLInputValue { } public struct GraphQLVariable { let name: String - + public init(_ name: String) { self.name = name } @@ -39,13 +48,13 @@ public extension GraphQLMapConvertible { } 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 { @@ -68,7 +77,7 @@ public protocol GraphQLFragment: GraphQLSelectionSet { public typealias Snapshot = [String: Any?] public protocol GraphQLSelectionSet: Decodable { static var selections: [GraphQLSelection] { get } - + var snapshot: Snapshot { get } init(snapshot: Snapshot) } @@ -92,10 +101,10 @@ enum APISwiftJSONValue: Codable { 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) { @@ -110,10 +119,10 @@ enum APISwiftJSONValue: Codable { self = .null } } - + func encode(to encoder: Encoder) throws { var container = encoder.singleValueContainer() - + switch self { case .array(let value): try container.encode(value) @@ -136,19 +145,19 @@ 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 } } @@ -157,7 +166,7 @@ public indirect enum GraphQLOutputType { case object([GraphQLSelection]) case nonNull(GraphQLOutputType) case list(GraphQLOutputType) - + var namedType: GraphQLOutputType { switch self { case .nonNull(let innerType), .list(let innerType): @@ -171,7 +180,7 @@ 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; @@ -181,7 +190,7 @@ public struct GraphQLBooleanCondition: GraphQLSelection { public struct GraphQLTypeCondition: GraphQLSelection { let possibleTypes: [String] let selections: [GraphQLSelection] - + public init(possibleTypes: [String], selections: [GraphQLSelection]) { self.possibleTypes = possibleTypes self.selections = selections; @@ -189,7 +198,7 @@ public struct GraphQLTypeCondition: GraphQLSelection { } public struct GraphQLFragmentSpread: GraphQLSelection { let fragment: GraphQLFragment.Type - + public init(_ fragment: GraphQLFragment.Type) { self.fragment = fragment } @@ -197,7 +206,7 @@ public struct GraphQLFragmentSpread: GraphQLSelection { public struct GraphQLTypeCase: GraphQLSelection { let variants: [String: [GraphQLSelection]] let `default`: [GraphQLSelection] - + public init(variants: [String: [GraphQLSelection]], default: [GraphQLSelection]) { self.variants = variants self.default = `default`; @@ -215,7 +224,7 @@ public enum JSONDecodingError: Error, LocalizedError { case nullValue case wrongType case couldNotConvert(value: Any, to: Any.Type) - + public var errorDescription: String? { switch self { case .missingValue: @@ -324,7 +333,7 @@ extension Dictionary: JSONEncodable { public var jsonValue: Any { return jsonObject } - + public var jsonObject: JSONObject { var jsonObject = JSONObject(minimumCapacity: count) for (key, value) in self { diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/APISwiftCompatibility/APISwiftTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/APISwiftCompatibility/APISwiftTests.swift index e2b405da1d..482021a53f 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/APISwiftCompatibility/APISwiftTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/APISwiftCompatibility/APISwiftTests.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import Amplify +import XCTest final class APISwiftTests: XCTestCase { @@ -15,12 +15,13 @@ final class APISwiftTests: XCTestCase { let input = CreateBlogInput(name: "name", file: file) let condition = ModelBlogConditionInput(name: .init(eq: "name")) let mutation = CreateBlogMutation(input: input) - + let request = GraphQLRequest( document: CreateBlogMutation.requestString, variables: mutation.variables?.jsonObject, - responseType: CreateBlogMutation.Data.self) - + responseType: CreateBlogMutation.Data.self + ) + var expectedDocument = """ mutation CreateBlog($input: CreateBlogInput!, $condition: ModelBlogConditionInput) { createBlog(input: $input, condition: $condition) { diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPlugin+ConfigureTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPlugin+ConfigureTests.swift index 8d16c47b05..340abe5027 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPlugin+ConfigureTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPlugin+ConfigureTests.swift @@ -43,7 +43,8 @@ class AWSAPICategoryPluginConfigureTests: AWSAPICategoryPluginTestBase { let plugin = AWSAPIPlugin() XCTAssertThrowsError(try plugin.configure(using: nil)) { error in guard let apiError = error as? PluginError, - case .pluginConfigurationError = apiError else { + case .pluginConfigurationError = apiError + else { XCTFail("Should throw invalidConfiguration exception. But received \(error) ") return } @@ -58,7 +59,8 @@ class AWSAPICategoryPluginConfigureTests: AWSAPICategoryPluginTestBase { modelIntrospection: nil, apiKey: "apiKey123", defaultAuthorizationType: .amazonCognitoUserPools, - authorizationTypes: [.apiKey, .awsIAM])) + authorizationTypes: [.apiKey, .awsIAM] + )) let plugin = AWSAPIPlugin() try plugin.configure(using: config) @@ -82,7 +84,8 @@ class AWSAPICategoryPluginConfigureTests: AWSAPICategoryPluginTestBase { let plugin = AWSAPIPlugin() XCTAssertThrowsError(try plugin.configure(using: config)) { error in guard let apiError = error as? PluginError, - case .pluginConfigurationError = apiError else { + case .pluginConfigurationError = apiError + else { XCTFail("Should throw invalidConfiguration exception. But received \(error) ") return } @@ -97,12 +100,14 @@ class AWSAPICategoryPluginConfigureTests: AWSAPICategoryPluginTestBase { modelIntrospection: nil, apiKey: nil, defaultAuthorizationType: .apiKey, - authorizationTypes: [])) + authorizationTypes: [] + )) let plugin = AWSAPIPlugin() XCTAssertThrowsError(try plugin.configure(using: config)) { error in guard let apiError = error as? PluginError, - case .pluginConfigurationError = apiError else { + case .pluginConfigurationError = apiError + else { XCTFail("Should throw invalidConfiguration exception. But received \(error) ") return } diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPlugin+GraphQLBehaviorTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPlugin+GraphQLBehaviorTests.swift index 74065cd3e5..a76766b5e1 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPlugin+GraphQLBehaviorTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPlugin+GraphQLBehaviorTests.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import Amplify -@testable import AWSAPIPlugin import AWSPluginsCore +import XCTest +@testable import AWSAPIPlugin class AWSAPICategoryPluginGraphQLBehaviorTests: AWSAPICategoryPluginTestBase { @@ -16,11 +16,13 @@ class AWSAPICategoryPluginGraphQLBehaviorTests: AWSAPICategoryPluginTestBase { func testQuery() async { let operationFinished = expectation(description: "Operation should finish") - let request = GraphQLRequest(apiName: apiName, - document: testDocument, - variables: nil, - responseType: JSONValue.self, - authMode: AWSAuthorizationType.apiKey) + let request = GraphQLRequest( + apiName: apiName, + document: testDocument, + variables: nil, + responseType: JSONValue.self, + authMode: AWSAuthorizationType.apiKey + ) let operation = apiPlugin.query(request: request) { _ in operationFinished.fulfill() } @@ -46,10 +48,12 @@ class AWSAPICategoryPluginGraphQLBehaviorTests: AWSAPICategoryPluginTestBase { func testMutate() async { let operationFinished = expectation(description: "Operation should finish") - let request = GraphQLRequest(apiName: apiName, - document: testDocument, - variables: nil, - responseType: JSONValue.self) + let request = GraphQLRequest( + apiName: apiName, + document: testDocument, + variables: nil, + responseType: JSONValue.self + ) let operation = apiPlugin.mutate(request: request) { _ in operationFinished.fulfill() } @@ -75,10 +79,12 @@ class AWSAPICategoryPluginGraphQLBehaviorTests: AWSAPICategoryPluginTestBase { func testSubscribe() async { let operationFinished = expectation(description: "Operation should finish") - let request = GraphQLRequest(apiName: apiName, - document: testDocument, - variables: nil, - responseType: JSONValue.self) + let request = GraphQLRequest( + apiName: apiName, + document: testDocument, + variables: nil, + responseType: JSONValue.self + ) let operation = apiPlugin.subscribe(request: request, valueListener: nil) { _ in operationFinished.fulfill() } diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPlugin+InterceptorBehaviorTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPlugin+InterceptorBehaviorTests.swift index ac458b9992..258229e3b3 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPlugin+InterceptorBehaviorTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPlugin+InterceptorBehaviorTests.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest -@testable import AWSAPIPlugin import AWSPluginsCore import InternalAmplifyCredentials +import XCTest +@testable import AWSAPIPlugin // swiftlint:disable:next type_name class AWSAPICategoryPluginInterceptorBehaviorTests: AWSAPICategoryPluginTestBase { diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPlugin+RESTClientBehaviorTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPlugin+RESTClientBehaviorTests.swift index 84647ff9dd..8f8857f922 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPlugin+RESTClientBehaviorTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPlugin+RESTClientBehaviorTests.swift @@ -8,8 +8,8 @@ import XCTest @testable import Amplify -@testable import AWSAPIPlugin @testable import AmplifyTestCommon +@testable import AWSAPIPlugin // swiftlint:disable:next type_name class AWSAPICategoryPluginRESTClientBehaviorTests: AWSAPICategoryPluginTestBase { diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPlugin+ReachabilityTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPlugin+ReachabilityTests.swift index 2d005cbdf1..5a3108758f 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPlugin+ReachabilityTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPlugin+ReachabilityTests.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest -import Foundation import AWSPluginsCore +import Foundation +import XCTest @testable import Amplify @testable import AmplifyTestCommon @@ -31,7 +31,7 @@ class AWSAPICategoryPluginReachabilityTests: XCTestCase { func testReachabilityReturnsGraphQLAPI() throws { let graphQLAPI = "graphQLAPI" do { - let endpointConfig = [graphQLAPI: try getEndpointConfig(apiName: graphQLAPI, endpointType: .graphQL)] + let endpointConfig = try [graphQLAPI: getEndpointConfig(apiName: graphQLAPI, endpointType: .graphQL)] let pluginConfig = AWSAPICategoryPluginConfiguration(endpoints: endpointConfig) let dependencies = AWSAPIPlugin.ConfigurationDependencies( pluginConfig: pluginConfig, @@ -58,8 +58,10 @@ class AWSAPICategoryPluginReachabilityTests: XCTestCase { let graphQLAPI = "graphQLAPI" let restAPI = "restAPI" do { - let endpointConfig = [graphQLAPI: try getEndpointConfig(apiName: graphQLAPI, endpointType: .graphQL), - restAPI: try getEndpointConfig(apiName: restAPI, endpointType: .rest)] + let endpointConfig = try [ + graphQLAPI: getEndpointConfig(apiName: graphQLAPI, endpointType: .graphQL), + restAPI: getEndpointConfig(apiName: restAPI, endpointType: .rest) + ] let pluginConfig = AWSAPICategoryPluginConfiguration(endpoints: endpointConfig) let dependencies = AWSAPIPlugin.ConfigurationDependencies( pluginConfig: pluginConfig, @@ -86,8 +88,10 @@ class AWSAPICategoryPluginReachabilityTests: XCTestCase { let graphQLAPI = "graphQLAPI" let restAPI = "restAPI" do { - let endpointConfig = [graphQLAPI: try getEndpointConfig(apiName: graphQLAPI, endpointType: .graphQL), - restAPI: try getEndpointConfig(apiName: restAPI, endpointType: .rest)] + let endpointConfig = try [ + graphQLAPI: getEndpointConfig(apiName: graphQLAPI, endpointType: .graphQL), + restAPI: getEndpointConfig(apiName: restAPI, endpointType: .rest) + ] let pluginConfig = AWSAPICategoryPluginConfiguration(endpoints: endpointConfig) let dependencies = AWSAPIPlugin.ConfigurationDependencies( pluginConfig: pluginConfig, @@ -128,6 +132,7 @@ class AWSAPICategoryPluginReachabilityTests: XCTestCase { region: nil, authorizationType: AWSAuthorizationType.none, endpointType: endpointType, - apiAuthProviderFactory: APIAuthProviderFactory()) + apiAuthProviderFactory: APIAuthProviderFactory() + ) } } diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPluginAmplifyVersionableTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPluginAmplifyVersionableTests.swift index a6e412c5cd..f033051f18 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPluginAmplifyVersionableTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPluginAmplifyVersionableTests.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import AWSAPIPlugin +import XCTest // swiftlint:disable:next type_name class AWSAPICategoryPluginAmplifyVersionableTests: XCTestCase { diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPluginTestBase.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPluginTestBase.swift index 9d6fa2b283..d270f0c6ac 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPluginTestBase.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPluginTestBase.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import Foundation +import XCTest @testable import Amplify @testable import AmplifyTestCommon @testable import AWSAPIPlugin @@ -38,18 +38,22 @@ class AWSAPICategoryPluginTestBase: XCTestCase { self.authService = authService do { - let endpointConfig = [apiName: try AWSAPICategoryPluginConfiguration.EndpointConfig( + let endpointConfig = try [apiName: AWSAPICategoryPluginConfiguration.EndpointConfig( name: apiName, baseURL: baseURL, region: region, authorizationType: AWSAuthorizationType.none, endpointType: .graphQL, - apiAuthProviderFactory: apiAuthProvider)] + apiAuthProviderFactory: apiAuthProvider + )] let interceptors = [apiName: AWSAPIEndpointInterceptors( - endpointName: apiName, - apiAuthProviderFactory: apiAuthProvider)] - let pluginConfig = AWSAPICategoryPluginConfiguration(endpoints: endpointConfig, - interceptors: interceptors) + endpointName: apiName, + apiAuthProviderFactory: apiAuthProvider + )] + let pluginConfig = AWSAPICategoryPluginConfiguration( + endpoints: endpointConfig, + interceptors: interceptors + ) self.pluginConfig = pluginConfig let dependencies = AWSAPIPlugin.ConfigurationDependencies( diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AppSyncRealTimeClient/AppSyncRealTimeClientTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AppSyncRealTimeClient/AppSyncRealTimeClientTests.swift index 83c2c58216..9aa6f52852 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AppSyncRealTimeClient/AppSyncRealTimeClientTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AppSyncRealTimeClient/AppSyncRealTimeClientTests.swift @@ -5,10 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // - -import XCTest -import Combine import Amplify +import Combine +import XCTest @_spi(WebSocket) import AWSPluginsCore @testable import AWSAPIPlugin @@ -58,7 +57,7 @@ class AppSyncRealTimeClientTests: XCTestCase { } } Task { - try await Task.sleep(nanoseconds: 80 * 1000) + try await Task.sleep(nanoseconds: 80 * 1_000) await appSyncClient.subject.send(.success(.init(id: nil, payload: nil, type: .connectionAck))) } await fulfillment(of: [finishExpectation], timeout: timeout + 1) @@ -90,7 +89,7 @@ class AppSyncRealTimeClientTests: XCTestCase { } } Task { - try await Task.sleep(nanoseconds: 80 * 1000) + try await Task.sleep(nanoseconds: 80 * 1_000) await appSyncClient.subject.send(.success(.init( id: id, payload: .object([ @@ -133,7 +132,7 @@ class AppSyncRealTimeClientTests: XCTestCase { } Task { - try await Task.sleep(nanoseconds: 80 * 1000) + try await Task.sleep(nanoseconds: 80 * 1_000) await appSyncClient.subject.send(.success(.init( id: id, payload: .object([ @@ -180,7 +179,7 @@ class AppSyncRealTimeClientTests: XCTestCase { } Task { - try await Task.sleep(nanoseconds: 80 * 1000) + try await Task.sleep(nanoseconds: 80 * 1_000) await appSyncClient.subject.send(.success(.init( id: id, payload: .object([ @@ -519,8 +518,7 @@ class AppSyncRealTimeClientTests: XCTestCase { errors.count == 1, let error = errors.first, let connectionLostError = error as? WebSocketClient.Error, - connectionLostError == WebSocketClient.Error.connectionLost - { + connectionLostError == WebSocketClient.Error.connectionLost { errorReceived.fulfill() } }.store(in: &cancellables) diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AppSyncRealTimeClient/AppSyncRealTimeRequestAuthTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AppSyncRealTimeClient/AppSyncRealTimeRequestAuthTests.swift index 6ab7af0692..f2667b41bc 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AppSyncRealTimeClient/AppSyncRealTimeRequestAuthTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AppSyncRealTimeClient/AppSyncRealTimeRequestAuthTests.swift @@ -5,7 +5,6 @@ // SPDX-License-Identifier: Apache-2.0 // - import XCTest @testable import AWSAPIPlugin @@ -197,7 +196,8 @@ class AppSyncRealTimeRequestAuthTests: XCTestCase { host: "example.com", authToken: "c9dad897-90d1-4a4c-a5c9-2b36a247735f", securityToken: "e7e6269e-fda1-4de0-8bdb-baa7b6dd0a0d", - amzDate: "9e0e2df9-2ee7-4659-8362-1c881e118c9f")) + amzDate: "9e0e2df9-2ee7-4659-8362-1c881e118c9f" + )) ).withBaseURL(URL(string: "https://example.com")!, encoder: jsonEncoder) XCTAssertEqual(encodedURL.absoluteString, expectedURL) } @@ -207,9 +207,9 @@ class AppSyncRealTimeRequestAuthTests: XCTestCase { } } -fileprivate extension String { +private extension String { func shrink() -> String { - return self.replacingOccurrences(of: "\n", with: "") + return replacingOccurrences(of: "\n", with: "") .replacingOccurrences(of: " ", with: "") } } diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Configuration/AWSAPICategoryPluginConfigurationEndpointConfigTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Configuration/AWSAPICategoryPluginConfigurationEndpointConfigTests.swift index be200d23a2..717233ab6b 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Configuration/AWSAPICategoryPluginConfigurationEndpointConfigTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Configuration/AWSAPICategoryPluginConfigurationEndpointConfigTests.swift @@ -5,11 +5,11 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import AWSPluginsCore +import XCTest @testable import Amplify -@testable import AWSAPIPlugin @testable import AmplifyTestCommon +@testable import AWSAPIPlugin // swiftlint:disable:next type_name class AWSAPICategoryPluginConfigurationEndpointConfigTests: XCTestCase { @@ -20,7 +20,7 @@ class AWSAPICategoryPluginConfigurationEndpointConfigTests: XCTestCase { let restAPI2 = "restAPI2" func testGetConfigAPIName() throws { - let endpointConfig = [graphQLAPI: try getEndpointConfig(apiName: graphQLAPI, endpointType: .graphQL)] + let endpointConfig = try [graphQLAPI: getEndpointConfig(apiName: graphQLAPI, endpointType: .graphQL)] let endpoint = try endpointConfig.getConfig(for: graphQLAPI) @@ -29,7 +29,7 @@ class AWSAPICategoryPluginConfigurationEndpointConfigTests: XCTestCase { } func testGetConfigAPINameFailsWhenInvalidAPIName() throws { - let endpointConfig = [graphQLAPI: try getEndpointConfig(apiName: graphQLAPI, endpointType: .graphQL)] + let endpointConfig = try [graphQLAPI: getEndpointConfig(apiName: graphQLAPI, endpointType: .graphQL)] do { _ = try endpointConfig.getConfig(for: "incorrectAPIName") @@ -44,8 +44,10 @@ class AWSAPICategoryPluginConfigurationEndpointConfigTests: XCTestCase { } func testGetConfigEndpointTypeForGraphQL() throws { - let endpointConfig = [graphQLAPI: try getEndpointConfig(apiName: graphQLAPI, endpointType: .graphQL), - restAPI: try getEndpointConfig(apiName: restAPI, endpointType: .rest)] + let endpointConfig = try [ + graphQLAPI: getEndpointConfig(apiName: graphQLAPI, endpointType: .graphQL), + restAPI: getEndpointConfig(apiName: restAPI, endpointType: .rest) + ] let endpoint = try endpointConfig.getConfig(endpointType: .graphQL) @@ -54,8 +56,10 @@ class AWSAPICategoryPluginConfigurationEndpointConfigTests: XCTestCase { } func testGetConfigEndpointTypeFailsWhenMoreThanOneEndpointOfTheTypeExists() throws { - let endpointConfig = [graphQLAPI: try getEndpointConfig(apiName: graphQLAPI, endpointType: .graphQL), - graphQLAPI2: try getEndpointConfig(apiName: graphQLAPI2, endpointType: .graphQL)] + let endpointConfig = try [ + graphQLAPI: getEndpointConfig(apiName: graphQLAPI, endpointType: .graphQL), + graphQLAPI2: getEndpointConfig(apiName: graphQLAPI2, endpointType: .graphQL) + ] do { _ = try endpointConfig.getConfig(endpointType: .graphQL) @@ -70,7 +74,7 @@ class AWSAPICategoryPluginConfigurationEndpointConfigTests: XCTestCase { } func testGetConfigEndpointTypeFailsWhenMissingEndpointForType() throws { - let endpointConfig = [restAPI: try getEndpointConfig(apiName: restAPI, endpointType: .rest)] + let endpointConfig = try [restAPI: getEndpointConfig(apiName: restAPI, endpointType: .rest)] do { _ = try endpointConfig.getConfig(endpointType: .graphQL) @@ -85,7 +89,7 @@ class AWSAPICategoryPluginConfigurationEndpointConfigTests: XCTestCase { } func testGetConfigEndpointTypeForREST() throws { - let endpointConfig = [restAPI: try getEndpointConfig(apiName: restAPI, endpointType: .rest)] + let endpointConfig = try [restAPI: getEndpointConfig(apiName: restAPI, endpointType: .rest)] let endpoint = try endpointConfig.getConfig(endpointType: .rest) @@ -94,8 +98,10 @@ class AWSAPICategoryPluginConfigurationEndpointConfigTests: XCTestCase { } func testGetConfigForOneGraphQLAndOneRESTEndpoint() throws { - let endpointConfig = [graphQLAPI: try getEndpointConfig(apiName: graphQLAPI, endpointType: .graphQL), - restAPI: try getEndpointConfig(apiName: restAPI, endpointType: .rest)] + let endpointConfig = try [ + graphQLAPI: getEndpointConfig(apiName: graphQLAPI, endpointType: .graphQL), + restAPI: getEndpointConfig(apiName: restAPI, endpointType: .rest) + ] let endpoint = try endpointConfig.getConfig() @@ -104,9 +110,11 @@ class AWSAPICategoryPluginConfigurationEndpointConfigTests: XCTestCase { } func testGetConfigForMoreThanOneGraphQLAndOneRESTEndpoint() throws { - let endpointConfig = [graphQLAPI: try getEndpointConfig(apiName: graphQLAPI, endpointType: .graphQL), - graphQLAPI2: try getEndpointConfig(apiName: graphQLAPI2, endpointType: .graphQL), - restAPI: try getEndpointConfig(apiName: restAPI, endpointType: .rest)] + let endpointConfig = try [ + graphQLAPI: getEndpointConfig(apiName: graphQLAPI, endpointType: .graphQL), + graphQLAPI2: getEndpointConfig(apiName: graphQLAPI2, endpointType: .graphQL), + restAPI: getEndpointConfig(apiName: restAPI, endpointType: .rest) + ] let endpoint = try endpointConfig.getConfig() @@ -115,9 +123,11 @@ class AWSAPICategoryPluginConfigurationEndpointConfigTests: XCTestCase { } func testGetConfigForOneGraphQLAndMoreThanOneRESTEndpoint() throws { - let endpointConfig = [graphQLAPI: try getEndpointConfig(apiName: graphQLAPI, endpointType: .graphQL), - restAPI: try getEndpointConfig(apiName: restAPI, endpointType: .rest), - restAPI2: try getEndpointConfig(apiName: restAPI2, endpointType: .rest)] + let endpointConfig = try [ + graphQLAPI: getEndpointConfig(apiName: graphQLAPI, endpointType: .graphQL), + restAPI: getEndpointConfig(apiName: restAPI, endpointType: .rest), + restAPI2: getEndpointConfig(apiName: restAPI2, endpointType: .rest) + ] let endpoint = try endpointConfig.getConfig() @@ -126,10 +136,12 @@ class AWSAPICategoryPluginConfigurationEndpointConfigTests: XCTestCase { } func testGetConfigShouldFailForMoreThanOneGraphQLAndRESTEndpoints() throws { - let endpointConfig = [graphQLAPI: try getEndpointConfig(apiName: graphQLAPI, endpointType: .graphQL), - graphQLAPI2: try getEndpointConfig(apiName: graphQLAPI2, endpointType: .graphQL), - restAPI: try getEndpointConfig(apiName: restAPI, endpointType: .rest), - restAPI2: try getEndpointConfig(apiName: restAPI2, endpointType: .rest)] + let endpointConfig = try [ + graphQLAPI: getEndpointConfig(apiName: graphQLAPI, endpointType: .graphQL), + graphQLAPI2: getEndpointConfig(apiName: graphQLAPI2, endpointType: .graphQL), + restAPI: getEndpointConfig(apiName: restAPI, endpointType: .rest), + restAPI2: getEndpointConfig(apiName: restAPI2, endpointType: .rest) + ] do { _ = try endpointConfig.getConfig() @@ -153,6 +165,7 @@ class AWSAPICategoryPluginConfigurationEndpointConfigTests: XCTestCase { region: nil, authorizationType: AWSAuthorizationType.none, endpointType: endpointType, - apiAuthProviderFactory: APIAuthProviderFactory()) + apiAuthProviderFactory: APIAuthProviderFactory() + ) } } diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Configuration/AWSAPICategoryPluginConfigurationTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Configuration/AWSAPICategoryPluginConfigurationTests.swift index b71e5491a8..0cdd8f3620 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Configuration/AWSAPICategoryPluginConfigurationTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Configuration/AWSAPICategoryPluginConfigurationTests.swift @@ -5,14 +5,14 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest +import AWSPluginsCore import Foundation +import InternalAmplifyCredentials +import XCTest @testable import Amplify @testable import AmplifyTestCommon @testable import AWSAPIPlugin @testable import AWSPluginsTestCommon -import AWSPluginsCore -import InternalAmplifyCredentials class AWSAPICategoryPluginConfigurationTests: XCTestCase { let graphQLAPI = "graphQLAPI" @@ -27,12 +27,15 @@ class AWSAPICategoryPluginConfigurationTests: XCTestCase { let interceptorsConfig = AWSAPIEndpointInterceptors( endpointName: graphQLAPI, - apiAuthProviderFactory: apiAuthProviderFactory) - - config = AWSAPICategoryPluginConfiguration(endpoints: [graphQLAPI: endpointConfig!], - interceptors: [graphQLAPI: interceptorsConfig], - apiAuthProviderFactory: apiAuthProviderFactory, - authService: MockAWSAuthService()) + apiAuthProviderFactory: apiAuthProviderFactory + ) + + config = AWSAPICategoryPluginConfiguration( + endpoints: [graphQLAPI: endpointConfig!], + interceptors: [graphQLAPI: interceptorsConfig], + apiAuthProviderFactory: apiAuthProviderFactory, + authService: MockAWSAuthService() + ) } func testThrowsOnMissingConfig() async throws { @@ -86,8 +89,10 @@ class AWSAPICategoryPluginConfigurationTests: XCTestCase { config?.addInterceptor(apiKeyInterceptor, toEndpoint: graphQLAPI) config?.addInterceptor(CustomURLInterceptor(), toEndpoint: graphQLAPI) - let interceptors = try config?.interceptorsForEndpoint(withConfig: endpointConfig!, - authType: .amazonCognitoUserPools) + let interceptors = try config?.interceptorsForEndpoint( + withConfig: endpointConfig!, + authType: .amazonCognitoUserPools + ) XCTAssertEqual(interceptors!.preludeInterceptors.count, 1) XCTAssertNotNil(interceptors!.preludeInterceptors[0] as? AuthTokenURLRequestInterceptor) @@ -119,7 +124,8 @@ class AWSAPICategoryPluginConfigurationTests: XCTestCase { authorizationType: AWSAuthorizationType.apiKey, endpointType: endpointType, apiKey: apiKey, - apiAuthProviderFactory: APIAuthProviderFactory()) + apiAuthProviderFactory: APIAuthProviderFactory() + ) } struct CustomURLInterceptor: URLRequestInterceptor { @@ -129,7 +135,7 @@ class AWSAPICategoryPluginConfigurationTests: XCTestCase { } struct MockTokenProvider: AuthTokenProvider { - + func getUserPoolAccessToken() async throws -> String { "token" } diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Configuration/AWSAPIEndpointInterceptorsTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Configuration/AWSAPIEndpointInterceptorsTests.swift index 03520086ef..19a2a76cc0 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Configuration/AWSAPIEndpointInterceptorsTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Configuration/AWSAPIEndpointInterceptorsTests.swift @@ -5,10 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import Amplify import AWSPluginsCore import InternalAmplifyCredentials +import XCTest @testable import AmplifyTestCommon @testable import AWSAPIPlugin @testable import AWSPluginsTestCommon @@ -19,9 +19,11 @@ class AWSAPIEndpointInterceptorsTests: XCTestCase { var config: AWSAuthorizationConfiguration? override func setUpWithError() throws { - config = try AWSAuthorizationConfiguration.makeConfiguration(authType: .apiKey, - region: "us-west-2", - apiKey: apiKey) + config = try AWSAuthorizationConfiguration.makeConfiguration( + authType: .apiKey, + region: "us-west-2", + apiKey: apiKey + ) } /// Given: an AWSAPIEndpointInterceptors @@ -52,26 +54,38 @@ class AWSAPIEndpointInterceptorsTests: XCTestCase { } func testaddMultipleAuthInterceptors() throws { - let apiKeyConfig = try AWSAuthorizationConfiguration.makeConfiguration(authType: .apiKey, - region: "us-west-2", - apiKey: apiKey) - - let awsIAMConfig = try AWSAuthorizationConfiguration.makeConfiguration(authType: .awsIAM, - region: "us-west-2", - apiKey: apiKey) - - let userPoolConfig = try AWSAuthorizationConfiguration.makeConfiguration(authType: .amazonCognitoUserPools, - region: "us-west-2", - apiKey: nil) + let apiKeyConfig = try AWSAuthorizationConfiguration.makeConfiguration( + authType: .apiKey, + region: "us-west-2", + apiKey: apiKey + ) + + let awsIAMConfig = try AWSAuthorizationConfiguration.makeConfiguration( + authType: .awsIAM, + region: "us-west-2", + apiKey: apiKey + ) + + let userPoolConfig = try AWSAuthorizationConfiguration.makeConfiguration( + authType: .amazonCognitoUserPools, + region: "us-west-2", + apiKey: nil + ) var interceptorConfig = createAPIInterceptorConfig() - try interceptorConfig.addAuthInterceptorsToEndpoint(endpointType: .graphQL, - authConfiguration: apiKeyConfig) - try interceptorConfig.addAuthInterceptorsToEndpoint(endpointType: .graphQL, - authConfiguration: awsIAMConfig) - - try interceptorConfig.addAuthInterceptorsToEndpoint(endpointType: .graphQL, - authConfiguration: userPoolConfig) + try interceptorConfig.addAuthInterceptorsToEndpoint( + endpointType: .graphQL, + authConfiguration: apiKeyConfig + ) + try interceptorConfig.addAuthInterceptorsToEndpoint( + endpointType: .graphQL, + authConfiguration: awsIAMConfig + ) + + try interceptorConfig.addAuthInterceptorsToEndpoint( + endpointType: .graphQL, + authConfiguration: userPoolConfig + ) XCTAssertEqual(interceptorConfig.preludeInterceptors.count, 2) XCTAssertEqual(interceptorConfig.interceptors.count, 0) @@ -86,28 +100,29 @@ class AWSAPIEndpointInterceptorsTests: XCTestCase { let authService = MockAWSAuthService() authService.tokenClaims = ["exp": validToken as AnyObject] let interceptorConfig = createAPIInterceptorConfig(authService: authService) - + let result = interceptorConfig.expiryValidator("") XCTAssertFalse(result) } - + func testExpiryValidator_Expired() { let expiredToken = Date().timeIntervalSince1970 - 1 let authService = MockAWSAuthService() authService.tokenClaims = ["exp": expiredToken as AnyObject] let interceptorConfig = createAPIInterceptorConfig(authService: authService) - + let result = interceptorConfig.expiryValidator("") XCTAssertTrue(result) } - + // MARK: - Test Helpers func createAPIInterceptorConfig(authService: AWSAuthCredentialsProviderBehavior = MockAWSAuthService()) -> AWSAPIEndpointInterceptors { return AWSAPIEndpointInterceptors( endpointName: endpointName, apiAuthProviderFactory: APIAuthProviderFactory(), - authService: authService) + authService: authService + ) } struct CustomInterceptor: URLRequestInterceptor { diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncListDecoderTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncListDecoderTests.swift index 87b2917b08..2e27a54ce4 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncListDecoderTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncListDecoderTests.swift @@ -5,11 +5,11 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import Amplify +import AWSPluginsCore +import XCTest @testable import AmplifyTestCommon @testable import AWSAPIPlugin -import AWSPluginsCore class AppSyncListDecoderTests: XCTestCase { @@ -77,10 +77,12 @@ class AppSyncListDecoderTests: XCTestCase { } func testShouldDecodeFromModelMetadata() throws { - let modelMetadata = AppSyncListDecoder.Metadata(appSyncAssociatedIdentifiers: ["postId"], - appSyncAssociatedFields: ["post"], - apiName: "apiName", - authMode: nil) + let modelMetadata = AppSyncListDecoder.Metadata( + appSyncAssociatedIdentifiers: ["postId"], + appSyncAssociatedFields: ["post"], + apiName: "apiName", + authMode: nil + ) let data = try encoder.encode(modelMetadata) let harness = try decoder.decode(AppSyncListDecoderHarness.self, from: data) XCTAssertNotNil(harness.listProvider) @@ -97,9 +99,13 @@ class AppSyncListDecoderTests: XCTestCase { } func testShouldDecodeFromAWSAppSyncListResponse() throws { - let listResponse = AppSyncListResponse(items: [Post4(title: "title"), - Post4(title: "title")], - nextToken: "nextToken") + let listResponse = AppSyncListResponse( + items: [ + Post4(title: "title"), + Post4(title: "title") + ], + nextToken: "nextToken" + ) let data = try encoder.encode(listResponse) let harness = try decoder.decode(AppSyncListDecoderHarness.self, from: data) XCTAssertNotNil(harness.listProvider) @@ -119,8 +125,8 @@ class AppSyncListDecoderTests: XCTestCase { func testInvalidPayload() throws { let json = "json" let data = try encoder.encode(json) - let result = try self.decoder.decode(AppSyncListDecoderHarness.self, from: data) + let result = try decoder.decode(AppSyncListDecoderHarness.self, from: data) XCTAssertNil(result.listProvider) - + } } diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncListPayloadTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncListPayloadTests.swift index 51fac4dac3..bfc2784d3d 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncListPayloadTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncListPayloadTests.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import Amplify +import XCTest @testable import AWSAPIPlugin class AppSyncListPayloadTests: XCTestCase { @@ -20,10 +20,12 @@ class AppSyncListPayloadTests: XCTestCase { ], "limit": 500 ] - let payload = AppSyncListPayload(graphQLData: JSONValue.null, - apiName: "apiName", - authMode: nil, - variables: variables) + let payload = AppSyncListPayload( + graphQLData: JSONValue.null, + apiName: "apiName", + authMode: nil, + variables: variables + ) guard let limit = payload.limit else { XCTFail("Could not get limit from payload") @@ -51,20 +53,24 @@ class AppSyncListPayloadTests: XCTestCase { ], "missingLimit": 500 ] - let payload = AppSyncListPayload(graphQLData: JSONValue.null, - apiName: "apiName", - authMode: nil, - variables: variables) + let payload = AppSyncListPayload( + graphQLData: JSONValue.null, + apiName: "apiName", + authMode: nil, + variables: variables + ) XCTAssertNil(payload.graphQLFilter) XCTAssertNil(payload.limit) } func testRetrieveNilFilterAndLimit_MissingVariables() { - let payload = AppSyncListPayload(graphQLData: JSONValue.null, - apiName: "apiName", - authMode: nil, - variables: nil) + let payload = AppSyncListPayload( + graphQLData: JSONValue.null, + apiName: "apiName", + authMode: nil, + variables: nil + ) XCTAssertNil(payload.graphQLFilter) XCTAssertNil(payload.limit) diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncListProviderPaginationTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncListProviderPaginationTests.swift index 410077d90d..3755b5f96f 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncListProviderPaginationTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncListProviderPaginationTests.swift @@ -6,10 +6,10 @@ // import XCTest -@testable import AWSPluginsCore @testable import Amplify @testable import AmplifyTestCommon @testable import AWSAPIPlugin +@testable import AWSPluginsCore extension AppSyncListProviderTests { @@ -34,10 +34,12 @@ extension AppSyncListProviderTests { } func testNotLoadedStateHasNextPageFalse() { - let modelMetadata = AppSyncListDecoder.Metadata(appSyncAssociatedIdentifiers: ["postId"], - appSyncAssociatedFields: ["post"], - apiName: "apiName", - authMode: nil) + let modelMetadata = AppSyncListDecoder.Metadata( + appSyncAssociatedIdentifiers: ["postId"], + appSyncAssociatedFields: ["post"], + apiName: "apiName", + authMode: nil + ) let provider = AppSyncListProvider(metadata: modelMetadata) guard case .notLoaded = provider.loadedState else { XCTFail("Should not be loaded") @@ -50,9 +52,11 @@ extension AppSyncListProviderTests { Amplify.Logging.logLevel = .verbose mockAPIPlugin.responders[.queryRequestResponse] = QueryRequestResponder> { _ in - let nextPage = List(elements: [Comment4(content: "content"), - Comment4(content: "content"), - Comment4(content: "content")]) + let nextPage = List(elements: [ + Comment4(content: "content"), + Comment4(content: "content"), + Comment4(content: "content") + ]) return .success(nextPage) } let elements = [Comment4(content: "content")] @@ -136,10 +140,12 @@ extension AppSyncListProviderTests { } func testNotLoadedStateGetNextPageFailure() async { - let modelMetadata = AppSyncListDecoder.Metadata(appSyncAssociatedIdentifiers: ["postId"], - appSyncAssociatedFields: ["post"], - apiName: "apiName", - authMode: nil) + let modelMetadata = AppSyncListDecoder.Metadata( + appSyncAssociatedIdentifiers: ["postId"], + appSyncAssociatedFields: ["post"], + apiName: "apiName", + authMode: nil + ) let provider = AppSyncListProvider(metadata: modelMetadata) guard case .notLoaded = provider.loadedState else { XCTFail("Should not be loaded") diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncListProviderTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncListProviderTests.swift index e8c7abd661..4f06001535 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncListProviderTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncListProviderTests.swift @@ -6,10 +6,10 @@ // import XCTest -@testable import AWSPluginsCore @testable import Amplify @testable import AmplifyTestCommon @testable import AWSAPIPlugin +@testable import AWSPluginsCore class AppSyncListProviderTests: XCTestCase { var mockAPIPlugin: MockAPICategoryPlugin! @@ -59,10 +59,12 @@ class AppSyncListProviderTests: XCTestCase { ], "limit": 500 ] - let appSyncPayload = AppSyncListPayload(graphQLData: json, - apiName: "apiName", - authMode: nil, - variables: variables) + let appSyncPayload = AppSyncListPayload( + graphQLData: json, + apiName: "apiName", + authMode: nil, + variables: variables + ) let provider = try AppSyncListProvider(payload: appSyncPayload) guard case .loaded(let elements, let nextToken, let filter) = provider.loadedState else { XCTFail("Should be in loaded state") @@ -85,10 +87,12 @@ class AppSyncListProviderTests: XCTestCase { ], "nextToken": "nextToken" ] - let appSyncPayload = AppSyncListPayload(graphQLData: json, - apiName: nil, - authMode: nil, - variables: nil) + let appSyncPayload = AppSyncListPayload( + graphQLData: json, + apiName: nil, + authMode: nil, + variables: nil + ) do { _ = try AppSyncListProvider(payload: appSyncPayload) } catch _ as DecodingError { @@ -99,10 +103,12 @@ class AppSyncListProviderTests: XCTestCase { } func testInitWithModelMetadataShouldBeNotLoadedState() throws { - let modelMetadata = AppSyncListDecoder.Metadata(appSyncAssociatedIdentifiers: ["postId"], - appSyncAssociatedFields: ["post"], - apiName: "apiName", - authMode: nil) + let modelMetadata = AppSyncListDecoder.Metadata( + appSyncAssociatedIdentifiers: ["postId"], + appSyncAssociatedFields: ["post"], + apiName: "apiName", + authMode: nil + ) let provider = AppSyncListProvider(metadata: modelMetadata) guard case .notLoaded(let associatedIdentifiers, let associatedFields) = provider.loadedState else { XCTFail("Should be in not loaded state") @@ -116,7 +122,7 @@ class AppSyncListProviderTests: XCTestCase { let elements = [Post4(title: "title"), Post4(title: "title")] let listProvider = AppSyncListProvider(elements: elements) let loadCompleted = expectation(description: "Load Completed") - + Task { let posts = try await listProvider.load() XCTAssertEqual(posts.count, 2) @@ -144,23 +150,25 @@ class AppSyncListProviderTests: XCTestCase { ] return .success(json) } - let modelMetadata = AppSyncListDecoder.Metadata(appSyncAssociatedIdentifiers: ["postId"], - appSyncAssociatedFields: ["post"], - apiName: "apiName", - authMode: .amazonCognitoUserPools) + let modelMetadata = AppSyncListDecoder.Metadata( + appSyncAssociatedIdentifiers: ["postId"], + appSyncAssociatedFields: ["post"], + apiName: "apiName", + authMode: .amazonCognitoUserPools + ) let provider = AppSyncListProvider(metadata: modelMetadata) guard case .notLoaded = provider.loadedState else { XCTFail("Should not be loaded") return } let loadCompleted = expectation(description: "Load Completed") - + Task { _ = try await provider.load() loadCompleted.fulfill() } await fulfillment(of: [loadCompleted], timeout: 1) - + guard case .loaded(let elements, let nextToken, let filterOptional) = provider.loadedState else { XCTFail("Should be loaded") return @@ -175,15 +183,17 @@ class AppSyncListProviderTests: XCTestCase { } XCTAssertEqual(postId, "postId") } - + func testNotLoadedStateSynchronousLoadFailure() async { mockAPIPlugin.responders[.queryRequestResponse] = QueryRequestResponder { _ in throw APIError.unknown("", "", nil) } - let modelMetadata = AppSyncListDecoder.Metadata(appSyncAssociatedIdentifiers: ["postId"], - appSyncAssociatedFields: ["post"], - apiName: "apiName", - authMode: nil) + let modelMetadata = AppSyncListDecoder.Metadata( + appSyncAssociatedIdentifiers: ["postId"], + appSyncAssociatedFields: ["post"], + apiName: "apiName", + authMode: nil + ) let provider = AppSyncListProvider(metadata: modelMetadata) guard case .notLoaded = provider.loadedState else { XCTFail("Should not be loaded") @@ -209,7 +219,7 @@ class AppSyncListProviderTests: XCTestCase { } await fulfillment(of: [loadCompleted], timeout: 1) } - + func testNotLoadedStateLoadWithCompletionSuccess() async { mockAPIPlugin.responders[.queryRequestResponse] = QueryRequestResponder { _ in @@ -227,10 +237,12 @@ class AppSyncListProviderTests: XCTestCase { ] return .success(json) } - let modelMetadata = AppSyncListDecoder.Metadata(appSyncAssociatedIdentifiers: ["postId"], - appSyncAssociatedFields: ["post"], - apiName: "apiName", - authMode: nil) + let modelMetadata = AppSyncListDecoder.Metadata( + appSyncAssociatedIdentifiers: ["postId"], + appSyncAssociatedFields: ["post"], + apiName: "apiName", + authMode: nil + ) let provider = AppSyncListProvider(metadata: modelMetadata) guard case .notLoaded = provider.loadedState else { XCTFail("Should not be loaded") @@ -241,9 +253,9 @@ class AppSyncListProviderTests: XCTestCase { _ = try await provider.load() loadComplete.fulfill() } - + await fulfillment(of: [loadComplete], timeout: 1) - + guard case .loaded(let elements, let nextToken, let filterOptional) = provider.loadedState else { XCTFail("Should be loaded") return @@ -263,10 +275,12 @@ class AppSyncListProviderTests: XCTestCase { mockAPIPlugin.responders[.queryRequestResponse] = QueryRequestResponder { _ in throw APIError.unknown("", "", nil) } - let modelMetadata = AppSyncListDecoder.Metadata(appSyncAssociatedIdentifiers: ["postId"], - appSyncAssociatedFields: ["post"], - apiName: "apiName", - authMode: nil) + let modelMetadata = AppSyncListDecoder.Metadata( + appSyncAssociatedIdentifiers: ["postId"], + appSyncAssociatedFields: ["post"], + apiName: "apiName", + authMode: nil + ) let provider = AppSyncListProvider(metadata: modelMetadata) guard case .notLoaded = provider.loadedState else { XCTFail("Should not be loaded") @@ -297,10 +311,12 @@ class AppSyncListProviderTests: XCTestCase { mockAPIPlugin.responders[.queryRequestResponse] = QueryRequestResponder { _ in return .failure(GraphQLResponseError.error([GraphQLError]())) } - let modelMetadata = AppSyncListDecoder.Metadata(appSyncAssociatedIdentifiers: ["postId"], - appSyncAssociatedFields: ["post"], - apiName: "apiName", - authMode: nil) + let modelMetadata = AppSyncListDecoder.Metadata( + appSyncAssociatedIdentifiers: ["postId"], + appSyncAssociatedFields: ["post"], + apiName: "apiName", + authMode: nil + ) let provider = AppSyncListProvider(metadata: modelMetadata) guard case .notLoaded = provider.loadedState else { XCTFail("Should not be loaded") @@ -308,7 +324,7 @@ class AppSyncListProviderTests: XCTestCase { } let loadComplete = expectation(description: "Load completed") Task { - + do { _ = try await provider.load() XCTFail("Should have failed") @@ -320,7 +336,7 @@ class AppSyncListProviderTests: XCTestCase { } loadComplete.fulfill() } - + } await fulfillment(of: [loadComplete], timeout: 1) guard case .notLoaded = provider.loadedState else { @@ -328,7 +344,7 @@ class AppSyncListProviderTests: XCTestCase { return } } - + func testNotLoadedStateLoadWithCompletionFailure_AWSAppSyncListResponseFailure() async { mockAPIPlugin.responders[.queryRequestResponse] = QueryRequestResponder { _ in @@ -346,10 +362,12 @@ class AppSyncListProviderTests: XCTestCase { ] return .success(json) } - let modelMetadata = AppSyncListDecoder.Metadata(appSyncAssociatedIdentifiers: ["postId"], - appSyncAssociatedFields: ["post"], - apiName: "apiName", - authMode: nil) + let modelMetadata = AppSyncListDecoder.Metadata( + appSyncAssociatedIdentifiers: ["postId"], + appSyncAssociatedFields: ["post"], + apiName: "apiName", + authMode: nil + ) let provider = AppSyncListProvider(metadata: modelMetadata) guard case .notLoaded = provider.loadedState else { XCTFail("Should not be loaded") @@ -366,7 +384,7 @@ class AppSyncListProviderTests: XCTestCase { return } loadComplete.fulfill() - + } } await fulfillment(of: [loadComplete], timeout: 1) diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncListResponseTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncListResponseTests.swift index 37910a8fc9..857a91c154 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncListResponseTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncListResponseTests.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import AmplifyTestCommon +import XCTest @testable import Amplify @testable import AWSAPIPlugin @@ -36,10 +36,12 @@ class AppSyncListResponseTests: XCTestCase { ], "nextToken": "nextToken" ] - let listResponse = try AppSyncListResponse.initWithMetadata(type: Post4.self, - graphQLData: graphQLData, - apiName: "apiName", - authMode: nil) + let listResponse = try AppSyncListResponse.initWithMetadata( + type: Post4.self, + graphQLData: graphQLData, + apiName: "apiName", + authMode: nil + ) XCTAssertEqual(listResponse.items.count, 2) XCTAssertEqual(listResponse.nextToken, "nextToken") @@ -59,10 +61,12 @@ class AppSyncListResponseTests: XCTestCase { ] ] ] - let listResponse = try AppSyncListResponse.initWithMetadata(type: Comment4.self, - graphQLData: graphQLData, - apiName: "apiName", - authMode: nil) + let listResponse = try AppSyncListResponse.initWithMetadata( + type: Comment4.self, + graphQLData: graphQLData, + apiName: "apiName", + authMode: nil + ) XCTAssertEqual(listResponse.items.count, 2) XCTAssertNil(listResponse.nextToken) diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncModelMetadataTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncModelMetadataTests.swift index f2ca4b3148..ac8ec972d9 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncModelMetadataTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/AppSyncModelMetadataTests.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import AmplifyTestCommon +import XCTest @testable import Amplify @testable import AWSAPIPlugin @@ -54,9 +54,11 @@ class ModelMetadataTests: XCTestCase { "__typename": "Post4" ] ] - let posts = AppSyncModelMetadataUtils.addMetadata(toModelArray: jsonArray, - apiName: "apiName", - authMode: .amazonCognitoUserPools) + let posts = AppSyncModelMetadataUtils.addMetadata( + toModelArray: jsonArray, + apiName: "apiName", + authMode: .amazonCognitoUserPools + ) XCTAssertEqual(posts.count, 2) for post in posts { guard case .object(let associationData) = post["comments"], diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/ListTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/ListTests.swift index ad28849701..061952e153 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/ListTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Core/ListTests.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import Amplify import AmplifyTestCommon +import XCTest @testable import AWSAPIPlugin class ListTests: XCTestCase { @@ -17,9 +17,11 @@ class ListTests: XCTestCase { } func testDecodeToResponseTypeList() async throws { - let request = GraphQLRequest>(document: "", - responseType: List.self, - decodePath: "listComments") + let request = GraphQLRequest>( + document: "", + responseType: List.self, + decodePath: "listComments" + ) let decoder = GraphQLResponseDecoder(request: request.toOperationRequest(operationType: .query)) let graphQLData: [String: JSONValue] = [ "listComments": [ diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Interceptor/APIKeyURLRequestInterceptorTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Interceptor/APIKeyURLRequestInterceptorTests.swift index fff55d800d..67b0fb91ae 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Interceptor/APIKeyURLRequestInterceptorTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Interceptor/APIKeyURLRequestInterceptorTests.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import AWSPluginsCore +import XCTest @testable import Amplify @testable import AmplifyTestCommon @testable import AWSAPIPlugin diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Interceptor/AuthTokenURLRequestInterceptorTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Interceptor/AuthTokenURLRequestInterceptorTests.swift index 74e1041f82..293a77a6f1 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Interceptor/AuthTokenURLRequestInterceptorTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Interceptor/AuthTokenURLRequestInterceptorTests.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import AWSPluginsCore import InternalAmplifyCredentials +import XCTest @testable import Amplify @testable import AmplifyTestCommon @testable import AWSAPIPlugin @@ -32,23 +32,26 @@ class AuthTokenURLRequestInterceptorTests: XCTestCase { XCTAssertNotNil(headers[URLRequestConstants.Header.xAmzDate]) XCTAssertNotNil(headers[URLRequestConstants.Header.userAgent]) } - + func testAuthTokenInterceptor_ThrowsInvalid() async throws { let mockTokenProvider = MockTokenProvider() - let interceptor = AuthTokenURLRequestInterceptor(authTokenProvider: mockTokenProvider, - isTokenExpired: { _ in return true }) + let interceptor = AuthTokenURLRequestInterceptor( + authTokenProvider: mockTokenProvider, + isTokenExpired: { _ in return true } + ) let request = RESTOperationRequestUtils.constructURLRequest( with: URL(string: "http://anapiendpoint.ca")!, operationType: .get, requestPayload: nil ) - + do { _ = try await interceptor.intercept(request).allHTTPHeaderFields } catch { guard case .operationError(let description, _, let underlyingError) = error as? APIError, let authError = underlyingError as? AuthError, - case .sessionExpired = authError else { + case .sessionExpired = authError + else { XCTFail("Should be API.operationError with underlying AuthError.sessionExpired") return } @@ -60,7 +63,7 @@ class AuthTokenURLRequestInterceptorTests: XCTestCase { extension AuthTokenURLRequestInterceptorTests { class MockTokenProvider: AuthTokenProvider { let authorizationToken = "authorizationToken" - + func getUserPoolAccessToken() async throws -> String { authorizationToken } diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Interceptor/SubscriptionInterceptor/APIKeyAuthInterceptorTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Interceptor/SubscriptionInterceptor/APIKeyAuthInterceptorTests.swift index 8c89c0a53a..885d929730 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Interceptor/SubscriptionInterceptor/APIKeyAuthInterceptorTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Interceptor/SubscriptionInterceptor/APIKeyAuthInterceptorTests.swift @@ -5,9 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // - -import XCTest import Amplify +import XCTest @testable import AWSAPIPlugin class APIKeyAuthInterceptorTests: XCTestCase { diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Interceptor/SubscriptionInterceptor/CognitoAuthInterceptorTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Interceptor/SubscriptionInterceptor/CognitoAuthInterceptorTests.swift index 4127f018fd..9428e4d414 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Interceptor/SubscriptionInterceptor/CognitoAuthInterceptorTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Interceptor/SubscriptionInterceptor/CognitoAuthInterceptorTests.swift @@ -5,9 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // - -import XCTest import Amplify +import XCTest @testable import AWSAPIPlugin @testable @_spi(WebSocket) import AWSPluginsCore @@ -110,14 +109,14 @@ class CognitoAuthInterceptorTests: XCTestCase { } } -fileprivate class MockAuthTokenProvider: AmplifyAuthTokenProvider { +private class MockAuthTokenProvider: AmplifyAuthTokenProvider { let authToken = UUID().uuidString func getLatestAuthToken() async throws -> String { return authToken } } -fileprivate class MockAuthTokenProviderFailed: AmplifyAuthTokenProvider { +private class MockAuthTokenProviderFailed: AmplifyAuthTokenProvider { let authToken = UUID().uuidString func getLatestAuthToken() async throws -> String { throw "Intended" diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Mocks/MockReachability.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Mocks/MockReachability.swift index 3befe8e8a1..10e31757cd 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Mocks/MockReachability.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Mocks/MockReachability.swift @@ -6,8 +6,8 @@ // import Amplify -import Foundation import AWSAPIPlugin +import Foundation class MockNetworkReachabilityProvidingFactory: NetworkReachabilityProvidingFactory { #if os(watchOS) diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Mocks/MockSessionFactory.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Mocks/MockSessionFactory.swift index ad04a70279..9ab63c60ab 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Mocks/MockSessionFactory.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Mocks/MockSessionFactory.swift @@ -6,8 +6,8 @@ // @testable import Amplify -@testable import AWSAPIPlugin @testable import AmplifyTestCommon +@testable import AWSAPIPlugin struct MockSessionFactory: URLSessionBehaviorFactory { let session: MockURLSession diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Mocks/MockSubscription.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Mocks/MockSubscription.swift index 51c1feea3e..660b516661 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Mocks/MockSubscription.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Mocks/MockSubscription.swift @@ -57,12 +57,12 @@ class MockAppSyncRealTimeClient: AppSyncRealTimeClientProtocol { } return subject.eraseToAnyPublisher() } - + func unsubscribe(id: String) async throws { try await Task.sleep(seconds: 0.45) subject.send(.unsubscribed) } - + func connect() async throws { } func disconnectWhenIdel() async { } @@ -138,6 +138,6 @@ actor MockWebSocketClient: AppSyncWebSocketClientProtocol { } func setStateToConnected() { - self.state = .connected + state = .connected } } diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Mocks/MockURLSession.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Mocks/MockURLSession.swift index 3e1a4e3b89..e588ba380f 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Mocks/MockURLSession.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Mocks/MockURLSession.swift @@ -6,8 +6,8 @@ // import Foundation -@testable import AWSAPIPlugin @testable import Amplify +@testable import AWSAPIPlugin class MockURLSession: URLSessionBehavior { weak var sessionBehaviorDelegate: URLSessionBehaviorDelegate? @@ -17,8 +17,10 @@ class MockURLSession: URLSessionBehavior { var onTaskForRequest: (URLRequest) -> URLSessionDataTaskBehavior var onReset: ((BasicClosure?) -> Void)? - init(onTaskForRequest: @escaping (URLRequest) -> URLSessionDataTaskBehavior, - onReset: ((BasicClosure?) -> Void)? = MockURLSession.defaultOnReset) { + init( + onTaskForRequest: @escaping (URLRequest) -> URLSessionDataTaskBehavior, + onReset: ((BasicClosure?) -> Void)? = MockURLSession.defaultOnReset + ) { self.onTaskForRequest = onTaskForRequest self.onReset = onReset } diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Mocks/MockURLSessionTask.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Mocks/MockURLSessionTask.swift index 1c06ec3212..7cf5e46fce 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Mocks/MockURLSessionTask.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Mocks/MockURLSessionTask.swift @@ -6,9 +6,9 @@ // import Foundation -@testable import AWSAPIPlugin @testable import Amplify @testable import AmplifyTestCommon +@testable import AWSAPIPlugin class MockURLSessionTask: URLSessionDataTaskBehavior { static var counter = AtomicValue(initialValue: 0) @@ -26,9 +26,11 @@ class MockURLSessionTask: URLSessionDataTaskBehavior { var onPause: BasicClosure? var onResume: BasicClosure? - init(onCancel: BasicClosure? = nil, - onPause: BasicClosure? = nil, - onResume: BasicClosure? = nil) { + init( + onCancel: BasicClosure? = nil, + onPause: BasicClosure? = nil, + onResume: BasicClosure? = nil + ) { self.onCancel = onCancel self.onPause = onPause self.onResume = onResume diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/AWSGraphQLOperationTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/AWSGraphQLOperationTests.swift index 9400006ebd..400b47b58e 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/AWSGraphQLOperationTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/AWSGraphQLOperationTests.swift @@ -5,21 +5,23 @@ // SPDX-License-Identifier: Apache-2.0 // +import AWSPluginsCore import XCTest @testable import Amplify @testable import AmplifyTestCommon @testable import AWSAPIPlugin @testable import AWSPluginsTestCommon -import AWSPluginsCore class AWSGraphQLOperationTests: AWSAPICategoryPluginTestBase { /// Tests that upon completion, the operation is removed from the task mapper. func testOperationCleanup() async { - let request = GraphQLRequest(apiName: apiName, - document: testDocument, - variables: nil, - responseType: JSONValue.self) + let request = GraphQLRequest( + apiName: apiName, + document: testDocument, + variables: nil, + responseType: JSONValue.self + ) let operation = apiPlugin.query(request: request, listener: nil) @@ -43,30 +45,37 @@ class AWSGraphQLOperationTests: AWSAPICategoryPluginTestBase { /// Request for `.amazonCognitoUserPool` at runtime with `request` while passing in what /// is configured as `.apiKey`. Expect that the interceptor is the token interceptor func testGetEndpointInterceptors() throws { - let request = GraphQLRequest(apiName: apiName, - document: testDocument, - variables: nil, - responseType: JSONValue.self, - authMode: AWSAuthorizationType.amazonCognitoUserPools) + let request = GraphQLRequest( + apiName: apiName, + document: testDocument, + variables: nil, + responseType: JSONValue.self, + authMode: AWSAuthorizationType.amazonCognitoUserPools + ) let task = try OperationTestBase.makeSingleValueErrorMockTask() let mockSession = MockURLSession(onTaskForRequest: { _ in task }) - let pluginConfig = AWSAPICategoryPluginConfiguration( + let pluginConfig = try AWSAPICategoryPluginConfiguration( endpoints: [ - apiName: try .init( + apiName: .init( name: apiName, baseURL: URL(string: "url")!, region: "us-test-1", authorizationType: .apiKey, endpointType: .graphQL, apiKey: "apiKey", - apiAuthProviderFactory: .init())], + apiAuthProviderFactory: .init() + ) + ], apiAuthProviderFactory: .init(), - authService: MockAWSAuthService()) - let operation = AWSGraphQLOperation(request: request.toOperationRequest(operationType: .query), - session: mockSession, - mapper: OperationTaskMapper(), - pluginConfig: pluginConfig, - resultListener: { _ in }) + authService: MockAWSAuthService() + ) + let operation = AWSGraphQLOperation( + request: request.toOperationRequest(operationType: .query), + session: mockSession, + mapper: OperationTaskMapper(), + pluginConfig: pluginConfig, + resultListener: { _ in } + ) // Act let results = operation.getEndpointInterceptors() @@ -74,7 +83,8 @@ class AWSGraphQLOperationTests: AWSAPICategoryPluginTestBase { // Assert guard case let .success(interceptors) = results, let interceptor = interceptors?.preludeInterceptors.first, - (interceptor as? AuthTokenURLRequestInterceptor) != nil else { + (interceptor as? AuthTokenURLRequestInterceptor) != nil + else { XCTFail("Should be token interceptor for Cognito User Pool") return } diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/AWSGraphQLSubscriptionOperationCancelTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/AWSGraphQLSubscriptionOperationCancelTests.swift index 95fc5b8e63..9911aa02e6 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/AWSGraphQLSubscriptionOperationCancelTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/AWSGraphQLSubscriptionOperationCancelTests.swift @@ -8,8 +8,8 @@ import XCTest @testable import Amplify -@testable import AWSAPIPlugin @testable import AmplifyTestCommon +@testable import AWSAPIPlugin @testable @_spi(WebSocket) import AWSPluginsCore @testable import AWSPluginsTestCommon @@ -36,13 +36,14 @@ class AWSGraphQLSubscriptionOperationCancelTests: XCTestCase { self.authService = authService do { - let endpointConfig = [apiName: try AWSAPICategoryPluginConfiguration.EndpointConfig( + let endpointConfig = try [apiName: AWSAPICategoryPluginConfiguration.EndpointConfig( name: apiName, baseURL: baseURL, region: region, authorizationType: AWSAuthorizationType.none, endpointType: .graphQL, - apiAuthProviderFactory: APIAuthProviderFactory())] + apiAuthProviderFactory: APIAuthProviderFactory() + )] let pluginConfig = AWSAPICategoryPluginConfiguration(endpoints: endpointConfig) self.pluginConfig = pluginConfig @@ -72,10 +73,12 @@ class AWSGraphQLSubscriptionOperationCancelTests: XCTestCase { }) await setUp(mockAppSyncRealTimeClientFactory: mockSubscriptionConnectionFactory) - let request = GraphQLRequest(apiName: apiName, - document: testDocument, - variables: nil, - responseType: JSONValue.self) + let request = GraphQLRequest( + apiName: apiName, + document: testDocument, + variables: nil, + responseType: JSONValue.self + ) let receivedValueConnecting = expectation(description: "Received value for connecting") @@ -135,7 +138,7 @@ class AWSGraphQLSubscriptionOperationCancelTests: XCTestCase { receivedCompletion.fulfill() } }) - + operation.cancel() XCTAssert(operation.isCancelled) @@ -144,7 +147,7 @@ class AWSGraphQLSubscriptionOperationCancelTests: XCTestCase { timeout: 1 ) } - + func testFailureOnConnection() async { let mockSubscriptionConnectionFactory = MockSubscriptionConnectionFactory(onGetOrCreateConnection: { _, _, _, _, _ in throw APIError.invalidConfiguration("something went wrong", "", nil) @@ -152,10 +155,12 @@ class AWSGraphQLSubscriptionOperationCancelTests: XCTestCase { await setUp(mockAppSyncRealTimeClientFactory: mockSubscriptionConnectionFactory) - let request = GraphQLRequest(apiName: apiName, - document: testDocument, - variables: nil, - responseType: JSONValue.self) + let request = GraphQLRequest( + apiName: apiName, + document: testDocument, + variables: nil, + responseType: JSONValue.self + ) let receivedCompletion = expectation(description: "Received completion") receivedCompletion.isInverted = true @@ -199,12 +204,14 @@ class AWSGraphQLSubscriptionOperationCancelTests: XCTestCase { await setUp(mockAppSyncRealTimeClientFactory: mockSubscriptionConnectionFactory) - let request = GraphQLRequest(apiName: apiName, - document: testDocument, - variables: nil, - responseType: JSONValue.self) - - + let request = GraphQLRequest( + apiName: apiName, + document: testDocument, + variables: nil, + responseType: JSONValue.self + ) + + let receivedValue = expectation(description: "Received value for connecting") receivedValue.assertForOverFulfill = false @@ -225,7 +232,7 @@ class AWSGraphQLSubscriptionOperationCancelTests: XCTestCase { let receivedFailure = expectation(description: "Received failure") receivedFailure.isInverted = true let receivedCompletion = expectation(description: "Received completion") - + _ = operation.subscribe(resultListener: { result in switch result { case .failure: @@ -234,7 +241,7 @@ class AWSGraphQLSubscriptionOperationCancelTests: XCTestCase { receivedCompletion.fulfill() } }) - + operation.cancel() XCTAssert(operation.isCancelled) await fulfillment( diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/AWSGraphQLSubscriptionTaskRunnerCancelTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/AWSGraphQLSubscriptionTaskRunnerCancelTests.swift index a06001515f..ce2d2b0981 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/AWSGraphQLSubscriptionTaskRunnerCancelTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/AWSGraphQLSubscriptionTaskRunnerCancelTests.swift @@ -8,8 +8,8 @@ import XCTest @testable import Amplify -@testable import AWSAPIPlugin @testable import AmplifyTestCommon +@testable import AWSAPIPlugin @testable import AWSPluginsCore @testable import AWSPluginsTestCommon @@ -36,13 +36,14 @@ class AWSGraphQLSubscriptionTaskRunnerCancelTests: XCTestCase { self.authService = authService do { - let endpointConfig = [apiName: try AWSAPICategoryPluginConfiguration.EndpointConfig( + let endpointConfig = try [apiName: AWSAPICategoryPluginConfiguration.EndpointConfig( name: apiName, baseURL: baseURL, region: region, authorizationType: AWSAuthorizationType.none, endpointType: .graphQL, - apiAuthProviderFactory: APIAuthProviderFactory())] + apiAuthProviderFactory: APIAuthProviderFactory() + )] let pluginConfig = AWSAPICategoryPluginConfiguration(endpoints: endpointConfig) self.pluginConfig = pluginConfig @@ -65,7 +66,7 @@ class AWSGraphQLSubscriptionTaskRunnerCancelTests: XCTestCase { XCTFail("Error setting up Amplify: \(error)") } } - + func testCancelSendsCompletion() async throws { let mockSubscriptionConnectionFactory = MockSubscriptionConnectionFactory(onGetOrCreateConnection: { _, _, _, _, _ in return MockAppSyncRealTimeClient() @@ -73,10 +74,12 @@ class AWSGraphQLSubscriptionTaskRunnerCancelTests: XCTestCase { await setUp(appSyncRealTimeClientFactory: mockSubscriptionConnectionFactory) - let request = GraphQLRequest(apiName: apiName, - document: testDocument, - variables: nil, - responseType: JSONValue.self) + let request = GraphQLRequest( + apiName: apiName, + document: testDocument, + variables: nil, + responseType: JSONValue.self + ) let receivedValueConnecting = expectation(description: "Received value for connecting") let receivedValueDisconnected = expectation(description: "Received value for disconnected") @@ -111,7 +114,7 @@ class AWSGraphQLSubscriptionTaskRunnerCancelTests: XCTestCase { try await MockAppSyncRealTimeClient.waitForUnsubscirbed() await fulfillment(of: [receivedValueDisconnected, receivedCompletion, receivedFailure], timeout: 1) } - + func testFailureOnConnection() async { let mockAppSyncRealTimeClientFactory = MockSubscriptionConnectionFactory(onGetOrCreateConnection: { _, _, _, _, _ in throw APIError.invalidConfiguration("something went wrong", "", nil) @@ -119,10 +122,12 @@ class AWSGraphQLSubscriptionTaskRunnerCancelTests: XCTestCase { await setUp(appSyncRealTimeClientFactory: mockAppSyncRealTimeClientFactory) - let request = GraphQLRequest(apiName: apiName, - document: testDocument, - variables: nil, - responseType: JSONValue.self) + let request = GraphQLRequest( + apiName: apiName, + document: testDocument, + variables: nil, + responseType: JSONValue.self + ) let receivedCompletion = expectation(description: "Received completion") receivedCompletion.isInverted = true @@ -141,7 +146,7 @@ class AWSGraphQLSubscriptionTaskRunnerCancelTests: XCTestCase { receivedFailure.fulfill() } } - + await fulfillment(of: [receivedValue, receivedFailure, receivedCompletion], timeout: 0.3) } @@ -154,11 +159,13 @@ class AWSGraphQLSubscriptionTaskRunnerCancelTests: XCTestCase { await setUp(appSyncRealTimeClientFactory: mockSubscriptionConnectionFactory) - let request = GraphQLRequest(apiName: apiName, - document: testDocument, - variables: nil, - responseType: JSONValue.self) - + let request = GraphQLRequest( + apiName: apiName, + document: testDocument, + variables: nil, + responseType: JSONValue.self + ) + let receivedValue = expectation(description: "Received value for connecting") receivedValue.expectedFulfillmentCount = 1 receivedValue.assertForOverFulfill = false @@ -167,7 +174,7 @@ class AWSGraphQLSubscriptionTaskRunnerCancelTests: XCTestCase { receivedFailure.isInverted = true let receivedCompletion = expectation(description: "Received completion") - + let subscriptionEvents = apiPlugin.subscribe(request: request) Task { do { diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/AWSHTTPURLResponseTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/AWSHTTPURLResponseTests.swift index 9cc06f34f6..8b55d2da64 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/AWSHTTPURLResponseTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/AWSHTTPURLResponseTests.swift @@ -12,11 +12,15 @@ class AWSHTTPURLResponseTests: XCTestCase { func testAWSHTTPURLResponse() throws { let body = Data("responseBody".utf8) - let httpResponse = HTTPURLResponse(url: URL(string: "dummyString")!, - statusCode: 200, - httpVersion: "1.1", - headerFields: ["key1": "value1", - "key2": "value2"])! + let httpResponse = HTTPURLResponse( + url: URL(string: "dummyString")!, + statusCode: 200, + httpVersion: "1.1", + headerFields: [ + "key1": "value1", + "key2": "value2" + ] + )! if let response = AWSHTTPURLResponse(response: httpResponse, body: body) { XCTAssertNotNil(response.body) XCTAssertNotNil(response.url) @@ -36,16 +40,20 @@ class AWSHTTPURLResponseTests: XCTestCase { func testAWSHTTPURLResponseNSCoding() { let body = Data("responseBody".utf8) - let httpResponse = HTTPURLResponse(url: URL(string: "dummyString")!, - statusCode: 200, - httpVersion: "1.1", - headerFields: ["key1": "value1", - "key2": "value2"])! + let httpResponse = HTTPURLResponse( + url: URL(string: "dummyString")!, + statusCode: 200, + httpVersion: "1.1", + headerFields: [ + "key1": "value1", + "key2": "value2" + ] + )! guard let response = AWSHTTPURLResponse(response: httpResponse, body: body) else { XCTFail("Failed to initialize `AWSHTTPURLResponse`") return } - let data : Data + let data: Data do { data = try NSKeyedArchiver.archivedData(withRootObject: response, requiringSecureCoding: false) XCTAssertNotNil(data) @@ -53,7 +61,7 @@ class AWSHTTPURLResponseTests: XCTestCase { XCTFail("Failed to archive data : \(error)") return } - + do { guard let unarchivedResponse = try NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(data) as? AWSHTTPURLResponse else { XCTFail("Failure while unarchiving") diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/AWSRESTOperationTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/AWSRESTOperationTests.swift index e6917c412c..9dca78a71e 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/AWSRESTOperationTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/AWSRESTOperationTests.swift @@ -122,7 +122,7 @@ class AWSRESTOperationTests: OperationTestBase { } -fileprivate struct TestURLRequestInterceptor: URLRequestInterceptor { +private struct TestURLRequestInterceptor: URLRequestInterceptor { let validate: (URLRequest) -> Bool func intercept(_ request: URLRequest) async throws -> URLRequest { diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/GraphQLMutateCombineTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/GraphQLMutateCombineTests.swift index 51a53fd429..82553bdfe6 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/GraphQLMutateCombineTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/GraphQLMutateCombineTests.swift @@ -8,8 +8,8 @@ import XCTest @testable import Amplify -@testable import AWSAPIPlugin @testable import AmplifyTestCommon +@testable import AWSAPIPlugin class GraphQLMutateCombineTests: OperationTestBase { let testDocument = "mutate { updateTodo { id name description }}" @@ -98,7 +98,7 @@ class GraphQLMutateCombineTests: OperationTestBase { let receivedFinish = expectation(description: "Received finished") receivedFinish.isInverted = true let receivedFailure = expectation(description: "Received failed") - + let sink = Amplify.Publisher.create { try await self.apiPlugin.mutate(request: request) }.sink(receiveCompletion: { completion in diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/GraphQLQueryCombineTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/GraphQLQueryCombineTests.swift index b25059ec02..01f9a44327 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/GraphQLQueryCombineTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/GraphQLQueryCombineTests.swift @@ -8,8 +8,8 @@ import XCTest @testable import Amplify -@testable import AWSAPIPlugin @testable import AmplifyTestCommon +@testable import AWSAPIPlugin class GraphQLQueryCombineTests: OperationTestBase { let testDocument = "query { getTodo { id name description }}" @@ -46,13 +46,16 @@ class GraphQLQueryCombineTests: OperationTestBase { receivedResponseError.fulfill() } }) - - await fulfillment(of: [receivedValue, - receivedFinish, - receivedFailure, - receivedResponseError - ], - timeout: 0.05) + + await fulfillment( + of: [ + receivedValue, + receivedFinish, + receivedFailure, + receivedResponseError + ], + timeout: 0.05 + ) sink.cancel() } @@ -86,13 +89,16 @@ class GraphQLQueryCombineTests: OperationTestBase { receivedResponseError.fulfill() } }) - - await fulfillment(of: [receivedValue, - receivedFinish, - receivedFailure, - receivedResponseError - ], - timeout: 0.05) + + await fulfillment( + of: [ + receivedValue, + receivedFinish, + receivedFailure, + receivedResponseError + ], + timeout: 0.05 + ) sink.cancel() } @@ -109,7 +115,7 @@ class GraphQLQueryCombineTests: OperationTestBase { let receivedFinish = expectation(description: "Received finished") receivedFinish.isInverted = true let receivedFailure = expectation(description: "Received failed") - + let sink = Amplify.Publisher.create { try await self.apiPlugin.query(request: request) }.sink(receiveCompletion: { completion in @@ -128,12 +134,15 @@ class GraphQLQueryCombineTests: OperationTestBase { } }) - await fulfillment(of: [receivedValue, - receivedFinish, - receivedFailure, - receivedResponseError - ], - timeout: 0.05) + await fulfillment( + of: [ + receivedValue, + receivedFinish, + receivedFailure, + receivedResponseError + ], + timeout: 0.05 + ) sink.cancel() } } diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/GraphQLSubscribeCombineTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/GraphQLSubscribeCombineTests.swift index cbe8ad220c..304a76eb49 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/GraphQLSubscribeCombineTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/GraphQLSubscribeCombineTests.swift @@ -9,14 +9,14 @@ import Combine import XCTest import Amplify +@_implementationOnly import AmplifyAsyncTesting @testable import AmplifyTestCommon @testable import AWSAPIPlugin -@_implementationOnly import AmplifyAsyncTesting class GraphQLSubscribeCombineTests: OperationTestBase { var sink: AnyCancellable? - + // Setup expectations var onSubscribeInvoked: XCTestExpectation! var receivedCompletionSuccess: XCTestExpectation! @@ -54,30 +54,32 @@ class GraphQLSubscribeCombineTests: OperationTestBase { } override func tearDown() async throws { - self.sink?.cancel() - self.connectionStateSink?.cancel() - self.subscriptionDataSink?.cancel() - self.onSubscribeInvoked = nil - self.receivedCompletionFailure = nil - self.receivedCompletionSuccess = nil - self.receivedDataValueError = nil - self.receivedDataValueSuccess = nil - self.receivedStateValueConnected = nil - self.receivedStateValueConnecting = nil - self.receivedStateValueDisconnected = nil + sink?.cancel() + connectionStateSink?.cancel() + subscriptionDataSink?.cancel() + onSubscribeInvoked = nil + receivedCompletionFailure = nil + receivedCompletionSuccess = nil + receivedDataValueError = nil + receivedDataValueSuccess = nil + receivedStateValueConnected = nil + receivedStateValueConnecting = nil + receivedStateValueDisconnected = nil try await super.tearDown() } func waitForSubscriptionExpectations() async { - await fulfillment(of: [receivedCompletionSuccess, - receivedCompletionFailure, - receivedStateValueConnecting, - receivedStateValueConnected, - receivedStateValueDisconnected, - receivedDataValueSuccess, - receivedDataValueError], timeout: 0.05) + await fulfillment(of: [ + receivedCompletionSuccess, + receivedCompletionFailure, + receivedStateValueConnecting, + receivedStateValueConnected, + receivedStateValueDisconnected, + receivedDataValueSuccess, + receivedDataValueError + ], timeout: 0.05) } - + func testHappyPath() async throws { receivedCompletionFailure.isInverted = true receivedDataValueError.isInverted = true @@ -254,7 +256,7 @@ class GraphQLSubscribeCombineTests: OperationTestBase { case .data(let result): switch result { case .success(let actualValue): - if let expectedValue = expectedValue { + if let expectedValue { XCTAssertEqual(actualValue, expectedValue) } self.receivedDataValueSuccess.fulfill() diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/GraphQLSubscribeTaskTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/GraphQLSubscribeTaskTests.swift index d632e131c7..768ad32e4e 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/GraphQLSubscribeTaskTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/GraphQLSubscribeTaskTests.swift @@ -9,9 +9,9 @@ import Combine import XCTest import Amplify +@_implementationOnly import AmplifyAsyncTesting @testable import AmplifyTestCommon @testable import AWSAPIPlugin -@_implementationOnly import AmplifyAsyncTesting class GraphQLSubscribeTasksTests: OperationTestBase { @@ -82,7 +82,7 @@ class GraphQLSubscribeTasksTests: OperationTestBase { timeout: 0.05 ) } - + func testHappyPath() async throws { receivedCompletionFailure.isInverted = true receivedDataValueError.isInverted = true @@ -134,7 +134,7 @@ class GraphQLSubscribeTasksTests: OperationTestBase { expectedCompletionFailureError = APIError.operationError("", "", AppSyncRealTimeRequest.Error.limitExceeded) await waitForSubscriptionExpectations() } - + func testConnectionErrorWithConnectionUnauthorizedError() async throws { receivedCompletionSuccess.isInverted = true receivedStateValueConnected.isInverted = true @@ -155,7 +155,7 @@ class GraphQLSubscribeTasksTests: OperationTestBase { ) await waitForSubscriptionExpectations() } - + func testConnectionErrorWithAppSyncConnectionError() async throws { receivedCompletionSuccess.isInverted = true receivedStateValueConnected.isInverted = true @@ -174,7 +174,7 @@ class GraphQLSubscribeTasksTests: OperationTestBase { func testDecodingError() async throws { let testData: JSONValue = [ - "data": [ "foo": true ], + "data": ["foo": true], "errors": [] ] receivedCompletionFailure.isInverted = true @@ -193,7 +193,7 @@ class GraphQLSubscribeTasksTests: OperationTestBase { func testMultipleSuccessValues() async throws { let testJSON: JSONValue = ["foo": true] let testData: JSONValue = [ - "data": [ "foo": true ] + "data": ["foo": true] ] receivedCompletionFailure.isInverted = true @@ -214,10 +214,10 @@ class GraphQLSubscribeTasksTests: OperationTestBase { func testMixedSuccessAndErrorValues() async throws { let successfulTestData: JSONValue = [ - "data": [ "foo": true ] + "data": ["foo": true] ] let invalidTestData: JSONValue = [ - "data": [ "foo": true ], + "data": ["foo": true], "errors": [] ] @@ -281,7 +281,7 @@ class GraphQLSubscribeTasksTests: OperationTestBase { case .data(let result): switch result { case .success(let actualValue): - if let expectedValue = expectedValue { + if let expectedValue { XCTAssertEqual(actualValue, expectedValue) } self.receivedDataValueSuccess.fulfill() @@ -290,20 +290,20 @@ class GraphQLSubscribeTasksTests: OperationTestBase { } } } - + self.receivedCompletionSuccess.fulfill() } catch { if let apiError = error as? APIError, let expectedError = expectedCompletionFailureError { XCTAssertEqual(apiError, expectedError) } - + self.receivedCompletionFailure.fulfill() } } } } - + extension APIError: Equatable { public static func == (lhs: APIError, rhs: APIError) -> Bool { switch (lhs, rhs) { diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/GraphQLSubscribeTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/GraphQLSubscribeTests.swift index b052ca2384..3f7d32eace 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/GraphQLSubscribeTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/GraphQLSubscribeTests.swift @@ -85,7 +85,7 @@ class GraphQLSubscribeTests: OperationTestBase { func testHappyPath() async throws { let testJSON: JSONValue = ["foo": true] let testData: JSONValue = [ - "data": [ "foo": true ] + "data": ["foo": true] ] receivedCompletionFinish.shouldTrigger = true receivedCompletionFailure.shouldTrigger = false @@ -102,14 +102,17 @@ class GraphQLSubscribeTests: OperationTestBase { mockAppSyncRealTimeClient.triggerEvent(.data(testData)) mockAppSyncRealTimeClient.triggerEvent(.unsubscribed) - await fulfillment(of: [receivedCompletionFinish, - receivedCompletionFailure, - receivedConnected, - receivedDisconnected, - receivedSubscriptionEventData, - receivedSubscriptionEventError - ], - timeout: 0.05) + await fulfillment( + of: [ + receivedCompletionFinish, + receivedCompletionFailure, + receivedConnected, + receivedDisconnected, + receivedSubscriptionEventData, + receivedSubscriptionEventError + ], + timeout: 0.05 + ) } /// Lifecycle test @@ -138,14 +141,17 @@ class GraphQLSubscribeTests: OperationTestBase { try await MockAppSyncRealTimeClient.waitForSubscirbed() mockAppSyncRealTimeClient.triggerEvent(.unsubscribed) - await fulfillment(of: [receivedCompletionFinish, - receivedCompletionFailure, - receivedConnected, - receivedDisconnected, - receivedSubscriptionEventData, - receivedSubscriptionEventError - ], - timeout: 0.05) + await fulfillment( + of: [ + receivedCompletionFinish, + receivedCompletionFailure, + receivedConnected, + receivedDisconnected, + receivedSubscriptionEventData, + receivedSubscriptionEventError + ], + timeout: 0.05 + ) } /// Lifecycle test @@ -172,14 +178,17 @@ class GraphQLSubscribeTests: OperationTestBase { try await MockAppSyncRealTimeClient.waitForSubscirbing() mockAppSyncRealTimeClient.triggerEvent(.error(["Error"])) - await fulfillment(of: [receivedCompletionFinish, - receivedCompletionFailure, - receivedConnected, - receivedDisconnected, - receivedSubscriptionEventData, - receivedSubscriptionEventError - ], - timeout: 0.05) + await fulfillment( + of: [ + receivedCompletionFinish, + receivedCompletionFailure, + receivedConnected, + receivedDisconnected, + receivedSubscriptionEventData, + receivedSubscriptionEventError + ], + timeout: 0.05 + ) } /// Lifecycle test @@ -196,8 +205,8 @@ class GraphQLSubscribeTests: OperationTestBase { /// - The completion handler is invoked with a normal termination func testDecodingError() async throws { let testData: JSONValue = [ - "data": [ "foo": true ], - "errors": [ ] + "data": ["foo": true], + "errors": [] ] receivedCompletionFinish.shouldTrigger = true receivedCompletionFailure.shouldTrigger = false @@ -214,14 +223,17 @@ class GraphQLSubscribeTests: OperationTestBase { mockAppSyncRealTimeClient.triggerEvent(.data(testData)) mockAppSyncRealTimeClient.triggerEvent(.unsubscribed) - await fulfillment(of: [receivedCompletionFinish, - receivedCompletionFailure, - receivedConnected, - receivedDisconnected, - receivedSubscriptionEventData, - receivedSubscriptionEventError - ], - timeout: 0.05) + await fulfillment( + of: [ + receivedCompletionFinish, + receivedCompletionFailure, + receivedConnected, + receivedDisconnected, + receivedSubscriptionEventData, + receivedSubscriptionEventError + ], + timeout: 0.05 + ) } func testMultipleSuccessValues() async throws { @@ -248,14 +260,17 @@ class GraphQLSubscribeTests: OperationTestBase { mockAppSyncRealTimeClient.triggerEvent(.data(testData)) mockAppSyncRealTimeClient.triggerEvent(.unsubscribed) - await fulfillment(of: [receivedCompletionFinish, - receivedCompletionFailure, - receivedConnected, - receivedDisconnected, - receivedSubscriptionEventData, - receivedSubscriptionEventError - ], - timeout: 0.05) + await fulfillment( + of: [ + receivedCompletionFinish, + receivedCompletionFailure, + receivedConnected, + receivedDisconnected, + receivedSubscriptionEventData, + receivedSubscriptionEventError + ], + timeout: 0.05 + ) } func testMixedSuccessAndErrorValues() async throws { @@ -288,14 +303,17 @@ class GraphQLSubscribeTests: OperationTestBase { mockAppSyncRealTimeClient.triggerEvent(.data(successfulTestData)) mockAppSyncRealTimeClient.triggerEvent(.unsubscribed) - await fulfillment(of: [receivedCompletionFinish, - receivedCompletionFailure, - receivedConnected, - receivedDisconnected, - receivedSubscriptionEventData, - receivedSubscriptionEventError - ], - timeout: 0.05) + await fulfillment( + of: [ + receivedCompletionFinish, + receivedCompletionFailure, + receivedConnected, + receivedDisconnected, + receivedSubscriptionEventData, + receivedSubscriptionEventError + ], + timeout: 0.05 + ) } // MARK: - Utilities @@ -344,7 +362,7 @@ class GraphQLSubscribeTests: OperationTestBase { case .data(let result): switch result { case .success(let actualValue): - if let expectedValue = expectedValue { + if let expectedValue { XCTAssertEqual(actualValue, expectedValue) } self.receivedSubscriptionEventData.fulfill() @@ -359,7 +377,8 @@ class GraphQLSubscribeTests: OperationTestBase { case .success: self.receivedCompletionFinish.fulfill() } - }) + } + ) return operation } diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/OperationTestBase.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/OperationTestBase.swift index b36ea8ccf0..f80837a92e 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/OperationTestBase.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/OperationTestBase.swift @@ -6,10 +6,10 @@ // import XCTest -@testable import AWSPluginsTestCommon @testable import Amplify @testable import AmplifyTestCommon @testable import AWSAPIPlugin +@testable import AWSPluginsTestCommon class OperationTestBase: XCTestCase { @@ -86,13 +86,17 @@ class OperationTestBase: XCTestCase { return } - delegate.urlSessionBehavior(mockSession, - dataTaskBehavior: mockTask, - didReceive: data) - - delegate.urlSessionBehavior(mockSession, - dataTaskBehavior: mockTask, - didCompleteWithError: nil) + delegate.urlSessionBehavior( + mockSession, + dataTaskBehavior: mockTask, + didReceive: data + ) + + delegate.urlSessionBehavior( + mockSession, + dataTaskBehavior: mockTask, + didCompleteWithError: nil + ) }) guard let task = mockTask else { @@ -111,9 +115,11 @@ class OperationTestBase: XCTestCase { return } - delegate.urlSessionBehavior(mockSession, - dataTaskBehavior: mockTask, - didCompleteWithError: URLError(.badServerResponse)) + delegate.urlSessionBehavior( + mockSession, + dataTaskBehavior: mockTask, + didCompleteWithError: URLError(.badServerResponse) + ) }) guard let task = mockTask else { diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/RESTCombineTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/RESTCombineTests.swift index e2c91d45c2..82f25bdd12 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/RESTCombineTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Operation/RESTCombineTests.swift @@ -8,8 +8,8 @@ import XCTest @testable import Amplify -@testable import AWSAPIPlugin @testable import AmplifyTestCommon +@testable import AWSAPIPlugin class RESTCombineTests: OperationTestBase { @@ -23,7 +23,7 @@ class RESTCombineTests: OperationTestBase { let receivedFinish = expectation(description: "Received finished") let receivedFailure = expectation(description: "Received failed") receivedFailure.isInverted = true - + let sink = Amplify.Publisher.create { try await self.apiPlugin.get(request: request) }.sink(receiveCompletion: { completion in diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Reachability/NetworkReachabilityNotifierTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Reachability/NetworkReachabilityNotifierTests.swift index 9777f3b291..14b16a79a3 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Reachability/NetworkReachabilityNotifierTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Reachability/NetworkReachabilityNotifierTests.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import Combine import Foundation import XCTest -import Combine @testable import Amplify @testable import AWSAPIPlugin @@ -34,7 +34,7 @@ class NetworkReachabilityNotifierTests: XCTestCase { var values = [Bool]() let cancellable = notifier.publisher.sink(receiveCompletion: { _ in XCTFail("Not expecting any error") - }, receiveValue: { (value: ReachabilityUpdate) -> Void in + }, receiveValue: { (value: ReachabilityUpdate) in values.append(value.isOnline) if values.count == 2 { XCTAssertFalse(values[0]) @@ -55,7 +55,7 @@ class NetworkReachabilityNotifierTests: XCTestCase { var values = [Bool]() let cancellable = notifier.publisher.sink(receiveCompletion: { _ in XCTFail("Not expecting any error") - }, receiveValue: { (value: ReachabilityUpdate) -> Void in + }, receiveValue: { (value: ReachabilityUpdate) in values.append(value.isOnline) if values.count == 2 { XCTAssertFalse(values[0]) @@ -77,7 +77,7 @@ class NetworkReachabilityNotifierTests: XCTestCase { var values = [Bool]() let cancellable = notifier.publisher.sink(receiveCompletion: { _ in XCTFail("Not expecting any error") - }, receiveValue: { (value: ReachabilityUpdate) -> Void in + }, receiveValue: { (value: ReachabilityUpdate) in values.append(value.isOnline) if values.count == 2 { XCTAssertFalse(values[0]) @@ -99,7 +99,7 @@ class NetworkReachabilityNotifierTests: XCTestCase { let completeExpect = expectation(description: ".sink receives completion") let cancellable = notifier.publisher.sink(receiveCompletion: { _ in completeExpect.fulfill() - }, receiveValue: { (value: ReachabilityUpdate) -> Void in + }, receiveValue: { (value: ReachabilityUpdate) in XCTAssertFalse(value.isOnline) defaultValueExpect.fulfill() }) diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Request/GraphQLOperationRequestUtilsTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Request/GraphQLOperationRequestUtilsTests.swift index bd02b693b3..d5778b4b67 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Request/GraphQLOperationRequestUtilsTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Request/GraphQLOperationRequestUtilsTests.swift @@ -4,8 +4,9 @@ // // SPDX-License-Identifier: Apache-2.0 // -import XCTest + import Amplify +import XCTest @testable import AWSAPIPlugin class GraphQLOperationRequestUtilsTests: XCTestCase { @@ -14,8 +15,10 @@ class GraphQLOperationRequestUtilsTests: XCTestCase { let testDocument = "testDocument" func testGraphQLOperationRequestWithCache() throws { - let request = GraphQLOperationRequestUtils.constructRequest(with: baseURL, - requestPayload: Data()) + let request = GraphQLOperationRequestUtils.constructRequest( + with: baseURL, + requestPayload: Data() + ) XCTAssertEqual(request.allHTTPHeaderFields?["Cache-Control"], "no-store") } } diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Request/GraphQLOperationRequestValidateTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Request/GraphQLOperationRequestValidateTests.swift index d56296a56a..7b93e94ce8 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Request/GraphQLOperationRequestValidateTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Request/GraphQLOperationRequestValidateTests.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import Amplify +import XCTest @testable import AWSAPIPlugin class GraphQLOperationRequestValidateTests: XCTestCase { @@ -16,11 +16,13 @@ class GraphQLOperationRequestValidateTests: XCTestCase { func testGraphQLOperationRequestValidate() throws { let requestOptions = GraphQLOperationRequest.Options(pluginOptions: nil) - let graphQLOperationRequest = GraphQLOperationRequest(apiName: testApiName, - operationType: .mutation, - document: testDocument, - responseType: String.self, - options: requestOptions) + let graphQLOperationRequest = GraphQLOperationRequest( + apiName: testApiName, + operationType: .mutation, + document: testDocument, + responseType: String.self, + options: requestOptions + ) XCTAssertNoThrow(try graphQLOperationRequest.validate()) } } diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Request/RESTOperationRequestValidateTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Request/RESTOperationRequestValidateTests.swift index 557e67e8fa..e6514dcf7c 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Request/RESTOperationRequestValidateTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Request/RESTOperationRequestValidateTests.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import Amplify +import XCTest @testable import AWSAPIPlugin class RESTOperationRequestValidateTests: XCTestCase { @@ -14,9 +14,11 @@ class RESTOperationRequestValidateTests: XCTestCase { let testApiName = "testApiName" func testRESTOperationRequestValidate() { - let restOperationRequest = RESTOperationRequest(apiName: testApiName, - operationType: .get, - options: RESTOperationRequest.Options()) + let restOperationRequest = RESTOperationRequest( + apiName: testApiName, + operationType: .get, + options: RESTOperationRequest.Options() + ) XCTAssertNoThrow(try restOperationRequest.validate()) } diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/SubscriptionFactory/AppSyncRealTimeClientFactoryTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/SubscriptionFactory/AppSyncRealTimeClientFactoryTests.swift index 7156ac7678..5ea9f8feed 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/SubscriptionFactory/AppSyncRealTimeClientFactoryTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/SubscriptionFactory/AppSyncRealTimeClientFactoryTests.swift @@ -5,7 +5,6 @@ // SPDX-License-Identifier: Apache-2.0 // - import XCTest @testable import AWSAPIPlugin diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Decode/GraphQLErrorDecoderTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Decode/GraphQLErrorDecoderTests.swift index e5a61e779e..0cc481a97e 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Decode/GraphQLErrorDecoderTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Decode/GraphQLErrorDecoderTests.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import Amplify +import XCTest @testable import AWSAPIPlugin class GraphQLErrorDecoderTests: XCTestCase { @@ -105,8 +105,10 @@ class GraphQLErrorDecoderTests: XCTestCase { } XCTAssertEqual(data["id"], "EF48518C-92EB-4F7A-A64E-D1B9325205CF") XCTAssertEqual(data["title"], "new3") - XCTAssertEqual(data["content"], - "Original content from DataStoreEndToEndTests at 2020-03-26 21:55:47 +0000") + XCTAssertEqual( + data["content"], + "Original content from DataStoreEndToEndTests at 2020-03-26 21:55:47 +0000" + ) XCTAssertEqual(data["_version"], 2) guard case let .string(errorType) = extensions["errorType"] else { diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Decode/GraphQLResponseDecoder+DecodeDataTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Decode/GraphQLResponseDecoder+DecodeDataTests.swift index 332fcd44fd..d81a8a8561 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Decode/GraphQLResponseDecoder+DecodeDataTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Decode/GraphQLResponseDecoder+DecodeDataTests.swift @@ -5,19 +5,21 @@ // SPDX-License-Identifier: Apache-2.0 // +@_implementationOnly import AmplifyAsyncTesting +import AWSPluginsCore import XCTest @testable import Amplify -import AWSPluginsCore @testable import AmplifyTestCommon @testable import AWSAPIPlugin -@_implementationOnly import AmplifyAsyncTesting extension GraphQLResponseDecoderTests { func testDecodeToResponseTypeForString() throws { - let request = GraphQLRequest(document: "", - responseType: String.self, - decodePath: "getSimpleModel") + let request = GraphQLRequest( + document: "", + responseType: String.self, + decodePath: "getSimpleModel" + ) let decoder = GraphQLResponseDecoder(request: request.toOperationRequest(operationType: .query)) let graphQLData: [String: JSONValue] = [ "getSimpleModel": [ @@ -31,9 +33,11 @@ extension GraphQLResponseDecoderTests { func testDecodeToResponseTypeForAnyModel() throws { ModelRegistry.register(modelType: SimpleModel.self) - let request = GraphQLRequest(document: "", - responseType: AnyModel.self, - decodePath: "getSimpleModel") + let request = GraphQLRequest( + document: "", + responseType: AnyModel.self, + decodePath: "getSimpleModel" + ) let decoder = GraphQLResponseDecoder(request: request.toOperationRequest(operationType: .query)) let graphQLData: [String: JSONValue] = [ "getSimpleModel": [ @@ -54,9 +58,11 @@ extension GraphQLResponseDecoderTests { } func testDecodeToResponseTypeForModel() throws { - let request = GraphQLRequest(document: "", - responseType: SimpleModel.self, - decodePath: "getSimpleModel") + let request = GraphQLRequest( + document: "", + responseType: SimpleModel.self, + decodePath: "getSimpleModel" + ) let decoder = GraphQLResponseDecoder(request: request.toOperationRequest(operationType: .query)) let graphQLData: [String: JSONValue] = [ "getSimpleModel": [ @@ -70,9 +76,11 @@ extension GraphQLResponseDecoderTests { } func testDecodeToResponseTypeForModelWithArrayAssoiation() throws { - let request = GraphQLRequest(document: "", - responseType: Post4.self, - decodePath: "getPost") + let request = GraphQLRequest( + document: "", + responseType: Post4.self, + decodePath: "getPost" + ) let decoder = GraphQLResponseDecoder(request: request.toOperationRequest(operationType: .query)) let graphQLData: [String: JSONValue] = [ "getPost": [ @@ -90,9 +98,11 @@ extension GraphQLResponseDecoderTests { } func testDecodeToResponseTypeForList() async throws { - let request = GraphQLRequest>(document: "", - responseType: List.self, - decodePath: "listSimpleModel") + let request = GraphQLRequest>( + document: "", + responseType: List.self, + decodePath: "listSimpleModel" + ) let decoder = GraphQLResponseDecoder(request: request.toOperationRequest(operationType: .query)) let graphQLData: [String: JSONValue] = [ "listSimpleModel": [ @@ -123,18 +133,22 @@ extension GraphQLResponseDecoderTests { func testDecodeToResponseTypeForCodable() throws { - let request = GraphQLRequest(document: "", - responseType: SimpleCodable.self, - decodePath: "getSimpleCodable") + let request = GraphQLRequest( + document: "", + responseType: SimpleCodable.self, + decodePath: "getSimpleCodable" + ) let graphQLDecoder = GraphQLResponseDecoder(request: request.toOperationRequest(operationType: .query)) - let expectedObject = SimpleCodable(myBool: true, - myDouble: 1.0, - myInt: 1, - myString: "string", - myDate: .now(), - myDateTime: .now(), - myTime: .now()) + let expectedObject = SimpleCodable( + myBool: true, + myDouble: 1.0, + myInt: 1, + myString: "string", + myDate: .now(), + myDateTime: .now(), + myTime: .now() + ) let data = try encoder.encode(expectedObject) let objectJSON = try decoder.decode(JSONValue.self, from: data) diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Decode/GraphQLResponseDecoderLazyPostComment4V2Tests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Decode/GraphQLResponseDecoderLazyPostComment4V2Tests.swift index fe72e229af..dc588ec8bd 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Decode/GraphQLResponseDecoderLazyPostComment4V2Tests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Decode/GraphQLResponseDecoderLazyPostComment4V2Tests.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import AWSPluginsCore import XCTest @testable import Amplify -import AWSPluginsCore @testable import AmplifyTestCommon @testable import AWSAPIPlugin @@ -16,7 +16,7 @@ class GraphQLResponseDecoderLazyPostComment4V2Tests: XCTestCase, SharedTestCases let decoder = JSONDecoder() let encoder = JSONEncoder() - + override func setUp() async throws { await Amplify.reset() Amplify.Logging.logLevel = .verbose @@ -28,7 +28,7 @@ class GraphQLResponseDecoderLazyPostComment4V2Tests: XCTestCase, SharedTestCases decoder.dateDecodingStrategy = ModelDateFormatting.decodingStrategy encoder.dateEncodingStrategy = ModelDateFormatting.encodingStrategy } - + func testSaveCommentThenQueryComment() async throws { let comment = LazyChildComment4V2(content: "content") // Create request @@ -53,13 +53,14 @@ class GraphQLResponseDecoderLazyPostComment4V2Tests: XCTestCase, SharedTestCases """ XCTAssertEqual(request.document, documentString) guard let variables = request.variables, - let input = variables["input"] as? [String: Any] else { + let input = variables["input"] as? [String: Any] + else { XCTFail("Missing request.variables input") return } XCTAssertEqual(input["id"] as? String, comment.id) XCTAssertEqual(input["content"] as? String, comment.content) - + // Get request let getRequest = GraphQLRequest.get(LazyChildComment4V2.self, byId: comment.id) documentString = """ @@ -82,12 +83,13 @@ class GraphQLResponseDecoderLazyPostComment4V2Tests: XCTestCase, SharedTestCases """ XCTAssertEqual(getRequest.document, documentString) guard let variables = getRequest.variables, - let id = variables["id"] as? String else { + let id = variables["id"] as? String + else { XCTFail("Missing request.variables id") return } XCTAssertEqual(id, comment.id) - + // Decode data let decoder = GraphQLResponseDecoder(request: getRequest.toOperationRequest(operationType: .mutation)) let graphQLData: [String: JSONValue] = [ @@ -114,10 +116,10 @@ class GraphQLResponseDecoderLazyPostComment4V2Tests: XCTestCase, SharedTestCases XCTFail("should be not loaded, with `nil` identifiers") } } - + func testSavePostThenQueryPost() async throws { let post = LazyParentPost4V2(title: "title") - + // Create request let request = GraphQLRequest.create(post) var documentString = """ @@ -133,13 +135,14 @@ class GraphQLResponseDecoderLazyPostComment4V2Tests: XCTestCase, SharedTestCases """ XCTAssertEqual(request.document, documentString) guard let variables = request.variables, - let input = variables["input"] as? [String: Any] else { + let input = variables["input"] as? [String: Any] + else { XCTFail("Missing request.variables input") return } XCTAssertEqual(input["id"] as? String, post.id) XCTAssertEqual(input["title"] as? String, post.title) - + // Get request let getRequest = GraphQLRequest.get(LazyParentPost4V2.self, byId: post.id) documentString = """ @@ -155,12 +158,13 @@ class GraphQLResponseDecoderLazyPostComment4V2Tests: XCTestCase, SharedTestCases """ XCTAssertEqual(getRequest.document, documentString) guard let variables = getRequest.variables, - let id = variables["id"] as? String else { + let id = variables["id"] as? String + else { XCTFail("Missing request.variables id") return } XCTAssertEqual(id, post.id) - + // Decode data let decoder = GraphQLResponseDecoder(request: getRequest.toOperationRequest(operationType: .mutation)) let graphQLData: [String: JSONValue] = [ @@ -191,7 +195,7 @@ class GraphQLResponseDecoderLazyPostComment4V2Tests: XCTestCase, SharedTestCases XCTFail("Should be not loaded with post data") } } - + func testSaveMultipleThenQueryComments() async throws { let request = GraphQLRequest.list(LazyChildComment4V2.self) let documentString = """ @@ -217,14 +221,15 @@ class GraphQLResponseDecoderLazyPostComment4V2Tests: XCTestCase, SharedTestCases """ XCTAssertEqual(request.document, documentString) guard let variables = request.variables, - let limit = variables["limit"] as? Int else { + let limit = variables["limit"] as? Int + else { XCTFail("Missing request.variables input") return } - XCTAssertEqual(limit, 1000) + XCTAssertEqual(limit, 1_000) let decoder = GraphQLResponseDecoder>( request: request.toOperationRequest(operationType: .query)) - + let date = Temporal.DateTime.now().iso8601String let graphQLData: [String: JSONValue] = [ "\(request.decodePath!)": [ @@ -264,7 +269,7 @@ class GraphQLResponseDecoderLazyPostComment4V2Tests: XCTestCase, SharedTestCases XCTAssertNotNil(comment2) XCTAssertTrue(queriedList.hasNextPage()) } - + func testSaveMultipleThenQueryPosts() async throws { let request = GraphQLRequest.list(LazyParentPost4V2.self) let documentString = """ @@ -283,13 +288,14 @@ class GraphQLResponseDecoderLazyPostComment4V2Tests: XCTestCase, SharedTestCases """ XCTAssertEqual(request.document, documentString) guard let variables = request.variables, - let limit = variables["limit"] as? Int else { + let limit = variables["limit"] as? Int + else { XCTFail("Missing request.variables input") return } - XCTAssertEqual(limit, 1000) + XCTAssertEqual(limit, 1_000) let decoder = GraphQLResponseDecoder(request: request.toOperationRequest(operationType: .query)) - + let graphQLData: [String: JSONValue] = [ "\(request.decodePath!)": [ "items": [ @@ -315,21 +321,22 @@ class GraphQLResponseDecoderLazyPostComment4V2Tests: XCTestCase, SharedTestCases XCTAssertNotNil(post1) XCTAssertNotNil(post2) } - + func testSaveCommentWithPostThenQueryCommentAndAccessPost() async throws { let post = LazyParentPost4V2(title: "title") let comment = LazyChildComment4V2(content: "content", post: post) - + let request = GraphQLRequest.create(comment) guard let variables = request.variables, - let input = variables["input"] as? [String: Any] else { + let input = variables["input"] as? [String: Any] + else { XCTFail("Missing request.variables input") return } XCTAssertEqual(input["id"] as? String, comment.id) XCTAssertEqual(input["content"] as? String, comment.content) XCTAssertEqual(input["postID"] as? String, post.id) - + let decoder = GraphQLResponseDecoder(request: request.toOperationRequest(operationType: .query)) var graphQLData: [String: JSONValue] = [ "\(request.decodePath!)": [ @@ -361,7 +368,7 @@ class GraphQLResponseDecoderLazyPostComment4V2Tests: XCTestCase, SharedTestCases } XCTAssertEqual(loadedPost.id, post.id) } - + graphQLData = [ "\(request.decodePath!)": [ "id": "id", @@ -386,7 +393,7 @@ class GraphQLResponseDecoderLazyPostComment4V2Tests: XCTestCase, SharedTestCases XCTAssertEqual(commentWithLazyLoadPost.content, "content") switch commentWithLazyLoadPost._post.modelProvider.getState() { case .notLoaded(let identifiers): - guard let identifiers = identifiers else { + guard let identifiers else { XCTFail("Missing identifiers") return } @@ -395,10 +402,10 @@ class GraphQLResponseDecoderLazyPostComment4V2Tests: XCTestCase, SharedTestCases XCTFail("should be in not loaded state when post data is partial") } } - + func testSaveCommentWithPostThenQueryPostAndAccessComments() async throws { let post = LazyParentPost4V2(title: "title") - + let request = GraphQLRequest.create(post) let decoder = GraphQLResponseDecoder(request: request.toOperationRequest(operationType: .query)) let graphQLData: [String: JSONValue] = [ @@ -426,7 +433,7 @@ class GraphQLResponseDecoderLazyPostComment4V2Tests: XCTestCase, SharedTestCases XCTFail("Should be not loaded with post data") } } - + func testSaveMultipleCommentWithPostThenQueryCommentsAndAccessPost() async throws { let post = LazyParentPost4V2(title: "title") let request = GraphQLRequest.list(LazyChildComment4V2.self) @@ -465,7 +472,7 @@ class GraphQLResponseDecoderLazyPostComment4V2Tests: XCTestCase, SharedTestCases } switch comment._post.modelProvider.getState() { case .notLoaded(let identifiers): - guard let identifiers = identifiers else { + guard let identifiers else { XCTFail("Missing identifiers") return } @@ -473,7 +480,7 @@ class GraphQLResponseDecoderLazyPostComment4V2Tests: XCTestCase, SharedTestCases case .loaded: XCTFail("Should be in not loaded state") } - + graphQLData = [ "\(request.decodePath!)": [ "items": [ @@ -511,7 +518,7 @@ class GraphQLResponseDecoderLazyPostComment4V2Tests: XCTestCase, SharedTestCases XCTAssertEqual(loadedPost.id, post.id) } } - + func testSaveMultipleCommentWithPostThenQueryPostAndAccessComments() async throws { let request = GraphQLRequest.list(LazyParentPost4V2.self) let decoder = GraphQLResponseDecoder(request: request.toOperationRequest(operationType: .query)) @@ -531,7 +538,8 @@ class GraphQLResponseDecoderLazyPostComment4V2Tests: XCTestCase, SharedTestCases let result = try decoder.decodeToResponseType(graphQLData) XCTAssertEqual(result.count, 1) guard let post = result.first, - let comments = post.comments else { + let comments = post.comments + else { XCTFail("Failed to decode to one post, with containing comments") return } diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Decode/GraphQLResponseDecoderPostComment4V2Tests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Decode/GraphQLResponseDecoderPostComment4V2Tests.swift index 88ed40292d..1d4b2a816e 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Decode/GraphQLResponseDecoderPostComment4V2Tests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Decode/GraphQLResponseDecoderPostComment4V2Tests.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import AWSPluginsCore import XCTest @testable import Amplify -import AWSPluginsCore @testable import AmplifyTestCommon @testable import AWSAPIPlugin @@ -16,7 +16,7 @@ class GraphQLResponseDecoderPostComment4V2Tests: XCTestCase, SharedTestCasesPost let decoder = JSONDecoder() let encoder = JSONEncoder() - + override func setUp() async throws { await Amplify.reset() ModelRegistry.register(modelType: ParentPost4V2.self) @@ -27,7 +27,7 @@ class GraphQLResponseDecoderPostComment4V2Tests: XCTestCase, SharedTestCasesPost decoder.dateDecodingStrategy = ModelDateFormatting.decodingStrategy encoder.dateEncodingStrategy = ModelDateFormatting.encodingStrategy } - + func testSaveCommentThenQueryComment() async throws { let comment = ChildComment4V2(content: "content") // Create request @@ -52,13 +52,14 @@ class GraphQLResponseDecoderPostComment4V2Tests: XCTestCase, SharedTestCasesPost """ XCTAssertEqual(request.document, documentString) guard let variables = request.variables, - let input = variables["input"] as? [String: Any] else { + let input = variables["input"] as? [String: Any] + else { XCTFail("Missing request.variables input") return } XCTAssertEqual(input["id"] as? String, comment.id) XCTAssertEqual(input["content"] as? String, comment.content) - + // Get request let getRequest = GraphQLRequest.get(ChildComment4V2.self, byId: comment.id) documentString = """ @@ -81,12 +82,13 @@ class GraphQLResponseDecoderPostComment4V2Tests: XCTestCase, SharedTestCasesPost """ XCTAssertEqual(getRequest.document, documentString) guard let variables = getRequest.variables, - let id = variables["id"] as? String else { + let id = variables["id"] as? String + else { XCTFail("Missing request.variables id") return } XCTAssertEqual(id, comment.id) - + // Decode data let decoder = GraphQLResponseDecoder(request: getRequest.toOperationRequest(operationType: .mutation)) let graphQLData: [String: JSONValue] = [ @@ -108,10 +110,10 @@ class GraphQLResponseDecoderPostComment4V2Tests: XCTestCase, SharedTestCasesPost XCTAssertEqual(savedComment.content, "content") XCTAssertNil(savedComment.post) } - + func testSavePostThenQueryPost() async throws { let post = ParentPost4V2(title: "title") - + // Create request let request = GraphQLRequest.create(post) var documentString = """ @@ -127,13 +129,14 @@ class GraphQLResponseDecoderPostComment4V2Tests: XCTestCase, SharedTestCasesPost """ XCTAssertEqual(request.document, documentString) guard let variables = request.variables, - let input = variables["input"] as? [String: Any] else { + let input = variables["input"] as? [String: Any] + else { XCTFail("Missing request.variables input") return } XCTAssertEqual(input["id"] as? String, post.id) XCTAssertEqual(input["title"] as? String, post.title) - + // Get request let getRequest = GraphQLRequest.get(ParentPost4V2.self, byId: post.id) documentString = """ @@ -149,12 +152,13 @@ class GraphQLResponseDecoderPostComment4V2Tests: XCTestCase, SharedTestCasesPost """ XCTAssertEqual(getRequest.document, documentString) guard let variables = getRequest.variables, - let id = variables["id"] as? String else { + let id = variables["id"] as? String + else { XCTFail("Missing request.variables id") return } XCTAssertEqual(id, post.id) - + // Decode data let decoder = GraphQLResponseDecoder(request: getRequest.toOperationRequest(operationType: .mutation)) let graphQLData: [String: JSONValue] = [ @@ -185,7 +189,7 @@ class GraphQLResponseDecoderPostComment4V2Tests: XCTestCase, SharedTestCasesPost XCTFail("Should be not loaded with post data") } } - + func testSaveMultipleThenQueryComments() async throws { let request = GraphQLRequest.list(ChildComment4V2.self) let documentString = """ @@ -211,14 +215,15 @@ class GraphQLResponseDecoderPostComment4V2Tests: XCTestCase, SharedTestCasesPost """ XCTAssertEqual(request.document, documentString) guard let variables = request.variables, - let limit = variables["limit"] as? Int else { + let limit = variables["limit"] as? Int + else { XCTFail("Missing request.variables input") return } - XCTAssertEqual(limit, 1000) + XCTAssertEqual(limit, 1_000) let decoder = GraphQLResponseDecoder>( request: request.toOperationRequest(operationType: .query)) - + let graphQLData: [String: JSONValue] = [ "\(request.decodePath!)": [ "items": [ @@ -253,7 +258,7 @@ class GraphQLResponseDecoderPostComment4V2Tests: XCTestCase, SharedTestCasesPost XCTAssertNotNil(comment2) XCTAssertTrue(queriedList.hasNextPage()) } - + func testSaveMultipleThenQueryPosts() async throws { let request = GraphQLRequest.list(ParentPost4V2.self) let documentString = """ @@ -272,13 +277,14 @@ class GraphQLResponseDecoderPostComment4V2Tests: XCTestCase, SharedTestCasesPost """ XCTAssertEqual(request.document, documentString) guard let variables = request.variables, - let limit = variables["limit"] as? Int else { + let limit = variables["limit"] as? Int + else { XCTFail("Missing request.variables input") return } - XCTAssertEqual(limit, 1000) + XCTAssertEqual(limit, 1_000) let decoder = GraphQLResponseDecoder(request: request.toOperationRequest(operationType: .query)) - + let graphQLData: [String: JSONValue] = [ "\(request.decodePath!)": [ "items": [ @@ -304,21 +310,22 @@ class GraphQLResponseDecoderPostComment4V2Tests: XCTestCase, SharedTestCasesPost XCTAssertNotNil(post1) XCTAssertNotNil(post2) } - + func testSaveCommentWithPostThenQueryCommentAndAccessPost() async throws { let post = ParentPost4V2(title: "title") let comment = ChildComment4V2(content: "content", post: post) - + let request = GraphQLRequest.create(comment) guard let variables = request.variables, - let input = variables["input"] as? [String: Any] else { + let input = variables["input"] as? [String: Any] + else { XCTFail("Missing request.variables input") return } XCTAssertEqual(input["id"] as? String, comment.id) XCTAssertEqual(input["content"] as? String, comment.content) XCTAssertEqual(input["postID"] as? String, post.id) - + let decoder = GraphQLResponseDecoder(request: request.toOperationRequest(operationType: .query)) var graphQLData: [String: JSONValue] = [ "\(request.decodePath!)": [ @@ -342,10 +349,10 @@ class GraphQLResponseDecoderPostComment4V2Tests: XCTestCase, SharedTestCasesPost XCTAssertEqual(commentWithEagerLoadedPost.content, "content") XCTAssertEqual(commentWithEagerLoadedPost.post?.id, post.id) } - + func testSaveCommentWithPostThenQueryPostAndAccessComments() async throws { let post = ParentPost4V2(title: "title") - + let request = GraphQLRequest.create(post) let decoder = GraphQLResponseDecoder(request: request.toOperationRequest(operationType: .query)) let graphQLData: [String: JSONValue] = [ @@ -373,7 +380,7 @@ class GraphQLResponseDecoderPostComment4V2Tests: XCTestCase, SharedTestCasesPost XCTFail("Should be not loaded with post data") } } - + func testSaveMultipleCommentWithPostThenQueryCommentsAndAccessPost() async throws { let post = ParentPost4V2(title: "title") let request = GraphQLRequest.list(ChildComment4V2.self) @@ -405,7 +412,7 @@ class GraphQLResponseDecoderPostComment4V2Tests: XCTestCase, SharedTestCasesPost } XCTAssertEqual(comment.post?.id, post.id) } - + func testSaveMultipleCommentWithPostThenQueryPostAndAccessComments() async throws { let request = GraphQLRequest.list(ParentPost4V2.self) let decoder = GraphQLResponseDecoder(request: request.toOperationRequest(operationType: .query)) @@ -425,7 +432,8 @@ class GraphQLResponseDecoderPostComment4V2Tests: XCTestCase, SharedTestCasesPost let result = try decoder.decodeToResponseType(graphQLData) XCTAssertEqual(result.count, 1) guard let post = result.first, - let comments = post.comments else { + let comments = post.comments + else { XCTFail("Failed to decode to one post, with containing comments") return } diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Decode/GraphQLResponseDecoderTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Decode/GraphQLResponseDecoderTests.swift index 6d9144880b..8b8184cdf6 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Decode/GraphQLResponseDecoderTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Decode/GraphQLResponseDecoderTests.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // +import AWSPluginsCore import XCTest @testable import Amplify -import AWSPluginsCore @testable import AmplifyTestCommon @testable import AWSAPIPlugin @@ -61,9 +61,11 @@ class GraphQLResponseDecoderTests: XCTestCase { } func testDecodeToGraphQLResponseWhenDataOnly() throws { - let request = GraphQLRequest(document: "", - responseType: String.self, - decodePath: "getSimpleModel") + let request = GraphQLRequest( + document: "", + responseType: String.self, + decodePath: "getSimpleModel" + ) let decoder = GraphQLResponseDecoder(request: request.toOperationRequest(operationType: .query)) let graphQLData: [String: JSONValue] = [ "data": [ @@ -85,9 +87,11 @@ class GraphQLResponseDecoderTests: XCTestCase { } func testDecodeToGraphQLResponseWhenErrorsOnly() throws { - let request = GraphQLRequest(document: "", - responseType: String.self, - decodePath: "getSimpleModel") + let request = GraphQLRequest( + document: "", + responseType: String.self, + decodePath: "getSimpleModel" + ) let decoder = GraphQLResponseDecoder(request: request.toOperationRequest(operationType: .query)) let graphQLData: [String: JSONValue] = [ "errors": [ @@ -101,16 +105,19 @@ class GraphQLResponseDecoderTests: XCTestCase { let result = try decoder.decodeToGraphQLResponse() guard case let .failure(response) = result, - case .error = response else { + case .error = response + else { XCTFail("Could not get failure response") return } } func testDecodeToGraphQLResponseWhenDataAndErrors() throws { - let request = GraphQLRequest(document: "", - responseType: String.self, - decodePath: "getSimpleModel") + let request = GraphQLRequest( + document: "", + responseType: String.self, + decodePath: "getSimpleModel" + ) let decoder = GraphQLResponseDecoder(request: request.toOperationRequest(operationType: .query)) let graphQLData: [String: JSONValue] = [ "data": [ @@ -129,16 +136,19 @@ class GraphQLResponseDecoderTests: XCTestCase { let result = try decoder.decodeToGraphQLResponse() guard case let .failure(response) = result, - case .partial = response else { + case .partial = response + else { XCTFail("Could not get failure response") return } } func testDecodeToGraphQLResponseWhenInvalidResponse() throws { - let request = GraphQLRequest(document: "", - responseType: String.self, - decodePath: "getSimpleModel") + let request = GraphQLRequest( + document: "", + responseType: String.self, + decodePath: "getSimpleModel" + ) let decoder = GraphQLResponseDecoder(request: request.toOperationRequest(operationType: .query)) let graphQLData: [String: JSONValue] = [ "invalidDataKey": [ @@ -168,9 +178,11 @@ class GraphQLResponseDecoderTests: XCTestCase { } func testDecodeToGraphQLResponseWhenPartialAndDataIsNull() throws { - let request = GraphQLRequest(document: "", - responseType: String.self, - decodePath: "getSimpleModel") + let request = GraphQLRequest( + document: "", + responseType: String.self, + decodePath: "getSimpleModel" + ) let decoder = GraphQLResponseDecoder(request: request.toOperationRequest(operationType: .query)) let graphQLData: [String: JSONValue] = [ "data": [ @@ -187,7 +199,8 @@ class GraphQLResponseDecoderTests: XCTestCase { let result = try decoder.decodeToGraphQLResponse() guard case let .failure(response) = result, - case .error = response else { + case .error = response + else { XCTFail("Could not get failure response") return } diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Internal/AWSAppSyncGrpahQLResponseTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Internal/AWSAppSyncGrpahQLResponseTests.swift index 74631e44de..b12ca0ca4d 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Internal/AWSAppSyncGrpahQLResponseTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Internal/AWSAppSyncGrpahQLResponseTests.swift @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import Amplify +import XCTest @testable import AWSAPIPlugin class AWSAppSyncGrpahQLResponseTests: XCTestCase { diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Utils/Array+Error+TypeCastTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Utils/Array+Error+TypeCastTests.swift index d1d6861a74..c94cc9db13 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Utils/Array+Error+TypeCastTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Utils/Array+Error+TypeCastTests.swift @@ -5,7 +5,6 @@ // SPDX-License-Identifier: Apache-2.0 // - import XCTest @testable @_spi(AmplifyAPI) import AWSAPIPlugin diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Utils/GraphQLRequestToListQueryTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Utils/GraphQLRequestToListQueryTests.swift index 783ceb0c0c..27b72d97ee 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Utils/GraphQLRequestToListQueryTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Utils/GraphQLRequestToListQueryTests.swift @@ -5,9 +5,9 @@ // SPDX-License-Identifier: Apache-2.0 // -import XCTest import AmplifyTestCommon import AWSPluginsCore +import XCTest @testable import Amplify @testable import AWSAPIPlugin @@ -24,12 +24,14 @@ class GraphQLRequestToListQueryTests: XCTestCase { func testFirstPageRequestRequest() { let predicate = Comment4.keys.post == "postId123" - let request = GraphQLRequest.listQuery(responseType: JSONValue.self, - modelSchema: Comment4.schema, - filter: predicate.graphQLFilter(for: Comment4.schema), - limit: 1_000, - apiName: "apiName", - authMode: .awsIAM) + let request = GraphQLRequest.listQuery( + responseType: JSONValue.self, + modelSchema: Comment4.schema, + filter: predicate.graphQLFilter(for: Comment4.schema), + limit: 1_000, + apiName: "apiName", + authMode: .awsIAM + ) XCTAssertNotNil(request) let expectedDocument = """ query ListComment4s($filter: ModelComment4FilterInput, $limit: Int) { @@ -59,8 +61,10 @@ class GraphQLRequestToListQueryTests: XCTestCase { XCTAssertNotNil(variables["limit"]) XCTAssertEqual(variables["limit"] as? Int, 1_000) guard let filter = variables["filter"] as? GraphQLFilter, - let filterJSON = try? JSONSerialization.data(withJSONObject: filter, - options: .prettyPrinted) else { + let filterJSON = try? JSONSerialization.data( + withJSONObject: filter, + options: .prettyPrinted + ) else { XCTFail("variables should contain a valid filter JSON") return } @@ -75,11 +79,13 @@ class GraphQLRequestToListQueryTests: XCTestCase { } func testMextPageRequest() { - let request = GraphQLRequest.listQuery(responseType: List.self, - modelSchema: Comment4.schema, - nextToken: "nextToken", - apiName: "apiName", - authMode: .amazonCognitoUserPools) + let request = GraphQLRequest.listQuery( + responseType: List.self, + modelSchema: Comment4.schema, + nextToken: "nextToken", + apiName: "apiName", + authMode: .amazonCognitoUserPools + ) XCTAssertNotNil(request) let expectedDocument = """ query ListComment4s($limit: Int, $nextToken: String) { @@ -118,13 +124,15 @@ class GraphQLRequestToListQueryTests: XCTestCase { "eq": "postId123" ] ] - let request = GraphQLRequest.listQuery(responseType: List.self, - modelSchema: Comment4.schema, - filter: previousFilter, - limit: 1_000, - nextToken: "nextToken", - apiName: "apiName", - authMode: .function) + let request = GraphQLRequest.listQuery( + responseType: List.self, + modelSchema: Comment4.schema, + filter: previousFilter, + limit: 1_000, + nextToken: "nextToken", + apiName: "apiName", + authMode: .function + ) XCTAssertNotNil(request) let expectedDocument = """ query ListComment4s($filter: ModelComment4FilterInput, $limit: Int, $nextToken: String) { @@ -157,8 +165,10 @@ class GraphQLRequestToListQueryTests: XCTestCase { XCTAssertEqual(variables["nextToken"] as? String, "nextToken") guard let filter = variables["filter"] as? GraphQLFilter, JSONSerialization.isValidJSONObject(filter), - let filterJSON = try? JSONSerialization.data(withJSONObject: filter, - options: .prettyPrinted) else { + let filterJSON = try? JSONSerialization.data( + withJSONObject: filter, + options: .prettyPrinted + ) else { XCTFail("variables should contain a valid filter JSON") return } diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Utils/RESTRequestUtilsTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Utils/RESTRequestUtilsTests.swift index 7d3af18917..047982f013 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Utils/RESTRequestUtilsTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Utils/RESTRequestUtilsTests.swift @@ -23,7 +23,7 @@ class RESTRequestUtilsTests: XCTestCase { } } - guard let expected = expected else { + guard let expected else { return XCTAssertTrue( queryParams.isEmpty, "Test \(testCase): Unexpected query items found \(queryParams)" diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Utils/Result+AsyncTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Utils/Result+AsyncTests.swift index 5ae473b899..6632f69988 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Utils/Result+AsyncTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Utils/Result+AsyncTests.swift @@ -5,7 +5,6 @@ // SPDX-License-Identifier: Apache-2.0 // - import XCTest @testable import AWSAPIPlugin @@ -18,7 +17,7 @@ class ResultAsyncTests: XCTestCase { let result = Result.success(0) let plus1Result = await result.flatMapAsync { - .success(await plus1($0)) + await .success(plus1($0)) } switch plus1Result { @@ -38,7 +37,7 @@ class ResultAsyncTests: XCTestCase { let expectedError = TestError() let result = Result<[Int], Error>.failure(expectedError) let count = await result.flatMapAsync { - .success(await arrayCount($0)) + await .success(arrayCount($0)) } switch count { @@ -51,4 +50,4 @@ class ResultAsyncTests: XCTestCase { } } -fileprivate class TestError: Error { } +private class TestError: Error { }