getKeyPermissions function
Future<KeyPermissions?>
getKeyPermissions({
- Client? client,
- required Credential credential,
- bool isSandbox = false,
Gets the key permissions.
GET /api/v3/brokerage/key_permissions https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/data-api/get-api-key-permissions
credential - The user's API credentials.
isSandbox - Whether to use the sandbox environment.
Returns a KeyPermissions object.
Implementation
Future<KeyPermissions?> getKeyPermissions(
{http.Client? client,
required Credential credential,
bool isSandbox = false}) async {
http.Response response = await getAuthorized('/key_permissions',
client: client, credential: credential, isSandbox: isSandbox);
if (response.statusCode == 200) {
var jsonResponse = jsonDecode(response.body);
return KeyPermissions.fromCBJson(jsonResponse);
} else {
var url = response.request?.url.toString();
print('Request to URL $url failed: Response code ${response.statusCode}');
print('Error Response Message: ${response.body}');
}
return null;
}