Language

BotHttpClient.SendAsync Method

Definition

Overloads

Name Description
SendAsync(HttpMethod, String, String, BotRequestOptions, CancellationToken)

Sends an HTTP request without expecting a response body.

SendAsync(HttpMethod, String, String, Dictionary<String,String>, String, BotRequestOptions, CancellationToken)

Sends an HTTP request with query parameters without expecting a response body.

SendAsync<T>(HttpMethod, String, String, BotRequestOptions, CancellationToken)

Sends an HTTP request and deserializes the response.

SendAsync<T>(HttpMethod, String, String, Dictionary<String,String>, String, BotRequestOptions, CancellationToken)

Sends an HTTP request with query parameters and deserializes the response.

SendAsync(HttpMethod, String, String, BotRequestOptions, CancellationToken)

Sends an HTTP request without expecting a response body.

public System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpMethod method, string url, string? body = default, Microsoft.Teams.Core.Http.BotRequestOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
member this.SendAsync : System.Net.Http.HttpMethod * string * string * Microsoft.Teams.Core.Http.BotRequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function SendAsync (method As HttpMethod, url As String, Optional body As String = Nothing, Optional options As BotRequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

method
HttpMethod

The HTTP method to use.

url
String

The full URL for the request.

body
String

The request body content. Optional.

options
BotRequestOptions

The request options. Optional.

cancellationToken
CancellationToken

A cancellation token that can be used to cancel the operation.

Returns

A task that represents the asynchronous operation.

Exceptions

Thrown if the request fails.

Applies to

SendAsync(HttpMethod, String, String, Dictionary<String,String>, String, BotRequestOptions, CancellationToken)

Sends an HTTP request with query parameters without expecting a response body.

public System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpMethod method, string baseUrl, string endpoint, System.Collections.Generic.Dictionary<string,string?>? queryParams = default, string? body = default, Microsoft.Teams.Core.Http.BotRequestOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
member this.SendAsync : System.Net.Http.HttpMethod * string * string * System.Collections.Generic.Dictionary<string, string> * string * Microsoft.Teams.Core.Http.BotRequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function SendAsync (method As HttpMethod, baseUrl As String, endpoint As String, Optional queryParams As Dictionary(Of String, String) = Nothing, Optional body As String = Nothing, Optional options As BotRequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

method
HttpMethod

The HTTP method to use.

baseUrl
String

The base URL for the request.

endpoint
String

The endpoint path to append to the base URL.

queryParams
Dictionary<String,String>

The query parameters to include in the request. Optional.

body
String

The request body content. Optional.

options
BotRequestOptions

The request options. Optional.

cancellationToken
CancellationToken

A cancellation token that can be used to cancel the operation.

Returns

A task that represents the asynchronous operation.

Exceptions

Thrown if the request fails.

Applies to

SendAsync<T>(HttpMethod, String, String, BotRequestOptions, CancellationToken)

Sends an HTTP request and deserializes the response.

public System.Threading.Tasks.Task<T?> SendAsync<T>(System.Net.Http.HttpMethod method, string url, string? body = default, Microsoft.Teams.Core.Http.BotRequestOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
member this.SendAsync : System.Net.Http.HttpMethod * string * string * Microsoft.Teams.Core.Http.BotRequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'T>
Public Function SendAsync(Of T) (method As HttpMethod, url As String, Optional body As String = Nothing, Optional options As BotRequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of T)

Type Parameters

T

The type to deserialize the response to.

Parameters

method
HttpMethod

The HTTP method to use.

url
String

The full URL for the request.

body
String

The request body content. Optional.

options
BotRequestOptions

The request options. Optional.

cancellationToken
CancellationToken

A cancellation token that can be used to cancel the operation.

Returns

Task<T>

A task that represents the asynchronous operation. The task result contains the deserialized response, or null if the response is empty or 404 (when ReturnNullOnNotFound is true).

Exceptions

Thrown if the request fails and the failure is not handled by options.

Applies to

SendAsync<T>(HttpMethod, String, String, Dictionary<String,String>, String, BotRequestOptions, CancellationToken)

Sends an HTTP request with query parameters and deserializes the response.

public System.Threading.Tasks.Task<T?> SendAsync<T>(System.Net.Http.HttpMethod method, string baseUrl, string endpoint, System.Collections.Generic.Dictionary<string,string?>? queryParams = default, string? body = default, Microsoft.Teams.Core.Http.BotRequestOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
member this.SendAsync : System.Net.Http.HttpMethod * string * string * System.Collections.Generic.Dictionary<string, string> * string * Microsoft.Teams.Core.Http.BotRequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'T>
Public Function SendAsync(Of T) (method As HttpMethod, baseUrl As String, endpoint As String, Optional queryParams As Dictionary(Of String, String) = Nothing, Optional body As String = Nothing, Optional options As BotRequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of T)

Type Parameters

T

The type to deserialize the response to.

Parameters

method
HttpMethod

The HTTP method to use.

baseUrl
String

The base URL for the request.

endpoint
String

The endpoint path to append to the base URL.

queryParams
Dictionary<String,String>

The query parameters to include in the request. Optional.

body
String

The request body content. Optional.

options
BotRequestOptions

The request options. Optional.

cancellationToken
CancellationToken

A cancellation token that can be used to cancel the operation.

Returns

Task<T>

A task that represents the asynchronous operation. The task result contains the deserialized response, or null if the response is empty or 404 (when ReturnNullOnNotFound is true).

Exceptions

Thrown if the request fails and the failure is not handled by options.

Applies to