public Item CreateItem(Item item) { var request = new RestRequest("/items", Method.POST); request.AddParameter("id", item.Id); request.AddParameter("name", item.Name); request.AddParameter("amount", item.Amount); request.AddParameter("payment_type", (int)item.PaymentType); request.AddParameter("buyer_id", item.BuyerId); request.AddParameter("seller_id", item.SellerId); request.AddParameter("fee_ids", item.FeeIds); request.AddParameter("description", item.Description); var response = SendRequest(Client, request); return JsonConvert.DeserializeObject<IDictionary<string, Item>>(response.Content).Values.First(); }
public Item UpdateItem(Item item) { var client = GetRestClient(); var request = new RestRequest("/items/{id}", Method.PATCH); request.AddUrlSegment("id", item.Id); request.AddParameter("amount", item.Amount); request.AddParameter("name", item.Name); request.AddParameter("description", item.Description); request.AddParameter("buyer_id", item.BuyerId); request.AddParameter("seller_id", item.SellerId); request.AddParameter("fee_ids", item.FeeIds); var response = SendRequest(client, request); return JsonConvert.DeserializeObject<IDictionary<string, Item>>(response.Content).Values.First(); }