Skip to content

Commit

Permalink
Add support for the connection status API (#601)
Browse files Browse the repository at this point in the history
* Add support for the connection status API

* Code review items

* Align doco
  • Loading branch information
Hawxy authored Oct 19, 2022
1 parent 659f6ad commit 2e81abc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Auth0.ManagementApi/Clients/ConnectionsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,16 @@ public Task<Connection> UpdateAsync(string id, ConnectionUpdateRequest request,
{
return Connection.SendAsync<Connection>(new HttpMethod("PATCH"), BuildUri($"connections/{EncodePath(id)}"), request, DefaultHeaders, cancellationToken: cancellationToken);
}

/// <summary>
/// Retrieves the status of an ad/ldap connection.
/// </summary>
/// <param name="id">ID of the connection to check.</param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
/// <returns>A <see cref="Task"/> that represents the asynchronous check operation. Will throw if the check fails.</returns>
public Task CheckStatusAsync(string id, CancellationToken cancellationToken = default)
{
return Connection.GetAsync<object>(BuildUri($"connections/{EncodePath(id)}/status"), DefaultHeaders, cancellationToken: cancellationToken);
}
}
}
8 changes: 8 additions & 0 deletions src/Auth0.ManagementApi/Clients/IConnectionsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,13 @@ public interface IConnectionsClient
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
/// <returns>The <see cref="Connection"/> that has been updated.</returns>
Task<Connection> UpdateAsync(string id, ConnectionUpdateRequest request, CancellationToken cancellationToken = default);

/// <summary>
/// Retrieves the status of an ad/ldap connection.
/// </summary>
/// <param name="id">ID of the connection to check.</param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
/// <returns>A <see cref="Task"/> that represents the asynchronous check operation. Will throw if the status check fails.</returns>
Task CheckStatusAsync(string id, CancellationToken cancellationToken = default);
}
}

0 comments on commit 2e81abc

Please sign in to comment.