Class WolfClientBuilder
A builder for WolfClient.
Namespace: TehGM.Wolfringo
Assembly: Wolfringo.Core.dll
Syntax
public class WolfClientBuilder
Constructors
| Improve this Doc View SourceWolfClientBuilder()
Creates a new WolfClient builder with default values pre-set.
Declaration
public WolfClientBuilder()
WolfClientBuilder(IServiceCollection)
Creates a new WolfClient builder with provided services.
Declaration
public WolfClientBuilder(IServiceCollection services)
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | Initial services to use. |
Properties
| Improve this Doc View SourceOptions
Options for the client.
Declaration
public WolfClientOptions Options { get; set; }
Property Value
Type | Description |
---|---|
WolfClientOptions |
Methods
| Improve this Doc View SourceBuild()
Builds a new WolfClient with provided values.
Declaration
public WolfClient Build()
Returns
Type | Description |
---|---|
WolfClient | A new WolfClient instance, |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Server URL is null. |
Build(out IServiceProvider)
Builds a new WolfClient with provided values.
Declaration
public WolfClient Build(out IServiceProvider services)
Parameters
Type | Name | Description |
---|---|---|
IServiceProvider | services | The built service provider. |
Returns
Type | Description |
---|---|
WolfClient | A new WolfClient instance, |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Server URL is null. |
ConfigureOptions(Action<WolfClientOptions>)
Allows configuring options for Wolf Client.
Declaration
public WolfClientBuilder ConfigureOptions(Action<WolfClientOptions> configure)
Parameters
Type | Name | Description |
---|---|---|
Action<WolfClientOptions> | configure | Delegate that can be used for options configuration. |
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
WithBetaServerURL()
Sets WOLF server URL to beta/rc value.
Declaration
public WolfClientBuilder WithBetaServerURL()
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
See Also
| Improve this Doc View SourceWithCaching(IWolfClientCache)
Sets entity cache container that client will use.
Declaration
public WolfClientBuilder WithCaching(IWolfClientCache cache)
Parameters
Type | Name | Description |
---|---|---|
IWolfClientCache | cache | The entity cache container. |
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
WithCaching<TImplementation>()
Sets entity cache container that client will use.
Declaration
public WolfClientBuilder WithCaching<TImplementation>()
where TImplementation : class, IWolfClientCache
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Type Parameters
Name | Description |
---|---|
TImplementation | Type of entity cache container. |
WithDefaultCaching()
Switches to default entity cache container with all caches enabled.
Declaration
public WolfClientBuilder WithDefaultCaching()
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Remarks
WolfClientCache will be used.
WithDefaultCaching(WolfCacheOptions)
Switches to default entity cache container.
Declaration
public WolfClientBuilder WithDefaultCaching(WolfCacheOptions options)
Parameters
Type | Name | Description |
---|---|---|
WolfCacheOptions | options | Options for the default entity cache container. |
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Remarks
WolfClientCache will be used.
WithDefaultMessageSerializers()
Switches to default message serializers provider with default options to use for serializing messages.
Declaration
public WolfClientBuilder WithDefaultMessageSerializers()
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Remarks
MessageSerializerProvider will be used.
See Also
| Improve this Doc View SourceWithDefaultMessageSerializers(MessageSerializerProviderOptions)
Switches to default message serializers provider to use for serializing messages.
Declaration
public WolfClientBuilder WithDefaultMessageSerializers(MessageSerializerProviderOptions options)
Parameters
Type | Name | Description |
---|---|---|
MessageSerializerProviderOptions | options | Options for the default provider. |
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Remarks
MessageSerializerProvider will be used.
See Also
| Improve this Doc View SourceWithDefaultResponseSerializers()
Switches to default response serializers provider with default options to use for deserializing responses.
Declaration
public WolfClientBuilder WithDefaultResponseSerializers()
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Remarks
ResponseSerializerProvider will be used.
See Also
| Improve this Doc View SourceWithDefaultResponseSerializers(ResponseSerializerProviderOptions)
Switches to default response serializers provider to use for deserializing responses.
Declaration
public WolfClientBuilder WithDefaultResponseSerializers(ResponseSerializerProviderOptions options)
Parameters
Type | Name | Description |
---|---|---|
ResponseSerializerProviderOptions | options | Options for the default provider. |
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Remarks
ResponseSerializerProvider will be used.
See Also
| Improve this Doc View SourceWithDefaultResponseTypeResolver()
Switches to default response type resolver to use for deserializing responses.
Declaration
public WolfClientBuilder WithDefaultResponseTypeResolver()
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Remarks
ResponseTypeResolver will be used.
See Also
| Improve this Doc View SourceWithDefaultServerURL()
Sets WOLF server URL to default value.
Declaration
public WolfClientBuilder WithDefaultServerURL()
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
See Also
| Improve this Doc View SourceWithDefaultSocketClient()
Switches to default socket client.
Declaration
public WolfClientBuilder WithDefaultSocketClient()
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Remarks
SocketClient will be used.
See Also
| Improve this Doc View SourceWithDefaultTokenProvider()
Switches to default token provider to generate a token for connection.
Declaration
public WolfClientBuilder WithDefaultTokenProvider()
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Remarks
RandomizedWolfTokenProvider will be used.
Using this method disables token set by using WithToken(String).
See Also
| Improve this Doc View SourceWithDevice(WolfDevice)
Sets device to connect as.
Declaration
public WolfClientBuilder WithDevice(WolfDevice device)
Parameters
Type | Name | Description |
---|---|---|
WolfDevice | device | Device to connect as. |
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
WithLogging(ILogger)
Sets a logger to be used by the client.
Declaration
public WolfClientBuilder WithLogging(ILogger logger)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | Logger to use. |
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
WithLogging(ILoggerFactory)
Sets a logger factory that will be used to create a logger.
Declaration
public WolfClientBuilder WithLogging(ILoggerFactory factory)
Parameters
Type | Name | Description |
---|---|---|
ILoggerFactory | factory | Logger factory to use when creating a logger. |
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
WithMessageSerializers(ISerializerProvider<String, IMessageSerializer>)
Sets message serializers provider to use for serializing messages.
Declaration
public WolfClientBuilder WithMessageSerializers(ISerializerProvider<string, IMessageSerializer> provider)
Parameters
Type | Name | Description |
---|---|---|
ISerializerProvider<String, IMessageSerializer> | provider | Serializers provider. |
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
See Also
| Improve this Doc View SourceWithMessageSerializers<TImplementation>()
Sets message serializers provider to use for serializing messages.
Declaration
public WolfClientBuilder WithMessageSerializers<TImplementation>()
where TImplementation : class, ISerializerProvider<string, IMessageSerializer>
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Type Parameters
Name | Description |
---|---|
TImplementation | Type of serializers provider. |
Remarks
TImplementation
must have a constructar that can be resolved from provided services.
See Also
| Improve this Doc View SourceWithResponseSerializers(ISerializerProvider<Type, IResponseSerializer>)
Sets response serializers provider to use for deserializing responses.
Declaration
public WolfClientBuilder WithResponseSerializers(ISerializerProvider<Type, IResponseSerializer> provider)
Parameters
Type | Name | Description |
---|---|---|
ISerializerProvider<Type, IResponseSerializer> | provider | Serializers provider. |
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
See Also
| Improve this Doc View SourceWithResponseSerializers<TImplementation>()
Sets response serializers provider to use for deserializing messages.
Declaration
public WolfClientBuilder WithResponseSerializers<TImplementation>()
where TImplementation : class, ISerializerProvider<Type, IResponseSerializer>
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Type Parameters
Name | Description |
---|---|
TImplementation | Type of serializers provider. |
Remarks
TImplementation
must have a constructar that can be resolved from provided services.
See Also
| Improve this Doc View SourceWithResponseTypeResolver(IResponseTypeResolver)
Sets response type resolver to use for deserializing responses.
Declaration
public WolfClientBuilder WithResponseTypeResolver(IResponseTypeResolver resolver)
Parameters
Type | Name | Description |
---|---|---|
IResponseTypeResolver | resolver | Response type resolver. |
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
See Also
| Improve this Doc View SourceWithResponseTypeResolver<TImplementation>()
Sets response type resolver to use for deserializing responses.
Declaration
public WolfClientBuilder WithResponseTypeResolver<TImplementation>()
where TImplementation : class, IResponseTypeResolver
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Type Parameters
Name | Description |
---|---|
TImplementation | Type of response type resolver. |
Remarks
TImplementation
must have a constructar that can be resolved from provided services.
See Also
| Improve this Doc View SourceWithServerURL(String)
Sets WOLF server URL to connect to.
Declaration
public WolfClientBuilder WithServerURL(string url)
Parameters
Type | Name | Description |
---|---|---|
String | url | WOLF server URL to connect to. |
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
See Also
| Improve this Doc View SourceWithService<TService>(TService)
Adds any custom service so it can be resolved during Dependency Injection.
Declaration
public WolfClientBuilder WithService<TService>(TService service)
where TService : class
Parameters
Type | Name | Description |
---|---|---|
TService | service | The service instance. |
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Type Parameters
Name | Description |
---|---|
TService | Type of the service. |
WithService<TService>(Func<IServiceProvider, TService>)
Adds any custom service so it can be resolved during Dependency Injection.
Declaration
public WolfClientBuilder WithService<TService>(Func<IServiceProvider, TService> factory)
where TService : class
Parameters
Type | Name | Description |
---|---|---|
Func<IServiceProvider, TService> | factory | Delegate that will be invoked when the service is resolved. |
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Type Parameters
Name | Description |
---|---|
TService | Type of the service. |
WithService<TService, TImplementation>()
Adds any custom service so it can be resolved during Dependency Injection.
Declaration
public WolfClientBuilder WithService<TService, TImplementation>()
where TService : class where TImplementation : class, TService
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Type Parameters
Name | Description |
---|---|
TService | Type of the service. |
TImplementation | Implementation type of the service |
WithSocketClient(ISocketClient)
Sets the underlying socket client.
Declaration
public WolfClientBuilder WithSocketClient(ISocketClient client)
Parameters
Type | Name | Description |
---|---|---|
ISocketClient | client | Socket client. |
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
See Also
| Improve this Doc View SourceWithSocketClient<TImplementation>()
Sets the underlying socket client.
Declaration
public WolfClientBuilder WithSocketClient<TImplementation>()
where TImplementation : class, ISocketClient
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Type Parameters
Name | Description |
---|---|
TImplementation | Type of response type resolver. |
Remarks
TImplementation
must have a constructar that can be resolved from provided services.
See Also
| Improve this Doc View SourceWithToken(String)
Sets a specific token to use for connection.
Declaration
public WolfClientBuilder WithToken(string token)
Parameters
Type | Name | Description |
---|---|---|
String | token | Token value. |
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Remarks
Using this method disables IWolfTokenProvider set by using WithTokenProvider(IWolfTokenProvider) and WithDefaultTokenProvider().
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
See Also
| Improve this Doc View SourceWithTokenProvider(IWolfTokenProvider)
Sets token provider used to generate a token for connection.
Declaration
public WolfClientBuilder WithTokenProvider(IWolfTokenProvider provider)
Parameters
Type | Name | Description |
---|---|---|
IWolfTokenProvider | provider | Token provider. |
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Remarks
Using this method disables token set by using WithToken(String).
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
See Also
| Improve this Doc View SourceWithTokenProvider<TImplementation>()
Sets token provider used to generate a token for connection.
Declaration
public WolfClientBuilder WithTokenProvider<TImplementation>()
where TImplementation : class, IWolfTokenProvider
Returns
Type | Description |
---|---|
WolfClientBuilder | Current builder instance. |
Type Parameters
Name | Description |
---|---|
TImplementation | Type of token provider. |
Remarks
Using this method disables token set by using WithToken(String).
TImplementation
must have a constructar that can be resolved from provided services.
See Also
Events
| Improve this Doc View SourceBuilding
Invoked when the builder is about to build a new instance of WolfClient.
Declaration
public event Action<IServiceCollection> Building
Event Type
Type | Description |
---|---|
Action<IServiceCollection> |
Built
Invoked when the builder has finished building a new instance of WolfClient.
Declaration
public event Action<WolfClient, IServiceProvider> Built
Event Type
Type | Description |
---|---|
Action<WolfClient, IServiceProvider> |