updateOAuthClient method
PUT /accounts/projects/{project_id}/oauth/clients/{client_id} Body: any subset of { grant_types, response_types, redirect_uris, scope, metadata } Returns a small status JSON (e.g., { "ok": true }).
Implementation
Future<Map<String, dynamic>> updateOAuthClient(
String projectId,
String clientId, {
List<String>? grantTypes,
List<String>? responseTypes,
List<String>? redirectUris,
String? scope,
Map<String, dynamic>? metadata,
}) async {
final cid = Uri.encodeComponent(clientId);
final uri = Uri.parse('$baseUrl/accounts/projects/$projectId/oauth/clients/$cid');
final body = <String, dynamic>{};
if (grantTypes != null) body['grant_types'] = grantTypes;
if (responseTypes != null) body['response_types'] = responseTypes;
if (redirectUris != null) body['redirect_uris'] = redirectUris;
if (scope != null) body['scope'] = scope;
if (metadata != null) body['metadata'] = metadata;
final response = await http.put(uri, headers: _getHeaders(), body: jsonEncode(body));
if (response.statusCode >= 400) {
throw MeshagentException(
'Failed to update OAuth client. '
'Status code: ${response.statusCode}, body: ${response.body}',
);
}
return jsonDecode(response.body) as Map<String, dynamic>;
}