/// <summary> /// Creates an instance of <see cref="FluentClient"/> with specified fluent <paramref name="builder"/>. /// </summary> /// <param name="builder">The fluent builder.</param> /// <returns>A new instance of <see cref="FluentClient"/>.</returns> /// <exception cref="ArgumentNullException"><paramref name="builder"/> is <see langword="null" />.</exception> public static FluentClient Create(Action <FluentClientBuilder> builder) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } var fluentClientBuilder = new FluentClientBuilder(); builder(fluentClientBuilder); var client = new FluentClient( fluentClientBuilder.ContentSerializer, fluentClientBuilder.MessageHandler, fluentClientBuilder.ShouldDisposeHandler, fluentClientBuilder.Interceptors); client.Defaults(fluentClientBuilder.DefaultRequest); return(client); }
/// <summary> /// Initializes a new instance of the <see cref="InterceptorResponseContext"/> class. /// </summary> /// <param name="client">The current <see cref="FluentClient"/> that called the interceptor.</param> /// <param name="httpResponse">The <see cref="HttpResponseMessage"/> received from the HTTP call.</param> public InterceptorResponseContext(FluentClient client, HttpResponseMessage httpResponse) { Client = client; HttpResponse = httpResponse; }
/// <summary> /// Initializes a new instance of the <see cref="InterceptorResponseContext" /> class. /// </summary> /// <param name="client">The current <see cref="FluentClient" /> that called the interceptor.</param> /// <param name="httpResponse">The <see cref="HttpResponseMessage" /> received from the HTTP call.</param> /// <param name="exception">The exception that occurred during the HTTP request.</param> public InterceptorResponseContext(FluentClient client, HttpResponseMessage httpResponse, Exception exception) { Client = client; HttpResponse = httpResponse; Exception = exception; }
/// <summary> /// Initializes a new instance of the <see cref="InterceptorRequestContext"/> class. /// </summary> /// <param name="client">The current <see cref="FluentClient"/>.</param> /// <param name="request">The <see cref="FluentRequest"/> used to build the current request.</param> public InterceptorRequestContext(FluentClient client, FluentRequest request) { Client = client; Request = request; }