Ejemplo n.º 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;
        }
Ejemplo n.º 3
0
        public static ApiClientContext Create(Action <ApiClientConfigurationExpression> action)
        {
            var apiClientContext        = new ApiClientContext();
            var configurationExpression = new ApiClientConfigurationExpression(apiClientContext);

            action(configurationExpression);

            return(apiClientContext);
        }
Ejemplo n.º 4
0
        internal ApiClientConfigurationExpression(ApiClientContext apiClientContext)
        {
            if (apiClientContext == null)
            {
                throw new ArgumentNullException("apiClientContext");
            }

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