Class: Svix::StatisticsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/svix/api/statistics_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ StatisticsApi

Returns a new instance of StatisticsApi.



19
20
21
# File 'lib/svix/api/statistics_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/svix/api/statistics_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#v1_statistics_aggregate_app_stats(app_usage_stats_in, opts = {}) ⇒ AppUsageStatsOut

Aggregate App Stats Creates a background task to calculate the message destinations for all applications in the environment. Note that this endpoint is asynchronous. You will need to poll the ‘Get Background Task` endpoint to retrieve the results of the operation.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :idempotency_key (String)

    The request's idempotency key

Returns:



28
29
30
31
# File 'lib/svix/api/statistics_api.rb', line 28

def v1_statistics_aggregate_app_stats(app_usage_stats_in, opts = {})
  data, _status_code, _headers = v1_statistics_aggregate_app_stats_with_http_info(app_usage_stats_in, opts)
  data
end

#v1_statistics_aggregate_app_stats_with_http_info(app_usage_stats_in, opts = {}) ⇒ Array<(AppUsageStatsOut, Integer, Hash)>

Aggregate App Stats Creates a background task to calculate the message destinations for all applications in the environment. Note that this endpoint is asynchronous. You will need to poll the &#x60;Get Background Task&#x60; endpoint to retrieve the results of the operation.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :idempotency_key (String)

    The request&#39;s idempotency key

Returns:

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

    AppUsageStatsOut data, response status code and response headers



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/svix/api/statistics_api.rb', line 39

def v1_statistics_aggregate_app_stats_with_http_info(app_usage_stats_in, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: StatisticsApi.v1_statistics_aggregate_app_stats ...'
  end
  # verify the required parameter 'app_usage_stats_in' is set
  if @api_client.config.client_side_validation && app_usage_stats_in.nil?
    fail ArgumentError, "Missing the required parameter 'app_usage_stats_in' when calling StatisticsApi.v1_statistics_aggregate_app_stats"
  end
  # resource path
  local_var_path = '/api/v1/stats/usage/app'

  # 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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'idempotency-key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(app_usage_stats_in)

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

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

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

#v1_statistics_aggregate_event_types(opts = {}) ⇒ AggregateEventTypesOut

Aggregate Event Types Creates a background task to calculate the listed event types for all apps in the organization. Note that this endpoint is asynchronous. You will need to poll the ‘Get Background Task` endpoint to retrieve the results of the operation.

Parameters:

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

    the optional parameters

Returns:



94
95
96
97
# File 'lib/svix/api/statistics_api.rb', line 94

def v1_statistics_aggregate_event_types(opts = {})
  data, _status_code, _headers = v1_statistics_aggregate_event_types_with_http_info(opts)
  data
end

#v1_statistics_aggregate_event_types_with_http_info(opts = {}) ⇒ Array<(AggregateEventTypesOut, Integer, Hash)>

Aggregate Event Types Creates a background task to calculate the listed event types for all apps in the organization. Note that this endpoint is asynchronous. You will need to poll the &#x60;Get Background Task&#x60; endpoint to retrieve the results of the operation.

Parameters:

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

    the optional parameters

Returns:

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

    AggregateEventTypesOut data, response status code and response headers



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
# File 'lib/svix/api/statistics_api.rb', line 103

def v1_statistics_aggregate_event_types_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: StatisticsApi.v1_statistics_aggregate_event_types ...'
  end
  # resource path
  local_var_path = '/api/v1/stats/usage/event-types'

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

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

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

#v1_stats_app_attempts(app_id, opts = {}) ⇒ AttemptStatisticsResponse

Get App Attempt Stats Returns application-level statistics on message attempts

Parameters:

  • app_id (String)

    The app&#39;s ID or UID

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

    the optional parameters

Options Hash (opts):

  • :start_date (Time)

    Filter the range to data starting from this date

  • :end_date (Time)

    Filter the range to data ending by this date

Returns:



154
155
156
157
# File 'lib/svix/api/statistics_api.rb', line 154

def v1_stats_app_attempts(app_id, opts = {})
  data, _status_code, _headers = v1_stats_app_attempts_with_http_info(app_id, opts)
  data
end

#v1_stats_app_attempts_with_http_info(app_id, opts = {}) ⇒ Array<(AttemptStatisticsResponse, Integer, Hash)>

Get App Attempt Stats Returns application-level statistics on message attempts

Parameters:

  • app_id (String)

    The app&#39;s ID or UID

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

    the optional parameters

Options Hash (opts):

  • :start_date (Time)

    Filter the range to data starting from this date

  • :end_date (Time)

    Filter the range to data ending by this date

Returns:

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

    AttemptStatisticsResponse data, response status code and response headers



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'lib/svix/api/statistics_api.rb', line 166

def v1_stats_app_attempts_with_http_info(app_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: StatisticsApi.v1_stats_app_attempts ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling StatisticsApi.v1_stats_app_attempts"
  end
  if @api_client.config.client_side_validation && app_id.to_s.length > 256
    fail ArgumentError, 'invalid value for "app_id" when calling StatisticsApi.v1_stats_app_attempts, the character length must be smaller than or equal to 256.'
  end

  if @api_client.config.client_side_validation && app_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "app_id" when calling StatisticsApi.v1_stats_app_attempts, the character length must be great than or equal to 1.'
  end

  pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
  if @api_client.config.client_side_validation && app_id !~ pattern
    fail ArgumentError, "invalid value for 'app_id' when calling StatisticsApi.v1_stats_app_attempts, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/api/v1/stats/app/{app_id}/attempt'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].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] || 'AttemptStatisticsResponse'

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

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

#v1_stats_endpoint_attempts(app_id, endpoint_id, opts = {}) ⇒ AttemptStatisticsResponse

Get Ep Stats Returns endpoint-level statistics on message attempts

Parameters:

  • app_id (String)

    The app&#39;s ID or UID

  • endpoint_id (String)

    The ep&#39;s ID or UID

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

    the optional parameters

Options Hash (opts):

  • :start_date (Time)

    Filter the range to data starting from this date

  • :end_date (Time)

    Filter the range to data ending by this date

Returns:



237
238
239
240
# File 'lib/svix/api/statistics_api.rb', line 237

def v1_stats_endpoint_attempts(app_id, endpoint_id, opts = {})
  data, _status_code, _headers = v1_stats_endpoint_attempts_with_http_info(app_id, endpoint_id, opts)
  data
end

#v1_stats_endpoint_attempts_with_http_info(app_id, endpoint_id, opts = {}) ⇒ Array<(AttemptStatisticsResponse, Integer, Hash)>

Get Ep Stats Returns endpoint-level statistics on message attempts

Parameters:

  • app_id (String)

    The app&#39;s ID or UID

  • endpoint_id (String)

    The ep&#39;s ID or UID

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

    the optional parameters

Options Hash (opts):

  • :start_date (Time)

    Filter the range to data starting from this date

  • :end_date (Time)

    Filter the range to data ending by this date

Returns:

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

    AttemptStatisticsResponse data, response status code and response headers



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/svix/api/statistics_api.rb', line 250

def v1_stats_endpoint_attempts_with_http_info(app_id, endpoint_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: StatisticsApi.v1_stats_endpoint_attempts ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling StatisticsApi.v1_stats_endpoint_attempts"
  end
  if @api_client.config.client_side_validation && app_id.to_s.length > 256
    fail ArgumentError, 'invalid value for "app_id" when calling StatisticsApi.v1_stats_endpoint_attempts, the character length must be smaller than or equal to 256.'
  end

  if @api_client.config.client_side_validation && app_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "app_id" when calling StatisticsApi.v1_stats_endpoint_attempts, the character length must be great than or equal to 1.'
  end

  pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
  if @api_client.config.client_side_validation && app_id !~ pattern
    fail ArgumentError, "invalid value for 'app_id' when calling StatisticsApi.v1_stats_endpoint_attempts, must conform to the pattern #{pattern}."
  end

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

  if @api_client.config.client_side_validation && endpoint_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "endpoint_id" when calling StatisticsApi.v1_stats_endpoint_attempts, the character length must be great than or equal to 1.'
  end

  pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
  if @api_client.config.client_side_validation && endpoint_id !~ pattern
    fail ArgumentError, "invalid value for 'endpoint_id' when calling StatisticsApi.v1_stats_endpoint_attempts, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/api/v1/stats/app/{app_id}/ep/{endpoint_id}/attempt'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'endpoint_id' + '}', CGI.escape(endpoint_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].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] || 'AttemptStatisticsResponse'

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

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