// general /// <summary>Sets login credentials.</summary> /// <param name="builder">Hosted WOLF Client Service builder.</param> /// <param name="login">Login.</param> /// <param name="password">Password.</param> /// <param name="loginType">Login Type.</param> /// <seealso cref="HostedWolfClientOptions.LoginUsername"/> /// <seealso cref="HostedWolfClientOptions.LoginPassword"/> /// <seealso cref="HostedWolfClientOptions.LoginType"/> public static IHostedWolfClientServiceBuilder SetCredentials(this IHostedWolfClientServiceBuilder builder, string login, string password, WolfLoginType loginType = WolfLoginType.Email) => builder.Configure(options => { options.LoginUsername = login; options.LoginPassword = password; options.LoginType = loginType; });
// response serializers /// <summary>Sets fallback response serializer in Message Response Provider.</summary> /// <param name="builder">Hosted WOLF Client Service builder.</param> /// <param name="serializer">Response serializer to fall back to.</param> /// <seealso cref="ResponseSerializerProvider"/> /// <seealso cref="ISerializerProvider{TKey, TSerializer}"/> /// <seealso cref="IResponseSerializer"/> /// <seealso cref="ResponseSerializerProviderOptions.FallbackSerializer"/> public static IHostedWolfClientServiceBuilder SetFallbackResponseSerializer(this IHostedWolfClientServiceBuilder builder, IResponseSerializer serializer) { if (serializer == null) { throw new ArgumentNullException(nameof(serializer)); } return(builder.ConfigureResponseSerializerProvider(options => options.FallbackSerializer = serializer)); }
/// <summary>Disables auto-reconnect behaviour.</summary> /// <param name="builder">Hosted WOLF Client Service builder.</param> /// <seealso cref="HostedWolfClientOptions.AutoReconnectAttempts"/> public static IHostedWolfClientServiceBuilder DisableAutoReconnect(this IHostedWolfClientServiceBuilder builder) => SetAutoReconnectAttempts(builder, 0);
/// <summary>Sets infinite auto-reconnect attempts.</summary> /// <param name="builder">Hosted WOLF Client Service builder.</param> /// <seealso cref="HostedWolfClientOptions.AutoReconnectAttempts"/> public static IHostedWolfClientServiceBuilder SetInfiniteAutoReconnectAttempts(this IHostedWolfClientServiceBuilder builder) => SetAutoReconnectAttempts(builder, -1);
/// <summary>Sets max auto-reconnect attempts.</summary> /// <param name="builder">Hosted WOLF Client Service builder.</param> /// <param name="attempts">Max reconnect attempts. 0 to disable. Negative values to infinite.</param> /// <seealso cref="HostedWolfClientOptions.AutoReconnectAttempts"/> public static IHostedWolfClientServiceBuilder SetAutoReconnectAttempts(this IHostedWolfClientServiceBuilder builder, int attempts) => builder.Configure(options => options.AutoReconnectAttempts = attempts);
/// <summary>Sets delay between auto-reconnect attempts.</summary> /// <param name="builder">Hosted WOLF Client Service builder.</param> /// <param name="delay">Delay between autoreconnect attempts.</param> /// <seealso cref="HostedWolfClientOptions.AutoReconnectDelay"/> public static IHostedWolfClientServiceBuilder SetAutoReconnectDelay(this IHostedWolfClientServiceBuilder builder, TimeSpan delay) => builder.Configure(options => options.AutoReconnectDelay = delay);
/// <summary>Sets auto-reconnect behaviour.</summary> /// <param name="builder">Hosted WOLF Client Service builder.</param> /// <param name="attempts">Max reconnect attempts. 0 to disable. Negative values to infinite.</param> /// <param name="delay">Delay between autoreconnect attempts.</param> /// <seealso cref="HostedWolfClientOptions.AutoReconnectAttempts"/> /// <seealso cref="HostedWolfClientOptions.AutoReconnectDelay"/> public static IHostedWolfClientServiceBuilder SetAutoReconnect(this IHostedWolfClientServiceBuilder builder, int attempts, TimeSpan delay) => builder.SetAutoReconnectDelay(delay).SetAutoReconnectAttempts(attempts);
/// <summary>Maps a response serializer in Message Response Provider.</summary> /// <param name="builder">Hosted WOLF Client Service builder.</param> /// <param name="responseType">Type of response message.</param> /// <param name="serializer">Serializer to serialize and deserialize with.</param> /// <seealso cref="ResponseSerializerProvider"/> /// <seealso cref="ISerializerProvider{TKey, TSerializer}"/> /// <seealso cref="IResponseSerializer"/> /// <seealso cref="ResponseSerializerProviderOptions.Serializers"/> public static IHostedWolfClientServiceBuilder MapResponseSerializer(this IHostedWolfClientServiceBuilder builder, Type responseType, IResponseSerializer serializer) => builder.ConfigureResponseSerializerProvider(options => options.Serializers[responseType] = serializer);
/// <summary>Maps a message serializer in Message Serializer Provider.</summary> /// <param name="builder">Hosted WOLF Client Service builder.</param> /// <param name="eventName">Name of WOLF protocol event. <see cref="MessageEventNames"/> for known constants.</param> /// <param name="serializer">Serializer to serialize and deserialize with.</param> /// <seealso cref="MessageSerializerProvider"/> /// <seealso cref="ISerializerProvider{TKey, TSerializer}"/> /// <seealso cref="IMessageSerializer"/> /// <seealso cref="MessageSerializerProviderOptions.Serializers"/> public static IHostedWolfClientServiceBuilder MapMessageSerializer(this IHostedWolfClientServiceBuilder builder, string eventName, IMessageSerializer serializer) => builder.ConfigureMessageSerializerProvider(options => options.Serializers[eventName] = serializer);
/// <summary>Sets server URL to Release Candidate server.</summary> /// <param name="builder">Hosted WOLF Client Service builder.</param> /// <seealso cref="HostedWolfClientOptions.ServerURL"/> /// <seealso cref="WolfClient.BetaServerURL"/> public static IHostedWolfClientServiceBuilder SetBetaServerURL(this IHostedWolfClientServiceBuilder builder) => SetServerURL(builder, WolfClient.BetaServerURL);
/// <summary>Sets server URL to connect to.</summary> /// <param name="builder">Hosted WOLF Client Service builder.</param> /// <param name="url">URL of WOLF servers.</param> /// <seealso cref="HostedWolfClientOptions.ServerURL"/> public static IHostedWolfClientServiceBuilder SetServerURL(this IHostedWolfClientServiceBuilder builder, string url) => builder.Configure(options => options.ServerURL = url);