svix 0.28.0 → 0.37.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +7 -1
  3. data/README.md +16 -3
  4. data/lib/svix/api/application_api.rb +386 -0
  5. data/lib/svix/api/authentication_api.rb +155 -0
  6. data/lib/svix/api/endpoint_api.rb +1281 -0
  7. data/lib/svix/api/event_type_api.rb +454 -0
  8. data/lib/svix/api/health_api.rb +77 -0
  9. data/lib/svix/api/message_api.rb +289 -0
  10. data/lib/svix/api/message_attempt_api.rb +678 -0
  11. data/lib/svix/api/statistics_api.rb +205 -0
  12. data/lib/svix/api_client.rb +399 -0
  13. data/lib/svix/api_error.rb +57 -0
  14. data/lib/svix/application_api.rb +29 -0
  15. data/lib/svix/authentication_api.rb +17 -0
  16. data/lib/svix/configuration.rb +277 -0
  17. data/lib/svix/endpoint_api.rb +55 -0
  18. data/{src → lib}/svix/errors.rb +0 -0
  19. data/lib/svix/event_type_api.rb +25 -0
  20. data/lib/svix/internal.rb +16 -0
  21. data/lib/svix/message_api.rb +21 -0
  22. data/lib/svix/message_attempt_api.rb +33 -0
  23. data/lib/svix/models/application_in.rb +277 -0
  24. data/lib/svix/models/application_out.rb +319 -0
  25. data/lib/svix/models/attempt_statistics_data.rb +231 -0
  26. data/lib/svix/models/attempt_statistics_response.rb +265 -0
  27. data/lib/svix/models/dashboard_access_out.rb +265 -0
  28. data/lib/svix/models/endpoint_created_event.rb +269 -0
  29. data/lib/svix/models/endpoint_created_event_data.rb +282 -0
  30. data/lib/svix/models/endpoint_deleted_event.rb +269 -0
  31. data/lib/svix/models/endpoint_deleted_event_data.rb +282 -0
  32. data/lib/svix/models/endpoint_disabled_event.rb +269 -0
  33. data/lib/svix/models/endpoint_disabled_event_data.rb +296 -0
  34. data/lib/svix/models/endpoint_headers_in.rb +225 -0
  35. data/lib/svix/models/endpoint_headers_out.rb +252 -0
  36. data/lib/svix/models/endpoint_in.rb +394 -0
  37. data/lib/svix/models/endpoint_message_out.rb +363 -0
  38. data/lib/svix/models/endpoint_out.rb +409 -0
  39. data/lib/svix/models/endpoint_secret_out.rb +245 -0
  40. data/lib/svix/models/endpoint_secret_rotate_in.rb +236 -0
  41. data/lib/svix/models/endpoint_stats.rb +265 -0
  42. data/lib/svix/models/endpoint_update.rb +367 -0
  43. data/lib/svix/models/endpoint_updated_event.rb +269 -0
  44. data/lib/svix/models/endpoint_updated_event_data.rb +282 -0
  45. data/lib/svix/models/endpointd_updated_event.rb +269 -0
  46. data/lib/svix/models/event_example_in.rb +253 -0
  47. data/lib/svix/models/event_type_example_out.rb +223 -0
  48. data/lib/svix/models/event_type_in.rb +290 -0
  49. data/lib/svix/models/event_type_out.rb +318 -0
  50. data/lib/svix/models/event_type_schema_in.rb +224 -0
  51. data/lib/svix/models/event_type_update.rb +246 -0
  52. data/lib/svix/models/http_error_out.rb +237 -0
  53. data/lib/svix/models/http_validation_error.rb +220 -0
  54. data/lib/svix/models/list_response_application_out.rb +248 -0
  55. data/lib/svix/models/list_response_endpoint_message_out.rb +248 -0
  56. data/lib/svix/models/list_response_endpoint_out.rb +248 -0
  57. data/lib/svix/models/list_response_event_type_out.rb +248 -0
  58. data/lib/svix/models/list_response_message_attempt_endpoint_out.rb +248 -0
  59. data/lib/svix/models/list_response_message_attempt_out.rb +248 -0
  60. data/lib/svix/models/list_response_message_endpoint_out.rb +248 -0
  61. data/lib/svix/models/list_response_message_out.rb +248 -0
  62. data/lib/svix/models/message_attempt_endpoint_out.rb +293 -0
  63. data/lib/svix/models/message_attempt_exhausted_event.rb +269 -0
  64. data/lib/svix/models/message_attempt_exhausted_event_data.rb +310 -0
  65. data/lib/svix/models/message_attempt_failed_event.rb +251 -0
  66. data/lib/svix/models/message_attempt_out.rb +307 -0
  67. data/lib/svix/models/message_attempt_trigger_type.rb +37 -0
  68. data/lib/svix/models/message_endpoint_out.rb +418 -0
  69. data/lib/svix/models/message_in.rb +312 -0
  70. data/lib/svix/models/message_out.rb +340 -0
  71. data/lib/svix/models/message_status.rb +39 -0
  72. data/lib/svix/models/recover_in.rb +223 -0
  73. data/lib/svix/models/statistics_period.rb +37 -0
  74. data/lib/svix/models/validation_error.rb +253 -0
  75. data/lib/svix/models/webhook_types.rb +280 -0
  76. data/lib/svix/svix.rb +43 -0
  77. data/{src → lib}/svix/util.rb +1 -1
  78. data/{src → lib}/svix/version.rb +1 -1
  79. data/{src → lib}/svix/webhook.rb +1 -1
  80. data/lib/svix.rb +80 -0
  81. data/svix.gemspec +16 -6
  82. metadata +100 -9
  83. data/.gitignore +0 -9
  84. data/src/svix.rb +0 -8
@@ -0,0 +1,289 @@
1
+ =begin
2
+ #Svix API
3
+
4
+ #Welcome to the Svix API documentation! Useful links: [Homepage](https://www.svix.com) | [Support email](mailto:support+docs@svix.com) | [Blog](https://www.svix.com/blog/) | [Slack Community](https://www.svix.com/slack/) # Introduction This is the reference documentation and schemas for the [Svix webhook service](https://www.svix.com) API. For tutorials and other documentation please refer to [the documentation](https://docs.svix.com). ## Main concepts In Svix you have four important entities you will be interacting with: - `messages`: these are the webhooks being sent. They can have contents and a few other properties. - `application`: this is where `messages` are sent to. Usually you want to create one application for each of your users. - `endpoint`: endpoints are the URLs messages will be sent to. Each application can have multiple `endpoints` and each message sent to that application will be sent to all of them (unless they are not subscribed to the sent event type). - `event-type`: event types are identifiers denoting the type of the message being sent. Event types are primarily used to decide which events are sent to which endpoint. ## Authentication Get your authentication token (`AUTH_TOKEN`) from the [Svix dashboard](https://dashboard.svix.com) and use it as part of the `Authorization` header as such: `Authorization: Bearer ${AUTH_TOKEN}`. <SecurityDefinitions /> ## Code samples The code samples assume you already have the respective libraries installed and you know how to use them. For the latest information on how to do that, please refer to [the documentation](https://docs.svix.com/). ## Cross-Origin Resource Sharing This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). And that allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.
5
+
6
+ The version of the OpenAPI document: 1.4
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Svix
16
+ class MessageApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create Message
23
+ # Creates a new message and dispatches it to all of the application's endpoints. The `eventId` is an optional custom unique ID. If a message with the same `eventId` already exists for any application in your environment, a 409 conflict error will be returned.
24
+ # @param app_id [String]
25
+ # @param message_in [MessageIn]
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [MessageOut]
28
+ def create_message_api_v1_app_app_id_msg_post(app_id, message_in, opts = {})
29
+ data, _status_code, _headers = create_message_api_v1_app_app_id_msg_post_with_http_info(app_id, message_in, opts)
30
+ data
31
+ end
32
+
33
+ # Create Message
34
+ # Creates a new message and dispatches it to all of the application&#39;s endpoints. The &#x60;eventId&#x60; is an optional custom unique ID. If a message with the same &#x60;eventId&#x60; already exists for any application in your environment, a 409 conflict error will be returned.
35
+ # @param app_id [String]
36
+ # @param message_in [MessageIn]
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<(MessageOut, Integer, Hash)>] MessageOut data, response status code and response headers
39
+ def create_message_api_v1_app_app_id_msg_post_with_http_info(app_id, message_in, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: MessageApi.create_message_api_v1_app_app_id_msg_post ...'
42
+ end
43
+ # verify the required parameter 'app_id' is set
44
+ if @api_client.config.client_side_validation && app_id.nil?
45
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling MessageApi.create_message_api_v1_app_app_id_msg_post"
46
+ end
47
+ if @api_client.config.client_side_validation && app_id.to_s.length > 256
48
+ fail ArgumentError, 'invalid value for "app_id" when calling MessageApi.create_message_api_v1_app_app_id_msg_post, the character length must be smaller than or equal to 256.'
49
+ end
50
+
51
+ if @api_client.config.client_side_validation && app_id.to_s.length < 1
52
+ fail ArgumentError, 'invalid value for "app_id" when calling MessageApi.create_message_api_v1_app_app_id_msg_post, the character length must be great than or equal to 1.'
53
+ end
54
+
55
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
56
+ if @api_client.config.client_side_validation && app_id !~ pattern
57
+ fail ArgumentError, "invalid value for 'app_id' when calling MessageApi.create_message_api_v1_app_app_id_msg_post, must conform to the pattern #{pattern}."
58
+ end
59
+
60
+ # verify the required parameter 'message_in' is set
61
+ if @api_client.config.client_side_validation && message_in.nil?
62
+ fail ArgumentError, "Missing the required parameter 'message_in' when calling MessageApi.create_message_api_v1_app_app_id_msg_post"
63
+ end
64
+ # resource path
65
+ local_var_path = '/api/v1/app/{app_id}/msg/'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
66
+
67
+ # query parameters
68
+ query_params = opts[:query_params] || {}
69
+
70
+ # header parameters
71
+ header_params = opts[:header_params] || {}
72
+ # HTTP header 'Accept' (if needed)
73
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
74
+ # HTTP header 'Content-Type'
75
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
76
+
77
+ # form parameters
78
+ form_params = opts[:form_params] || {}
79
+
80
+ # http body (model)
81
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(message_in)
82
+
83
+ # return_type
84
+ return_type = opts[:debug_return_type] || 'MessageOut'
85
+
86
+ # auth_names
87
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
88
+
89
+ new_options = opts.merge(
90
+ :operation => :"MessageApi.create_message_api_v1_app_app_id_msg_post",
91
+ :header_params => header_params,
92
+ :query_params => query_params,
93
+ :form_params => form_params,
94
+ :body => post_body,
95
+ :auth_names => auth_names,
96
+ :return_type => return_type
97
+ )
98
+
99
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
100
+ if @api_client.config.debugging
101
+ @api_client.config.logger.debug "API called: MessageApi#create_message_api_v1_app_app_id_msg_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
102
+ end
103
+ return data, status_code, headers
104
+ end
105
+
106
+ # Get Message
107
+ # Get a message by its ID or eventID.
108
+ # @param msg_id [String]
109
+ # @param app_id [String]
110
+ # @param [Hash] opts the optional parameters
111
+ # @return [MessageOut]
112
+ def get_message_api_v1_app_app_id_msg_msg_id_get(msg_id, app_id, opts = {})
113
+ data, _status_code, _headers = get_message_api_v1_app_app_id_msg_msg_id_get_with_http_info(msg_id, app_id, opts)
114
+ data
115
+ end
116
+
117
+ # Get Message
118
+ # Get a message by its ID or eventID.
119
+ # @param msg_id [String]
120
+ # @param app_id [String]
121
+ # @param [Hash] opts the optional parameters
122
+ # @return [Array<(MessageOut, Integer, Hash)>] MessageOut data, response status code and response headers
123
+ def get_message_api_v1_app_app_id_msg_msg_id_get_with_http_info(msg_id, app_id, opts = {})
124
+ if @api_client.config.debugging
125
+ @api_client.config.logger.debug 'Calling API: MessageApi.get_message_api_v1_app_app_id_msg_msg_id_get ...'
126
+ end
127
+ # verify the required parameter 'msg_id' is set
128
+ if @api_client.config.client_side_validation && msg_id.nil?
129
+ fail ArgumentError, "Missing the required parameter 'msg_id' when calling MessageApi.get_message_api_v1_app_app_id_msg_msg_id_get"
130
+ end
131
+ if @api_client.config.client_side_validation && msg_id.to_s.length > 256
132
+ fail ArgumentError, 'invalid value for "msg_id" when calling MessageApi.get_message_api_v1_app_app_id_msg_msg_id_get, the character length must be smaller than or equal to 256.'
133
+ end
134
+
135
+ if @api_client.config.client_side_validation && msg_id.to_s.length < 1
136
+ fail ArgumentError, 'invalid value for "msg_id" when calling MessageApi.get_message_api_v1_app_app_id_msg_msg_id_get, the character length must be great than or equal to 1.'
137
+ end
138
+
139
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
140
+ if @api_client.config.client_side_validation && msg_id !~ pattern
141
+ fail ArgumentError, "invalid value for 'msg_id' when calling MessageApi.get_message_api_v1_app_app_id_msg_msg_id_get, must conform to the pattern #{pattern}."
142
+ end
143
+
144
+ # verify the required parameter 'app_id' is set
145
+ if @api_client.config.client_side_validation && app_id.nil?
146
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling MessageApi.get_message_api_v1_app_app_id_msg_msg_id_get"
147
+ end
148
+ if @api_client.config.client_side_validation && app_id.to_s.length > 256
149
+ fail ArgumentError, 'invalid value for "app_id" when calling MessageApi.get_message_api_v1_app_app_id_msg_msg_id_get, the character length must be smaller than or equal to 256.'
150
+ end
151
+
152
+ if @api_client.config.client_side_validation && app_id.to_s.length < 1
153
+ fail ArgumentError, 'invalid value for "app_id" when calling MessageApi.get_message_api_v1_app_app_id_msg_msg_id_get, the character length must be great than or equal to 1.'
154
+ end
155
+
156
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
157
+ if @api_client.config.client_side_validation && app_id !~ pattern
158
+ fail ArgumentError, "invalid value for 'app_id' when calling MessageApi.get_message_api_v1_app_app_id_msg_msg_id_get, must conform to the pattern #{pattern}."
159
+ end
160
+
161
+ # resource path
162
+ local_var_path = '/api/v1/app/{app_id}/msg/{msg_id}/'.sub('{' + 'msg_id' + '}', CGI.escape(msg_id.to_s)).sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
163
+
164
+ # query parameters
165
+ query_params = opts[:query_params] || {}
166
+
167
+ # header parameters
168
+ header_params = opts[:header_params] || {}
169
+ # HTTP header 'Accept' (if needed)
170
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
171
+
172
+ # form parameters
173
+ form_params = opts[:form_params] || {}
174
+
175
+ # http body (model)
176
+ post_body = opts[:debug_body]
177
+
178
+ # return_type
179
+ return_type = opts[:debug_return_type] || 'MessageOut'
180
+
181
+ # auth_names
182
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
183
+
184
+ new_options = opts.merge(
185
+ :operation => :"MessageApi.get_message_api_v1_app_app_id_msg_msg_id_get",
186
+ :header_params => header_params,
187
+ :query_params => query_params,
188
+ :form_params => form_params,
189
+ :body => post_body,
190
+ :auth_names => auth_names,
191
+ :return_type => return_type
192
+ )
193
+
194
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
195
+ if @api_client.config.debugging
196
+ @api_client.config.logger.debug "API called: MessageApi#get_message_api_v1_app_app_id_msg_msg_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
197
+ end
198
+ return data, status_code, headers
199
+ end
200
+
201
+ # List Messages
202
+ # List all of the application's messages. The `before` parameter lets you filter all items created before a certain date and is ignored if an iterator is passed.
203
+ # @param app_id [String]
204
+ # @param [Hash] opts the optional parameters
205
+ # @option opts [String] :iterator
206
+ # @option opts [Integer] :limit (default to 50)
207
+ # @option opts [Array<String>] :event_types
208
+ # @option opts [Time] :before
209
+ # @return [ListResponseMessageOut]
210
+ def list_messages_api_v1_app_app_id_msg_get(app_id, opts = {})
211
+ data, _status_code, _headers = list_messages_api_v1_app_app_id_msg_get_with_http_info(app_id, opts)
212
+ data
213
+ end
214
+
215
+ # List Messages
216
+ # List all of the application&#39;s messages. The &#x60;before&#x60; parameter lets you filter all items created before a certain date and is ignored if an iterator is passed.
217
+ # @param app_id [String]
218
+ # @param [Hash] opts the optional parameters
219
+ # @option opts [String] :iterator
220
+ # @option opts [Integer] :limit
221
+ # @option opts [Array<String>] :event_types
222
+ # @option opts [Time] :before
223
+ # @return [Array<(ListResponseMessageOut, Integer, Hash)>] ListResponseMessageOut data, response status code and response headers
224
+ def list_messages_api_v1_app_app_id_msg_get_with_http_info(app_id, opts = {})
225
+ if @api_client.config.debugging
226
+ @api_client.config.logger.debug 'Calling API: MessageApi.list_messages_api_v1_app_app_id_msg_get ...'
227
+ end
228
+ # verify the required parameter 'app_id' is set
229
+ if @api_client.config.client_side_validation && app_id.nil?
230
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling MessageApi.list_messages_api_v1_app_app_id_msg_get"
231
+ end
232
+ if @api_client.config.client_side_validation && app_id.to_s.length > 256
233
+ fail ArgumentError, 'invalid value for "app_id" when calling MessageApi.list_messages_api_v1_app_app_id_msg_get, the character length must be smaller than or equal to 256.'
234
+ end
235
+
236
+ if @api_client.config.client_side_validation && app_id.to_s.length < 1
237
+ fail ArgumentError, 'invalid value for "app_id" when calling MessageApi.list_messages_api_v1_app_app_id_msg_get, the character length must be great than or equal to 1.'
238
+ end
239
+
240
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
241
+ if @api_client.config.client_side_validation && app_id !~ pattern
242
+ fail ArgumentError, "invalid value for 'app_id' when calling MessageApi.list_messages_api_v1_app_app_id_msg_get, must conform to the pattern #{pattern}."
243
+ end
244
+
245
+ # resource path
246
+ local_var_path = '/api/v1/app/{app_id}/msg/'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
247
+
248
+ # query parameters
249
+ query_params = opts[:query_params] || {}
250
+ query_params[:'iterator'] = opts[:'iterator'] if !opts[:'iterator'].nil?
251
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
252
+ query_params[:'event_types'] = @api_client.build_collection_param(opts[:'event_types'], :multi) if !opts[:'event_types'].nil?
253
+ query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
254
+
255
+ # header parameters
256
+ header_params = opts[:header_params] || {}
257
+ # HTTP header 'Accept' (if needed)
258
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
259
+
260
+ # form parameters
261
+ form_params = opts[:form_params] || {}
262
+
263
+ # http body (model)
264
+ post_body = opts[:debug_body]
265
+
266
+ # return_type
267
+ return_type = opts[:debug_return_type] || 'ListResponseMessageOut'
268
+
269
+ # auth_names
270
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
271
+
272
+ new_options = opts.merge(
273
+ :operation => :"MessageApi.list_messages_api_v1_app_app_id_msg_get",
274
+ :header_params => header_params,
275
+ :query_params => query_params,
276
+ :form_params => form_params,
277
+ :body => post_body,
278
+ :auth_names => auth_names,
279
+ :return_type => return_type
280
+ )
281
+
282
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
283
+ if @api_client.config.debugging
284
+ @api_client.config.logger.debug "API called: MessageApi#list_messages_api_v1_app_app_id_msg_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
285
+ end
286
+ return data, status_code, headers
287
+ end
288
+ end
289
+ end