/// <summary>
        /// Retrieve clicks Retrieves a group of clicks from the account based on a query object.  If no parameters are specified, the API call will fail with a bad request error.  Always specify some parameters to limit the scope of the clicks returned to ones you are truly interested in.  You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="clickQuery">Click query</param>
        /// <param name="limit">The maximum number of records to return on this one API call. (Maximum 10000) (optional, default to 10000)</param>
        /// <param name="offset">Pagination of the record set.  Offset is a zero based index. (optional, default to 0)</param>
        /// <param name="expand">The object expansion to perform on the result.  Only option is link. (optional)</param>
        /// <returns>Task of AffiliateClicksResponse</returns>
        public async System.Threading.Tasks.Task <AffiliateClicksResponse> GetClicksByQueryAsync(AffiliateClickQuery clickQuery, int?limit = null, int?offset = null, string expand = null)
        {
            ApiResponse <AffiliateClicksResponse> localVarResponse = await GetClicksByQueryAsyncWithHttpInfo(clickQuery, limit, offset, expand);

            return(localVarResponse.Data);
        }
        /// <summary>
        /// Retrieve clicks Retrieves a group of clicks from the account based on a query object.  If no parameters are specified, the API call will fail with a bad request error.  Always specify some parameters to limit the scope of the clicks returned to ones you are truly interested in.  You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="clickQuery">Click query</param>
        /// <param name="limit">The maximum number of records to return on this one API call. (Maximum 10000) (optional, default to 10000)</param>
        /// <param name="offset">Pagination of the record set.  Offset is a zero based index. (optional, default to 0)</param>
        /// <param name="expand">The object expansion to perform on the result.  Only option is link. (optional)</param>
        /// <returns>Task of ApiResponse (AffiliateClicksResponse)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <AffiliateClicksResponse> > GetClicksByQueryAsyncWithHttpInfo(AffiliateClickQuery clickQuery, int?limit = null, int?offset = null, string expand = null)
        {
            // verify the required parameter 'clickQuery' is set
            if (clickQuery == null)
            {
                throw new ApiException(400, "Missing required parameter 'clickQuery' when calling AffiliateApi->GetClicksByQuery");
            }

            var    localVarPath         = "/affiliate/clicks/query";
            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[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

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

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

            if (limit != null)
            {
                localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_limit", limit));                // query parameter
            }
            if (offset != null)
            {
                localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_offset", offset));                 // query parameter
            }
            if (expand != null)
            {
                localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand));                 // query parameter
            }
            if (clickQuery != null && clickQuery.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(clickQuery); // http body (model) parameter
            }
            else
            {
                localVarPostBody = clickQuery; // byte array
            }

            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

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

            int localVarStatusCode = (int)localVarResponse.StatusCode;

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

            return(new ApiResponse <AffiliateClicksResponse>(localVarStatusCode,
                                                             localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                             (AffiliateClicksResponse)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(AffiliateClicksResponse))));
        }
        /// <summary>
        /// Retrieve clicks Retrieves a group of clicks from the account based on a query object.  If no parameters are specified, the API call will fail with a bad request error.  Always specify some parameters to limit the scope of the clicks returned to ones you are truly interested in.  You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="clickQuery">Click query</param>
        /// <param name="limit">The maximum number of records to return on this one API call. (Maximum 10000) (optional, default to 10000)</param>
        /// <param name="offset">Pagination of the record set.  Offset is a zero based index. (optional, default to 0)</param>
        /// <param name="expand">The object expansion to perform on the result.  Only option is link. (optional)</param>
        /// <returns>AffiliateClicksResponse</returns>
        public AffiliateClicksResponse GetClicksByQuery(AffiliateClickQuery clickQuery, int?limit = null, int?offset = null, string expand = null)
        {
            ApiResponse <AffiliateClicksResponse> localVarResponse = GetClicksByQueryWithHttpInfo(clickQuery, limit, offset, expand);

            return(localVarResponse.Data);
        }