Пример #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));
 }
Пример #2
0
        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));
        }