Exemplo n.º 1
0
        /// <summary>
        /// Creates a new instance of the CoolRunnerClient
        /// </summary>
        /// <param name="apiEmail"></param>
        /// <param name="apiToken"></param>
        /// <param name="developerId">The value could be your company name or name of the integration, and maybe even include a version number</param>
        public CoolRunnerClient(string apiEmail, string apiToken, string developerId)
        {
            _url        = "https://api.coolrunner.dk/";
            _apiEmail   = apiEmail;
            _apiToken   = apiToken;
            _httpClient = BuildHttpClient(_url, $"{_apiEmail}:{_apiToken}", developerId, null);

            FreightRates = new FreightRatesClient(_httpClient);
            Shipments    = new ShipmentsClient(_httpClient);
            InventNord   = new InventNordClient(_httpClient);
        }
Exemplo n.º 2
0
        public ViagogoClient(
            ProductHeaderValue product,
            IGogoKitConfiguration configuration,
            IOAuth2TokenStore tokenStore,
            IJsonSerializer serializer,
            IHttpConnection oauthConnection,
            IHttpConnection apiConnection)
        {
            Requires.ArgumentNotNull(product, nameof(product));
            Requires.ArgumentNotNull(configuration, nameof(configuration));
            Requires.ArgumentNotNull(tokenStore, nameof(tokenStore));
            Requires.ArgumentNotNull(serializer, nameof(serializer));
            Requires.ArgumentNotNull(oauthConnection, nameof(oauthConnection));
            Requires.ArgumentNotNull(apiConnection, nameof(apiConnection));

            var halKitConfiguration = new HalKitConfiguration(configuration.ViagogoApiRootEndpoint)
            {
                CaptureSynchronizationContext = configuration.CaptureSynchronizationContext
            };

            Configuration = configuration;
            TokenStore    = tokenStore;
            Hypermedia    = new HalClient(halKitConfiguration, apiConnection);
            var linkFactory = new LinkFactory(configuration);

            OAuth2         = new OAuth2Client(oauthConnection, configuration);
            User           = new UserClient(Hypermedia);
            Search         = new SearchClient(Hypermedia);
            Addresses      = new AddressesClient(User, Hypermedia, linkFactory);
            Purchases      = new PurchasesClient(User, Hypermedia, linkFactory);
            Sales          = new SalesClient(Hypermedia, linkFactory);
            Shipments      = new ShipmentsClient(Hypermedia, linkFactory);
            PaymentMethods = new PaymentMethodsClient(User, Hypermedia, linkFactory);
            Countries      = new CountriesClient(Hypermedia, linkFactory);
            Currencies     = new CurrenciesClient(Hypermedia, linkFactory);
            Categories     = new CategoriesClient(Hypermedia, linkFactory);
            Events         = new EventsClient(Hypermedia);
            Listings       = new ListingsClient(Hypermedia);
            Venues         = new VenuesClient(Hypermedia);
            SellerListings = new SellerListingsClient(Hypermedia, linkFactory);
            Webhooks       = new WebhooksClient(Hypermedia, linkFactory);

            BatchClient = new BatchClient(apiConnection,
                                          new ApiResponseFactory(serializer, halKitConfiguration),
                                          serializer,
                                          new LinkResolver());
        }