Skip to content

Commit

Permalink
add doc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lawmicha committed Aug 21, 2024
1 parent f7cf339 commit bbd8095
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ import AwsCommonRuntimeKit // CommonRuntimeKit.initialize()

extension AWSCognitoAuthPlugin {


/// Creates a AWS IAM SigV4 signer capable of signing AWS AppSync requests.
///
/// **Note**. Although this method is static, **Amplify.Auth** is required to be configured with **AWSCognitoAuthPlugin** as
/// it depends on the credentials provider from Cognito through `Amplify.Auth.fetchAuthSession`. The static type allows
/// developers to simplify their callsite without having to access the method on the plugin instance.
///
/// - Parameter region: The region of the AWS AppSync API
/// - Returns: A closure tha takes in a requestand returns a signed request.
public static func createAppSyncSigner(region: String) -> ((URLRequest) async throws -> URLRequest) {
return { request in
try await signAppSyncRequest(request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,25 @@
import Foundation
@_spi(InternalAmplifyConfiguration) import Amplify


/// Hold necessary AWS AppSync configuration values to interact with the AppSync API
public struct AWSAppSyncConfiguration {

/// The region of the AWS AppSync API
public let region: String

/// The endpoint of the AWS AppSync API
public let endpoint: URL

/// API key for API Key authentication.
public let apiKey: String?


/// Initializes an `AWSAppSyncConfiguration` instance using the provided AmplifyOutputs file.
/// AmplifyOutputs support multiple ways to read the `amplify_outputs.json` configuration file
///
/// For example, `try AWSAppSyncConfiguraton(with: .amplifyOutputs)` will read the
/// `amplify_outputs.json` file from the main bundle.
public init(with amplifyOutputs: AmplifyOutputs) throws {
let resolvedConfiguration = try amplifyOutputs.resolveConfiguration()

Expand All @@ -28,6 +42,5 @@ public struct AWSAppSyncConfiguration {
}
self.endpoint = endpoint
self.apiKey = dataCategory.apiKey

}
}

0 comments on commit bbd8095

Please sign in to comment.