Class: Zernio::LogsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zernio-sdk/api/logs_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ LogsApi

Returns a new instance of LogsApi.



19
20
21
# File 'lib/zernio-sdk/api/logs_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/zernio-sdk/api/logs_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#list_logs(opts = {}) ⇒ ListLogs200Response

List activity logs Unified logs endpoint. Returns logs for publishing, connections, webhooks, and messaging. Filter by type, platform, status, and time range. Logs are retained for 90 days.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :type (String)

    Log category to query. Use `all` for the unified view across every category, or `api_request` for your API request logs (method, path, status, latency). (default to 'publishing')

  • :status (String)

    Filter by status

  • :platform (String)

    Filter by platform

  • :action (String)

    Filter by action (e.g., post.published, message.sent, account.connected, webhook.delivered)

  • :search (String)

    Free-text search across log fields

  • :days (Integer)

    Number of days to look back (max 90) (default to 90)

  • :limit (Integer)

    Maximum number of logs to return (max 100) (default to 50)

  • :skip (Integer)

    Number of logs to skip (for pagination) (default to 0)

  • :account_id (String)

    Filter by connected account ID

  • :event (String)

    Filter webhook logs by event (e.g. post.published, message.received)

  • :request_id (String)

    Correlation ID — returns every log spawned by a single API request

  • :from (Time)

    Precise start instant (ISO 8601); narrows within the day range

  • :to (Time)

    Precise end instant (ISO 8601)

  • :status_code (Integer)

    Filter by exact HTTP status code (api_request logs)

  • :api_key_id (String)

    Filter by the API key that made the request (api_request logs)

  • :include_read_receipts (Boolean)

    Include message.read / message.delivered events (hidden by default for messaging logs) (default to false)

Returns:



42
43
44
45
# File 'lib/zernio-sdk/api/logs_api.rb', line 42

def list_logs(opts = {})
  data, _status_code, _headers = list_logs_with_http_info(opts)
  data
end

#list_logs_with_http_info(opts = {}) ⇒ Array<(ListLogs200Response, Integer, Hash)>

List activity logs Unified logs endpoint. Returns logs for publishing, connections, webhooks, and messaging. Filter by type, platform, status, and time range. Logs are retained for 90 days.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :type (String)

    Log category to query. Use `all` for the unified view across every category, or `api_request` for your API request logs (method, path, status, latency). (default to 'publishing')

  • :status (String)

    Filter by status

  • :platform (String)

    Filter by platform

  • :action (String)

    Filter by action (e.g., post.published, message.sent, account.connected, webhook.delivered)

  • :search (String)

    Free-text search across log fields

  • :days (Integer)

    Number of days to look back (max 90) (default to 90)

  • :limit (Integer)

    Maximum number of logs to return (max 100) (default to 50)

  • :skip (Integer)

    Number of logs to skip (for pagination) (default to 0)

  • :account_id (String)

    Filter by connected account ID

  • :event (String)

    Filter webhook logs by event (e.g. post.published, message.received)

  • :request_id (String)

    Correlation ID — returns every log spawned by a single API request

  • :from (Time)

    Precise start instant (ISO 8601); narrows within the day range

  • :to (Time)

    Precise end instant (ISO 8601)

  • :status_code (Integer)

    Filter by exact HTTP status code (api_request logs)

  • :api_key_id (String)

    Filter by the API key that made the request (api_request logs)

  • :include_read_receipts (Boolean)

    Include message.read / message.delivered events (hidden by default for messaging logs) (default to false)

Returns:

  • (Array<(ListLogs200Response, Integer, Hash)>)

    ListLogs200Response data, response status code and response headers



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/zernio-sdk/api/logs_api.rb', line 67

def list_logs_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LogsApi.list_logs ...'
  end
  allowable_values = ["all", "publishing", "connections", "webhooks", "messaging", "workflow_event", "api_request"]
  if @api_client.config.client_side_validation && opts[:'type'] && !allowable_values.include?(opts[:'type'])
    fail ArgumentError, "invalid value for \"type\", must be one of #{allowable_values}"
  end
  allowable_values = ["success", "failed", "pending", "skipped", "all"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  allowable_values = ["tiktok", "instagram", "whatsapp", "facebook", "youtube", "linkedin", "twitter", "threads", "pinterest", "reddit", "bluesky", "googlebusiness", "telegram", "snapchat", "all"]
  if @api_client.config.client_side_validation && opts[:'platform'] && !allowable_values.include?(opts[:'platform'])
    fail ArgumentError, "invalid value for \"platform\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'days'].nil? && opts[:'days'] > 90
    fail ArgumentError, 'invalid value for "opts[:"days"]" when calling LogsApi.list_logs, must be smaller than or equal to 90.'
  end

  if @api_client.config.client_side_validation && !opts[:'days'].nil? && opts[:'days'] < 1
    fail ArgumentError, 'invalid value for "opts[:"days"]" when calling LogsApi.list_logs, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling LogsApi.list_logs, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling LogsApi.list_logs, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'skip'].nil? && opts[:'skip'] < 0
    fail ArgumentError, 'invalid value for "opts[:"skip"]" when calling LogsApi.list_logs, must be greater than or equal to 0.'
  end

  # resource path
  local_var_path = '/v1/logs'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
  query_params[:'action'] = opts[:'action'] if !opts[:'action'].nil?
  query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
  query_params[:'days'] = opts[:'days'] if !opts[:'days'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
  query_params[:'account_id'] = opts[:'account_id'] if !opts[:'account_id'].nil?
  query_params[:'event'] = opts[:'event'] if !opts[:'event'].nil?
  query_params[:'request_id'] = opts[:'request_id'] if !opts[:'request_id'].nil?
  query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
  query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
  query_params[:'status_code'] = opts[:'status_code'] if !opts[:'status_code'].nil?
  query_params[:'api_key_id'] = opts[:'api_key_id'] if !opts[:'api_key_id'].nil?
  query_params[:'include_read_receipts'] = opts[:'include_read_receipts'] if !opts[:'include_read_receipts'].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] || 'ListLogs200Response'

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

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