zyphr 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +59 -0
  3. data/docs/BatchPublishWaaSEvents201Response.md +18 -0
  4. data/docs/CreateWaaSApplication201Response.md +18 -0
  5. data/docs/CreateWaaSApplicationRequest.md +22 -0
  6. data/docs/CreateWaaSEndpoint201Response.md +18 -0
  7. data/docs/CreateWaaSEndpointRequest.md +22 -0
  8. data/docs/CreateWaaSEndpointResponse.md +30 -0
  9. data/docs/CreateWaaSEventType201Response.md +18 -0
  10. data/docs/CreateWaaSEventTypeRequest.md +26 -0
  11. data/docs/GenerateWaaSPortalToken201Response.md +18 -0
  12. data/docs/GetWaaSEndpoint200Response.md +18 -0
  13. data/docs/GetWaaSUsage200Response.md +18 -0
  14. data/docs/ListWaaSApplications200Response.md +18 -0
  15. data/docs/ListWaaSEndpointDeliveries200Response.md +18 -0
  16. data/docs/ListWaaSEndpoints200Response.md +18 -0
  17. data/docs/ListWaaSEventTypes200Response.md +18 -0
  18. data/docs/PublishWaaSEvent201Response.md +18 -0
  19. data/docs/UpdateWaaSApplicationRequest.md +22 -0
  20. data/docs/UpdateWaaSEndpointRequest.md +22 -0
  21. data/docs/UpdateWaaSEventTypeRequest.md +24 -0
  22. data/docs/WaaSApplication.md +32 -0
  23. data/docs/WaaSApplicationsApi.md +446 -0
  24. data/docs/WaaSBatchPublishRequest.md +18 -0
  25. data/docs/WaaSBatchPublishResponse.md +22 -0
  26. data/docs/WaaSDeliveriesApi.md +319 -0
  27. data/docs/WaaSDelivery.md +38 -0
  28. data/docs/WaaSEndpoint.md +32 -0
  29. data/docs/WaaSEndpointsApi.md +673 -0
  30. data/docs/WaaSEventType.md +36 -0
  31. data/docs/WaaSEventTypesApi.md +454 -0
  32. data/docs/WaaSEventsApi.md +155 -0
  33. data/docs/WaaSPortalApi.md +81 -0
  34. data/docs/WaaSPortalTokenRequest.md +24 -0
  35. data/docs/WaaSPortalTokenRequestTheme.md +20 -0
  36. data/docs/WaaSPortalTokenResponse.md +20 -0
  37. data/docs/WaaSPublishEventRequest.md +24 -0
  38. data/docs/WaaSPublishEventResponse.md +26 -0
  39. data/docs/WaaSUsageResponse.md +28 -0
  40. data/lib/zyphr/api/waa_s_applications_api.rb +425 -0
  41. data/lib/zyphr/api/waa_s_deliveries_api.rb +316 -0
  42. data/lib/zyphr/api/waa_s_endpoints_api.rb +653 -0
  43. data/lib/zyphr/api/waa_s_event_types_api.rb +452 -0
  44. data/lib/zyphr/api/waa_s_events_api.rb +170 -0
  45. data/lib/zyphr/api/waa_s_portal_api.rb +96 -0
  46. data/lib/zyphr/models/batch_publish_waa_s_events201_response.rb +220 -0
  47. data/lib/zyphr/models/create_waa_s_application201_response.rb +220 -0
  48. data/lib/zyphr/models/create_waa_s_application_request.rb +275 -0
  49. data/lib/zyphr/models/create_waa_s_endpoint201_response.rb +220 -0
  50. data/lib/zyphr/models/create_waa_s_endpoint_request.rb +294 -0
  51. data/lib/zyphr/models/create_waa_s_endpoint_response.rb +277 -0
  52. data/lib/zyphr/models/create_waa_s_event_type201_response.rb +220 -0
  53. data/lib/zyphr/models/create_waa_s_event_type_request.rb +292 -0
  54. data/lib/zyphr/models/generate_waa_s_portal_token201_response.rb +220 -0
  55. data/lib/zyphr/models/get_waa_s_endpoint200_response.rb +220 -0
  56. data/lib/zyphr/models/get_waa_s_usage200_response.rb +220 -0
  57. data/lib/zyphr/models/list_waa_s_applications200_response.rb +222 -0
  58. data/lib/zyphr/models/list_waa_s_endpoint_deliveries200_response.rb +222 -0
  59. data/lib/zyphr/models/list_waa_s_endpoints200_response.rb +222 -0
  60. data/lib/zyphr/models/list_waa_s_event_types200_response.rb +222 -0
  61. data/lib/zyphr/models/publish_waa_s_event201_response.rb +220 -0
  62. data/lib/zyphr/models/update_waa_s_application_request.rb +272 -0
  63. data/lib/zyphr/models/update_waa_s_endpoint_request.rb +274 -0
  64. data/lib/zyphr/models/update_waa_s_event_type_request.rb +247 -0
  65. data/lib/zyphr/models/waa_s_application.rb +317 -0
  66. data/lib/zyphr/models/waa_s_batch_publish_request.rb +248 -0
  67. data/lib/zyphr/models/waa_s_batch_publish_response.rb +240 -0
  68. data/lib/zyphr/models/waa_s_delivery.rb +344 -0
  69. data/lib/zyphr/models/waa_s_endpoint.rb +319 -0
  70. data/lib/zyphr/models/waa_s_event_type.rb +335 -0
  71. data/lib/zyphr/models/waa_s_portal_token_request.rb +267 -0
  72. data/lib/zyphr/models/waa_s_portal_token_request_theme.rb +263 -0
  73. data/lib/zyphr/models/waa_s_portal_token_response.rb +229 -0
  74. data/lib/zyphr/models/waa_s_publish_event_request.rb +302 -0
  75. data/lib/zyphr/models/waa_s_publish_event_response.rb +256 -0
  76. data/lib/zyphr/models/waa_s_usage_response.rb +265 -0
  77. data/lib/zyphr.rb +37 -0
  78. data/spec/api/waa_s_applications_api_spec.rb +110 -0
  79. data/spec/api/waa_s_deliveries_api_spec.rb +94 -0
  80. data/spec/api/waa_s_endpoints_api_spec.rb +154 -0
  81. data/spec/api/waa_s_event_types_api_spec.rb +115 -0
  82. data/spec/api/waa_s_events_api_spec.rb +61 -0
  83. data/spec/api/waa_s_portal_api_spec.rb +48 -0
  84. data/spec/models/batch_publish_waa_s_events201_response_spec.rb +36 -0
  85. data/spec/models/create_waa_s_application201_response_spec.rb +36 -0
  86. data/spec/models/create_waa_s_application_request_spec.rb +48 -0
  87. data/spec/models/create_waa_s_endpoint201_response_spec.rb +36 -0
  88. data/spec/models/create_waa_s_endpoint_request_spec.rb +48 -0
  89. data/spec/models/create_waa_s_endpoint_response_spec.rb +72 -0
  90. data/spec/models/create_waa_s_event_type201_response_spec.rb +36 -0
  91. data/spec/models/create_waa_s_event_type_request_spec.rb +60 -0
  92. data/spec/models/generate_waa_s_portal_token201_response_spec.rb +36 -0
  93. data/spec/models/get_waa_s_endpoint200_response_spec.rb +36 -0
  94. data/spec/models/get_waa_s_usage200_response_spec.rb +36 -0
  95. data/spec/models/list_waa_s_applications200_response_spec.rb +36 -0
  96. data/spec/models/list_waa_s_endpoint_deliveries200_response_spec.rb +36 -0
  97. data/spec/models/list_waa_s_endpoints200_response_spec.rb +36 -0
  98. data/spec/models/list_waa_s_event_types200_response_spec.rb +36 -0
  99. data/spec/models/publish_waa_s_event201_response_spec.rb +36 -0
  100. data/spec/models/update_waa_s_application_request_spec.rb +52 -0
  101. data/spec/models/update_waa_s_endpoint_request_spec.rb +52 -0
  102. data/spec/models/update_waa_s_event_type_request_spec.rb +54 -0
  103. data/spec/models/waa_s_application_spec.rb +82 -0
  104. data/spec/models/waa_s_batch_publish_request_spec.rb +36 -0
  105. data/spec/models/waa_s_batch_publish_response_spec.rb +48 -0
  106. data/spec/models/waa_s_delivery_spec.rb +100 -0
  107. data/spec/models/waa_s_endpoint_spec.rb +82 -0
  108. data/spec/models/waa_s_event_type_spec.rb +94 -0
  109. data/spec/models/waa_s_portal_token_request_spec.rb +54 -0
  110. data/spec/models/waa_s_portal_token_request_theme_spec.rb +46 -0
  111. data/spec/models/waa_s_portal_token_response_spec.rb +42 -0
  112. data/spec/models/waa_s_publish_event_request_spec.rb +54 -0
  113. data/spec/models/waa_s_publish_event_response_spec.rb +60 -0
  114. data/spec/models/waa_s_usage_response_spec.rb +66 -0
  115. data/zyphr.gemspec +1 -1
  116. metadata +150 -2
@@ -0,0 +1,452 @@
1
+ =begin
2
+ #Zyphr API
3
+
4
+ #Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: support@zyphr.dev
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.12.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Zyphr
16
+ class WaaSEventTypesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Register an event type
23
+ # Register a new custom event type for a WaaS application.
24
+ # @param app_id [String]
25
+ # @param create_waa_s_event_type_request [CreateWaaSEventTypeRequest]
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [CreateWaaSEventType201Response]
28
+ def create_waa_s_event_type(app_id, create_waa_s_event_type_request, opts = {})
29
+ data, _status_code, _headers = create_waa_s_event_type_with_http_info(app_id, create_waa_s_event_type_request, opts)
30
+ data
31
+ end
32
+
33
+ # Register an event type
34
+ # Register a new custom event type for a WaaS application.
35
+ # @param app_id [String]
36
+ # @param create_waa_s_event_type_request [CreateWaaSEventTypeRequest]
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<(CreateWaaSEventType201Response, Integer, Hash)>] CreateWaaSEventType201Response data, response status code and response headers
39
+ def create_waa_s_event_type_with_http_info(app_id, create_waa_s_event_type_request, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: WaaSEventTypesApi.create_waa_s_event_type ...'
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 WaaSEventTypesApi.create_waa_s_event_type"
46
+ end
47
+ # verify the required parameter 'create_waa_s_event_type_request' is set
48
+ if @api_client.config.client_side_validation && create_waa_s_event_type_request.nil?
49
+ fail ArgumentError, "Missing the required parameter 'create_waa_s_event_type_request' when calling WaaSEventTypesApi.create_waa_s_event_type"
50
+ end
51
+ # resource path
52
+ local_var_path = '/v1/waas/applications/{appId}/event-types'.sub('{' + 'appId' + '}', CGI.escape(app_id.to_s))
53
+
54
+ # query parameters
55
+ query_params = opts[:query_params] || {}
56
+
57
+ # header parameters
58
+ header_params = opts[:header_params] || {}
59
+ # HTTP header 'Accept' (if needed)
60
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
61
+ # HTTP header 'Content-Type'
62
+ content_type = @api_client.select_header_content_type(['application/json'])
63
+ if !content_type.nil?
64
+ header_params['Content-Type'] = content_type
65
+ end
66
+
67
+ # form parameters
68
+ form_params = opts[:form_params] || {}
69
+
70
+ # http body (model)
71
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_waa_s_event_type_request)
72
+
73
+ # return_type
74
+ return_type = opts[:debug_return_type] || 'CreateWaaSEventType201Response'
75
+
76
+ # auth_names
77
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
78
+
79
+ new_options = opts.merge(
80
+ :operation => :"WaaSEventTypesApi.create_waa_s_event_type",
81
+ :header_params => header_params,
82
+ :query_params => query_params,
83
+ :form_params => form_params,
84
+ :body => post_body,
85
+ :auth_names => auth_names,
86
+ :return_type => return_type
87
+ )
88
+
89
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
90
+ if @api_client.config.debugging
91
+ @api_client.config.logger.debug "API called: WaaSEventTypesApi#create_waa_s_event_type\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
92
+ end
93
+ return data, status_code, headers
94
+ end
95
+
96
+ # Delete an event type
97
+ # Permanently delete an event type. Endpoints subscribed to this type will stop receiving deliveries.
98
+ # @param app_id [String]
99
+ # @param event_type_id [String]
100
+ # @param [Hash] opts the optional parameters
101
+ # @return [nil]
102
+ def delete_waa_s_event_type(app_id, event_type_id, opts = {})
103
+ delete_waa_s_event_type_with_http_info(app_id, event_type_id, opts)
104
+ nil
105
+ end
106
+
107
+ # Delete an event type
108
+ # Permanently delete an event type. Endpoints subscribed to this type will stop receiving deliveries.
109
+ # @param app_id [String]
110
+ # @param event_type_id [String]
111
+ # @param [Hash] opts the optional parameters
112
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
113
+ def delete_waa_s_event_type_with_http_info(app_id, event_type_id, opts = {})
114
+ if @api_client.config.debugging
115
+ @api_client.config.logger.debug 'Calling API: WaaSEventTypesApi.delete_waa_s_event_type ...'
116
+ end
117
+ # verify the required parameter 'app_id' is set
118
+ if @api_client.config.client_side_validation && app_id.nil?
119
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling WaaSEventTypesApi.delete_waa_s_event_type"
120
+ end
121
+ # verify the required parameter 'event_type_id' is set
122
+ if @api_client.config.client_side_validation && event_type_id.nil?
123
+ fail ArgumentError, "Missing the required parameter 'event_type_id' when calling WaaSEventTypesApi.delete_waa_s_event_type"
124
+ end
125
+ # resource path
126
+ local_var_path = '/v1/waas/applications/{appId}/event-types/{eventTypeId}'.sub('{' + 'appId' + '}', CGI.escape(app_id.to_s)).sub('{' + 'eventTypeId' + '}', CGI.escape(event_type_id.to_s))
127
+
128
+ # query parameters
129
+ query_params = opts[:query_params] || {}
130
+
131
+ # header parameters
132
+ header_params = opts[:header_params] || {}
133
+
134
+ # form parameters
135
+ form_params = opts[:form_params] || {}
136
+
137
+ # http body (model)
138
+ post_body = opts[:debug_body]
139
+
140
+ # return_type
141
+ return_type = opts[:debug_return_type]
142
+
143
+ # auth_names
144
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
145
+
146
+ new_options = opts.merge(
147
+ :operation => :"WaaSEventTypesApi.delete_waa_s_event_type",
148
+ :header_params => header_params,
149
+ :query_params => query_params,
150
+ :form_params => form_params,
151
+ :body => post_body,
152
+ :auth_names => auth_names,
153
+ :return_type => return_type
154
+ )
155
+
156
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
157
+ if @api_client.config.debugging
158
+ @api_client.config.logger.debug "API called: WaaSEventTypesApi#delete_waa_s_event_type\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
159
+ end
160
+ return data, status_code, headers
161
+ end
162
+
163
+ # Deprecate an event type
164
+ # Mark an event type as deprecated. Existing subscriptions continue to receive deliveries, but new subscriptions are blocked.
165
+ # @param app_id [String]
166
+ # @param event_type_id [String]
167
+ # @param [Hash] opts the optional parameters
168
+ # @return [nil]
169
+ def deprecate_waa_s_event_type(app_id, event_type_id, opts = {})
170
+ deprecate_waa_s_event_type_with_http_info(app_id, event_type_id, opts)
171
+ nil
172
+ end
173
+
174
+ # Deprecate an event type
175
+ # Mark an event type as deprecated. Existing subscriptions continue to receive deliveries, but new subscriptions are blocked.
176
+ # @param app_id [String]
177
+ # @param event_type_id [String]
178
+ # @param [Hash] opts the optional parameters
179
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
180
+ def deprecate_waa_s_event_type_with_http_info(app_id, event_type_id, opts = {})
181
+ if @api_client.config.debugging
182
+ @api_client.config.logger.debug 'Calling API: WaaSEventTypesApi.deprecate_waa_s_event_type ...'
183
+ end
184
+ # verify the required parameter 'app_id' is set
185
+ if @api_client.config.client_side_validation && app_id.nil?
186
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling WaaSEventTypesApi.deprecate_waa_s_event_type"
187
+ end
188
+ # verify the required parameter 'event_type_id' is set
189
+ if @api_client.config.client_side_validation && event_type_id.nil?
190
+ fail ArgumentError, "Missing the required parameter 'event_type_id' when calling WaaSEventTypesApi.deprecate_waa_s_event_type"
191
+ end
192
+ # resource path
193
+ local_var_path = '/v1/waas/applications/{appId}/event-types/{eventTypeId}/deprecate'.sub('{' + 'appId' + '}', CGI.escape(app_id.to_s)).sub('{' + 'eventTypeId' + '}', CGI.escape(event_type_id.to_s))
194
+
195
+ # query parameters
196
+ query_params = opts[:query_params] || {}
197
+
198
+ # header parameters
199
+ header_params = opts[:header_params] || {}
200
+
201
+ # form parameters
202
+ form_params = opts[:form_params] || {}
203
+
204
+ # http body (model)
205
+ post_body = opts[:debug_body]
206
+
207
+ # return_type
208
+ return_type = opts[:debug_return_type]
209
+
210
+ # auth_names
211
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
212
+
213
+ new_options = opts.merge(
214
+ :operation => :"WaaSEventTypesApi.deprecate_waa_s_event_type",
215
+ :header_params => header_params,
216
+ :query_params => query_params,
217
+ :form_params => form_params,
218
+ :body => post_body,
219
+ :auth_names => auth_names,
220
+ :return_type => return_type
221
+ )
222
+
223
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
224
+ if @api_client.config.debugging
225
+ @api_client.config.logger.debug "API called: WaaSEventTypesApi#deprecate_waa_s_event_type\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
226
+ end
227
+ return data, status_code, headers
228
+ end
229
+
230
+ # Get an event type
231
+ # @param app_id [String]
232
+ # @param event_type_id [String]
233
+ # @param [Hash] opts the optional parameters
234
+ # @return [CreateWaaSEventType201Response]
235
+ def get_waa_s_event_type(app_id, event_type_id, opts = {})
236
+ data, _status_code, _headers = get_waa_s_event_type_with_http_info(app_id, event_type_id, opts)
237
+ data
238
+ end
239
+
240
+ # Get an event type
241
+ # @param app_id [String]
242
+ # @param event_type_id [String]
243
+ # @param [Hash] opts the optional parameters
244
+ # @return [Array<(CreateWaaSEventType201Response, Integer, Hash)>] CreateWaaSEventType201Response data, response status code and response headers
245
+ def get_waa_s_event_type_with_http_info(app_id, event_type_id, opts = {})
246
+ if @api_client.config.debugging
247
+ @api_client.config.logger.debug 'Calling API: WaaSEventTypesApi.get_waa_s_event_type ...'
248
+ end
249
+ # verify the required parameter 'app_id' is set
250
+ if @api_client.config.client_side_validation && app_id.nil?
251
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling WaaSEventTypesApi.get_waa_s_event_type"
252
+ end
253
+ # verify the required parameter 'event_type_id' is set
254
+ if @api_client.config.client_side_validation && event_type_id.nil?
255
+ fail ArgumentError, "Missing the required parameter 'event_type_id' when calling WaaSEventTypesApi.get_waa_s_event_type"
256
+ end
257
+ # resource path
258
+ local_var_path = '/v1/waas/applications/{appId}/event-types/{eventTypeId}'.sub('{' + 'appId' + '}', CGI.escape(app_id.to_s)).sub('{' + 'eventTypeId' + '}', CGI.escape(event_type_id.to_s))
259
+
260
+ # query parameters
261
+ query_params = opts[:query_params] || {}
262
+
263
+ # header parameters
264
+ header_params = opts[:header_params] || {}
265
+ # HTTP header 'Accept' (if needed)
266
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
267
+
268
+ # form parameters
269
+ form_params = opts[:form_params] || {}
270
+
271
+ # http body (model)
272
+ post_body = opts[:debug_body]
273
+
274
+ # return_type
275
+ return_type = opts[:debug_return_type] || 'CreateWaaSEventType201Response'
276
+
277
+ # auth_names
278
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
279
+
280
+ new_options = opts.merge(
281
+ :operation => :"WaaSEventTypesApi.get_waa_s_event_type",
282
+ :header_params => header_params,
283
+ :query_params => query_params,
284
+ :form_params => form_params,
285
+ :body => post_body,
286
+ :auth_names => auth_names,
287
+ :return_type => return_type
288
+ )
289
+
290
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
291
+ if @api_client.config.debugging
292
+ @api_client.config.logger.debug "API called: WaaSEventTypesApi#get_waa_s_event_type\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
293
+ end
294
+ return data, status_code, headers
295
+ end
296
+
297
+ # List event types
298
+ # List all event types registered for a WaaS application.
299
+ # @param app_id [String]
300
+ # @param [Hash] opts the optional parameters
301
+ # @option opts [Integer] :limit (default to 50)
302
+ # @option opts [Integer] :offset (default to 0)
303
+ # @option opts [String] :category
304
+ # @option opts [String] :status
305
+ # @return [ListWaaSEventTypes200Response]
306
+ def list_waa_s_event_types(app_id, opts = {})
307
+ data, _status_code, _headers = list_waa_s_event_types_with_http_info(app_id, opts)
308
+ data
309
+ end
310
+
311
+ # List event types
312
+ # List all event types registered for a WaaS application.
313
+ # @param app_id [String]
314
+ # @param [Hash] opts the optional parameters
315
+ # @option opts [Integer] :limit (default to 50)
316
+ # @option opts [Integer] :offset (default to 0)
317
+ # @option opts [String] :category
318
+ # @option opts [String] :status
319
+ # @return [Array<(ListWaaSEventTypes200Response, Integer, Hash)>] ListWaaSEventTypes200Response data, response status code and response headers
320
+ def list_waa_s_event_types_with_http_info(app_id, opts = {})
321
+ if @api_client.config.debugging
322
+ @api_client.config.logger.debug 'Calling API: WaaSEventTypesApi.list_waa_s_event_types ...'
323
+ end
324
+ # verify the required parameter 'app_id' is set
325
+ if @api_client.config.client_side_validation && app_id.nil?
326
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling WaaSEventTypesApi.list_waa_s_event_types"
327
+ end
328
+ allowable_values = ["active", "deprecated"]
329
+ if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
330
+ fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
331
+ end
332
+ # resource path
333
+ local_var_path = '/v1/waas/applications/{appId}/event-types'.sub('{' + 'appId' + '}', CGI.escape(app_id.to_s))
334
+
335
+ # query parameters
336
+ query_params = opts[:query_params] || {}
337
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
338
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
339
+ query_params[:'category'] = opts[:'category'] if !opts[:'category'].nil?
340
+ query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
341
+
342
+ # header parameters
343
+ header_params = opts[:header_params] || {}
344
+ # HTTP header 'Accept' (if needed)
345
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
346
+
347
+ # form parameters
348
+ form_params = opts[:form_params] || {}
349
+
350
+ # http body (model)
351
+ post_body = opts[:debug_body]
352
+
353
+ # return_type
354
+ return_type = opts[:debug_return_type] || 'ListWaaSEventTypes200Response'
355
+
356
+ # auth_names
357
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
358
+
359
+ new_options = opts.merge(
360
+ :operation => :"WaaSEventTypesApi.list_waa_s_event_types",
361
+ :header_params => header_params,
362
+ :query_params => query_params,
363
+ :form_params => form_params,
364
+ :body => post_body,
365
+ :auth_names => auth_names,
366
+ :return_type => return_type
367
+ )
368
+
369
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
370
+ if @api_client.config.debugging
371
+ @api_client.config.logger.debug "API called: WaaSEventTypesApi#list_waa_s_event_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
372
+ end
373
+ return data, status_code, headers
374
+ end
375
+
376
+ # Update an event type
377
+ # @param app_id [String]
378
+ # @param event_type_id [String]
379
+ # @param update_waa_s_event_type_request [UpdateWaaSEventTypeRequest]
380
+ # @param [Hash] opts the optional parameters
381
+ # @return [nil]
382
+ def update_waa_s_event_type(app_id, event_type_id, update_waa_s_event_type_request, opts = {})
383
+ update_waa_s_event_type_with_http_info(app_id, event_type_id, update_waa_s_event_type_request, opts)
384
+ nil
385
+ end
386
+
387
+ # Update an event type
388
+ # @param app_id [String]
389
+ # @param event_type_id [String]
390
+ # @param update_waa_s_event_type_request [UpdateWaaSEventTypeRequest]
391
+ # @param [Hash] opts the optional parameters
392
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
393
+ def update_waa_s_event_type_with_http_info(app_id, event_type_id, update_waa_s_event_type_request, opts = {})
394
+ if @api_client.config.debugging
395
+ @api_client.config.logger.debug 'Calling API: WaaSEventTypesApi.update_waa_s_event_type ...'
396
+ end
397
+ # verify the required parameter 'app_id' is set
398
+ if @api_client.config.client_side_validation && app_id.nil?
399
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling WaaSEventTypesApi.update_waa_s_event_type"
400
+ end
401
+ # verify the required parameter 'event_type_id' is set
402
+ if @api_client.config.client_side_validation && event_type_id.nil?
403
+ fail ArgumentError, "Missing the required parameter 'event_type_id' when calling WaaSEventTypesApi.update_waa_s_event_type"
404
+ end
405
+ # verify the required parameter 'update_waa_s_event_type_request' is set
406
+ if @api_client.config.client_side_validation && update_waa_s_event_type_request.nil?
407
+ fail ArgumentError, "Missing the required parameter 'update_waa_s_event_type_request' when calling WaaSEventTypesApi.update_waa_s_event_type"
408
+ end
409
+ # resource path
410
+ local_var_path = '/v1/waas/applications/{appId}/event-types/{eventTypeId}'.sub('{' + 'appId' + '}', CGI.escape(app_id.to_s)).sub('{' + 'eventTypeId' + '}', CGI.escape(event_type_id.to_s))
411
+
412
+ # query parameters
413
+ query_params = opts[:query_params] || {}
414
+
415
+ # header parameters
416
+ header_params = opts[:header_params] || {}
417
+ # HTTP header 'Content-Type'
418
+ content_type = @api_client.select_header_content_type(['application/json'])
419
+ if !content_type.nil?
420
+ header_params['Content-Type'] = content_type
421
+ end
422
+
423
+ # form parameters
424
+ form_params = opts[:form_params] || {}
425
+
426
+ # http body (model)
427
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_waa_s_event_type_request)
428
+
429
+ # return_type
430
+ return_type = opts[:debug_return_type]
431
+
432
+ # auth_names
433
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
434
+
435
+ new_options = opts.merge(
436
+ :operation => :"WaaSEventTypesApi.update_waa_s_event_type",
437
+ :header_params => header_params,
438
+ :query_params => query_params,
439
+ :form_params => form_params,
440
+ :body => post_body,
441
+ :auth_names => auth_names,
442
+ :return_type => return_type
443
+ )
444
+
445
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
446
+ if @api_client.config.debugging
447
+ @api_client.config.logger.debug "API called: WaaSEventTypesApi#update_waa_s_event_type\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
448
+ end
449
+ return data, status_code, headers
450
+ end
451
+ end
452
+ end
@@ -0,0 +1,170 @@
1
+ =begin
2
+ #Zyphr API
3
+
4
+ #Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: support@zyphr.dev
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.12.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Zyphr
16
+ class WaaSEventsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Batch publish events
23
+ # Publish up to 100 events in a single request. Requires Starter plan or higher.
24
+ # @param app_id [String]
25
+ # @param waa_s_batch_publish_request [WaaSBatchPublishRequest]
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [BatchPublishWaaSEvents201Response]
28
+ def batch_publish_waa_s_events(app_id, waa_s_batch_publish_request, opts = {})
29
+ data, _status_code, _headers = batch_publish_waa_s_events_with_http_info(app_id, waa_s_batch_publish_request, opts)
30
+ data
31
+ end
32
+
33
+ # Batch publish events
34
+ # Publish up to 100 events in a single request. Requires Starter plan or higher.
35
+ # @param app_id [String]
36
+ # @param waa_s_batch_publish_request [WaaSBatchPublishRequest]
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<(BatchPublishWaaSEvents201Response, Integer, Hash)>] BatchPublishWaaSEvents201Response data, response status code and response headers
39
+ def batch_publish_waa_s_events_with_http_info(app_id, waa_s_batch_publish_request, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: WaaSEventsApi.batch_publish_waa_s_events ...'
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 WaaSEventsApi.batch_publish_waa_s_events"
46
+ end
47
+ # verify the required parameter 'waa_s_batch_publish_request' is set
48
+ if @api_client.config.client_side_validation && waa_s_batch_publish_request.nil?
49
+ fail ArgumentError, "Missing the required parameter 'waa_s_batch_publish_request' when calling WaaSEventsApi.batch_publish_waa_s_events"
50
+ end
51
+ # resource path
52
+ local_var_path = '/v1/waas/applications/{appId}/events/batch'.sub('{' + 'appId' + '}', CGI.escape(app_id.to_s))
53
+
54
+ # query parameters
55
+ query_params = opts[:query_params] || {}
56
+
57
+ # header parameters
58
+ header_params = opts[:header_params] || {}
59
+ # HTTP header 'Accept' (if needed)
60
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
61
+ # HTTP header 'Content-Type'
62
+ content_type = @api_client.select_header_content_type(['application/json'])
63
+ if !content_type.nil?
64
+ header_params['Content-Type'] = content_type
65
+ end
66
+
67
+ # form parameters
68
+ form_params = opts[:form_params] || {}
69
+
70
+ # http body (model)
71
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(waa_s_batch_publish_request)
72
+
73
+ # return_type
74
+ return_type = opts[:debug_return_type] || 'BatchPublishWaaSEvents201Response'
75
+
76
+ # auth_names
77
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
78
+
79
+ new_options = opts.merge(
80
+ :operation => :"WaaSEventsApi.batch_publish_waa_s_events",
81
+ :header_params => header_params,
82
+ :query_params => query_params,
83
+ :form_params => form_params,
84
+ :body => post_body,
85
+ :auth_names => auth_names,
86
+ :return_type => return_type
87
+ )
88
+
89
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
90
+ if @api_client.config.debugging
91
+ @api_client.config.logger.debug "API called: WaaSEventsApi#batch_publish_waa_s_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
92
+ end
93
+ return data, status_code, headers
94
+ end
95
+
96
+ # Publish an event
97
+ # Publish an event to all subscribed endpoints for the specified tenant. Zyphr creates delivery records and queues them for delivery.
98
+ # @param app_id [String]
99
+ # @param waa_s_publish_event_request [WaaSPublishEventRequest]
100
+ # @param [Hash] opts the optional parameters
101
+ # @return [PublishWaaSEvent201Response]
102
+ def publish_waa_s_event(app_id, waa_s_publish_event_request, opts = {})
103
+ data, _status_code, _headers = publish_waa_s_event_with_http_info(app_id, waa_s_publish_event_request, opts)
104
+ data
105
+ end
106
+
107
+ # Publish an event
108
+ # Publish an event to all subscribed endpoints for the specified tenant. Zyphr creates delivery records and queues them for delivery.
109
+ # @param app_id [String]
110
+ # @param waa_s_publish_event_request [WaaSPublishEventRequest]
111
+ # @param [Hash] opts the optional parameters
112
+ # @return [Array<(PublishWaaSEvent201Response, Integer, Hash)>] PublishWaaSEvent201Response data, response status code and response headers
113
+ def publish_waa_s_event_with_http_info(app_id, waa_s_publish_event_request, opts = {})
114
+ if @api_client.config.debugging
115
+ @api_client.config.logger.debug 'Calling API: WaaSEventsApi.publish_waa_s_event ...'
116
+ end
117
+ # verify the required parameter 'app_id' is set
118
+ if @api_client.config.client_side_validation && app_id.nil?
119
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling WaaSEventsApi.publish_waa_s_event"
120
+ end
121
+ # verify the required parameter 'waa_s_publish_event_request' is set
122
+ if @api_client.config.client_side_validation && waa_s_publish_event_request.nil?
123
+ fail ArgumentError, "Missing the required parameter 'waa_s_publish_event_request' when calling WaaSEventsApi.publish_waa_s_event"
124
+ end
125
+ # resource path
126
+ local_var_path = '/v1/waas/applications/{appId}/events'.sub('{' + 'appId' + '}', CGI.escape(app_id.to_s))
127
+
128
+ # query parameters
129
+ query_params = opts[:query_params] || {}
130
+
131
+ # header parameters
132
+ header_params = opts[:header_params] || {}
133
+ # HTTP header 'Accept' (if needed)
134
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
135
+ # HTTP header 'Content-Type'
136
+ content_type = @api_client.select_header_content_type(['application/json'])
137
+ if !content_type.nil?
138
+ header_params['Content-Type'] = content_type
139
+ end
140
+
141
+ # form parameters
142
+ form_params = opts[:form_params] || {}
143
+
144
+ # http body (model)
145
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(waa_s_publish_event_request)
146
+
147
+ # return_type
148
+ return_type = opts[:debug_return_type] || 'PublishWaaSEvent201Response'
149
+
150
+ # auth_names
151
+ auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
152
+
153
+ new_options = opts.merge(
154
+ :operation => :"WaaSEventsApi.publish_waa_s_event",
155
+ :header_params => header_params,
156
+ :query_params => query_params,
157
+ :form_params => form_params,
158
+ :body => post_body,
159
+ :auth_names => auth_names,
160
+ :return_type => return_type
161
+ )
162
+
163
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
164
+ if @api_client.config.debugging
165
+ @api_client.config.logger.debug "API called: WaaSEventsApi#publish_waa_s_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
166
+ end
167
+ return data, status_code, headers
168
+ end
169
+ end
170
+ end