public async Task<string> BookDeliveryAsync(DeliveryPoint sender, DeliveryPoint recipient) { var booking = BookingTranslator.BuildBooking(sender, recipient); var merchantDeliveryBooking = new MerchantDeliveryBooking() { apiKey = this.apiKey, booking = booking, }; return await swiftClient.SendBookingRequestAsync(merchantDeliveryBooking); }
public async Task<string> SendBookingRequestAsync(MerchantDeliveryBooking merchantDeliveryBooking) { using (var client = new HttpClient()) { client.BaseAddress = new Uri(" https://app.getswift.co"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var result = await client.PostAsJsonAsync("api/v2/deliveries", merchantDeliveryBooking); var message = await result.Content.ReadAsStringAsync(); return message; } }