Example #1
0
        public Task <Pickup> CreatePickupAsync(Carrier carrier, PickupWindow pickupWindow)
        {
            Requires.ArgumentNotNull(carrier, nameof(carrier));
            Requires.ArgumentNotNull(pickupWindow, nameof(pickupWindow));

            return(_halClient.PostAsync <Pickup>(carrier.CreatePickupLink, pickupWindow));
        }
Example #2
0
        public async Task <ETicketUploads> UploadETicketsAsync(
            Sale sale,
            string fileName,
            byte[] fileBytes,
            string contentType,
            ETicketUploadRequest request,
            CancellationToken cancellationToken)
        {
            Requires.ArgumentNotNull(sale, nameof(sale));
            Requires.ArgumentNotNullOrEmpty(fileName, nameof(fileName));
            Requires.ArgumentNotNull(fileBytes, nameof(fileBytes));
            Requires.ArgumentNotNull(contentType, nameof(contentType));

            var multipartContent = new MultipartFormDataContent($"---GogoKitBoundary{Guid.NewGuid()}");
            var fileContent      = new StreamContent(new MemoryStream(fileBytes));

            fileContent.Headers.ContentType = new MediaTypeHeaderValue(contentType);
            multipartContent.Add(fileContent, "file", fileName);

            var uploadETicketsLink = await _linkFactory.CreateLinkAsync($"sales/{sale.Id}/eticketuploads").ConfigureAwait(_halClient);

            return(await _halClient.PostAsync <ETicketUploads>(
                       uploadETicketsLink,
                       multipartContent,
                       request,
                       cancellationToken).ConfigureAwait(_halClient));
        }
Example #3
0
        private async Task <PaymentMethod> CreatePaymentMethodAsync(
            NewPaymentMethod paymentMethod,
            Func <PaymentMethods, Link> getLinkFunc)
        {
            var paymentMethodsPage = await GetAsync(new PaymentMethodRequest { PageSize = 1 }).ConfigureAwait(_halClient);

            return(await _halClient.PostAsync <PaymentMethod>(getLinkFunc(paymentMethodsPage),
                                                              paymentMethod).ConfigureAwait(_halClient));
        }
Example #4
0
        public async Task <Address> CreateAsync(NewAddress address)
        {
            Requires.ArgumentNotNull(address, nameof(address));

            var addresses = await GetAsync(new AddressRequest { PageSize = 1 }).ConfigureAwait(_halClient);

            return(await _halClient.PostAsync <Address>(addresses.CreateAddressLink, address)
                   .ConfigureAwait(_halClient));
        }
Example #5
0
        public Task <ETicketUploads> UploadETicketsAsync(
            Sale sale,
            string fileName,
            byte[] pdfFileBytes,
            ETicketUploadRequest request,
            CancellationToken cancellationToken)
        {
            Requires.ArgumentNotNull(sale, nameof(sale));
            Requires.ArgumentNotNull(sale.UploadETicketsLink, nameof(sale.UploadETicketsLink));
            Requires.ArgumentNotNullOrEmpty(fileName, nameof(fileName));
            Requires.ArgumentNotNull(pdfFileBytes, nameof(pdfFileBytes));

            var multipartContent = new MultipartFormDataContent($"---GogoKitBoundary{Guid.NewGuid()}");
            var fileContent      = new StreamContent(new MemoryStream(pdfFileBytes));

            fileContent.Headers.ContentType = new MediaTypeHeaderValue("application/pdf");
            multipartContent.Add(fileContent, "file", fileName);

            return(_halClient.PostAsync <ETicketUploads>(
                       sale.UploadETicketsLink,
                       multipartContent,
                       request,
                       cancellationToken));
        }
Example #6
0
        public async Task <Webhook> CreateAsync(NewWebhook webhook, WebhookRequest request)
        {
            var createLink = await _linkFactory.CreateLinkAsync("webhooks").ConfigureAwait(_halClient);

            return(await _halClient.PostAsync <Webhook>(createLink, webhook, request).ConfigureAwait(_halClient));
        }
Example #7
0
        public async Task <SellerListingPreview> CreateSellerListingPreviewAsync(int eventId, NewSellerListing listing)
        {
            var previewLink = await _linkFactory.CreateLinkAsync($"events/{eventId}/sellerlistingpreview").ConfigureAwait(_halClient);

            return(await _halClient.PostAsync <SellerListingPreview>(previewLink, listing).ConfigureAwait(_halClient));
        }
Example #8
0
 public Task <PurchasePreview> CreatePurchasePreviewAsync(Listing listing, NewPurchasePreview preview)
 {
     return(_halClient.PostAsync <PurchasePreview>(
                listing.PurchasePreviewLink,
                preview));
 }