Skip to content

Commit

Permalink
updated swiftformat rules
Browse files Browse the repository at this point in the history
  • Loading branch information
phantumcode committed Sep 9, 2024
1 parent ab170fa commit e1601ca
Show file tree
Hide file tree
Showing 338 changed files with 5,166 additions and 3,658 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,47 +9,57 @@ import Amplify

public extension AWSAPIPlugin {

func query<R: Decodable>(request: GraphQLRequest<R>,
listener: GraphQLOperation<R>.ResultListener?) -> GraphQLOperation<R>
{
let operation = AWSGraphQLOperation(request: request.toOperationRequest(operationType: .query),
session: session,
mapper: mapper,
pluginConfig: pluginConfig,
resultListener: listener)
func query<R: Decodable>(
request: GraphQLRequest<R>,
listener: GraphQLOperation<R>.ResultListener?
) -> GraphQLOperation<R> {
let operation = AWSGraphQLOperation(
request: request.toOperationRequest(operationType: .query),
session: session,
mapper: mapper,
pluginConfig: pluginConfig,
resultListener: listener
)
queue.addOperation(operation)
return operation
}

func query<R: Decodable>(request: GraphQLRequest<R>) async throws -> GraphQLTask<R>.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<R: Decodable>(request: GraphQLRequest<R>,
listener: GraphQLOperation<R>.ResultListener?) -> GraphQLOperation<R>
{
let operation = AWSGraphQLOperation(request: request.toOperationRequest(operationType: .mutation),
session: session,
mapper: mapper,
pluginConfig: pluginConfig,
resultListener: listener)
func mutate<R: Decodable>(
request: GraphQLRequest<R>,
listener: GraphQLOperation<R>.ResultListener?
) -> GraphQLOperation<R> {
let operation = AWSGraphQLOperation(
request: request.toOperationRequest(operationType: .mutation),
session: session,
mapper: mapper,
pluginConfig: pluginConfig,
resultListener: listener
)
queue.addOperation(operation)
return operation
}

func mutate<R: Decodable>(request: GraphQLRequest<R>) async throws -> GraphQLTask<R>.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
Expand All @@ -67,18 +77,21 @@ public extension AWSAPIPlugin {
authService: authService,
apiAuthProviderFactory: authProviderFactory,
inProcessListener: valueListener,
resultListener: completionListener)
resultListener: completionListener
)
queue.addOperation(operation)
return operation
}

func subscribe<R>(request: GraphQLRequest<R>) -> AmplifyAsyncThrowingSequence<GraphQLSubscriptionEvent<R>> {
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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading

0 comments on commit e1601ca

Please sign in to comment.