Skip to content

Commit

Permalink
stash
Browse files Browse the repository at this point in the history
  • Loading branch information
lawmicha committed Jan 18, 2024
1 parent 8beec7b commit 90a37a7
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ extension APICategory: APICategoryGraphQLBehavior {
try await plugin.query(request: request)
}

@available(customCondition, introduced: 1.0)
public func mutate<R: Decodable>(request: GraphQLRequest<R>) async throws -> GraphQLTask<R>.Success {
try await plugin.mutate(request: request)
}
Expand All @@ -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
}
53 changes: 53 additions & 0 deletions AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/API.swift
Original file line number Diff line number Diff line change
@@ -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
)
}




Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import Foundation
import AWSPluginsCore

protocol AWSAPIPluginConfigurationGraphQL {

}

protocol AWSAPIPluginConfigurationREST {

}

public struct AWSAPIPluginConfiguration: Codable {

public struct API: Codable {
Expand Down
8 changes: 4 additions & 4 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},
{
Expand Down Expand Up @@ -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"
}
},
{
Expand Down

0 comments on commit 90a37a7

Please sign in to comment.