turnkey_http 0.1.1
turnkey_http: ^0.1.1 copied to clipboard
A Dart package for making HTTP requests to the Turnkey API.
turnkey_http #
A lower-level, fully typed HTTP client for interacting with Turnkey API.
Turnkey API documentation lives here: https://docs.turnkey.com.
Example usage:
import 'package:turnkey_api_key_stamper/api_stamper.dart';
import 'package:turnkey_http/turnkey_client.dart';
// This stamper produces signatures using the API key pair passed in.
final stamper = ApiStamper(
apiPublicKey: '...',
apiPrivateKey: '...',
);
// The Turnkey client uses the passed in stamper to produce signed requests
// and sends them to Turnkey
final client = TurnkeyClient(
config: THttpConfig(baseUrl: 'https://api.turnkey.com'),
stamper: stamper,
);
// Now you can make authenticated requests!
final data = await client.getWhoami(
input: TGetWhoamiRequest(organizationId: '<Your organization id>'),
);
copied to clipboard
HTTP client #
turnkey_http
provides fully typed http client for interacting with the Turnkey API. You can find all available methods here. The types of input parameters and output responses are also exported for convenience.
The OpenAPI spec that generates the client and types is also included in the package.
Generating HTTP Client #
To generate the typed HTTP client from the OpenAPI spec, run the following commands:
-
Install dependencies:
flutter pub get
copied to clipboard -
Run the code generator
dart run build_runner build
copied to clipboard