updateProjectExternalOAuthRegistration method
Future<void>
updateProjectExternalOAuthRegistration({
- required String projectId,
- required String registrationId,
- required OAuthClientConfig oauth,
- required String clientId,
- String? clientSecret,
- String? delegatedTo,
- ConnectorRef? connector,
Implementation
Future<void> updateProjectExternalOAuthRegistration({
required String projectId,
required String registrationId,
required OAuthClientConfig oauth,
required String clientId,
String? clientSecret,
String? delegatedTo,
ConnectorRef? connector,
}) async {
final encodedProjectId = Uri.encodeComponent(projectId);
final encodedRegistrationId = Uri.encodeComponent(registrationId);
final uri = Uri.parse('$baseUrl/accounts/projects/$encodedProjectId/external-oauth/$encodedRegistrationId');
final body = <String, dynamic>{
'oauth': oauth.toJson(),
'client_id': clientId,
if (clientSecret != null) 'client_secret': clientSecret,
if (delegatedTo != null) 'delegated_to': delegatedTo,
if (connector != null) 'connector': connector.toJson(),
};
final response = await httpClient.put(uri, body: jsonEncode(body));
if (response.statusCode >= 400) {
throw MeshagentException(
'Failed to update project external oauth registration. '
'Status code: ${response.statusCode}, body: ${response.body}',
);
}
}