UserAPIKeyAuthProviderClient
public protocol UserAPIKeyAuthProviderClient
A protocol defining methods for creating, updating, and deleting the user API keys of a Stitch user.
-
Creates a user API key that can be used to authenticate as the current user.
Declaration
Swift
func createAPIKey(withName name: String, _ completionHandler: @escaping (StitchResult<UserAPIKey>) -> Void)
Parameters
withName
The name of the API key to be created.
completionHandler
The handler to be executed when the request is complete. If the operation is successful, the result will contain the created user API key as a
UserAPIKey
. -
Fetches a user API key associated with the current user.
Declaration
Swift
func fetchAPIKey(withID id: ObjectId, _ completionHandler: @escaping (StitchResult<UserAPIKey>) -> Void)
Parameters
withID
The id of the API key to fetch.
completionHandler
The handler to be executed when the request is complete. If the operation is successful, the result will contain the created user API key as a
UserAPIKey
. The fetched API key will not contain the actual key string. -
Fetches the user API keys associated with the current user.
Declaration
Swift
func fetchAPIKeys(_ completionHandler: @escaping (StitchResult<[UserAPIKey]>) -> Void)
Parameters
completionHandler
The handler to be executed when the request is complete. If the operation is successful, the result will contain the fetched API keys as an
[UserAPIKey]
. The fetched API keys will not contain the actual key string. -
Deletes a user API key associated with the current user.
Declaration
Swift
func deleteAPIKey(withID id: ObjectId, _ completionHandler: @escaping (StitchResult<Void>) -> Void)
Parameters
withID
The id of the API key to delete.
completionHandler
The handler to be executed when the request is complete.
-
Enables a user API key associated with the current user.
Declaration
Swift
func enableAPIKey(withID id: ObjectId, _ completionHandler: @escaping (StitchResult<Void>) -> Void)
Parameters
withID
The id of the API key to enable.
completionHandler
The handler to be executed when the request is complete.
-
Disables a user API key associated with the current user.
Declaration
Swift
func disableAPIKey(withID id: ObjectId, _ completionHandler: @escaping (StitchResult<Void>) -> Void)
Parameters
withID
The id of the API key to disable.
completionHandler
The handler to be executed when the request is complete.