Class DiscoveryApi
Provides methods to retrieve metadata of the exchange apis
Inheritance
object
DiscoveryApi
Namespace: Transit.Shared.Communication.Azure.Exchange
Assembly: Transit.Shared.dll
Syntax
public class DiscoveryApi
Remarks
A valid scope is required to obtain exchange api metadata
Examples
string scope = "your-import-scope";
var api = new DiscoveryApi(scope);
var metadata = await api.GetImportMetadataAsync();
// Import Endpoints
var endpoints = metadata.Endpoints;
// Configuration for OAuth 2.0 client credential flow
var auth = metadata.Authentication;
Constructors
DiscoveryApi(string)
Initializes a new instance of the DiscoveryApi class.
Declaration
public DiscoveryApi(string scope)
Parameters
| Type | Name | Description |
|---|---|---|
| string | scope | A valid exchange scope |
Methods
GetImportMetadataAsync()
Retrieves the import metadata
Declaration
public Task<ImportMetadata> GetImportMetadataAsync()
Returns
| Type | Description |
|---|---|
| Task<ImportMetadata> | Import api metadata |
GetImportMetadataAsync(CancellationToken)
Retrieves the import metadata
Declaration
public Task<ImportMetadata> GetImportMetadataAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | A token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<ImportMetadata> | Import api metadata |
Exceptions
| Type | Condition |
|---|---|
| OperationCanceledException | Thrown when the operation is canceled. |
GetImportMetadataAsync(TimeSpan)
Retrieves the import metadata
Declaration
public Task<ImportMetadata> GetImportMetadataAsync(TimeSpan timeout)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpan | timeout | The maximum time to wait for the operation to complete. |
Returns
| Type | Description |
|---|---|
| Task<ImportMetadata> | Import api metadata |
Exceptions
| Type | Condition |
|---|---|
| OperationCanceledException | Thrown when the operation times out. |