BaseAppApi<TConfig extends BaseClientConfig> class

The base API implementation for making live and mocked web requests.

Constructors

BaseAppApi({required TConfig config, required Client httpClient})

Properties

accessCode String?
Stores the active access code for an authenticated user, if any.
no setter
cognitoClient ↔ Client?
The cognito.Client wrapping the httpClient for Cognito requests. This can be used in custom Cognito calls by a derived API.
latefinal
config → TConfig
The TConfig instance from the registry.
final
hashCode int
The hash code for this object.
no setterinherited
httpClient → Client
The http.Client used for making requests. This can be used for custom HTTP calls by a derived API.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
timeout Duration
The configured request timeout Duration.
latefinal
user → CognitoUser?
Accesses the actively authenticated cognito.CognitoUser, if any.
no setter
userPool ↔ CognitoUserPool?
The cognito.CognitoUserPool using the cognitoClient and underlying httpClient for authentication. This can be used in custom Cognito calls by a derived API.
latefinal

Methods

hostedCodeCapture(String url) String?
Attempts to extract the authorization code from the provided url. Returns the code, if found, otherwise null.
hostedCodeLogin(String hostedCode) Future<void>
Completes the hosted signin process with the hostedCode and sets the API user.
hostedLoginUrl() String
Builds the URL for a hosted signin experience.
login(String username, String password) Future<bool>
Attempts to authenticate a user by username and password against the userPool. If successful, the user instance is holds the authenticated user. The user JWT is held internally and attached to request through the makeRequest implementation.
logout() Future<void>
Logs out and releases the user, and destroys the underlying JWT.
makeRequest<TResponse extends ResponseBase, TRequest extends RequestBase>({required String url, required TRequest request, required TConfig config, required JsonDeserializer<TResponse> fromJson, ApiTimeoutHandler<TResponse>? onTimeout}) Future<TResponse?>
The underlying concrete implementation for making requests.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited