deleteProjectExternalOAuthRegistration method

Future<void> deleteProjectExternalOAuthRegistration({
  1. required String projectId,
  2. required String registrationId,
  3. String? delegatedTo,
})

Implementation

Future<void> deleteProjectExternalOAuthRegistration({
  required String projectId,
  required String registrationId,
  String? delegatedTo,
}) async {
  final encodedProjectId = Uri.encodeComponent(projectId);
  final encodedRegistrationId = Uri.encodeComponent(registrationId);
  final query = <String, String>{};
  if (delegatedTo != null) query['delegated_to'] = delegatedTo;
  final uri = Uri.parse(
    '$baseUrl/accounts/projects/$encodedProjectId/external-oauth/$encodedRegistrationId',
  ).replace(queryParameters: query.isEmpty ? null : query);
  final response = await httpClient.delete(uri);

  if (response.statusCode >= 400) {
    throw MeshagentException(
      'Failed to delete project external oauth registration. '
      'Status code: ${response.statusCode}, body: ${response.body}',
    );
  }
}