revokeM2MToken method

Future<GetM2MTokens200ResponseM2mTokensInner?> revokeM2MToken(
  1. String m2mTokenId,
  2. RevokeApiKeyRequest revokeApiKeyRequest
)

Revoke a M2M Token

Revokes a M2M Token. This endpoint can be authenticated by either a Machine Secret Key or by a Clerk Secret Key. - When revoking a M2M Token with a Machine Secret Key, the token must managed by the Machine associated with the Machine Secret Key. - When revoking a M2M Token with a Clerk Secret Key, any token on the Instance can be revoked.

Parameters:

Implementation

Future<GetM2MTokens200ResponseM2mTokensInner?> revokeM2MToken(
  String m2mTokenId,
  RevokeApiKeyRequest revokeApiKeyRequest,
) async {
  final response = await revokeM2MTokenWithHttpInfo(
    m2mTokenId,
    revokeApiKeyRequest,
  );
  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),
      'GetM2MTokens200ResponseM2mTokensInner',
    ) as GetM2MTokens200ResponseM2mTokensInner;
  }
  return null;
}