/// <summary>
        /// Get members Get array of members satisfied search criteria.
        /// </summary>
        /// <exception cref="VirtoCommerce.Client.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="criteria">concrete instance of SearchCriteria type type will be created by using PolymorphicMemberSearchCriteriaJsonConverter</param>
        /// <returns>Task of VirtoCommerceDomainCustomerModelMembersSearchResult</returns>
        public async System.Threading.Tasks.Task<VirtoCommerceDomainCustomerModelMembersSearchResult> CustomerModuleSearchAsync (VirtoCommerceDomainCustomerModelMembersSearchCriteria criteria)
        {
             ApiResponse<VirtoCommerceDomainCustomerModelMembersSearchResult> localVarResponse = await CustomerModuleSearchAsyncWithHttpInfo(criteria);
             return localVarResponse.Data;

        }
        /// <summary>
        /// Get members Get array of members satisfied search criteria.
        /// </summary>
        /// <exception cref="VirtoCommerce.Client.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="criteria">concrete instance of SearchCriteria type type will be created by using PolymorphicMemberSearchCriteriaJsonConverter</param>
        /// <returns>Task of ApiResponse (VirtoCommerceDomainCustomerModelMembersSearchResult)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<VirtoCommerceDomainCustomerModelMembersSearchResult>> CustomerModuleSearchAsyncWithHttpInfo (VirtoCommerceDomainCustomerModelMembersSearchCriteria criteria)
        {
            // verify the required parameter 'criteria' is set
            if (criteria == null)
                throw new ApiException(400, "Missing required parameter 'criteria' when calling CustomerManagementModuleApi->CustomerModuleSearch");

            var localVarPath = "/api/members/search";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new Dictionary<String, String>();
            var localVarHeaderParams = new Dictionary<String, String>(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", 
                "text/json", 
                "application/xml", 
                "text/xml", 
                "application/x-www-form-urlencoded"
            };
            String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json", 
                "text/json", 
                "application/xml", 
                "text/xml"
            };
            String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            // set "format" to json by default
            // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
            localVarPathParams.Add("format", "json");
            if (criteria.GetType() != typeof(byte[]))
            {
                localVarPostBody = Configuration.ApiClient.Serialize(criteria); // http body (model) parameter
            }
            else
            {
                localVarPostBody = criteria; // byte array
            }


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

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (localVarStatusCode >= 400 && (localVarStatusCode != 404 || Configuration.ThrowExceptionWhenStatusCodeIs404))
                throw new ApiException (localVarStatusCode, "Error calling CustomerModuleSearch: " + localVarResponse.Content, localVarResponse.Content);
            else if (localVarStatusCode == 0)
                throw new ApiException (localVarStatusCode, "Error calling CustomerModuleSearch: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage);

            return new ApiResponse<VirtoCommerceDomainCustomerModelMembersSearchResult>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (VirtoCommerceDomainCustomerModelMembersSearchResult) Configuration.ApiClient.Deserialize(localVarResponse, typeof(VirtoCommerceDomainCustomerModelMembersSearchResult)));
            
        }
 /// <summary>
 /// Get members Get array of members satisfied search criteria.
 /// </summary>
 /// <exception cref="VirtoCommerce.Client.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="criteria">concrete instance of SearchCriteria type type will be created by using PolymorphicMemberSearchCriteriaJsonConverter</param>
 /// <returns>VirtoCommerceDomainCustomerModelMembersSearchResult</returns>
 public VirtoCommerceDomainCustomerModelMembersSearchResult CustomerModuleSearch (VirtoCommerceDomainCustomerModelMembersSearchCriteria criteria)
 {
      ApiResponse<VirtoCommerceDomainCustomerModelMembersSearchResult> localVarResponse = CustomerModuleSearchWithHttpInfo(criteria);
      return localVarResponse.Data;
 }