=begin
#Marketing Events

#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 Marketing
    module Events
      class IdentifiersApi
        attr_accessor :api_client

        def initialize(api_client = ApiClient.default)
          @api_client = api_client
        end
        # Find App-Specific Marketing Events by External Event Id
        # Retrieves Marketing Events where the externalEventId matches the value provided in the request, limited to events created by the app making the request.  Marketing Events created by other apps will not be included in the results.
        # @param q [String] The id of the marketing event in the external event application (externalEventId)
        # @param [Hash] opts the optional parameters
        # @return [CollectionResponseSearchPublicResponseWrapperNoPaging]
        def do_search(q, opts = {})
          data, _status_code, _headers = do_search_with_http_info(q, opts)
          data
        end

        # Find App-Specific Marketing Events by External Event Id
        # Retrieves Marketing Events where the externalEventId matches the value provided in the request, limited to events created by the app making the request.  Marketing Events created by other apps will not be included in the results.
        # @param q [String] The id of the marketing event in the external event application (externalEventId)
        # @param [Hash] opts the optional parameters
        # @return [Array<(CollectionResponseSearchPublicResponseWrapperNoPaging, Integer, Hash)>] CollectionResponseSearchPublicResponseWrapperNoPaging data, response status code and response headers
        def do_search_with_http_info(q, opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: IdentifiersApi.do_search ...'
          end
          # verify the required parameter 'q' is set
          if @api_client.config.client_side_validation && q.nil?
            fail ArgumentError, "Missing the required parameter 'q' when calling IdentifiersApi.do_search"
          end
          # resource path
          local_var_path = '/marketing/v3/marketing-events/events/search'

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

          # 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] || 'CollectionResponseSearchPublicResponseWrapperNoPaging'

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

          new_options = opts.merge(
            :operation => :"IdentifiersApi.do_search",
            :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: IdentifiersApi#do_search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
          end
          return data, status_code, headers
        end

        # Find Marketing Events by External Event Id
        # This endpoint searches the portal for all Marketing Events whose externalEventId matches the value provided in the request.  It retrieves the objectId and additional event details for each matching Marketing Event.  Since multiple Marketing Events can have the same externalEventId, the endpoint returns all matching results.  Note: Marketing Events become searchable by externalEventId a few minutes after creation.
        # @param external_event_id [String] The id of the marketing event in the external event application.
        # @param [Hash] opts the optional parameters
        # @return [CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging]
        def search_portal_events(external_event_id, opts = {})
          data, _status_code, _headers = search_portal_events_with_http_info(external_event_id, opts)
          data
        end

        # Find Marketing Events by External Event Id
        # This endpoint searches the portal for all Marketing Events whose externalEventId matches the value provided in the request.  It retrieves the objectId and additional event details for each matching Marketing Event.  Since multiple Marketing Events can have the same externalEventId, the endpoint returns all matching results.  Note: Marketing Events become searchable by externalEventId a few minutes after creation.
        # @param external_event_id [String] The id of the marketing event in the external event application.
        # @param [Hash] opts the optional parameters
        # @return [Array<(CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging, Integer, Hash)>] CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging data, response status code and response headers
        def search_portal_events_with_http_info(external_event_id, opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: IdentifiersApi.search_portal_events ...'
          end
          # verify the required parameter 'external_event_id' is set
          if @api_client.config.client_side_validation && external_event_id.nil?
            fail ArgumentError, "Missing the required parameter 'external_event_id' when calling IdentifiersApi.search_portal_events"
          end
          # resource path
          local_var_path = '/marketing/v3/marketing-events/{externalEventId}/identifiers'.sub('{' + 'externalEventId' + '}', CGI.escape(external_event_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] || 'CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging'

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

          new_options = opts.merge(
            :operation => :"IdentifiersApi.search_portal_events",
            :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: IdentifiersApi#search_portal_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
          end
          return data, status_code, headers
        end
      end
    end
  end
end
