IDownstreamApi.CallApiForAppAsync Method

Definition

Overloads

CallApiForAppAsync(String, Action<DownstreamApiOptions>, HttpContent, CancellationToken)

Calls the downstream API on behalf of the app itself, with the required scopes.

CallApiForAppAsync<TInput,TOutput>(String, TInput, Action<DownstreamApiOptions>, CancellationToken)

Calls a downstream API consuming JSON with some data and returns data.

CallApiForAppAsync<TOutput>(String, Action<DownstreamApiOptions>, CancellationToken)

Call a web API endpoint with an HttpGet, and return strongly typed data.

CallApiForAppAsync(String, Action<DownstreamApiOptions>, HttpContent, CancellationToken)

Calls the downstream API on behalf of the app itself, with the required scopes.

public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> CallApiForAppAsync (string? serviceName, Action<Microsoft.Identity.Abstractions.DownstreamApiOptions>? downstreamApiOptionsOverride = default, System.Net.Http.HttpContent? content = default, System.Threading.CancellationToken cancellationToken = default);
abstract member CallApiForAppAsync : string * Action<Microsoft.Identity.Abstractions.DownstreamApiOptions> * System.Net.Http.HttpContent * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
Public Function CallApiForAppAsync (serviceName As String, Optional downstreamApiOptionsOverride As Action(Of DownstreamApiOptions) = Nothing, Optional content As HttpContent = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of HttpResponseMessage)

Parameters

serviceName
String

Name of the service describing the downstream API. There can be several configuration named sections mapped to a DownstreamApiOptions, each for one downstream API. You can pass-in null, but in that case downstreamApiOptionsOverride needs to be set.

downstreamApiOptionsOverride
Action<DownstreamApiOptions>

(Optional) Overrides the options proposed in the configuration described by serviceName.

content
HttpContent

Content to send to the API in the case where HttpMethod is HttpMethod.Patch, Post, Put.

cancellationToken
CancellationToken

Cancellation token.

Returns

An HttpResponseMessage that the application will process.

Applies to

CallApiForAppAsync<TInput,TOutput>(String, TInput, Action<DownstreamApiOptions>, CancellationToken)

Calls a downstream API consuming JSON with some data and returns data.

public System.Threading.Tasks.Task<TOutput?> CallApiForAppAsync<TInput,TOutput> (string? serviceName, TInput input, Action<Microsoft.Identity.Abstractions.DownstreamApiOptions>? downstreamApiOptionsOverride = default, System.Threading.CancellationToken cancellationToken = default) where TOutput : class;
abstract member CallApiForAppAsync : string * 'Input * Action<Microsoft.Identity.Abstractions.DownstreamApiOptions> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Output (requires 'Output : null)> (requires 'Output : null)
Public Function CallApiForAppAsync(Of TInput, TOutput) (serviceName As String, input As TInput, Optional downstreamApiOptionsOverride As Action(Of DownstreamApiOptions) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TOutput)

Type Parameters

TInput

Input type.

TOutput

Output type.

Parameters

serviceName
String

Name of the service describing the downstream API. There can be several configuration named sections mapped to a DownstreamApiOptions, each for one downstream API. You can pass-in null, but in that case downstreamApiOptionsOverride needs to be set.

input
TInput

Input parameter to the downstream web API.

downstreamApiOptionsOverride
Action<DownstreamApiOptions>

Overrides the options proposed in the configuration described by serviceName.

cancellationToken
CancellationToken

Cancellation token.

Returns

Task<TOutput>

The value returned by the downstream web API.

Applies to

CallApiForAppAsync<TOutput>(String, Action<DownstreamApiOptions>, CancellationToken)

Call a web API endpoint with an HttpGet, and return strongly typed data.

public System.Threading.Tasks.Task<TOutput?> CallApiForAppAsync<TOutput> (string serviceName, Action<Microsoft.Identity.Abstractions.DownstreamApiOptions>? downstreamApiOptionsOverride = default, System.Threading.CancellationToken cancellationToken = default) where TOutput : class;
abstract member CallApiForAppAsync : string * Action<Microsoft.Identity.Abstractions.DownstreamApiOptions> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Output (requires 'Output : null)> (requires 'Output : null)
Public Function CallApiForAppAsync(Of TOutput As Class) (serviceName As String, Optional downstreamApiOptionsOverride As Action(Of DownstreamApiOptions) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TOutput)

Type Parameters

TOutput

Output type.

Parameters

serviceName
String

Name of the service describing the downstream API. There can be several configuration named sections mapped to a DownstreamApiOptions, each for one downstream API. You can pass-in null, but in that case downstreamApiOptionsOverride needs to be set.

downstreamApiOptionsOverride
Action<DownstreamApiOptions>

Overrides the options proposed in the configuration described by serviceName.

cancellationToken
CancellationToken

Cancellation token.

Returns

Task<TOutput>

The value returned by the downstream web API.

Applies to