=begin #HubSpot Events API #API for accessing CRM object events. The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.3.1 =end require 'cgi' module Hubspot module Events class EventsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Returns a collection of events matching a query. # @param [Hash] opts the optional parameters # @option opts [DateTime] :occurred_after The starting time as an ISO 8601 timestamp. # @option opts [DateTime] :occurred_before The ending time as an ISO 8601 timestamp. # @option opts [String] :object_type The type of object being selected. Valid values are hubspot named object types (e.g. `contact`). # @option opts [Integer] :object_id The id of the selected object. If not present, then the `objectProperty` parameter is required. # @option opts [String] :event_type Limits the response to the specified event type. For example `&eventType=e_visited_page` returns only `e_visited_page` events. If not present all event types are returned. # @option opts [String] :after An additional parameter that may be used to get the next `limit` set of results. # @option opts [String] :before # @option opts [Integer] :limit The maximum number of events to return, defaults to 20. # @option opts [Array] :sort Selects the sort field and order. Defaults to ascending, prefix with `-` for descending order. `occurredAt` is the only field supported for sorting. # @return [CollectionResponseExternalUnifiedEvent] def get_page(opts = {}) data, _status_code, _headers = get_page_with_http_info(opts) data end # Returns a collection of events matching a query. # @param [Hash] opts the optional parameters # @option opts [DateTime] :occurred_after The starting time as an ISO 8601 timestamp. # @option opts [DateTime] :occurred_before The ending time as an ISO 8601 timestamp. # @option opts [String] :object_type The type of object being selected. Valid values are hubspot named object types (e.g. `contact`). # @option opts [Integer] :object_id The id of the selected object. If not present, then the `objectProperty` parameter is required. # @option opts [String] :event_type Limits the response to the specified event type. For example `&eventType=e_visited_page` returns only `e_visited_page` events. If not present all event types are returned. # @option opts [String] :after An additional parameter that may be used to get the next `limit` set of results. # @option opts [String] :before # @option opts [Integer] :limit The maximum number of events to return, defaults to 20. # @option opts [Array] :sort Selects the sort field and order. Defaults to ascending, prefix with `-` for descending order. `occurredAt` is the only field supported for sorting. # @return [Array<(CollectionResponseExternalUnifiedEvent, Integer, Hash)>] CollectionResponseExternalUnifiedEvent data, response status code and response headers def get_page_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EventsApi.get_page ...' end # resource path local_var_path = '/events/v3/events' # query parameters query_params = opts[:query_params] || {} query_params[:'occurredAfter'] = opts[:'occurred_after'] if !opts[:'occurred_after'].nil? query_params[:'occurredBefore'] = opts[:'occurred_before'] if !opts[:'occurred_before'].nil? query_params[:'objectType'] = opts[:'object_type'] if !opts[:'object_type'].nil? query_params[:'objectId'] = opts[:'object_id'] if !opts[:'object_id'].nil? query_params[:'eventType'] = opts[:'event_type'] if !opts[:'event_type'].nil? 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? query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].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[:body] # return_type return_type = opts[:return_type] || 'CollectionResponseExternalUnifiedEvent' # auth_names auth_names = opts[:auth_names] || ['hapikey', 'oauth2'] new_options = opts.merge( :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: EventsApi#get_page\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end end