Interface IOpenBiApiClient
- Namespace
- BiExcellence.OpenBi.Api
- Assembly
- BiExcellence.OpenBi.Api.Client.dll
Low-level HTTP transport shared by every OpenBI REST API domain's extension methods (see the
BiExcellence.OpenBi.Api.* namespaces). Obtain an instance from OpenBiApiClient
and authenticate it using the extension methods in BiExcellence.OpenBi.Api.Auth before
calling any other domain operation.
public interface IOpenBiApiClient
- Extension Methods
-
OpenBiApiClientApiKeyExtensions.CreateApiKeySecretAsync(IOpenBiApiClient, string, CancellationToken)OpenBiApiClientBatchJobExtensions.CreateBatchJobAsync(IOpenBiApiClient, BatchJob, CancellationToken)OpenBiApiClientBlogExtensions.DeleteContentArticleAsync(IOpenBiApiClient, string, CancellationToken)OpenBiApiClientDownloadExtensions.CreateDownloadAsync(IOpenBiApiClient, Download, CancellationToken)OpenBiApiClientMasterDataExtensions.GetHierarchiesAsync(IOpenBiApiClient, string, CancellationToken)OpenBiApiClientOAuthAppExtensions.CreateOAuthAppAsync(IOpenBiApiClient, OAuthApp, CancellationToken)OpenBiApiClientRoleExtensions.GetRolesAsync(IOpenBiApiClient, OpenBiListRequest?, CancellationToken)OpenBiApiClientUsergroupExtensions.DeleteUsergroupAsync(IOpenBiApiClient, string, CancellationToken)
Properties
AccessToken
The bearer access token currently attached to outgoing requests, or null if none has been set.
string? AccessToken { get; }
Property Value
- string
BaseAddress
The REST API's base address, e.g. https://myserver/openbi/api/.
Uri BaseAddress { get; }
Property Value
- Uri
Methods
DeleteAsync(string, CancellationToken)
Sends a DELETE request.
Task DeleteAsync(string requestUri, CancellationToken cancellationToken = default)
Parameters
requestUristringcancellationTokenCancellationToken
Returns
- Task
GetAsync<TResponse>(string, CancellationToken)
Sends a GET request and deserializes the JSON response body.
Task<TResponse?> GetAsync<TResponse>(string requestUri, CancellationToken cancellationToken = default)
Parameters
requestUristringcancellationTokenCancellationToken
Returns
- Task<TResponse>
Type Parameters
TResponse
GetFileAsync(string, CancellationToken)
Sends a GET request and returns the response body as a file: the stream plus the media type and file name the server stated. Use this where the response is a document rather than JSON.
Task<OpenBiApiFile> GetFileAsync(string requestUri, CancellationToken cancellationToken = default)
Parameters
requestUristringThe relative request URI.
cancellationTokenCancellationTokenA cancellation token.
Returns
- Task<OpenBiApiFile>
The file. Disposing it disposes the underlying response.
GetListAsync<TItem>(string, CancellationToken)
Sends a GET request against a list endpoint and returns its items together with the X-Total-Count response header, when present.
Task<OpenBiListResult<TItem>> GetListAsync<TItem>(string requestUri, CancellationToken cancellationToken = default)
Parameters
requestUristringcancellationTokenCancellationToken
Returns
- Task<OpenBiListResult<TItem>>
Type Parameters
TItem
GetStreamAsync(string, CancellationToken)
Sends a GET request and returns the raw response stream (e.g. for file downloads).
The caller owns and must dispose the returned stream.
Task<Stream> GetStreamAsync(string requestUri, CancellationToken cancellationToken = default)
Parameters
requestUristringcancellationTokenCancellationToken
Returns
- Task<Stream>
PostAsync(string, CancellationToken)
Sends a POST request with no body.
Task PostAsync(string requestUri, CancellationToken cancellationToken = default)
Parameters
requestUristringcancellationTokenCancellationToken
Returns
- Task
PostAsync<TRequest>(string, TRequest?, CancellationToken)
Sends a POST request with a JSON body and no response body.
Task PostAsync<TRequest>(string requestUri, TRequest? body, CancellationToken cancellationToken = default)
Parameters
requestUristringbodyTRequestcancellationTokenCancellationToken
Returns
- Task
Type Parameters
TRequest
PostAsync<TRequest, TResponse>(string, TRequest?, CancellationToken)
Sends a POST request with a JSON body and deserializes the JSON response body.
Task<TResponse?> PostAsync<TRequest, TResponse>(string requestUri, TRequest? body, CancellationToken cancellationToken = default)
Parameters
requestUristringbodyTRequestcancellationTokenCancellationToken
Returns
- Task<TResponse>
Type Parameters
TRequestTResponse
PostFileAsync<TResponse>(string, Stream, string, IEnumerable<KeyValuePair<string, string>>?, CancellationToken)
Sends a multipart/form-data POST carrying one file plus optional text fields, and
deserializes the JSON response body. The file is streamed rather than buffered.
Task<TResponse?> PostFileAsync<TResponse>(string requestUri, Stream stream, string fileName, IEnumerable<KeyValuePair<string, string>>? fields = null, CancellationToken cancellationToken = default)
Parameters
requestUristringstreamStreamfileNamestringfieldsIEnumerable<KeyValuePair<string, string>>cancellationTokenCancellationToken
Returns
- Task<TResponse>
Type Parameters
TResponse
PostFormAsync(string, IEnumerable<KeyValuePair<string, string>>, CancellationToken)
Sends a POST request with an application/x-www-form-urlencoded body and no response body
(used by /oauth/revoke).
Task PostFormAsync(string requestUri, IEnumerable<KeyValuePair<string, string>> form, CancellationToken cancellationToken = default)
Parameters
requestUristringformIEnumerable<KeyValuePair<string, string>>cancellationTokenCancellationToken
Returns
- Task
PostFormAsync<TResponse>(string, IEnumerable<KeyValuePair<string, string>>, CancellationToken)
Sends a POST request with an application/x-www-form-urlencoded body (used by the
/oauth/token and /oauth/revoke endpoints) and deserializes the JSON response body.
Task<TResponse?> PostFormAsync<TResponse>(string requestUri, IEnumerable<KeyValuePair<string, string>> form, CancellationToken cancellationToken = default)
Parameters
requestUristringformIEnumerable<KeyValuePair<string, string>>cancellationTokenCancellationToken
Returns
- Task<TResponse>
Type Parameters
TResponse
PostServerSentEventsAsync<TRequest, TItem>(string, TRequest?, CancellationToken)
Sends a POST request with a JSON body, asking the server for a server-sent event stream, and
yields each event's deserialized payload as it arrives. The stream stays open until the server closes
it, so enumeration lasts as long as the operation being reported on.
IAsyncEnumerable<TItem> PostServerSentEventsAsync<TRequest, TItem>(string requestUri, TRequest? body, CancellationToken cancellationToken = default)
Parameters
requestUristringbodyTRequestcancellationTokenCancellationToken
Returns
- IAsyncEnumerable<TItem>
Type Parameters
TRequestTItem
QueryListAsync<TRequest, TItem>(string, TRequest?, CancellationToken)
Sends a QUERY request with a JSON body and reads the response as a list. The QUERY-method form of a list route takes the same options as the query string does, for filters that do not fit in a URL.
Task<OpenBiListResult<TItem>> QueryListAsync<TRequest, TItem>(string requestUri, TRequest? body, CancellationToken cancellationToken = default)
Parameters
requestUristringThe relative request URI.
bodyTRequestThe query options.
cancellationTokenCancellationTokenA cancellation token.
Returns
- Task<OpenBiListResult<TItem>>
Type Parameters
TRequestThe request body type.
TItemThe item type to deserialize each entry into.
SetAccessToken(string?)
Attaches (or clears, when accessToken is null) the bearer access token used to authorize subsequent requests.
void SetAccessToken(string? accessToken)
Parameters
accessTokenstring