/// <summary> /// Creates a new <see cref="FulfillmentServiceEntity"/>. /// </summary> /// <param name="fulfillmentServiceEntity">A new <see cref="FulfillmentServiceEntity"/>. Id should be set to null.</param> /// has been created.</param> /// <returns>The new <see cref="FulfillmentServiceEntity"/>.</returns> public virtual async Task <FulfillmentServiceEntity> CreateAsync(FulfillmentServiceEntity fulfillmentServiceEntity) { var req = PrepareRequest($"fulfillment_services.json"); var body = fulfillmentServiceEntity.ToDictionary(); var content = new JsonContent(new { fulfillment_service = body }); return(await ExecuteRequestAsync <FulfillmentServiceEntity>(req, HttpMethod.Post, content, "fulfillment_service")); }
/// <summary> /// Creates a new <see cref="FulfillmentServiceEntity"/>. /// </summary> /// <param name="fulfillmentServiceEntity">A new <see cref="FulfillmentServiceEntity"/>. Id should be set to null.</param> /// <param name="cancellationToken">Cancellation Token</param> /// has been created.</param> /// <returns>The new <see cref="FulfillmentServiceEntity"/>.</returns> public virtual async Task <FulfillmentServiceEntity> CreateAsync(FulfillmentServiceEntity fulfillmentServiceEntity, CancellationToken cancellationToken = default) { var req = PrepareRequest($"fulfillment_services.json"); var body = fulfillmentServiceEntity.ToDictionary(); var content = new JsonContent(new { fulfillment_service = body }); var response = await ExecuteRequestAsync <FulfillmentServiceEntity>(req, HttpMethod.Post, cancellationToken, content, "fulfillment_service"); return(response.Result); }
/// <summary> /// Updates the given <see cref="FulfillmentServiceEntity"/>. /// </summary> /// <param name="fulfillmentServiceId">Id of the fulfillment service being updated.</param> /// <param name="fulfillmentServiceEntity">The <see cref="FulfillmentServiceEntity"/> to update.</param> /// <returns>The updated <see cref="FulfillmentServiceEntity"/>.</returns> public virtual async Task <FulfillmentServiceEntity> UpdateAsync(long fulfillmentServiceId, FulfillmentServiceEntity fulfillmentServiceEntity) { var req = PrepareRequest($"fulfillment_services/{fulfillmentServiceId}.json"); var body = fulfillmentServiceEntity.ToDictionary(); var content = new JsonContent(new { fulfillment_service = body }); var response = await ExecuteRequestAsync <FulfillmentServiceEntity>(req, HttpMethod.Put, content, "fulfillment_service"); return(response.Result); }