Exemple #1
0
        /// <summary>
        /// Execute PUT request for object
        /// </summary>
        /// <param name="id">Posted object id</param>
        /// <param name="data">Type to put</param>
        public void Put(string id, IDataGeneratable data)
        {
            RestClientService.RestClient.Put($"{UrlResolver.GetUrl(data)}/{id}", data);
            ObjectToPostId objectCreated = new ObjectToPostId(data, id);

            RequestHelper.HandleTheResponse("PUT");
            Storage.UpdateItem(data.GetType(), objectCreated);
        }
Exemple #2
0
        /// <summary>
        /// Execute POST request for object
        /// </summary>
        /// <param name="data">Type to post</param>
        public void Post(IDataGeneratable data)
        {
            RestClientService.RestClient.Post(UrlResolver.GetUrl(data), data);
            ObjectToPostId objectCreated = new ObjectToPostId(data, RestClientService.RestClient.PostResponseId);

            RequestHelper.HandleTheResponse("POST");
            Storage.SaveItem(data.GetType(), objectCreated);
        }
Exemple #3
0
 /// <summary>
 /// Execute DELETE request for type
 /// </summary>
 /// <param name="id">Id or Id with additional url</param>
 /// <param name="data">Created object</param>
 public void Delete(string id, IDataGeneratable data)
 {
     if (id.StartsWith("/"))
     {
         id = id.Remove(0, 1);
     }
     RestClientService.RestClient.Delete($"{UrlResolver.GetUrl(data)}/{id}");
     RequestHelper.HandleTheResponse("DELETE");
 }