Exemple #1
0
 public Task <TSubResource> PatchAsync <TSubResource>(TSubResource resource,
                                                      Action <TSubResource> patchAction,
                                                      Action <IRequestOptions <TSubResource> > options)
     where TSubResource : class, TResource
 {
     return(Client.PatchAsync(resource, patchAction, options));
 }
        internal static async Task <T> PatchAsync <T>(this IPomonaClient client,
                                                      T target,
                                                      Action <T> updateAction,
                                                      Action <IRequestOptions <T> > options = null)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }
            var patchForm = (T)client.TypeMapper.CreatePatchForm(typeof(T), target);

            updateAction(patchForm);

            var requestOptions = new RequestOptions <T>();

            options?.Invoke(requestOptions);

            return((T)await client.PatchAsync(patchForm, requestOptions));
        }