From 2e81abc3c9c881b14ca133eae651f43976a8c5cc Mon Sep 17 00:00:00 2001 From: JT Date: Wed, 19 Oct 2022 15:51:24 +0800 Subject: [PATCH] Add support for the connection status API (#601) * Add support for the connection status API * Code review items * Align doco --- src/Auth0.ManagementApi/Clients/ConnectionsClient.cs | 11 +++++++++++ src/Auth0.ManagementApi/Clients/IConnectionsClient.cs | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/src/Auth0.ManagementApi/Clients/ConnectionsClient.cs b/src/Auth0.ManagementApi/Clients/ConnectionsClient.cs index 04ab2a422..07a16bb2b 100644 --- a/src/Auth0.ManagementApi/Clients/ConnectionsClient.cs +++ b/src/Auth0.ManagementApi/Clients/ConnectionsClient.cs @@ -132,5 +132,16 @@ public Task UpdateAsync(string id, ConnectionUpdateRequest request, { return Connection.SendAsync(new HttpMethod("PATCH"), BuildUri($"connections/{EncodePath(id)}"), request, DefaultHeaders, cancellationToken: cancellationToken); } + + /// + /// Retrieves the status of an ad/ldap connection. + /// + /// ID of the connection to check. + /// The cancellation token to cancel operation. + /// A that represents the asynchronous check operation. Will throw if the check fails. + public Task CheckStatusAsync(string id, CancellationToken cancellationToken = default) + { + return Connection.GetAsync(BuildUri($"connections/{EncodePath(id)}/status"), DefaultHeaders, cancellationToken: cancellationToken); + } } } diff --git a/src/Auth0.ManagementApi/Clients/IConnectionsClient.cs b/src/Auth0.ManagementApi/Clients/IConnectionsClient.cs index 28260ccba..70699bc4c 100644 --- a/src/Auth0.ManagementApi/Clients/IConnectionsClient.cs +++ b/src/Auth0.ManagementApi/Clients/IConnectionsClient.cs @@ -62,5 +62,13 @@ public interface IConnectionsClient /// The cancellation token to cancel operation. /// The that has been updated. Task UpdateAsync(string id, ConnectionUpdateRequest request, CancellationToken cancellationToken = default); + + /// + /// Retrieves the status of an ad/ldap connection. + /// + /// ID of the connection to check. + /// The cancellation token to cancel operation. + /// A that represents the asynchronous check operation. Will throw if the status check fails. + Task CheckStatusAsync(string id, CancellationToken cancellationToken = default); } }