/// <summary> /// Creates a new item for an specific connector /// </summary> /// <param name="request">The item parameters</param> /// <returns>an object with the info to retrieve the data when the execution is ready</returns> public async Task <Item> CreateItem(ItemParameters request) { try { return(await httpService.PostAsync <Item>(URL_ITEMS, request.ToBody())); } catch (ApiException e) { if (e.ApiError != null && e.ApiError.Errors != null) { throw new ValidationException(e.StatusCode, e.ApiError); } throw e; } }
/// <summary> /// Update an item connection with/without credentials forcing a sync /// </summary> /// <param name="id">Item id</param> /// <returns>An item object with the status of the connection</returns> public async Task <Item> UpdateItem(Guid id, ItemParameters request) { try { return(await httpService.PatchAsync <Item>(URL_ITEMS + "/{id}", request.ToBody(), null, HTTP.Utils.GetSegment(id.ToString()))); } catch (ApiException e) { if (e.ApiError != null && e.ApiError.Errors != null) { throw new ValidationException(e.StatusCode, e.ApiError); } throw e; } }