Пример #1
0
        public static ApiClientContext Create(Action<ApiClientConfigurationExpression> action) {

            var apiClientContext = new ApiClientContext();
            var configurationExpression = new ApiClientConfigurationExpression(apiClientContext);

            action(configurationExpression);

            return apiClientContext;
        }
        internal ApiClientConfigurationExpression(ApiClientContext apiClientContext) {

            if (apiClientContext == null) {

                throw new ArgumentNullException("apiClientContext");
            }

            _apiClientContext = apiClientContext;
        }
Пример #3
0
        public static ApiClientContext Create(Action <ApiClientConfigurationExpression> action)
        {
            var apiClientContext        = new ApiClientContext();
            var configurationExpression = new ApiClientConfigurationExpression(apiClientContext);

            action(configurationExpression);

            return(apiClientContext);
        }
Пример #4
0
        internal ApiClientConfigurationExpression(ApiClientContext apiClientContext)
        {
            if (apiClientContext == null)
            {
                throw new ArgumentNullException("apiClientContext");
            }

            _apiClientContext = apiClientContext;
        }
Пример #5
0
 internal static TClient GetClient <TClient>(this ApiClientContext apiClientContext, Func <TClient> valueFactory)
 {
     return((TClient)apiClientContext.Clients.GetOrAdd(typeof(TClient), k => valueFactory()));
 }
Пример #6
0
 public static IShipmentTypesClient GetShipmentTypesClient(this ApiClientContext apiClientContext)
 {
     return(apiClientContext.GetClient <IShipmentTypesClient>(() => new ShipmentTypesClient(apiClientContext.HttpClient)));
 }
Пример #7
0
 public static IShipmentsClient GetShipmentsClient(this ApiClientContext apiClientContext)
 {
     return(apiClientContext.GetClient <IShipmentsClient>(() => new ShipmentsClient(apiClientContext.HttpClient, apiClientContext.AffiliateKey)));
 }