Class ScopeApi

Provides methods to create, update, and delete api scopes

Inheritance
object
ScopeApi
Namespace: Transit.Shared.Communication.Azure.Exchange
Assembly: Transit.Shared.dll
Syntax
public class ScopeApi
Examples
// Create the scope for uploading Tours and Orders
// This will open a browswer for interactive login. A user with role "api admin" is required
var api = new ScopeApi();
var request = ScopeRequest.ForImportUpload("Your-Import-Source-Aid", "Your-Link-Source-Guid", "Your-Link-Source-Aid", [ImportDataType.Tour, ImportDataType.Order]);
string scope = await api.CreateAsync(request);
// Save the scope
await SaveToDatabaseAsync(scope);
// Activate the scope
await api.UpdateAsync(ScopeRequest.ForUpdate(scope, isEnabled:true));

Methods

CreateAsync(ScopeRequest)

Creates a new api scope

Declaration
public Task<string> CreateAsync(ScopeRequest request)
Parameters
Type Name Description
ScopeRequest request

The scope request containing the configuration for the new scope. Use one of the static methods in ScopeRequest to create the scope request

Returns
Type Description
Task<string>

A new scope

CreateAsync(ScopeRequest, CancellationToken)

Creates a new api scope

Declaration
public Task<string> CreateAsync(ScopeRequest request, CancellationToken cancellationToken)
Parameters
Type Name Description
ScopeRequest request

The scope request containing the configuration for the new scope. Use one of the static methods in ScopeRequest to create the scope request

CancellationToken cancellationToken

A token to cancel the operation.

Returns
Type Description
Task<string>

A new scope

Exceptions
Type Condition
OperationCanceledException

Thrown when the operation is canceled.

CreateAsync(ScopeRequest, TimeSpan)

Creates a new api scope

Declaration
public Task<string> CreateAsync(ScopeRequest request, TimeSpan timeout)
Parameters
Type Name Description
ScopeRequest request

The scope request containing the configuration for the new scope. Use one of the static methods in ScopeRequest to create the scope request

TimeSpan timeout

The maximum time to wait for the operation to complete.

Returns
Type Description
Task<string>

A new scope

Exceptions
Type Condition
OperationCanceledException

Thrown when the operation times out.

DeleteAllAsync(string)

Deletes all api scopes of a link source

Declaration
public Task DeleteAllAsync(string owner)
Parameters
Type Name Description
string owner

The link source GUID whose scopes should be deleted.

Returns
Type Description
Task

DeleteAllAsync(string, CancellationToken)

Deletes all api scopes of a link source

Declaration
public Task DeleteAllAsync(string owner, CancellationToken cancellationToken)
Parameters
Type Name Description
string owner

The link source GUID whose scopes should be deleted.

CancellationToken cancellationToken

A token to cancel the operation.

Returns
Type Description
Task
Exceptions
Type Condition
OperationCanceledException

Thrown when the operation is canceled.

DeleteAllAsync(string, TimeSpan)

Deletes all api scopes of a link source

Declaration
public Task DeleteAllAsync(string owner, TimeSpan timeout)
Parameters
Type Name Description
string owner

The link source GUID whose scopes should be deleted.

TimeSpan timeout

The maximum time to wait for the operation to complete.

Returns
Type Description
Task
Exceptions
Type Condition
OperationCanceledException

Thrown when the operation times out.

DeleteAsync(string)

Deletes an existing api scope.

Declaration
public Task DeleteAsync(string scope)
Parameters
Type Name Description
string scope

The scope value to delete.

Returns
Type Description
Task

DeleteAsync(string, CancellationToken)

Deletes an existing api scope.

Declaration
public Task DeleteAsync(string scope, CancellationToken cancellationToken)
Parameters
Type Name Description
string scope

The scope value to delete.

CancellationToken cancellationToken

A token to cancel the operation.

Returns
Type Description
Task
Exceptions
Type Condition
OperationCanceledException

Thrown when the operation is canceled.

DeleteAsync(string, TimeSpan)

Deletes an existing api scope.

Declaration
public Task DeleteAsync(string scope, TimeSpan timeout)
Parameters
Type Name Description
string scope

The scope value to delete.

TimeSpan timeout

The maximum time to wait for the operation to complete.

Returns
Type Description
Task
Exceptions
Type Condition
OperationCanceledException

Thrown when the operation times out.

UpdateAsync(ScopeRequest)

Updates an existing api scope

Declaration
public Task UpdateAsync(ScopeRequest request)
Parameters
Type Name Description
ScopeRequest request

The scope request containing the configuration for the scope. Use the static method ForUpdate(string, bool) to create the scope request

Returns
Type Description
Task

UpdateAsync(ScopeRequest, CancellationToken)

Updates an existing api scope

Declaration
public Task UpdateAsync(ScopeRequest request, CancellationToken cancellationToken)
Parameters
Type Name Description
ScopeRequest request

The scope request containing the configuration for the scope. Use the static method ForUpdate(string, bool) to create the scope request

CancellationToken cancellationToken

A token to cancel the operation.

Returns
Type Description
Task
Exceptions
Type Condition
OperationCanceledException

Thrown when the operation is canceled.

UpdateAsync(ScopeRequest, TimeSpan)

Updates an existing api scope

Declaration
public Task UpdateAsync(ScopeRequest request, TimeSpan timeout)
Parameters
Type Name Description
ScopeRequest request

The scope request containing the configuration for the scope. Use the static method ForUpdate(string, bool) to create the scope request

TimeSpan timeout

The maximum time to wait for the operation to complete.

Returns
Type Description
Task
Exceptions
Type Condition
OperationCanceledException

Thrown when the operation times out.

In this article
Back to top Generated by DocFX