=begin
#Lists

#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

The version of the OpenAPI document: v3

Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.2.1

=end

require 'cgi'

module Hubspot
  module Crm
    module Lists
      class MembershipsApi
        attr_accessor :api_client

        def initialize(api_client = ApiClient.default)
          @api_client = api_client
        end
        # Add Records to a List
        # Add the records provided to the list. Records that do not exist or that are already members of the list are ignored.  This endpoint only works for lists that have a `processingType` of `MANUAL` or `SNAPSHOT`.
        # @param list_id [String] The **ILS ID** of the &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60; list.
        # @param request_body [Array<String>] 
        # @param [Hash] opts the optional parameters
        # @return [MembershipsUpdateResponse]
        def add(list_id, request_body, opts = {})
          data, _status_code, _headers = add_with_http_info(list_id, request_body, opts)
          data
        end

        # Add Records to a List
        # Add the records provided to the list. Records that do not exist or that are already members of the list are ignored.  This endpoint only works for lists that have a &#x60;processingType&#x60; of &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60;.
        # @param list_id [String] The **ILS ID** of the &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60; list.
        # @param request_body [Array<String>] 
        # @param [Hash] opts the optional parameters
        # @return [Array<(MembershipsUpdateResponse, Integer, Hash)>] MembershipsUpdateResponse data, response status code and response headers
        def add_with_http_info(list_id, request_body, opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: MembershipsApi.add ...'
          end
          # verify the required parameter 'list_id' is set
          if @api_client.config.client_side_validation && list_id.nil?
            fail ArgumentError, "Missing the required parameter 'list_id' when calling MembershipsApi.add"
          end
          # verify the required parameter 'request_body' is set
          if @api_client.config.client_side_validation && request_body.nil?
            fail ArgumentError, "Missing the required parameter 'request_body' when calling MembershipsApi.add"
          end
          # resource path
          local_var_path = '/crm/v3/lists/{listId}/memberships/add'.sub('{' + 'listId' + '}', CGI.escape(list_id.to_s))

          # query parameters
          query_params = opts[:query_params] || {}

          # header parameters
          header_params = opts[:header_params] || {}
          # HTTP header 'Accept' (if needed)
          header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])
          # HTTP header 'Content-Type'
          content_type = @api_client.select_header_content_type(['application/json'])
          if !content_type.nil?
              header_params['Content-Type'] = content_type
          end

          # form parameters
          form_params = opts[:form_params] || {}

          # http body (model)
          post_body = opts[:debug_body] || @api_client.object_to_http_body(request_body)

          # return_type
          return_type = opts[:debug_return_type] || 'MembershipsUpdateResponse'

          # auth_names
          auth_names = opts[:debug_auth_names] || ['oauth2']

          new_options = opts.merge(
            :operation => :"MembershipsApi.add",
            :header_params => header_params,
            :query_params => query_params,
            :form_params => form_params,
            :body => post_body,
            :auth_names => auth_names,
            :return_type => return_type
          )

          data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
          if @api_client.config.debugging
            @api_client.config.logger.debug "API called: MembershipsApi#add\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
          end
          return data, status_code, headers
        end

        # Add All Records from a Source List to a Destination List
        # Add all of the records from a *source list* (specified by the `sourceListId`) to a *destination list* (specified by the `listId`). Records that are already members of the *destination list* will be ignored. The *destination* and *source list* IDs must be different. The *destination* and *source lists* must contain records of the same type (e.g. contacts, companies, etc.).  This endpoint only works for *destination lists* that have a `processingType` of `MANUAL` or `SNAPSHOT`. The *source list* can have any `processingType`.  This endpoint only supports a `sourceListId` for lists with less than 100,000 memberships.
        # @param list_id [String] The **ILS ID** of the &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60; *destination list*, which the *source list* records are added to.
        # @param source_list_id [String] The **ILS ID** of the *source list* to grab the records from, which are then added to the *destination list*.
        # @param [Hash] opts the optional parameters
        # @return [nil]
        def add_all_from_list(list_id, source_list_id, opts = {})
          add_all_from_list_with_http_info(list_id, source_list_id, opts)
          nil
        end

        # Add All Records from a Source List to a Destination List
        # Add all of the records from a *source list* (specified by the &#x60;sourceListId&#x60;) to a *destination list* (specified by the &#x60;listId&#x60;). Records that are already members of the *destination list* will be ignored. The *destination* and *source list* IDs must be different. The *destination* and *source lists* must contain records of the same type (e.g. contacts, companies, etc.).  This endpoint only works for *destination lists* that have a &#x60;processingType&#x60; of &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60;. The *source list* can have any &#x60;processingType&#x60;.  This endpoint only supports a &#x60;sourceListId&#x60; for lists with less than 100,000 memberships.
        # @param list_id [String] The **ILS ID** of the &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60; *destination list*, which the *source list* records are added to.
        # @param source_list_id [String] The **ILS ID** of the *source list* to grab the records from, which are then added to the *destination list*.
        # @param [Hash] opts the optional parameters
        # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
        def add_all_from_list_with_http_info(list_id, source_list_id, opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: MembershipsApi.add_all_from_list ...'
          end
          # verify the required parameter 'list_id' is set
          if @api_client.config.client_side_validation && list_id.nil?
            fail ArgumentError, "Missing the required parameter 'list_id' when calling MembershipsApi.add_all_from_list"
          end
          # verify the required parameter 'source_list_id' is set
          if @api_client.config.client_side_validation && source_list_id.nil?
            fail ArgumentError, "Missing the required parameter 'source_list_id' when calling MembershipsApi.add_all_from_list"
          end
          # resource path
          local_var_path = '/crm/v3/lists/{listId}/memberships/add-from/{sourceListId}'.sub('{' + 'listId' + '}', CGI.escape(list_id.to_s)).sub('{' + 'sourceListId' + '}', CGI.escape(source_list_id.to_s))

          # query parameters
          query_params = opts[:query_params] || {}

          # header parameters
          header_params = opts[:header_params] || {}
          # HTTP header 'Accept' (if needed)
          header_params['Accept'] = @api_client.select_header_accept(['*/*'])

          # form parameters
          form_params = opts[:form_params] || {}

          # http body (model)
          post_body = opts[:debug_body]

          # return_type
          return_type = opts[:debug_return_type]

          # auth_names
          auth_names = opts[:debug_auth_names] || ['oauth2']

          new_options = opts.merge(
            :operation => :"MembershipsApi.add_all_from_list",
            :header_params => header_params,
            :query_params => query_params,
            :form_params => form_params,
            :body => post_body,
            :auth_names => auth_names,
            :return_type => return_type
          )

          data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
          if @api_client.config.debugging
            @api_client.config.logger.debug "API called: MembershipsApi#add_all_from_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
          end
          return data, status_code, headers
        end

        # Add and/or Remove Records from a List
        # Add and/or remove records that have already been created in the system to and/or from a list.  This endpoint only works for lists that have a `processingType` of `MANUAL` or `SNAPSHOT`.
        # @param list_id [String] The **ILS ID** of the &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60; list.
        # @param membership_change_request [MembershipChangeRequest] 
        # @param [Hash] opts the optional parameters
        # @return [MembershipsUpdateResponse]
        def add_and_remove(list_id, membership_change_request, opts = {})
          data, _status_code, _headers = add_and_remove_with_http_info(list_id, membership_change_request, opts)
          data
        end

        # Add and/or Remove Records from a List
        # Add and/or remove records that have already been created in the system to and/or from a list.  This endpoint only works for lists that have a &#x60;processingType&#x60; of &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60;.
        # @param list_id [String] The **ILS ID** of the &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60; list.
        # @param membership_change_request [MembershipChangeRequest] 
        # @param [Hash] opts the optional parameters
        # @return [Array<(MembershipsUpdateResponse, Integer, Hash)>] MembershipsUpdateResponse data, response status code and response headers
        def add_and_remove_with_http_info(list_id, membership_change_request, opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: MembershipsApi.add_and_remove ...'
          end
          # verify the required parameter 'list_id' is set
          if @api_client.config.client_side_validation && list_id.nil?
            fail ArgumentError, "Missing the required parameter 'list_id' when calling MembershipsApi.add_and_remove"
          end
          # verify the required parameter 'membership_change_request' is set
          if @api_client.config.client_side_validation && membership_change_request.nil?
            fail ArgumentError, "Missing the required parameter 'membership_change_request' when calling MembershipsApi.add_and_remove"
          end
          # resource path
          local_var_path = '/crm/v3/lists/{listId}/memberships/add-and-remove'.sub('{' + 'listId' + '}', CGI.escape(list_id.to_s))

          # query parameters
          query_params = opts[:query_params] || {}

          # header parameters
          header_params = opts[:header_params] || {}
          # HTTP header 'Accept' (if needed)
          header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])
          # HTTP header 'Content-Type'
          content_type = @api_client.select_header_content_type(['application/json'])
          if !content_type.nil?
              header_params['Content-Type'] = content_type
          end

          # form parameters
          form_params = opts[:form_params] || {}

          # http body (model)
          post_body = opts[:debug_body] || @api_client.object_to_http_body(membership_change_request)

          # return_type
          return_type = opts[:debug_return_type] || 'MembershipsUpdateResponse'

          # auth_names
          auth_names = opts[:debug_auth_names] || ['oauth2']

          new_options = opts.merge(
            :operation => :"MembershipsApi.add_and_remove",
            :header_params => header_params,
            :query_params => query_params,
            :form_params => form_params,
            :body => post_body,
            :auth_names => auth_names,
            :return_type => return_type
          )

          data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
          if @api_client.config.debugging
            @api_client.config.logger.debug "API called: MembershipsApi#add_and_remove\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
          end
          return data, status_code, headers
        end

        # Get lists record is member of
        # For given record provide lists this record is member of.
        # @param object_type_id [String] Object type id of the record
        # @param record_id [String] Id of the record
        # @param [Hash] opts the optional parameters
        # @return [ApiCollectionResponseRecordListMembershipNoPaging]
        def get_lists(object_type_id, record_id, opts = {})
          data, _status_code, _headers = get_lists_with_http_info(object_type_id, record_id, opts)
          data
        end

        # Get lists record is member of
        # For given record provide lists this record is member of.
        # @param object_type_id [String] Object type id of the record
        # @param record_id [String] Id of the record
        # @param [Hash] opts the optional parameters
        # @return [Array<(ApiCollectionResponseRecordListMembershipNoPaging, Integer, Hash)>] ApiCollectionResponseRecordListMembershipNoPaging data, response status code and response headers
        def get_lists_with_http_info(object_type_id, record_id, opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: MembershipsApi.get_lists ...'
          end
          # verify the required parameter 'object_type_id' is set
          if @api_client.config.client_side_validation && object_type_id.nil?
            fail ArgumentError, "Missing the required parameter 'object_type_id' when calling MembershipsApi.get_lists"
          end
          # verify the required parameter 'record_id' is set
          if @api_client.config.client_side_validation && record_id.nil?
            fail ArgumentError, "Missing the required parameter 'record_id' when calling MembershipsApi.get_lists"
          end
          # resource path
          local_var_path = '/crm/v3/lists/records/{objectTypeId}/{recordId}/memberships'.sub('{' + 'objectTypeId' + '}', CGI.escape(object_type_id.to_s)).sub('{' + 'recordId' + '}', CGI.escape(record_id.to_s))

          # query parameters
          query_params = opts[:query_params] || {}

          # header parameters
          header_params = opts[:header_params] || {}
          # HTTP header 'Accept' (if needed)
          header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])

          # form parameters
          form_params = opts[:form_params] || {}

          # http body (model)
          post_body = opts[:debug_body]

          # return_type
          return_type = opts[:debug_return_type] || 'ApiCollectionResponseRecordListMembershipNoPaging'

          # auth_names
          auth_names = opts[:debug_auth_names] || ['oauth2']

          new_options = opts.merge(
            :operation => :"MembershipsApi.get_lists",
            :header_params => header_params,
            :query_params => query_params,
            :form_params => form_params,
            :body => post_body,
            :auth_names => auth_names,
            :return_type => return_type
          )

          data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
          if @api_client.config.debugging
            @api_client.config.logger.debug "API called: MembershipsApi#get_lists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
          end
          return data, status_code, headers
        end

        # Fetch List Memberships Ordered by ID
        # Fetch the memberships of a list in order sorted by the `recordId` of the records in the list.  The `recordId`s are sorted in *ascending* order if an `after` offset or no offset is provided. If only a `before` offset is provided, then the records are sorted in *descending* order.  The `after` offset parameter will take precedence over the `before` offset in a case where both are provided.
        # @param list_id [String] The **ILS ID** of the list.
        # @param [Hash] opts the optional parameters
        # @option opts [String] :after The paging offset token for the page that comes &#x60;after&#x60; the previously requested records.  If provided, then the records in the response will be the records following the offset, sorted in *ascending* order. Takes precedence over the &#x60;before&#x60; offset.
        # @option opts [String] :before The paging offset token for the page that comes &#x60;before&#x60; the previously requested records.  If provided, then the records in the response will be the records preceding the offset, sorted in *descending* order.
        # @option opts [Integer] :limit The number of records to return in the response. The maximum &#x60;limit&#x60; is 250. (default to 100)
        # @return [ApiCollectionResponseJoinTimeAndRecordId]
        def get_page(list_id, opts = {})
          data, _status_code, _headers = get_page_with_http_info(list_id, opts)
          data
        end

        # Fetch List Memberships Ordered by ID
        # Fetch the memberships of a list in order sorted by the &#x60;recordId&#x60; of the records in the list.  The &#x60;recordId&#x60;s are sorted in *ascending* order if an &#x60;after&#x60; offset or no offset is provided. If only a &#x60;before&#x60; offset is provided, then the records are sorted in *descending* order.  The &#x60;after&#x60; offset parameter will take precedence over the &#x60;before&#x60; offset in a case where both are provided.
        # @param list_id [String] The **ILS ID** of the list.
        # @param [Hash] opts the optional parameters
        # @option opts [String] :after The paging offset token for the page that comes &#x60;after&#x60; the previously requested records.  If provided, then the records in the response will be the records following the offset, sorted in *ascending* order. Takes precedence over the &#x60;before&#x60; offset.
        # @option opts [String] :before The paging offset token for the page that comes &#x60;before&#x60; the previously requested records.  If provided, then the records in the response will be the records preceding the offset, sorted in *descending* order.
        # @option opts [Integer] :limit The number of records to return in the response. The maximum &#x60;limit&#x60; is 250. (default to 100)
        # @return [Array<(ApiCollectionResponseJoinTimeAndRecordId, Integer, Hash)>] ApiCollectionResponseJoinTimeAndRecordId data, response status code and response headers
        def get_page_with_http_info(list_id, opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: MembershipsApi.get_page ...'
          end
          # verify the required parameter 'list_id' is set
          if @api_client.config.client_side_validation && list_id.nil?
            fail ArgumentError, "Missing the required parameter 'list_id' when calling MembershipsApi.get_page"
          end
          # resource path
          local_var_path = '/crm/v3/lists/{listId}/memberships'.sub('{' + 'listId' + '}', CGI.escape(list_id.to_s))

          # query parameters
          query_params = opts[:query_params] || {}
          query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
          query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
          query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

          # header parameters
          header_params = opts[:header_params] || {}
          # HTTP header 'Accept' (if needed)
          header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])

          # form parameters
          form_params = opts[:form_params] || {}

          # http body (model)
          post_body = opts[:debug_body]

          # return_type
          return_type = opts[:debug_return_type] || 'ApiCollectionResponseJoinTimeAndRecordId'

          # auth_names
          auth_names = opts[:debug_auth_names] || ['oauth2']

          new_options = opts.merge(
            :operation => :"MembershipsApi.get_page",
            :header_params => header_params,
            :query_params => query_params,
            :form_params => form_params,
            :body => post_body,
            :auth_names => auth_names,
            :return_type => return_type
          )

          data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
          if @api_client.config.debugging
            @api_client.config.logger.debug "API called: MembershipsApi#get_page\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
          end
          return data, status_code, headers
        end

        # Fetch List Memberships Ordered by Added to List Date
        # Fetch the memberships of a list in order sorted by the time the records were added to the list.  The `recordId`s are sorted in *ascending* order if an `after` offset or no offset is provided. If only a `before` offset is provided, then the records are sorted in *descending* order.  The `after` offset parameter will take precedence over the `before` offset in a case where both are provided.
        # @param list_id [String] The **ILS ID** of the list.
        # @param [Hash] opts the optional parameters
        # @option opts [String] :after The paging offset token for the page that comes &#x60;after&#x60; the previously requested records.  If provided, then the records in the response will be the records following the offset, sorted in *ascending* order. Takes precedence over the &#x60;before&#x60; offset.
        # @option opts [String] :before The paging offset token for the page that comes &#x60;before&#x60; the previously requested records.  If provided, then the records in the response will be the records preceding the offset, sorted in *descending* order.
        # @option opts [Integer] :limit The number of records to return in the response. The maximum &#x60;limit&#x60; is 250. (default to 100)
        # @return [ApiCollectionResponseJoinTimeAndRecordId]
        def get_page_ordered_by_added_to_list_date(list_id, opts = {})
          data, _status_code, _headers = get_page_ordered_by_added_to_list_date_with_http_info(list_id, opts)
          data
        end

        # Fetch List Memberships Ordered by Added to List Date
        # Fetch the memberships of a list in order sorted by the time the records were added to the list.  The &#x60;recordId&#x60;s are sorted in *ascending* order if an &#x60;after&#x60; offset or no offset is provided. If only a &#x60;before&#x60; offset is provided, then the records are sorted in *descending* order.  The &#x60;after&#x60; offset parameter will take precedence over the &#x60;before&#x60; offset in a case where both are provided.
        # @param list_id [String] The **ILS ID** of the list.
        # @param [Hash] opts the optional parameters
        # @option opts [String] :after The paging offset token for the page that comes &#x60;after&#x60; the previously requested records.  If provided, then the records in the response will be the records following the offset, sorted in *ascending* order. Takes precedence over the &#x60;before&#x60; offset.
        # @option opts [String] :before The paging offset token for the page that comes &#x60;before&#x60; the previously requested records.  If provided, then the records in the response will be the records preceding the offset, sorted in *descending* order.
        # @option opts [Integer] :limit The number of records to return in the response. The maximum &#x60;limit&#x60; is 250. (default to 100)
        # @return [Array<(ApiCollectionResponseJoinTimeAndRecordId, Integer, Hash)>] ApiCollectionResponseJoinTimeAndRecordId data, response status code and response headers
        def get_page_ordered_by_added_to_list_date_with_http_info(list_id, opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: MembershipsApi.get_page_ordered_by_added_to_list_date ...'
          end
          # verify the required parameter 'list_id' is set
          if @api_client.config.client_side_validation && list_id.nil?
            fail ArgumentError, "Missing the required parameter 'list_id' when calling MembershipsApi.get_page_ordered_by_added_to_list_date"
          end
          # resource path
          local_var_path = '/crm/v3/lists/{listId}/memberships/join-order'.sub('{' + 'listId' + '}', CGI.escape(list_id.to_s))

          # query parameters
          query_params = opts[:query_params] || {}
          query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
          query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
          query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

          # header parameters
          header_params = opts[:header_params] || {}
          # HTTP header 'Accept' (if needed)
          header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])

          # form parameters
          form_params = opts[:form_params] || {}

          # http body (model)
          post_body = opts[:debug_body]

          # return_type
          return_type = opts[:debug_return_type] || 'ApiCollectionResponseJoinTimeAndRecordId'

          # auth_names
          auth_names = opts[:debug_auth_names] || ['oauth2']

          new_options = opts.merge(
            :operation => :"MembershipsApi.get_page_ordered_by_added_to_list_date",
            :header_params => header_params,
            :query_params => query_params,
            :form_params => form_params,
            :body => post_body,
            :auth_names => auth_names,
            :return_type => return_type
          )

          data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
          if @api_client.config.debugging
            @api_client.config.logger.debug "API called: MembershipsApi#get_page_ordered_by_added_to_list_date\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
          end
          return data, status_code, headers
        end

        # Remove Records from a List
        # Remove the records provided from the list. Records that do not exist or that are not members of the list are ignored.  This endpoint only works for lists that have a `processingType` of `MANUAL` or `SNAPSHOT`.
        # @param list_id [String] The **ILS ID** of the &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60; list.
        # @param request_body [Array<String>] 
        # @param [Hash] opts the optional parameters
        # @return [MembershipsUpdateResponse]
        def remove(list_id, request_body, opts = {})
          data, _status_code, _headers = remove_with_http_info(list_id, request_body, opts)
          data
        end

        # Remove Records from a List
        # Remove the records provided from the list. Records that do not exist or that are not members of the list are ignored.  This endpoint only works for lists that have a &#x60;processingType&#x60; of &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60;.
        # @param list_id [String] The **ILS ID** of the &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60; list.
        # @param request_body [Array<String>] 
        # @param [Hash] opts the optional parameters
        # @return [Array<(MembershipsUpdateResponse, Integer, Hash)>] MembershipsUpdateResponse data, response status code and response headers
        def remove_with_http_info(list_id, request_body, opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: MembershipsApi.remove ...'
          end
          # verify the required parameter 'list_id' is set
          if @api_client.config.client_side_validation && list_id.nil?
            fail ArgumentError, "Missing the required parameter 'list_id' when calling MembershipsApi.remove"
          end
          # verify the required parameter 'request_body' is set
          if @api_client.config.client_side_validation && request_body.nil?
            fail ArgumentError, "Missing the required parameter 'request_body' when calling MembershipsApi.remove"
          end
          # resource path
          local_var_path = '/crm/v3/lists/{listId}/memberships/remove'.sub('{' + 'listId' + '}', CGI.escape(list_id.to_s))

          # query parameters
          query_params = opts[:query_params] || {}

          # header parameters
          header_params = opts[:header_params] || {}
          # HTTP header 'Accept' (if needed)
          header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])
          # HTTP header 'Content-Type'
          content_type = @api_client.select_header_content_type(['application/json'])
          if !content_type.nil?
              header_params['Content-Type'] = content_type
          end

          # form parameters
          form_params = opts[:form_params] || {}

          # http body (model)
          post_body = opts[:debug_body] || @api_client.object_to_http_body(request_body)

          # return_type
          return_type = opts[:debug_return_type] || 'MembershipsUpdateResponse'

          # auth_names
          auth_names = opts[:debug_auth_names] || ['oauth2']

          new_options = opts.merge(
            :operation => :"MembershipsApi.remove",
            :header_params => header_params,
            :query_params => query_params,
            :form_params => form_params,
            :body => post_body,
            :auth_names => auth_names,
            :return_type => return_type
          )

          data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
          if @api_client.config.debugging
            @api_client.config.logger.debug "API called: MembershipsApi#remove\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
          end
          return data, status_code, headers
        end

        # Delete All Records from a List
        # Remove **all** of the records from a list. ***Note:*** *The list is not deleted.*  This endpoint only works for lists that have a `processingType` of `MANUAL` or `SNAPSHOT`.  This endpoint only supports lists that have less than 100,000 memberships.
        # @param list_id [String] The **ILS ID** of the &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60; list.
        # @param [Hash] opts the optional parameters
        # @return [nil]
        def remove_all(list_id, opts = {})
          remove_all_with_http_info(list_id, opts)
          nil
        end

        # Delete All Records from a List
        # Remove **all** of the records from a list. ***Note:*** *The list is not deleted.*  This endpoint only works for lists that have a &#x60;processingType&#x60; of &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60;.  This endpoint only supports lists that have less than 100,000 memberships.
        # @param list_id [String] The **ILS ID** of the &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60; list.
        # @param [Hash] opts the optional parameters
        # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
        def remove_all_with_http_info(list_id, opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: MembershipsApi.remove_all ...'
          end
          # verify the required parameter 'list_id' is set
          if @api_client.config.client_side_validation && list_id.nil?
            fail ArgumentError, "Missing the required parameter 'list_id' when calling MembershipsApi.remove_all"
          end
          # resource path
          local_var_path = '/crm/v3/lists/{listId}/memberships'.sub('{' + 'listId' + '}', CGI.escape(list_id.to_s))

          # query parameters
          query_params = opts[:query_params] || {}

          # header parameters
          header_params = opts[:header_params] || {}
          # HTTP header 'Accept' (if needed)
          header_params['Accept'] = @api_client.select_header_accept(['*/*'])

          # form parameters
          form_params = opts[:form_params] || {}

          # http body (model)
          post_body = opts[:debug_body]

          # return_type
          return_type = opts[:debug_return_type]

          # auth_names
          auth_names = opts[:debug_auth_names] || ['oauth2']

          new_options = opts.merge(
            :operation => :"MembershipsApi.remove_all",
            :header_params => header_params,
            :query_params => query_params,
            :form_params => form_params,
            :body => post_body,
            :auth_names => auth_names,
            :return_type => return_type
          )

          data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
          if @api_client.config.debugging
            @api_client.config.logger.debug "API called: MembershipsApi#remove_all\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
          end
          return data, status_code, headers
        end
      end
    end
  end
end
