diff --git a/Amplify/Categories/API/ClientBehavior/APICategory+GraphQLBehavior.swift b/Amplify/Categories/API/ClientBehavior/APICategory+GraphQLBehavior.swift index 10510fc7e0..7dc6285cdb 100644 --- a/Amplify/Categories/API/ClientBehavior/APICategory+GraphQLBehavior.swift +++ b/Amplify/Categories/API/ClientBehavior/APICategory+GraphQLBehavior.swift @@ -12,6 +12,7 @@ extension APICategory: APICategoryGraphQLBehavior { try await plugin.query(request: request) } + @available(customCondition, introduced: 1.0) public func mutate(request: GraphQLRequest) async throws -> GraphQLTask.Success { try await plugin.mutate(request: request) } @@ -20,3 +21,8 @@ extension APICategory: APICategoryGraphQLBehavior { plugin.subscribe(request: request) } } +// Check if a custom condition is met +func isCustomConditionMet() -> Bool { + // Your custom conditions go here + return true // Replace with your actual condition logic +} diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/API.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/API.swift new file mode 100644 index 0000000000..3d17a18d1f --- /dev/null +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/API.swift @@ -0,0 +1,53 @@ +// this file is generated + +public struct Backend { + static var apiConfiguration: AWSAPIPluginConfiguration { + return .init(apiName: "APIName", + endpoint: "http://endpoint", + endpointType: .graphQL, + region: "us-east-1", + authorizationType: .amazonCognitoUserPools) + } +} + +// Developer's code +import Amplify + +func before() throws { + let plugin = AWSAPIPlugin() + try Amplify.add(plugin: plugin) + try Amplify.configure() +} + +func after() throws { + let plugin: AWSAPIPlugin + #if DEBUG + plugin = AWSAPIPlugin(configuration: .dev) + #else + plugin = AWSAPIPlugin(configuration: .prod) + #endif + try Amplify.add(plugin: plugin) + try Amplify.configure() +} + +extension AWSAPIPluginConfiguration { + static let prod: Self = .init( + apiName: "APIName", + endpoint: "http://endpoint", + endpointType: .graphQL, + region: "", + authorizationType: .amazonCognitoUserPools + ) + + static let dev: Self = .init( + apiName: "", + endpoint: "", + endpointType: .graphQL, + region: "", + authorizationType: .amazonCognitoUserPools + ) +} + + + + diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPIPluginConfiguration.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPIPluginConfiguration.swift index c71d840d2a..25f14051b3 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPIPluginConfiguration.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPIPluginConfiguration.swift @@ -1,6 +1,14 @@ import Foundation import AWSPluginsCore +protocol AWSAPIPluginConfigurationGraphQL { + +} + +protocol AWSAPIPluginConfigurationREST { + +} + public struct AWSAPIPluginConfiguration: Codable { public struct API: Codable { diff --git a/Package.resolved b/Package.resolved index f0706d6cef..5f428451eb 100644 --- a/Package.resolved +++ b/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/aws-amplify/amplify-swift-utils-notifications.git", "state" : { - "revision" : "959eec669ba97c7d923b963c3e66ca8a0b2737f6", - "version" : "1.1.1" + "revision" : "f970384ad1035732f99259255cd2f97564807e41", + "version" : "1.1.0" } }, { @@ -86,8 +86,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-collections", "state" : { - "revision" : "d029d9d39c87bed85b1c50adee7c41795261a192", - "version" : "1.0.6" + "revision" : "a902f1823a7ff3c9ab2fba0f992396b948eda307", + "version" : "1.0.5" } }, {