create method
Implementation
Future<Map<String, dynamic>> create({
required Dio apiDio,
required String name,
}) async {
try {
final resp = await apiDio.post(Endpoints.apiKeys, data: {'name': name});
return resp.data['data'] as Map<String, dynamic>;
} on DioException catch (e) {
if (e.response?.statusCode == 429) {
throw const AuthCliFault(
ExitCodes.usage,
'Too many key creations, try again later.',
errorCode: 'rate_limited',
);
}
throw _mapError(e, action: 'create API key');
}
}