Interface IExternalServiceBuilder
- Namespace
- Cratis.Chronicle.ExternalServices
- Assembly
- Cratis.Chronicle.dll
Defines a fluent builder for configuring an external service.
public interface IExternalServiceBuilder
- Extension Methods
Methods
Http(string)
Configures the service as an HTTP endpoint.
IExternalServiceBuilder Http(string url)
Parameters
urlstringThe base URL of the endpoint.
Returns
- IExternalServiceBuilder
The builder continuation.
MsSql(string, string, string, string, int)
Configures the service as a Microsoft SQL Server database endpoint.
IExternalServiceBuilder MsSql(string host, string database, string username, string password, int port = 0)
Parameters
hoststringThe database host.
databasestringThe database name.
usernamestringThe username used to connect.
passwordstringThe password used to connect.
portintThe database port. Leave as 0 to use the provider default.
Returns
- IExternalServiceBuilder
The builder continuation.
PostgreSql(string, string, string, string, int)
Configures the service as a PostgreSQL database endpoint.
IExternalServiceBuilder PostgreSql(string host, string database, string username, string password, int port = 0)
Parameters
hoststringThe database host.
databasestringThe database name.
usernamestringThe username used to connect.
passwordstringThe password used to connect.
portintThe database port. Leave as 0 to use the provider default.
Returns
- IExternalServiceBuilder
The builder continuation.
WithBasicAuth(string, string)
Configures basic authentication for an HTTP endpoint.
IExternalServiceBuilder WithBasicAuth(string username, string password)
Parameters
Returns
- IExternalServiceBuilder
The builder continuation.
WithBearerToken(string)
Configures bearer token authentication for an HTTP endpoint.
IExternalServiceBuilder WithBearerToken(string token)
Parameters
tokenstringThe bearer token.
Returns
- IExternalServiceBuilder
The builder continuation.
WithHeader(string, string)
Adds a header to send with every HTTP request.
IExternalServiceBuilder WithHeader(string key, string value)
Parameters
Returns
- IExternalServiceBuilder
The builder continuation.
WithOAuth(string, string, string)
Configures OAuth authentication for an HTTP endpoint.
IExternalServiceBuilder WithOAuth(string authority, string clientId, string clientSecret)
Parameters
authoritystringThe OAuth authority.
clientIdstringThe OAuth client ID.
clientSecretstringThe OAuth client secret.
Returns
- IExternalServiceBuilder
The builder continuation.
WithOAuth(string, string, string, string)
Configures OAuth client credentials with an optional scope.
IExternalServiceBuilder WithOAuth(string authority, string clientId, string clientSecret, string scope)
Parameters
authoritystringThe authority.
clientIdstringThe client identifier.
clientSecretstringThe client secret.
scopestringThe requested scope.
Returns
- IExternalServiceBuilder
The builder continuation.
Exceptions
- NotSupportedException
The builder does not support scoped OAuth configuration.
WithOption(string, string)
Adds a provider-specific option to a database endpoint's connection string.
IExternalServiceBuilder WithOption(string key, string value)
Parameters
Returns
- IExternalServiceBuilder
The builder continuation.