Class ExternalServiceBuilder

Namespace
Cratis.Chronicle.ExternalServices
Assembly
Cratis.Chronicle.dll

Represents an implementation of IExternalServiceBuilder.

public class ExternalServiceBuilder : IExternalServiceBuilder
Inheritance
ExternalServiceBuilder
Implements
Inherited Members
Extension Methods

Constructors

ExternalServiceBuilder()

public ExternalServiceBuilder()

Methods

Build(string, string)

public ExternalServiceDefinition Build(string id, string name)

Parameters

id string

The identifier of the external service.

name string

The human-readable name of the external service.

Returns

ExternalServiceDefinition

The built ExternalServiceDefinition.

Http(string)

Configures the service as an HTTP endpoint.

public 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.

public 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.

public 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.

public 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.

public 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.

public 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.

public 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.

public 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.

public IExternalServiceBuilder WithOption(string key, string value)

Parameters

key string

The option key.

value string

The option value.

Returns

IExternalServiceBuilder

The builder continuation.