=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 BasicApi
        include Hubspot::Helpers::GetAllHelper

        attr_accessor :api_client

        def initialize(api_client = ApiClient.default)
          @api_client = api_client
        end
        # Delete Marketing Event by External Ids
        # Deletes the existing Marketing Event with the specified externalAccountId, externalEventId, if it exists.  Only Marketing Events created by the same app can be deleted.
        # @param external_event_id [String] The id of the marketing event in the external event application
        # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application
        # @param [Hash] opts the optional parameters
        # @return [nil]
        def archive(external_event_id, external_account_id, opts = {})
          archive_with_http_info(external_event_id, external_account_id, opts)
          nil
        end

        # Delete Marketing Event by External Ids
        # Deletes the existing Marketing Event with the specified externalAccountId, externalEventId, if it exists.  Only Marketing Events created by the same app can be deleted.
        # @param external_event_id [String] The id of the marketing event in the external event application
        # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application
        # @param [Hash] opts the optional parameters
        # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
        def archive_with_http_info(external_event_id, external_account_id, opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: BasicApi.archive ...'
          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 BasicApi.archive"
          end
          # verify the required parameter 'external_account_id' is set
          if @api_client.config.client_side_validation && external_account_id.nil?
            fail ArgumentError, "Missing the required parameter 'external_account_id' when calling BasicApi.archive"
          end
          # resource path
          local_var_path = '/marketing/v3/marketing-events/events/{externalEventId}'.sub('{' + 'externalEventId' + '}', CGI.escape(external_event_id.to_s))

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

          # 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 => :"BasicApi.archive",
            :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: BasicApi#archive\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
          end
          return data, status_code, headers
        end

        # Delete Marketing Event by objectId
        # Deletes the existing Marketing Event with the specified objectId, if it exists.
        # @param object_id [String] The internal ID of the marketing event in HubSpot
        # @param [Hash] opts the optional parameters
        # @return [nil]
        def archive_by_object_id(object_id, opts = {})
          archive_by_object_id_with_http_info(object_id, opts)
          nil
        end

        # Delete Marketing Event by objectId
        # Deletes the existing Marketing Event with the specified objectId, if it exists.
        # @param object_id [String] The internal ID of the marketing event in HubSpot
        # @param [Hash] opts the optional parameters
        # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
        def archive_by_object_id_with_http_info(object_id, opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: BasicApi.archive_by_object_id ...'
          end
          # verify the required parameter 'object_id' is set
          if @api_client.config.client_side_validation && object_id.nil?
            fail ArgumentError, "Missing the required parameter 'object_id' when calling BasicApi.archive_by_object_id"
          end
          # resource path
          local_var_path = '/marketing/v3/marketing-events/{objectId}'.sub('{' + 'objectId' + '}', CGI.escape(object_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 => :"BasicApi.archive_by_object_id",
            :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: BasicApi#archive_by_object_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
          end
          return data, status_code, headers
        end

        # Create a marketing event
        # Creates a new marketing event in HubSpot
        # @param marketing_event_create_request_params [MarketingEventCreateRequestParams] 
        # @param [Hash] opts the optional parameters
        # @return [MarketingEventDefaultResponse]
        def create(marketing_event_create_request_params, opts = {})
          data, _status_code, _headers = create_with_http_info(marketing_event_create_request_params, opts)
          data
        end

        # Create a marketing event
        # Creates a new marketing event in HubSpot
        # @param marketing_event_create_request_params [MarketingEventCreateRequestParams] 
        # @param [Hash] opts the optional parameters
        # @return [Array<(MarketingEventDefaultResponse, Integer, Hash)>] MarketingEventDefaultResponse data, response status code and response headers
        def create_with_http_info(marketing_event_create_request_params, opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: BasicApi.create ...'
          end
          # verify the required parameter 'marketing_event_create_request_params' is set
          if @api_client.config.client_side_validation && marketing_event_create_request_params.nil?
            fail ArgumentError, "Missing the required parameter 'marketing_event_create_request_params' when calling BasicApi.create"
          end
          # resource path
          local_var_path = '/marketing/v3/marketing-events/events'

          # 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(marketing_event_create_request_params)

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

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

          new_options = opts.merge(
            :operation => :"BasicApi.create",
            :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(:POST, local_var_path, new_options)
          if @api_client.config.debugging
            @api_client.config.logger.debug "API called: BasicApi#create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
          end
          return data, status_code, headers
        end

        # Get all marketing event
        # Returns all Marketing Events available on the portal, along with their properties, regardless of whether they were created manually or through the application.  The marketing events returned by this endpoint are sorted by objectId.
        # @param [Hash] opts the optional parameters
        # @option opts [String] :after The cursor indicating the position of the last retrieved item.
        # @option opts [Integer] :limit The limit for response size. The default value is 10, the max number is 100 (default to 10)
        # @return [CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging]
        def get_all(opts = {})
          data, _status_code, _headers = get_all_with_http_info(opts)
          data
        end

        # Get all marketing event
        # Returns all Marketing Events available on the portal, along with their properties, regardless of whether they were created manually or through the application.  The marketing events returned by this endpoint are sorted by objectId.
        # @param [Hash] opts the optional parameters
        # @option opts [String] :after The cursor indicating the position of the last retrieved item.
        # @option opts [Integer] :limit The limit for response size. The default value is 10, the max number is 100 (default to 10)
        # @return [Array<(CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging, Integer, Hash)>] CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging data, response status code and response headers
        def get_all_with_http_info(opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: BasicApi.get_all ...'
          end
          # resource path
          local_var_path = '/marketing/v3/marketing-events/'

          # query parameters
          query_params = opts[:query_params] || {}
          query_params[:'after'] = opts[:'after'] if !opts[:'after'].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] || 'CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging'

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

          new_options = opts.merge(
            :operation => :"BasicApi.get_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(:GET, local_var_path, new_options)
          if @api_client.config.debugging
            @api_client.config.logger.debug "API called: BasicApi#get_all\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
          end
          return data, status_code, headers
        end

        # Get Marketing Event by objectId
        # Returns the details of a Marketing Event with the specified objectId, if it exists.
        # @param object_id [String] The internal ID of the marketing event in HubSpot
        # @param [Hash] opts the optional parameters
        # @return [MarketingEventPublicReadResponseV2]
        def get_by_object_id(object_id, opts = {})
          data, _status_code, _headers = get_by_object_id_with_http_info(object_id, opts)
          data
        end

        # Get Marketing Event by objectId
        # Returns the details of a Marketing Event with the specified objectId, if it exists.
        # @param object_id [String] The internal ID of the marketing event in HubSpot
        # @param [Hash] opts the optional parameters
        # @return [Array<(MarketingEventPublicReadResponseV2, Integer, Hash)>] MarketingEventPublicReadResponseV2 data, response status code and response headers
        def get_by_object_id_with_http_info(object_id, opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: BasicApi.get_by_object_id ...'
          end
          # verify the required parameter 'object_id' is set
          if @api_client.config.client_side_validation && object_id.nil?
            fail ArgumentError, "Missing the required parameter 'object_id' when calling BasicApi.get_by_object_id"
          end
          # resource path
          local_var_path = '/marketing/v3/marketing-events/{objectId}'.sub('{' + 'objectId' + '}', CGI.escape(object_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] || 'MarketingEventPublicReadResponseV2'

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

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

        # Get Marketing Event by External IDs
        # Returns the details of a Marketing Event with the specified externalAccountId, externalEventId, if it exists.  Only Marketing Events created by the same app making the request can be retrieved.
        # @param external_event_id [String] The id of the marketing event in the external event application
        # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application
        # @param [Hash] opts the optional parameters
        # @return [MarketingEventPublicReadResponse]
        def get_details(external_event_id, external_account_id, opts = {})
          data, _status_code, _headers = get_details_with_http_info(external_event_id, external_account_id, opts)
          data
        end

        # Get Marketing Event by External IDs
        # Returns the details of a Marketing Event with the specified externalAccountId, externalEventId, if it exists.  Only Marketing Events created by the same app making the request can be retrieved.
        # @param external_event_id [String] The id of the marketing event in the external event application
        # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application
        # @param [Hash] opts the optional parameters
        # @return [Array<(MarketingEventPublicReadResponse, Integer, Hash)>] MarketingEventPublicReadResponse data, response status code and response headers
        def get_details_with_http_info(external_event_id, external_account_id, opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: BasicApi.get_details ...'
          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 BasicApi.get_details"
          end
          # verify the required parameter 'external_account_id' is set
          if @api_client.config.client_side_validation && external_account_id.nil?
            fail ArgumentError, "Missing the required parameter 'external_account_id' when calling BasicApi.get_details"
          end
          # resource path
          local_var_path = '/marketing/v3/marketing-events/events/{externalEventId}'.sub('{' + 'externalEventId' + '}', CGI.escape(external_event_id.to_s))

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

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

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

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

        # Update Marketing Event by External IDs
        # Updates the details of an existing Marketing Event identified by its externalAccountId, externalEventId if it exists.  Only Marketing Events created by the same app can be updated.
        # @param external_event_id [String] The id of the marketing event in the external event application
        # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application
        # @param marketing_event_update_request_params [MarketingEventUpdateRequestParams] 
        # @param [Hash] opts the optional parameters
        # @return [MarketingEventPublicDefaultResponse]
        def update(external_event_id, external_account_id, marketing_event_update_request_params, opts = {})
          data, _status_code, _headers = update_with_http_info(external_event_id, external_account_id, marketing_event_update_request_params, opts)
          data
        end

        # Update Marketing Event by External IDs
        # Updates the details of an existing Marketing Event identified by its externalAccountId, externalEventId if it exists.  Only Marketing Events created by the same app can be updated.
        # @param external_event_id [String] The id of the marketing event in the external event application
        # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application
        # @param marketing_event_update_request_params [MarketingEventUpdateRequestParams] 
        # @param [Hash] opts the optional parameters
        # @return [Array<(MarketingEventPublicDefaultResponse, Integer, Hash)>] MarketingEventPublicDefaultResponse data, response status code and response headers
        def update_with_http_info(external_event_id, external_account_id, marketing_event_update_request_params, opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: BasicApi.update ...'
          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 BasicApi.update"
          end
          # verify the required parameter 'external_account_id' is set
          if @api_client.config.client_side_validation && external_account_id.nil?
            fail ArgumentError, "Missing the required parameter 'external_account_id' when calling BasicApi.update"
          end
          # verify the required parameter 'marketing_event_update_request_params' is set
          if @api_client.config.client_side_validation && marketing_event_update_request_params.nil?
            fail ArgumentError, "Missing the required parameter 'marketing_event_update_request_params' when calling BasicApi.update"
          end
          # resource path
          local_var_path = '/marketing/v3/marketing-events/events/{externalEventId}'.sub('{' + 'externalEventId' + '}', CGI.escape(external_event_id.to_s))

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

          # 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(marketing_event_update_request_params)

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

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

          new_options = opts.merge(
            :operation => :"BasicApi.update",
            :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(:PATCH, local_var_path, new_options)
          if @api_client.config.debugging
            @api_client.config.logger.debug "API called: BasicApi#update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
          end
          return data, status_code, headers
        end

        # Update Marketing Event by objectId
        # Updates the details of an existing Marketing Event identified by its objectId, if it exists.
        # @param object_id [String] The internal ID of the marketing event in HubSpot
        # @param marketing_event_public_update_request_v2 [MarketingEventPublicUpdateRequestV2] 
        # @param [Hash] opts the optional parameters
        # @return [MarketingEventPublicDefaultResponseV2]
        def update_by_object_id(object_id, marketing_event_public_update_request_v2, opts = {})
          data, _status_code, _headers = update_by_object_id_with_http_info(object_id, marketing_event_public_update_request_v2, opts)
          data
        end

        # Update Marketing Event by objectId
        # Updates the details of an existing Marketing Event identified by its objectId, if it exists.
        # @param object_id [String] The internal ID of the marketing event in HubSpot
        # @param marketing_event_public_update_request_v2 [MarketingEventPublicUpdateRequestV2] 
        # @param [Hash] opts the optional parameters
        # @return [Array<(MarketingEventPublicDefaultResponseV2, Integer, Hash)>] MarketingEventPublicDefaultResponseV2 data, response status code and response headers
        def update_by_object_id_with_http_info(object_id, marketing_event_public_update_request_v2, opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: BasicApi.update_by_object_id ...'
          end
          # verify the required parameter 'object_id' is set
          if @api_client.config.client_side_validation && object_id.nil?
            fail ArgumentError, "Missing the required parameter 'object_id' when calling BasicApi.update_by_object_id"
          end
          # verify the required parameter 'marketing_event_public_update_request_v2' is set
          if @api_client.config.client_side_validation && marketing_event_public_update_request_v2.nil?
            fail ArgumentError, "Missing the required parameter 'marketing_event_public_update_request_v2' when calling BasicApi.update_by_object_id"
          end
          # resource path
          local_var_path = '/marketing/v3/marketing-events/{objectId}'.sub('{' + 'objectId' + '}', CGI.escape(object_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(marketing_event_public_update_request_v2)

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

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

          new_options = opts.merge(
            :operation => :"BasicApi.update_by_object_id",
            :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(:PATCH, local_var_path, new_options)
          if @api_client.config.debugging
            @api_client.config.logger.debug "API called: BasicApi#update_by_object_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
          end
          return data, status_code, headers
        end

        # Create or update a marketing event
        # Upserts a marketing event If there is an existing marketing event with the specified ID, it will be updated; otherwise a new event will be created.
        # @param external_event_id [String] The id of the marketing event in the external event application
        # @param marketing_event_create_request_params [MarketingEventCreateRequestParams] 
        # @param [Hash] opts the optional parameters
        # @return [MarketingEventPublicDefaultResponse]
        def upsert(external_event_id, marketing_event_create_request_params, opts = {})
          data, _status_code, _headers = upsert_with_http_info(external_event_id, marketing_event_create_request_params, opts)
          data
        end

        # Create or update a marketing event
        # Upserts a marketing event If there is an existing marketing event with the specified ID, it will be updated; otherwise a new event will be created.
        # @param external_event_id [String] The id of the marketing event in the external event application
        # @param marketing_event_create_request_params [MarketingEventCreateRequestParams] 
        # @param [Hash] opts the optional parameters
        # @return [Array<(MarketingEventPublicDefaultResponse, Integer, Hash)>] MarketingEventPublicDefaultResponse data, response status code and response headers
        def upsert_with_http_info(external_event_id, marketing_event_create_request_params, opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: BasicApi.upsert ...'
          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 BasicApi.upsert"
          end
          # verify the required parameter 'marketing_event_create_request_params' is set
          if @api_client.config.client_side_validation && marketing_event_create_request_params.nil?
            fail ArgumentError, "Missing the required parameter 'marketing_event_create_request_params' when calling BasicApi.upsert"
          end
          # resource path
          local_var_path = '/marketing/v3/marketing-events/events/{externalEventId}'.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', '*/*'])
          # 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(marketing_event_create_request_params)

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

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

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