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

url string

The 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

host string

The database host.

database string

The database name.

username string

The username used to connect.

password string

The password used to connect.

port int

The 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

host string

The database host.

database string

The database name.

username string

The username used to connect.

password string

The password used to connect.

port int

The 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

username string

The username.

password string

The password.

Returns

IExternalServiceBuilder

The builder continuation.

WithBearerToken(string)

Configures bearer token authentication for an HTTP endpoint.

IExternalServiceBuilder WithBearerToken(string token)

Parameters

token string

The 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

key string

The header key.

value string

The header value.

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

authority string

The OAuth authority.

clientId string

The OAuth client ID.

clientSecret string

The 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

authority string

The authority.

clientId string

The client identifier.

clientSecret string

The client secret.

scope string

The 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

key string

The option key.

value string

The option value.

Returns

IExternalServiceBuilder

The builder continuation.