コード例 #1
0
        /// <summary>
        /// Retrieves one or more profiles with associated settings and configurable items
        /// </summary>
        /// <exception cref="avalara.comms.rest.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="requestedClientId">Client id associated with profile(s) to be fetched  Null value will use client id submitting the request or default client id as applicable. (optional)</param>
        /// <param name="requestedProfileId">Configuration profile id to be fetched  Use 0 to indicate all profiles  Null value will use profile id from request or 0 if not set. (optional)</param>
        /// <param name="itemType">Item Type  Examples:    Configuration, Bundle, Exclusion, Override, All (optional)</param>
        /// <returns>Task of ApiResponse (TaxCalculationSettingsResponse)</returns>
        public async System.Threading.Tasks.Task <avalara.comms.rest.v2.Client.ApiResponse <TaxCalculationSettingsResponse> > ApiV2ProfilesGetProfilesGetAsyncWithHttpInfo(int?requestedClientId = default(int?), int?requestedProfileId = default(int?), TaxCalculationSettingTypes itemType = default(TaxCalculationSettingTypes))
        {
            avalara.comms.rest.v2.Client.RequestOptions localVarRequestOptions = new avalara.comms.rest.v2.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "text/plain",
                "application/json",
                "text/json"
            };

            foreach (var _contentType in _contentTypes)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", _contentType);
            }

            foreach (var _accept in _accepts)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", _accept);
            }

            if (requestedClientId != null)
            {
                foreach (var _kvp in avalara.comms.rest.v2.Client.ClientUtils.ParameterToMultiMap("", "RequestedClientId", requestedClientId))
                {
                    foreach (var _kvpValue in _kvp.Value)
                    {
                        localVarRequestOptions.QueryParameters.Add(_kvp.Key, _kvpValue);
                    }
                }
            }
            if (requestedProfileId != null)
            {
                foreach (var _kvp in avalara.comms.rest.v2.Client.ClientUtils.ParameterToMultiMap("", "RequestedProfileId", requestedProfileId))
                {
                    foreach (var _kvpValue in _kvp.Value)
                    {
                        localVarRequestOptions.QueryParameters.Add(_kvp.Key, _kvpValue);
                    }
                }
            }
            if (itemType != null)
            {
                foreach (var _kvp in avalara.comms.rest.v2.Client.ClientUtils.ParameterToMultiMap("", "ItemType", itemType))
                {
                    foreach (var _kvpValue in _kvp.Value)
                    {
                        localVarRequestOptions.QueryParameters.Add(_kvp.Key, _kvpValue);
                    }
                }
            }

            // authentication (Basic) required
            // http basic authentication required
            if (!String.IsNullOrEmpty(this.Configuration.Username) || !String.IsNullOrEmpty(this.Configuration.Password))
            {
                localVarRequestOptions.HeaderParameters.Add("Authorization", "Basic " + avalara.comms.rest.v2.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password));
            }

            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.GetAsync <TaxCalculationSettingsResponse>("/api/v2/profiles/GetProfiles", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("ApiV2ProfilesGetProfilesGet", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
コード例 #2
0
 /// <summary>
 /// Retrieves one or more profiles with associated settings and configurable items
 /// </summary>
 /// <exception cref="avalara.comms.rest.v2.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="requestedClientId">Client id associated with profile(s) to be fetched  Null value will use client id submitting the request or default client id as applicable. (optional)</param>
 /// <param name="requestedProfileId">Configuration profile id to be fetched  Use 0 to indicate all profiles  Null value will use profile id from request or 0 if not set. (optional)</param>
 /// <param name="itemType">Item Type  Examples:    Configuration, Bundle, Exclusion, Override, All (optional)</param>
 /// <returns>TaxCalculationSettingsResponse</returns>
 public TaxCalculationSettingsResponse ApiV2ProfilesGetProfilesGet(int?requestedClientId = default(int?), int?requestedProfileId = default(int?), TaxCalculationSettingTypes itemType = default(TaxCalculationSettingTypes))
 {
     avalara.comms.rest.v2.Client.ApiResponse <TaxCalculationSettingsResponse> localVarResponse = ApiV2ProfilesGetProfilesGetWithHttpInfo(requestedClientId, requestedProfileId, itemType);
     return(localVarResponse.Data);
 }
コード例 #3
0
        /// <summary>
        /// Retrieves one or more profiles with associated settings and configurable items
        /// </summary>
        /// <exception cref="avalara.comms.rest.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="requestedClientId">Client id associated with profile(s) to be fetched  Null value will use client id submitting the request or default client id as applicable. (optional)</param>
        /// <param name="requestedProfileId">Configuration profile id to be fetched  Use 0 to indicate all profiles  Null value will use profile id from request or 0 if not set. (optional)</param>
        /// <param name="itemType">Item Type  Examples:    Configuration, Bundle, Exclusion, Override, All (optional)</param>
        /// <returns>Task of TaxCalculationSettingsResponse</returns>
        public async System.Threading.Tasks.Task <TaxCalculationSettingsResponse> ApiV2ProfilesGetProfilesGetAsync(int?requestedClientId = default(int?), int?requestedProfileId = default(int?), TaxCalculationSettingTypes itemType = default(TaxCalculationSettingTypes))
        {
            avalara.comms.rest.v2.Client.ApiResponse <TaxCalculationSettingsResponse> localVarResponse = await ApiV2ProfilesGetProfilesGetAsyncWithHttpInfo(requestedClientId, requestedProfileId, itemType);

            return(localVarResponse.Data);
        }
コード例 #4
0
        /// <summary>
        /// Retrieves one or more profiles with associated settings and configurable items
        /// </summary>
        /// <exception cref="avalara.comms.rest.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="requestedClientId">Client id associated with profile(s) to be fetched  Null value will use client id submitting the request or default client id as applicable. (optional)</param>
        /// <param name="requestedProfileId">Configuration profile id to be fetched  Use 0 to indicate all profiles  Null value will use profile id from request or 0 if not set. (optional)</param>
        /// <param name="itemType">Item Type  Examples:    Configuration, Bundle, Exclusion, Override, All (optional)</param>
        /// <returns>Task of ApiResponse (TaxCalculationSettingsResponse)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <TaxCalculationSettingsResponse> > ApiV2ProfilesGetProfilesGetAsyncWithHttpInfo(int?requestedClientId = default(int?), int?requestedProfileId = default(int?), TaxCalculationSettingTypes itemType = default(TaxCalculationSettingTypes))
        {
            var    localVarPath         = "/api/v2/profiles/GetProfiles";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new List <KeyValuePair <String, String> >();
            var    localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
            };
            String localVarHttpContentType    = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "text/plain",
                "application/json",
                "text/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (requestedClientId != null)
            {
                localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "RequestedClientId", requestedClientId));                            // query parameter
            }
            if (requestedProfileId != null)
            {
                localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "RequestedProfileId", requestedProfileId));                             // query parameter
            }
            if (itemType != null)
            {
                localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "ItemType", itemType));                   // query parameter
            }
            // authentication (Basic) required
            // http basic authentication required
            if (!String.IsNullOrEmpty(this.Configuration.Username) || !String.IsNullOrEmpty(this.Configuration.Password))
            {
                localVarHeaderParams["Authorization"] = "Basic " + ApiClient.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password);
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                            Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                            localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("ApiV2ProfilesGetProfilesGet", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <TaxCalculationSettingsResponse>(localVarStatusCode,
                                                                    localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
                                                                    (TaxCalculationSettingsResponse)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(TaxCalculationSettingsResponse))));
        }