postAccountKeys method
Creates — or rotates — the caller's API key of the requested type and returns it ONCE.
Creates — or rotates — the caller's API key of the requested type and returns it ONCE. A real IAM failure surfaces as 502, never a fabricated key. Rotating is what creating means here: a user holds one key per type, so the endpoint is idempotent by (caller, type) and the superseded credential stops working. Two live secrets for one user would make "revoke my key" a lie.
Parameters:
- KeyTypeIn keyTypeIn (required):
Implementation
Future<MintedKey?> postAccountKeys(KeyTypeIn keyTypeIn,) async {
final response = await postAccountKeysWithHttpInfo(keyTypeIn,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'MintedKey',) as MintedKey;
}
return null;
}