=begin
#Hatchet API

#The Hatchet API

The version of the OpenAPI document: 1.0.0

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

=end

require 'cgi'

module HatchetSdkRest
  class EventApi
    attr_accessor :api_client

    def initialize(api_client = ApiClient.default)
      @api_client = api_client
    end
    # Create event
    # Creates a new event.
    # @param tenant [String] The tenant id
    # @param create_event_request [CreateEventRequest] The event to create
    # @param [Hash] opts the optional parameters
    # @return [Event]
    def event_create(tenant, create_event_request, opts = {})
      data, _status_code, _headers = event_create_with_http_info(tenant, create_event_request, opts)
      data
    end

    # Create event
    # Creates a new event.
    # @param tenant [String] The tenant id
    # @param create_event_request [CreateEventRequest] The event to create
    # @param [Hash] opts the optional parameters
    # @return [Array<(Event, Integer, Hash)>] Event data, response status code and response headers
    def event_create_with_http_info(tenant, create_event_request, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: EventApi.event_create ...'
      end
      # verify the required parameter 'tenant' is set
      if @api_client.config.client_side_validation && tenant.nil?
        fail ArgumentError, "Missing the required parameter 'tenant' when calling EventApi.event_create"
      end
      if @api_client.config.client_side_validation && tenant.to_s.length > 36
        fail ArgumentError, 'invalid value for "tenant" when calling EventApi.event_create, the character length must be smaller than or equal to 36.'
      end

      if @api_client.config.client_side_validation && tenant.to_s.length < 36
        fail ArgumentError, 'invalid value for "tenant" when calling EventApi.event_create, the character length must be greater than or equal to 36.'
      end

      # verify the required parameter 'create_event_request' is set
      if @api_client.config.client_side_validation && create_event_request.nil?
        fail ArgumentError, "Missing the required parameter 'create_event_request' when calling EventApi.event_create"
      end
      # resource path
      local_var_path = '/api/v1/tenants/{tenant}/events'.sub('{' + 'tenant' + '}', CGI.escape(tenant.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']) unless header_params['Accept']
      # 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(create_event_request)

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

      # auth_names
      auth_names = opts[:debug_auth_names] || ['cookieAuth', 'bearerAuth']

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

    # Bulk Create events
    # Bulk creates new events.
    # @param tenant [String] The tenant id
    # @param bulk_create_event_request [BulkCreateEventRequest] The events to create
    # @param [Hash] opts the optional parameters
    # @return [Events]
    def event_create_bulk(tenant, bulk_create_event_request, opts = {})
      data, _status_code, _headers = event_create_bulk_with_http_info(tenant, bulk_create_event_request, opts)
      data
    end

    # Bulk Create events
    # Bulk creates new events.
    # @param tenant [String] The tenant id
    # @param bulk_create_event_request [BulkCreateEventRequest] The events to create
    # @param [Hash] opts the optional parameters
    # @return [Array<(Events, Integer, Hash)>] Events data, response status code and response headers
    def event_create_bulk_with_http_info(tenant, bulk_create_event_request, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: EventApi.event_create_bulk ...'
      end
      # verify the required parameter 'tenant' is set
      if @api_client.config.client_side_validation && tenant.nil?
        fail ArgumentError, "Missing the required parameter 'tenant' when calling EventApi.event_create_bulk"
      end
      if @api_client.config.client_side_validation && tenant.to_s.length > 36
        fail ArgumentError, 'invalid value for "tenant" when calling EventApi.event_create_bulk, the character length must be smaller than or equal to 36.'
      end

      if @api_client.config.client_side_validation && tenant.to_s.length < 36
        fail ArgumentError, 'invalid value for "tenant" when calling EventApi.event_create_bulk, the character length must be greater than or equal to 36.'
      end

      # verify the required parameter 'bulk_create_event_request' is set
      if @api_client.config.client_side_validation && bulk_create_event_request.nil?
        fail ArgumentError, "Missing the required parameter 'bulk_create_event_request' when calling EventApi.event_create_bulk"
      end
      # resource path
      local_var_path = '/api/v1/tenants/{tenant}/events/bulk'.sub('{' + 'tenant' + '}', CGI.escape(tenant.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']) unless header_params['Accept']
      # 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(bulk_create_event_request)

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

      # auth_names
      auth_names = opts[:debug_auth_names] || ['cookieAuth', 'bearerAuth']

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

    # Get event data
    # Get the data for an event.
    # @param event [String] The event id
    # @param [Hash] opts the optional parameters
    # @return [EventData]
    def event_data_get(event, opts = {})
      data, _status_code, _headers = event_data_get_with_http_info(event, opts)
      data
    end

    # Get event data
    # Get the data for an event.
    # @param event [String] The event id
    # @param [Hash] opts the optional parameters
    # @return [Array<(EventData, Integer, Hash)>] EventData data, response status code and response headers
    def event_data_get_with_http_info(event, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: EventApi.event_data_get ...'
      end
      # verify the required parameter 'event' is set
      if @api_client.config.client_side_validation && event.nil?
        fail ArgumentError, "Missing the required parameter 'event' when calling EventApi.event_data_get"
      end
      if @api_client.config.client_side_validation && event.to_s.length > 36
        fail ArgumentError, 'invalid value for "event" when calling EventApi.event_data_get, the character length must be smaller than or equal to 36.'
      end

      if @api_client.config.client_side_validation && event.to_s.length < 36
        fail ArgumentError, 'invalid value for "event" when calling EventApi.event_data_get, the character length must be greater than or equal to 36.'
      end

      # resource path
      local_var_path = '/api/v1/events/{event}/data'.sub('{' + 'event' + '}', CGI.escape(event.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']) unless header_params['Accept']

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

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

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

      # auth_names
      auth_names = opts[:debug_auth_names] || ['cookieAuth', 'bearerAuth']

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

    # Get event data
    # Get the data for an event.
    # @param event_with_tenant [String] The event id
    # @param tenant [String] The tenant id
    # @param [Hash] opts the optional parameters
    # @return [EventData]
    def event_data_get_with_tenant(event_with_tenant, tenant, opts = {})
      data, _status_code, _headers = event_data_get_with_tenant_with_http_info(event_with_tenant, tenant, opts)
      data
    end

    # Get event data
    # Get the data for an event.
    # @param event_with_tenant [String] The event id
    # @param tenant [String] The tenant id
    # @param [Hash] opts the optional parameters
    # @return [Array<(EventData, Integer, Hash)>] EventData data, response status code and response headers
    def event_data_get_with_tenant_with_http_info(event_with_tenant, tenant, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: EventApi.event_data_get_with_tenant ...'
      end
      # verify the required parameter 'event_with_tenant' is set
      if @api_client.config.client_side_validation && event_with_tenant.nil?
        fail ArgumentError, "Missing the required parameter 'event_with_tenant' when calling EventApi.event_data_get_with_tenant"
      end
      if @api_client.config.client_side_validation && event_with_tenant.to_s.length > 36
        fail ArgumentError, 'invalid value for "event_with_tenant" when calling EventApi.event_data_get_with_tenant, the character length must be smaller than or equal to 36.'
      end

      if @api_client.config.client_side_validation && event_with_tenant.to_s.length < 36
        fail ArgumentError, 'invalid value for "event_with_tenant" when calling EventApi.event_data_get_with_tenant, the character length must be greater than or equal to 36.'
      end

      # verify the required parameter 'tenant' is set
      if @api_client.config.client_side_validation && tenant.nil?
        fail ArgumentError, "Missing the required parameter 'tenant' when calling EventApi.event_data_get_with_tenant"
      end
      if @api_client.config.client_side_validation && tenant.to_s.length > 36
        fail ArgumentError, 'invalid value for "tenant" when calling EventApi.event_data_get_with_tenant, the character length must be smaller than or equal to 36.'
      end

      if @api_client.config.client_side_validation && tenant.to_s.length < 36
        fail ArgumentError, 'invalid value for "tenant" when calling EventApi.event_data_get_with_tenant, the character length must be greater than or equal to 36.'
      end

      # resource path
      local_var_path = '/api/v1/tenants/{tenant}/events/{event-with-tenant}/data'.sub('{' + 'event-with-tenant' + '}', CGI.escape(event_with_tenant.to_s)).sub('{' + 'tenant' + '}', CGI.escape(tenant.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']) unless header_params['Accept']

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

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

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

      # auth_names
      auth_names = opts[:debug_auth_names] || ['cookieAuth', 'bearerAuth']

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

    # Get event data
    # Get an event.
    # @param event [String] The event id
    # @param [Hash] opts the optional parameters
    # @return [Event]
    def event_get(event, opts = {})
      data, _status_code, _headers = event_get_with_http_info(event, opts)
      data
    end

    # Get event data
    # Get an event.
    # @param event [String] The event id
    # @param [Hash] opts the optional parameters
    # @return [Array<(Event, Integer, Hash)>] Event data, response status code and response headers
    def event_get_with_http_info(event, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: EventApi.event_get ...'
      end
      # verify the required parameter 'event' is set
      if @api_client.config.client_side_validation && event.nil?
        fail ArgumentError, "Missing the required parameter 'event' when calling EventApi.event_get"
      end
      if @api_client.config.client_side_validation && event.to_s.length > 36
        fail ArgumentError, 'invalid value for "event" when calling EventApi.event_get, the character length must be smaller than or equal to 36.'
      end

      if @api_client.config.client_side_validation && event.to_s.length < 36
        fail ArgumentError, 'invalid value for "event" when calling EventApi.event_get, the character length must be greater than or equal to 36.'
      end

      # resource path
      local_var_path = '/api/v1/events/{event}'.sub('{' + 'event' + '}', CGI.escape(event.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']) unless header_params['Accept']

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

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

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

      # auth_names
      auth_names = opts[:debug_auth_names] || ['cookieAuth', 'bearerAuth']

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

    # List event keys
    # Lists all event keys for a tenant.
    # @param tenant [String] The tenant id
    # @param [Hash] opts the optional parameters
    # @return [EventKeyList]
    def event_key_list(tenant, opts = {})
      data, _status_code, _headers = event_key_list_with_http_info(tenant, opts)
      data
    end

    # List event keys
    # Lists all event keys for a tenant.
    # @param tenant [String] The tenant id
    # @param [Hash] opts the optional parameters
    # @return [Array<(EventKeyList, Integer, Hash)>] EventKeyList data, response status code and response headers
    def event_key_list_with_http_info(tenant, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: EventApi.event_key_list ...'
      end
      # verify the required parameter 'tenant' is set
      if @api_client.config.client_side_validation && tenant.nil?
        fail ArgumentError, "Missing the required parameter 'tenant' when calling EventApi.event_key_list"
      end
      if @api_client.config.client_side_validation && tenant.to_s.length > 36
        fail ArgumentError, 'invalid value for "tenant" when calling EventApi.event_key_list, the character length must be smaller than or equal to 36.'
      end

      if @api_client.config.client_side_validation && tenant.to_s.length < 36
        fail ArgumentError, 'invalid value for "tenant" when calling EventApi.event_key_list, the character length must be greater than or equal to 36.'
      end

      # resource path
      local_var_path = '/api/v1/tenants/{tenant}/events/keys'.sub('{' + 'tenant' + '}', CGI.escape(tenant.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']) unless header_params['Accept']

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

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

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

      # auth_names
      auth_names = opts[:debug_auth_names] || ['cookieAuth', 'bearerAuth']

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

    # List events
    # Lists all events for a tenant.
    # @param tenant [String] The tenant id
    # @param [Hash] opts the optional parameters
    # @option opts [Integer] :offset The number to skip
    # @option opts [Integer] :limit The number to limit by
    # @option opts [Array<String>] :keys A list of keys to filter by
    # @option opts [Array<String>] :workflows A list of workflow IDs to filter by
    # @option opts [Array<WorkflowRunStatus>] :statuses A list of workflow run statuses to filter by
    # @option opts [String] :search The search query to filter for
    # @option opts [EventOrderByField] :order_by_field What to order by
    # @option opts [EventOrderByDirection] :order_by_direction The order direction
    # @option opts [Array<String>] :additional_metadata A list of metadata key value pairs to filter by
    # @option opts [Array<String>] :event_ids A list of event ids to filter by
    # @return [EventList]
    def event_list(tenant, opts = {})
      data, _status_code, _headers = event_list_with_http_info(tenant, opts)
      data
    end

    # List events
    # Lists all events for a tenant.
    # @param tenant [String] The tenant id
    # @param [Hash] opts the optional parameters
    # @option opts [Integer] :offset The number to skip
    # @option opts [Integer] :limit The number to limit by
    # @option opts [Array<String>] :keys A list of keys to filter by
    # @option opts [Array<String>] :workflows A list of workflow IDs to filter by
    # @option opts [Array<WorkflowRunStatus>] :statuses A list of workflow run statuses to filter by
    # @option opts [String] :search The search query to filter for
    # @option opts [EventOrderByField] :order_by_field What to order by
    # @option opts [EventOrderByDirection] :order_by_direction The order direction
    # @option opts [Array<String>] :additional_metadata A list of metadata key value pairs to filter by
    # @option opts [Array<String>] :event_ids A list of event ids to filter by
    # @return [Array<(EventList, Integer, Hash)>] EventList data, response status code and response headers
    def event_list_with_http_info(tenant, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: EventApi.event_list ...'
      end
      # verify the required parameter 'tenant' is set
      if @api_client.config.client_side_validation && tenant.nil?
        fail ArgumentError, "Missing the required parameter 'tenant' when calling EventApi.event_list"
      end
      if @api_client.config.client_side_validation && tenant.to_s.length > 36
        fail ArgumentError, 'invalid value for "tenant" when calling EventApi.event_list, the character length must be smaller than or equal to 36.'
      end

      if @api_client.config.client_side_validation && tenant.to_s.length < 36
        fail ArgumentError, 'invalid value for "tenant" when calling EventApi.event_list, the character length must be greater than or equal to 36.'
      end

      # resource path
      local_var_path = '/api/v1/tenants/{tenant}/events'.sub('{' + 'tenant' + '}', CGI.escape(tenant.to_s))

      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
      query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
      query_params[:'keys'] = @api_client.build_collection_param(opts[:'keys'], :multi) if !opts[:'keys'].nil?
      query_params[:'workflows'] = @api_client.build_collection_param(opts[:'workflows'], :multi) if !opts[:'workflows'].nil?
      query_params[:'statuses'] = @api_client.build_collection_param(opts[:'statuses'], :multi) if !opts[:'statuses'].nil?
      query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
      query_params[:'orderByField'] = opts[:'order_by_field'] if !opts[:'order_by_field'].nil?
      query_params[:'orderByDirection'] = opts[:'order_by_direction'] if !opts[:'order_by_direction'].nil?
      query_params[:'additionalMetadata'] = @api_client.build_collection_param(opts[:'additional_metadata'], :multi) if !opts[:'additional_metadata'].nil?
      query_params[:'eventIds'] = @api_client.build_collection_param(opts[:'event_ids'], :multi) if !opts[:'event_ids'].nil?

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

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

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

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

      # auth_names
      auth_names = opts[:debug_auth_names] || ['cookieAuth', 'bearerAuth']

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

    # Replay events
    # Cancels all runs for a list of events.
    # @param tenant [String] The tenant id
    # @param cancel_event_request [CancelEventRequest] The event ids to replay
    # @param [Hash] opts the optional parameters
    # @return [EventUpdateCancel200Response]
    def event_update_cancel(tenant, cancel_event_request, opts = {})
      data, _status_code, _headers = event_update_cancel_with_http_info(tenant, cancel_event_request, opts)
      data
    end

    # Replay events
    # Cancels all runs for a list of events.
    # @param tenant [String] The tenant id
    # @param cancel_event_request [CancelEventRequest] The event ids to replay
    # @param [Hash] opts the optional parameters
    # @return [Array<(EventUpdateCancel200Response, Integer, Hash)>] EventUpdateCancel200Response data, response status code and response headers
    def event_update_cancel_with_http_info(tenant, cancel_event_request, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: EventApi.event_update_cancel ...'
      end
      # verify the required parameter 'tenant' is set
      if @api_client.config.client_side_validation && tenant.nil?
        fail ArgumentError, "Missing the required parameter 'tenant' when calling EventApi.event_update_cancel"
      end
      if @api_client.config.client_side_validation && tenant.to_s.length > 36
        fail ArgumentError, 'invalid value for "tenant" when calling EventApi.event_update_cancel, the character length must be smaller than or equal to 36.'
      end

      if @api_client.config.client_side_validation && tenant.to_s.length < 36
        fail ArgumentError, 'invalid value for "tenant" when calling EventApi.event_update_cancel, the character length must be greater than or equal to 36.'
      end

      # verify the required parameter 'cancel_event_request' is set
      if @api_client.config.client_side_validation && cancel_event_request.nil?
        fail ArgumentError, "Missing the required parameter 'cancel_event_request' when calling EventApi.event_update_cancel"
      end
      # resource path
      local_var_path = '/api/v1/tenants/{tenant}/events/cancel'.sub('{' + 'tenant' + '}', CGI.escape(tenant.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']) unless header_params['Accept']
      # 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(cancel_event_request)

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

      # auth_names
      auth_names = opts[:debug_auth_names] || ['cookieAuth', 'bearerAuth']

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

    # Replay events
    # Replays a list of events.
    # @param tenant [String] The tenant id
    # @param replay_event_request [ReplayEventRequest] The event ids to replay
    # @param [Hash] opts the optional parameters
    # @return [EventList]
    def event_update_replay(tenant, replay_event_request, opts = {})
      data, _status_code, _headers = event_update_replay_with_http_info(tenant, replay_event_request, opts)
      data
    end

    # Replay events
    # Replays a list of events.
    # @param tenant [String] The tenant id
    # @param replay_event_request [ReplayEventRequest] The event ids to replay
    # @param [Hash] opts the optional parameters
    # @return [Array<(EventList, Integer, Hash)>] EventList data, response status code and response headers
    def event_update_replay_with_http_info(tenant, replay_event_request, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: EventApi.event_update_replay ...'
      end
      # verify the required parameter 'tenant' is set
      if @api_client.config.client_side_validation && tenant.nil?
        fail ArgumentError, "Missing the required parameter 'tenant' when calling EventApi.event_update_replay"
      end
      if @api_client.config.client_side_validation && tenant.to_s.length > 36
        fail ArgumentError, 'invalid value for "tenant" when calling EventApi.event_update_replay, the character length must be smaller than or equal to 36.'
      end

      if @api_client.config.client_side_validation && tenant.to_s.length < 36
        fail ArgumentError, 'invalid value for "tenant" when calling EventApi.event_update_replay, the character length must be greater than or equal to 36.'
      end

      # verify the required parameter 'replay_event_request' is set
      if @api_client.config.client_side_validation && replay_event_request.nil?
        fail ArgumentError, "Missing the required parameter 'replay_event_request' when calling EventApi.event_update_replay"
      end
      # resource path
      local_var_path = '/api/v1/tenants/{tenant}/events/replay'.sub('{' + 'tenant' + '}', CGI.escape(tenant.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']) unless header_params['Accept']
      # 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(replay_event_request)

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

      # auth_names
      auth_names = opts[:debug_auth_names] || ['cookieAuth', 'bearerAuth']

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

    # Get events
    # Get an event by its id
    # @param tenant [String] The tenant id
    # @param v1_event [String] The event id
    # @param [Hash] opts the optional parameters
    # @return [V1Event]
    def v1_event_get(tenant, v1_event, opts = {})
      data, _status_code, _headers = v1_event_get_with_http_info(tenant, v1_event, opts)
      data
    end

    # Get events
    # Get an event by its id
    # @param tenant [String] The tenant id
    # @param v1_event [String] The event id
    # @param [Hash] opts the optional parameters
    # @return [Array<(V1Event, Integer, Hash)>] V1Event data, response status code and response headers
    def v1_event_get_with_http_info(tenant, v1_event, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: EventApi.v1_event_get ...'
      end
      # verify the required parameter 'tenant' is set
      if @api_client.config.client_side_validation && tenant.nil?
        fail ArgumentError, "Missing the required parameter 'tenant' when calling EventApi.v1_event_get"
      end
      if @api_client.config.client_side_validation && tenant.to_s.length > 36
        fail ArgumentError, 'invalid value for "tenant" when calling EventApi.v1_event_get, the character length must be smaller than or equal to 36.'
      end

      if @api_client.config.client_side_validation && tenant.to_s.length < 36
        fail ArgumentError, 'invalid value for "tenant" when calling EventApi.v1_event_get, the character length must be greater than or equal to 36.'
      end

      # verify the required parameter 'v1_event' is set
      if @api_client.config.client_side_validation && v1_event.nil?
        fail ArgumentError, "Missing the required parameter 'v1_event' when calling EventApi.v1_event_get"
      end
      if @api_client.config.client_side_validation && v1_event.to_s.length > 36
        fail ArgumentError, 'invalid value for "v1_event" when calling EventApi.v1_event_get, the character length must be smaller than or equal to 36.'
      end

      if @api_client.config.client_side_validation && v1_event.to_s.length < 36
        fail ArgumentError, 'invalid value for "v1_event" when calling EventApi.v1_event_get, the character length must be greater than or equal to 36.'
      end

      # resource path
      local_var_path = '/api/v1/stable/tenants/{tenant}/events/{v1-event}'.sub('{' + 'tenant' + '}', CGI.escape(tenant.to_s)).sub('{' + 'v1-event' + '}', CGI.escape(v1_event.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']) unless header_params['Accept']

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

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

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

      # auth_names
      auth_names = opts[:debug_auth_names] || ['cookieAuth', 'bearerAuth']

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

    # List event keys
    # Lists all event keys for a tenant.
    # @param tenant [String] The tenant id
    # @param [Hash] opts the optional parameters
    # @return [EventKeyList]
    def v1_event_key_list(tenant, opts = {})
      data, _status_code, _headers = v1_event_key_list_with_http_info(tenant, opts)
      data
    end

    # List event keys
    # Lists all event keys for a tenant.
    # @param tenant [String] The tenant id
    # @param [Hash] opts the optional parameters
    # @return [Array<(EventKeyList, Integer, Hash)>] EventKeyList data, response status code and response headers
    def v1_event_key_list_with_http_info(tenant, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: EventApi.v1_event_key_list ...'
      end
      # verify the required parameter 'tenant' is set
      if @api_client.config.client_side_validation && tenant.nil?
        fail ArgumentError, "Missing the required parameter 'tenant' when calling EventApi.v1_event_key_list"
      end
      if @api_client.config.client_side_validation && tenant.to_s.length > 36
        fail ArgumentError, 'invalid value for "tenant" when calling EventApi.v1_event_key_list, the character length must be smaller than or equal to 36.'
      end

      if @api_client.config.client_side_validation && tenant.to_s.length < 36
        fail ArgumentError, 'invalid value for "tenant" when calling EventApi.v1_event_key_list, the character length must be greater than or equal to 36.'
      end

      # resource path
      local_var_path = '/api/v1/stable/tenants/{tenant}/events/keys'.sub('{' + 'tenant' + '}', CGI.escape(tenant.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']) unless header_params['Accept']

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

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

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

      # auth_names
      auth_names = opts[:debug_auth_names] || ['cookieAuth', 'bearerAuth']

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

    # List events
    # Lists all events for a tenant.
    # @param tenant [String] The tenant id
    # @param [Hash] opts the optional parameters
    # @option opts [Integer] :offset The number to skip
    # @option opts [Integer] :limit The number to limit by
    # @option opts [Array<String>] :keys A list of keys to filter by
    # @option opts [Time] :since Consider events that occurred after this time
    # @option opts [Time] :_until Consider events that occurred before this time
    # @option opts [Array<String>] :workflow_ids Filter to events that are associated with a specific workflow run
    # @option opts [Array<V1TaskStatus>] :workflow_run_statuses Filter to events that are associated with workflow runs matching a certain status
    # @option opts [Array<String>] :event_ids Filter to specific events by their ids
    # @option opts [Array<String>] :additional_metadata Filter by additional metadata on the events
    # @option opts [Array<String>] :scopes The scopes to filter by
    # @return [V1EventList]
    def v1_event_list(tenant, opts = {})
      data, _status_code, _headers = v1_event_list_with_http_info(tenant, opts)
      data
    end

    # List events
    # Lists all events for a tenant.
    # @param tenant [String] The tenant id
    # @param [Hash] opts the optional parameters
    # @option opts [Integer] :offset The number to skip
    # @option opts [Integer] :limit The number to limit by
    # @option opts [Array<String>] :keys A list of keys to filter by
    # @option opts [Time] :since Consider events that occurred after this time
    # @option opts [Time] :_until Consider events that occurred before this time
    # @option opts [Array<String>] :workflow_ids Filter to events that are associated with a specific workflow run
    # @option opts [Array<V1TaskStatus>] :workflow_run_statuses Filter to events that are associated with workflow runs matching a certain status
    # @option opts [Array<String>] :event_ids Filter to specific events by their ids
    # @option opts [Array<String>] :additional_metadata Filter by additional metadata on the events
    # @option opts [Array<String>] :scopes The scopes to filter by
    # @return [Array<(V1EventList, Integer, Hash)>] V1EventList data, response status code and response headers
    def v1_event_list_with_http_info(tenant, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: EventApi.v1_event_list ...'
      end
      # verify the required parameter 'tenant' is set
      if @api_client.config.client_side_validation && tenant.nil?
        fail ArgumentError, "Missing the required parameter 'tenant' when calling EventApi.v1_event_list"
      end
      if @api_client.config.client_side_validation && tenant.to_s.length > 36
        fail ArgumentError, 'invalid value for "tenant" when calling EventApi.v1_event_list, the character length must be smaller than or equal to 36.'
      end

      if @api_client.config.client_side_validation && tenant.to_s.length < 36
        fail ArgumentError, 'invalid value for "tenant" when calling EventApi.v1_event_list, the character length must be greater than or equal to 36.'
      end

      # resource path
      local_var_path = '/api/v1/stable/tenants/{tenant}/events'.sub('{' + 'tenant' + '}', CGI.escape(tenant.to_s))

      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
      query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
      query_params[:'keys'] = @api_client.build_collection_param(opts[:'keys'], :multi) if !opts[:'keys'].nil?
      query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
      query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
      query_params[:'workflowIds'] = @api_client.build_collection_param(opts[:'workflow_ids'], :multi) if !opts[:'workflow_ids'].nil?
      query_params[:'workflowRunStatuses'] = @api_client.build_collection_param(opts[:'workflow_run_statuses'], :multi) if !opts[:'workflow_run_statuses'].nil?
      query_params[:'eventIds'] = @api_client.build_collection_param(opts[:'event_ids'], :multi) if !opts[:'event_ids'].nil?
      query_params[:'additionalMetadata'] = @api_client.build_collection_param(opts[:'additional_metadata'], :multi) if !opts[:'additional_metadata'].nil?
      query_params[:'scopes'] = @api_client.build_collection_param(opts[:'scopes'], :multi) if !opts[:'scopes'].nil?

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

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

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

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

      # auth_names
      auth_names = opts[:debug_auth_names] || ['cookieAuth', 'bearerAuth']

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