示例#1
0
        /// <summary>
        /// Sends a PATCH request using specified fluent builder as an asynchronous operation.
        /// </summary>
        /// <typeparam name="TResponse">The type of the response.</typeparam>
        /// <param name="fluentClient">The <see cref="IFluentClient"/> used to send request.</param>
        /// <param name="builder">The fluent builder factory.</param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="fluentClient" /> or <paramref name="builder" /> is <see langword="null" />.</exception>
        public static async Task <TResponse> PatchAsync <TResponse>(this IFluentClient fluentClient, Action <FormBuilder> builder)
        {
            if (fluentClient == null)
            {
                throw new ArgumentNullException(nameof(fluentClient));
            }

            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            var response = await fluentClient.PatchAsync(builder).ConfigureAwait(false);

            var data = await response.DeserializeAsync <TResponse>().ConfigureAwait(false);

            return(data);
        }