Class RestChannelServiceClientFactory
A factory to create REST clients to interact with a Channel Service.
public class RestChannelServiceClientFactory : IChannelServiceClientFactory
- Inheritance
-
RestChannelServiceClientFactory
- Implements
- Inherited Members
Remarks
Connector and UserToken client factory.
Constructors
RestChannelServiceClientFactory(IConfiguration, IHttpClientFactory, IConnections, string, string, ILogger)
public RestChannelServiceClientFactory(IConfiguration configuration, IHttpClientFactory httpClientFactory, IConnections connections, string tokenServiceEndpoint = "https://api.botframework.com", string tokenServiceAudience = "https://api.botframework.com", ILogger logger = null)
Parameters
configuration
IConfigurationhttpClientFactory
IHttpClientFactoryUsed to create an HttpClient with the fullname of this class
connections
IConnectionstokenServiceEndpoint
stringtokenServiceAudience
stringlogger
ILogger
Exceptions
- ArgumentNullException
- ArgumentException
- InvalidOperationException
Thrown when an instance of Microsoft.Agents.Authentication.IAccessTokenProvider is not found via Microsoft.Agents.Authentication.IConnections.
Methods
CreateConnectorClientAsync(ClaimsIdentity, string, string, CancellationToken, IList<string>, bool)
Creates a Microsoft.Agents.Connector.IConnectorClient that can be used to create Microsoft.Agents.Connector.IConnectorClient.
public Task<IConnectorClient> CreateConnectorClientAsync(ClaimsIdentity claimsIdentity, string serviceUrl, string audience, CancellationToken cancellationToken, IList<string> scopes = null, bool useAnonymous = false)
Parameters
claimsIdentity
ClaimsIdentityThe inbound Activity's ClaimsIdentity.
serviceUrl
stringThe service URL.
audience
stringcancellationToken
CancellationTokenA cancellation token.
scopes
IList<string>The scopes to request.
useAnonymous
boolWhether to use anonymous credentials.
Returns
- Task<IConnectorClient>
A Microsoft.Agents.Connector.IConnectorClient.
Remarks
This is called at the beginning of each turn.
Exceptions
- ArgumentNullException
- ArgumentException
- InvalidOperationException
Thrown when an instance of Microsoft.Agents.Authentication.IAccessTokenProvider is not found via Microsoft.Agents.Authentication.IConnections.
CreateUserTokenClientAsync(ClaimsIdentity, CancellationToken, bool)
Creates the appropriate Microsoft.Agents.Connector.IUserTokenClient instance.
public Task<IUserTokenClient> CreateUserTokenClientAsync(ClaimsIdentity claimsIdentity, CancellationToken cancellationToken, bool useAnonymous = false)
Parameters
claimsIdentity
ClaimsIdentityThe inbound Activity's ClaimsIdentity.
cancellationToken
CancellationTokenA cancellation token.
useAnonymous
boolWhether to use anonymous credentials.
Returns
- Task<IUserTokenClient>
Asynchronous Task with Microsoft.Agents.Connector.IUserTokenClient instance.
Exceptions
- ArgumentNullException
- ArgumentException
- InvalidOperationException
Thrown when an instance of Microsoft.Agents.Authentication.IAccessTokenProvider is not found via Microsoft.Agents.Authentication.IConnections.