zyphr 0.1.39 → 0.1.40

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 (90) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +35 -14
  3. data/docs/AddWorkflowStep201Response.md +20 -0
  4. data/docs/AddWorkflowStepRequest.md +30 -0
  5. data/docs/AuthRegistrationApi.md +1 -1
  6. data/docs/CreateWorkflow201Response.md +20 -0
  7. data/docs/CreateWorkflowRequest.md +26 -0
  8. data/docs/DeleteWorkflow200Response.md +20 -0
  9. data/docs/{TopicDeleteResponseData.md → DeleteWorkflow200ResponseData.md} +2 -2
  10. data/docs/DeleteWorkflowStep200Response.md +20 -0
  11. data/docs/DeleteWorkflowStep200ResponseData.md +22 -0
  12. data/docs/ListWorkflowExecutions200Response.md +20 -0
  13. data/docs/{SmsListResponseMeta.md → ListWorkflowExecutions200ResponseMeta.md} +2 -2
  14. data/docs/ListWorkflows200Response.md +20 -0
  15. data/docs/ListWorkflows200ResponseMeta.md +32 -0
  16. data/docs/ReorderWorkflowStepsRequest.md +18 -0
  17. data/docs/SignInWithGameCenterRequest.md +1 -1
  18. data/docs/SmsListResponse.md +1 -1
  19. data/docs/TopicDeleteResponse.md +1 -1
  20. data/docs/TriggerWorkflow202Response.md +20 -0
  21. data/docs/TriggerWorkflow202ResponseData.md +22 -0
  22. data/docs/TriggerWorkflowRequest.md +24 -0
  23. data/docs/UpdateWorkflowRequest.md +24 -0
  24. data/docs/UpdateWorkflowStatusRequest.md +18 -0
  25. data/docs/UpdateWorkflowStepRequest.md +20 -0
  26. data/docs/Workflow.md +42 -0
  27. data/docs/WorkflowStatus.md +15 -0
  28. data/docs/WorkflowStep.md +38 -0
  29. data/docs/WorkflowStepType.md +15 -0
  30. data/docs/WorkflowsApi.md +901 -0
  31. data/lib/zyphr/api/auth_registration_api.rb +2 -2
  32. data/lib/zyphr/api/workflows_api.rb +897 -0
  33. data/lib/zyphr/models/add_workflow_step201_response.rb +229 -0
  34. data/lib/zyphr/models/add_workflow_step_request.rb +384 -0
  35. data/lib/zyphr/models/create_workflow201_response.rb +229 -0
  36. data/lib/zyphr/models/create_workflow_request.rb +292 -0
  37. data/lib/zyphr/models/delete_workflow200_response.rb +229 -0
  38. data/lib/zyphr/models/{topic_delete_response_data.rb → delete_workflow200_response_data.rb} +3 -3
  39. data/lib/zyphr/models/delete_workflow_step200_response.rb +229 -0
  40. data/lib/zyphr/models/delete_workflow_step200_response_data.rb +238 -0
  41. data/lib/zyphr/models/list_workflow_executions200_response.rb +231 -0
  42. data/lib/zyphr/models/{sms_list_response_meta.rb → list_workflow_executions200_response_meta.rb} +3 -3
  43. data/lib/zyphr/models/list_workflows200_response.rb +231 -0
  44. data/lib/zyphr/models/list_workflows200_response_meta.rb +284 -0
  45. data/lib/zyphr/models/reorder_workflow_steps_request.rb +249 -0
  46. data/lib/zyphr/models/sign_in_with_game_center_request.rb +1 -1
  47. data/lib/zyphr/models/sms_list_response.rb +1 -1
  48. data/lib/zyphr/models/topic_delete_response.rb +1 -1
  49. data/lib/zyphr/models/trigger_workflow202_response.rb +229 -0
  50. data/lib/zyphr/models/trigger_workflow202_response_data.rb +240 -0
  51. data/lib/zyphr/models/trigger_workflow_request.rb +272 -0
  52. data/lib/zyphr/models/update_workflow_request.rb +269 -0
  53. data/lib/zyphr/models/{v1_muse_subjects_suggest_post_request.rb → update_workflow_status_request.rb} +19 -86
  54. data/lib/zyphr/models/update_workflow_step_request.rb +232 -0
  55. data/lib/zyphr/models/workflow.rb +514 -0
  56. data/lib/zyphr/models/workflow_status.rb +42 -0
  57. data/lib/zyphr/models/workflow_step.rb +505 -0
  58. data/lib/zyphr/models/workflow_step_type.rb +47 -0
  59. data/lib/zyphr.rb +24 -4
  60. data/spec/api/auth_registration_api_spec.rb +1 -1
  61. data/spec/api/workflows_api_spec.rb +192 -0
  62. data/spec/models/add_workflow_step201_response_spec.rb +42 -0
  63. data/spec/models/add_workflow_step_request_spec.rb +76 -0
  64. data/spec/models/create_workflow201_response_spec.rb +42 -0
  65. data/spec/models/{v1_muse_subjects_suggest_post_request_spec.rb → create_workflow_request_spec.rb} +16 -14
  66. data/spec/models/{topic_delete_response_data_spec.rb → delete_workflow200_response_data_spec.rb} +6 -6
  67. data/spec/models/delete_workflow200_response_spec.rb +42 -0
  68. data/spec/models/delete_workflow_step200_response_data_spec.rb +48 -0
  69. data/spec/models/delete_workflow_step200_response_spec.rb +42 -0
  70. data/spec/models/{sms_list_response_meta_spec.rb → list_workflow_executions200_response_meta_spec.rb} +6 -6
  71. data/spec/models/list_workflow_executions200_response_spec.rb +42 -0
  72. data/spec/models/list_workflows200_response_meta_spec.rb +78 -0
  73. data/spec/models/list_workflows200_response_spec.rb +42 -0
  74. data/spec/models/reorder_workflow_steps_request_spec.rb +36 -0
  75. data/spec/models/trigger_workflow202_response_data_spec.rb +48 -0
  76. data/spec/models/trigger_workflow202_response_spec.rb +42 -0
  77. data/spec/models/trigger_workflow_request_spec.rb +54 -0
  78. data/spec/models/update_workflow_request_spec.rb +54 -0
  79. data/spec/models/update_workflow_status_request_spec.rb +36 -0
  80. data/spec/models/update_workflow_step_request_spec.rb +42 -0
  81. data/spec/models/workflow_spec.rb +108 -0
  82. data/spec/models/workflow_status_spec.rb +30 -0
  83. data/spec/models/workflow_step_spec.rb +100 -0
  84. data/spec/models/workflow_step_type_spec.rb +30 -0
  85. data/zyphr.gemspec +1 -1
  86. metadata +97 -17
  87. data/docs/MuseApi.md +0 -681
  88. data/docs/V1MuseSubjectsSuggestPostRequest.md +0 -24
  89. data/lib/zyphr/api/muse_api.rb +0 -644
  90. data/spec/api/muse_api_spec.rb +0 -156
@@ -0,0 +1,505 @@
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 ## Account Sending Status Every authenticated response carries the account's current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## 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 'date'
14
+ require 'time'
15
+
16
+ module Zyphr
17
+ class WorkflowStep
18
+ attr_accessor :id
19
+
20
+ attr_accessor :workflow_id
21
+
22
+ # Unique step identifier within the workflow.
23
+ attr_accessor :step_key
24
+
25
+ # Human-readable step name.
26
+ attr_accessor :name
27
+
28
+ attr_accessor :type
29
+
30
+ # Ordering position of the step within the workflow.
31
+ attr_accessor :position
32
+
33
+ # Step configuration. The shape depends on `type` — channel steps carry message content (subject, body, template_id, etc.), `delay` steps carry `{ amount, unit }`, and `branch` steps carry `{ conditions }`.
34
+ attr_accessor :config
35
+
36
+ attr_accessor :parent_step_id
37
+
38
+ attr_accessor :branch_path
39
+
40
+ attr_accessor :created_at
41
+
42
+ attr_accessor :updated_at
43
+
44
+ class EnumAttributeValidator
45
+ attr_reader :datatype
46
+ attr_reader :allowable_values
47
+
48
+ def initialize(datatype, allowable_values)
49
+ @allowable_values = allowable_values.map do |value|
50
+ case datatype.to_s
51
+ when /Integer/i
52
+ value.to_i
53
+ when /Float/i
54
+ value.to_f
55
+ else
56
+ value
57
+ end
58
+ end
59
+ end
60
+
61
+ def valid?(value)
62
+ !value || allowable_values.include?(value)
63
+ end
64
+ end
65
+
66
+ # Attribute mapping from ruby-style variable name to JSON key.
67
+ def self.attribute_map
68
+ {
69
+ :'id' => :'id',
70
+ :'workflow_id' => :'workflow_id',
71
+ :'step_key' => :'step_key',
72
+ :'name' => :'name',
73
+ :'type' => :'type',
74
+ :'position' => :'position',
75
+ :'config' => :'config',
76
+ :'parent_step_id' => :'parent_step_id',
77
+ :'branch_path' => :'branch_path',
78
+ :'created_at' => :'created_at',
79
+ :'updated_at' => :'updated_at'
80
+ }
81
+ end
82
+
83
+ # Returns attribute mapping this model knows about
84
+ def self.acceptable_attribute_map
85
+ attribute_map
86
+ end
87
+
88
+ # Returns all the JSON keys this model knows about
89
+ def self.acceptable_attributes
90
+ acceptable_attribute_map.values
91
+ end
92
+
93
+ # Attribute type mapping.
94
+ def self.openapi_types
95
+ {
96
+ :'id' => :'String',
97
+ :'workflow_id' => :'String',
98
+ :'step_key' => :'String',
99
+ :'name' => :'String',
100
+ :'type' => :'WorkflowStepType',
101
+ :'position' => :'Integer',
102
+ :'config' => :'Hash<String, Object>',
103
+ :'parent_step_id' => :'String',
104
+ :'branch_path' => :'String',
105
+ :'created_at' => :'Time',
106
+ :'updated_at' => :'Time'
107
+ }
108
+ end
109
+
110
+ # List of attributes with nullable: true
111
+ def self.openapi_nullable
112
+ Set.new([
113
+ :'parent_step_id',
114
+ :'branch_path',
115
+ ])
116
+ end
117
+
118
+ # Initializes the object
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ def initialize(attributes = {})
121
+ if (!attributes.is_a?(Hash))
122
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::WorkflowStep` initialize method"
123
+ end
124
+
125
+ # check to see if the attribute exists and convert string to symbol for hash key
126
+ acceptable_attribute_map = self.class.acceptable_attribute_map
127
+ attributes = attributes.each_with_object({}) { |(k, v), h|
128
+ if (!acceptable_attribute_map.key?(k.to_sym))
129
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::WorkflowStep`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
130
+ end
131
+ h[k.to_sym] = v
132
+ }
133
+
134
+ if attributes.key?(:'id')
135
+ self.id = attributes[:'id']
136
+ else
137
+ self.id = nil
138
+ end
139
+
140
+ if attributes.key?(:'workflow_id')
141
+ self.workflow_id = attributes[:'workflow_id']
142
+ else
143
+ self.workflow_id = nil
144
+ end
145
+
146
+ if attributes.key?(:'step_key')
147
+ self.step_key = attributes[:'step_key']
148
+ else
149
+ self.step_key = nil
150
+ end
151
+
152
+ if attributes.key?(:'name')
153
+ self.name = attributes[:'name']
154
+ else
155
+ self.name = nil
156
+ end
157
+
158
+ if attributes.key?(:'type')
159
+ self.type = attributes[:'type']
160
+ else
161
+ self.type = nil
162
+ end
163
+
164
+ if attributes.key?(:'position')
165
+ self.position = attributes[:'position']
166
+ else
167
+ self.position = nil
168
+ end
169
+
170
+ if attributes.key?(:'config')
171
+ if (value = attributes[:'config']).is_a?(Hash)
172
+ self.config = value
173
+ end
174
+ else
175
+ self.config = nil
176
+ end
177
+
178
+ if attributes.key?(:'parent_step_id')
179
+ self.parent_step_id = attributes[:'parent_step_id']
180
+ end
181
+
182
+ if attributes.key?(:'branch_path')
183
+ self.branch_path = attributes[:'branch_path']
184
+ end
185
+
186
+ if attributes.key?(:'created_at')
187
+ self.created_at = attributes[:'created_at']
188
+ else
189
+ self.created_at = nil
190
+ end
191
+
192
+ if attributes.key?(:'updated_at')
193
+ self.updated_at = attributes[:'updated_at']
194
+ else
195
+ self.updated_at = nil
196
+ end
197
+ end
198
+
199
+ # Show invalid properties with the reasons. Usually used together with valid?
200
+ # @return Array for valid properties with the reasons
201
+ def list_invalid_properties
202
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
203
+ invalid_properties = Array.new
204
+ if @id.nil?
205
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
206
+ end
207
+
208
+ if @workflow_id.nil?
209
+ invalid_properties.push('invalid value for "workflow_id", workflow_id cannot be nil.')
210
+ end
211
+
212
+ if @step_key.nil?
213
+ invalid_properties.push('invalid value for "step_key", step_key cannot be nil.')
214
+ end
215
+
216
+ if @name.nil?
217
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
218
+ end
219
+
220
+ if @type.nil?
221
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
222
+ end
223
+
224
+ if @position.nil?
225
+ invalid_properties.push('invalid value for "position", position cannot be nil.')
226
+ end
227
+
228
+ if @config.nil?
229
+ invalid_properties.push('invalid value for "config", config cannot be nil.')
230
+ end
231
+
232
+ if @created_at.nil?
233
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
234
+ end
235
+
236
+ if @updated_at.nil?
237
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
238
+ end
239
+
240
+ invalid_properties
241
+ end
242
+
243
+ # Check to see if the all the properties in the model are valid
244
+ # @return true if the model is valid
245
+ def valid?
246
+ warn '[DEPRECATED] the `valid?` method is obsolete'
247
+ return false if @id.nil?
248
+ return false if @workflow_id.nil?
249
+ return false if @step_key.nil?
250
+ return false if @name.nil?
251
+ return false if @type.nil?
252
+ return false if @position.nil?
253
+ return false if @config.nil?
254
+ branch_path_validator = EnumAttributeValidator.new('String', ["true", "false"])
255
+ return false unless branch_path_validator.valid?(@branch_path)
256
+ return false if @created_at.nil?
257
+ return false if @updated_at.nil?
258
+ true
259
+ end
260
+
261
+ # Custom attribute writer method with validation
262
+ # @param [Object] id Value to be assigned
263
+ def id=(id)
264
+ if id.nil?
265
+ fail ArgumentError, 'id cannot be nil'
266
+ end
267
+
268
+ @id = id
269
+ end
270
+
271
+ # Custom attribute writer method with validation
272
+ # @param [Object] workflow_id Value to be assigned
273
+ def workflow_id=(workflow_id)
274
+ if workflow_id.nil?
275
+ fail ArgumentError, 'workflow_id cannot be nil'
276
+ end
277
+
278
+ @workflow_id = workflow_id
279
+ end
280
+
281
+ # Custom attribute writer method with validation
282
+ # @param [Object] step_key Value to be assigned
283
+ def step_key=(step_key)
284
+ if step_key.nil?
285
+ fail ArgumentError, 'step_key cannot be nil'
286
+ end
287
+
288
+ @step_key = step_key
289
+ end
290
+
291
+ # Custom attribute writer method with validation
292
+ # @param [Object] name Value to be assigned
293
+ def name=(name)
294
+ if name.nil?
295
+ fail ArgumentError, 'name cannot be nil'
296
+ end
297
+
298
+ @name = name
299
+ end
300
+
301
+ # Custom attribute writer method with validation
302
+ # @param [Object] type Value to be assigned
303
+ def type=(type)
304
+ if type.nil?
305
+ fail ArgumentError, 'type cannot be nil'
306
+ end
307
+
308
+ @type = type
309
+ end
310
+
311
+ # Custom attribute writer method with validation
312
+ # @param [Object] position Value to be assigned
313
+ def position=(position)
314
+ if position.nil?
315
+ fail ArgumentError, 'position cannot be nil'
316
+ end
317
+
318
+ @position = position
319
+ end
320
+
321
+ # Custom attribute writer method with validation
322
+ # @param [Object] config Value to be assigned
323
+ def config=(config)
324
+ if config.nil?
325
+ fail ArgumentError, 'config cannot be nil'
326
+ end
327
+
328
+ @config = config
329
+ end
330
+
331
+ # Custom attribute writer method checking allowed values (enum).
332
+ # @param [Object] branch_path Object to be assigned
333
+ def branch_path=(branch_path)
334
+ validator = EnumAttributeValidator.new('String', ["true", "false"])
335
+ unless validator.valid?(branch_path)
336
+ fail ArgumentError, "invalid value for \"branch_path\", must be one of #{validator.allowable_values}."
337
+ end
338
+ @branch_path = branch_path
339
+ end
340
+
341
+ # Custom attribute writer method with validation
342
+ # @param [Object] created_at Value to be assigned
343
+ def created_at=(created_at)
344
+ if created_at.nil?
345
+ fail ArgumentError, 'created_at cannot be nil'
346
+ end
347
+
348
+ @created_at = created_at
349
+ end
350
+
351
+ # Custom attribute writer method with validation
352
+ # @param [Object] updated_at Value to be assigned
353
+ def updated_at=(updated_at)
354
+ if updated_at.nil?
355
+ fail ArgumentError, 'updated_at cannot be nil'
356
+ end
357
+
358
+ @updated_at = updated_at
359
+ end
360
+
361
+ # Checks equality by comparing each attribute.
362
+ # @param [Object] Object to be compared
363
+ def ==(o)
364
+ return true if self.equal?(o)
365
+ self.class == o.class &&
366
+ id == o.id &&
367
+ workflow_id == o.workflow_id &&
368
+ step_key == o.step_key &&
369
+ name == o.name &&
370
+ type == o.type &&
371
+ position == o.position &&
372
+ config == o.config &&
373
+ parent_step_id == o.parent_step_id &&
374
+ branch_path == o.branch_path &&
375
+ created_at == o.created_at &&
376
+ updated_at == o.updated_at
377
+ end
378
+
379
+ # @see the `==` method
380
+ # @param [Object] Object to be compared
381
+ def eql?(o)
382
+ self == o
383
+ end
384
+
385
+ # Calculates hash code according to all attributes.
386
+ # @return [Integer] Hash code
387
+ def hash
388
+ [id, workflow_id, step_key, name, type, position, config, parent_step_id, branch_path, created_at, updated_at].hash
389
+ end
390
+
391
+ # Builds the object from hash
392
+ # @param [Hash] attributes Model attributes in the form of hash
393
+ # @return [Object] Returns the model itself
394
+ def self.build_from_hash(attributes)
395
+ return nil unless attributes.is_a?(Hash)
396
+ attributes = attributes.transform_keys(&:to_sym)
397
+ transformed_hash = {}
398
+ openapi_types.each_pair do |key, type|
399
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
400
+ transformed_hash["#{key}"] = nil
401
+ elsif type =~ /\AArray<(.*)>/i
402
+ # check to ensure the input is an array given that the attribute
403
+ # is documented as an array but the input is not
404
+ if attributes[attribute_map[key]].is_a?(Array)
405
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
406
+ end
407
+ elsif !attributes[attribute_map[key]].nil?
408
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
409
+ end
410
+ end
411
+ new(transformed_hash)
412
+ end
413
+
414
+ # Deserializes the data based on type
415
+ # @param string type Data type
416
+ # @param string value Value to be deserialized
417
+ # @return [Object] Deserialized data
418
+ def self._deserialize(type, value)
419
+ case type.to_sym
420
+ when :Time
421
+ Time.parse(value)
422
+ when :Date
423
+ Date.parse(value)
424
+ when :String
425
+ value.to_s
426
+ when :Integer
427
+ value.to_i
428
+ when :Float
429
+ value.to_f
430
+ when :Boolean
431
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
432
+ true
433
+ else
434
+ false
435
+ end
436
+ when :Object
437
+ # generic object (usually a Hash), return directly
438
+ value
439
+ when /\AArray<(?<inner_type>.+)>\z/
440
+ inner_type = Regexp.last_match[:inner_type]
441
+ value.map { |v| _deserialize(inner_type, v) }
442
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
443
+ k_type = Regexp.last_match[:k_type]
444
+ v_type = Regexp.last_match[:v_type]
445
+ {}.tap do |hash|
446
+ value.each do |k, v|
447
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
448
+ end
449
+ end
450
+ else # model
451
+ # models (e.g. Pet) or oneOf
452
+ klass = Zyphr.const_get(type)
453
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
454
+ end
455
+ end
456
+
457
+ # Returns the string representation of the object
458
+ # @return [String] String presentation of the object
459
+ def to_s
460
+ to_hash.to_s
461
+ end
462
+
463
+ # to_body is an alias to to_hash (backward compatibility)
464
+ # @return [Hash] Returns the object in the form of hash
465
+ def to_body
466
+ to_hash
467
+ end
468
+
469
+ # Returns the object in the form of hash
470
+ # @return [Hash] Returns the object in the form of hash
471
+ def to_hash
472
+ hash = {}
473
+ self.class.attribute_map.each_pair do |attr, param|
474
+ value = self.send(attr)
475
+ if value.nil?
476
+ is_nullable = self.class.openapi_nullable.include?(attr)
477
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
478
+ end
479
+
480
+ hash[param] = _to_hash(value)
481
+ end
482
+ hash
483
+ end
484
+
485
+ # Outputs non-array value in the form of hash
486
+ # For object, use to_hash. Otherwise, just return the value
487
+ # @param [Object] value Any valid value
488
+ # @return [Hash] Returns the value in the form of hash
489
+ def _to_hash(value)
490
+ if value.is_a?(Array)
491
+ value.compact.map { |v| _to_hash(v) }
492
+ elsif value.is_a?(Hash)
493
+ {}.tap do |hash|
494
+ value.each { |k, v| hash[k] = _to_hash(v) }
495
+ end
496
+ elsif value.respond_to? :to_hash
497
+ value.to_hash
498
+ else
499
+ value
500
+ end
501
+ end
502
+
503
+ end
504
+
505
+ end
@@ -0,0 +1,47 @@
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 ## Account Sending Status Every authenticated response carries the account's current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## 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 'date'
14
+ require 'time'
15
+
16
+ module Zyphr
17
+ class WorkflowStepType
18
+ EMAIL = "email".freeze
19
+ PUSH = "push".freeze
20
+ SMS = "sms".freeze
21
+ IN_APP = "in_app".freeze
22
+ SLACK = "slack".freeze
23
+ DISCORD = "discord".freeze
24
+ TEAMS = "teams".freeze
25
+ DELAY = "delay".freeze
26
+ BRANCH = "branch".freeze
27
+
28
+ def self.all_vars
29
+ @all_vars ||= [EMAIL, PUSH, SMS, IN_APP, SLACK, DISCORD, TEAMS, DELAY, BRANCH].freeze
30
+ end
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def self.build_from_hash(value)
36
+ new.build_from_hash(value)
37
+ end
38
+
39
+ # Builds the enum from string
40
+ # @param [String] The enum value in the form of the string
41
+ # @return [String] The enum value
42
+ def build_from_hash(value)
43
+ return value if WorkflowStepType.all_vars.include?(value)
44
+ raise "Invalid ENUM value #{value} for class #WorkflowStepType"
45
+ end
46
+ end
47
+ end
data/lib/zyphr.rb CHANGED
@@ -22,6 +22,8 @@ require 'zyphr/models/add_domain200_response_meta'
22
22
  require 'zyphr/models/add_domain_request'
23
23
  require 'zyphr/models/add_organization_member_request'
24
24
  require 'zyphr/models/add_topic_subscribers_request'
25
+ require 'zyphr/models/add_workflow_step201_response'
26
+ require 'zyphr/models/add_workflow_step_request'
25
27
  require 'zyphr/models/api_error'
26
28
  require 'zyphr/models/api_error_error'
27
29
  require 'zyphr/models/api_error_meta'
@@ -88,10 +90,16 @@ require 'zyphr/models/create_waa_s_endpoint_response'
88
90
  require 'zyphr/models/create_waa_s_event_type201_response'
89
91
  require 'zyphr/models/create_waa_s_event_type_request'
90
92
  require 'zyphr/models/create_webhook_request'
93
+ require 'zyphr/models/create_workflow201_response'
94
+ require 'zyphr/models/create_workflow_request'
91
95
  require 'zyphr/models/delete_domain_response'
92
96
  require 'zyphr/models/delete_domain_response_data'
93
97
  require 'zyphr/models/delete_result'
94
98
  require 'zyphr/models/delete_result_data'
99
+ require 'zyphr/models/delete_workflow200_response'
100
+ require 'zyphr/models/delete_workflow200_response_data'
101
+ require 'zyphr/models/delete_workflow_step200_response'
102
+ require 'zyphr/models/delete_workflow_step200_response_data'
95
103
  require 'zyphr/models/device'
96
104
  require 'zyphr/models/device_list_response'
97
105
  require 'zyphr/models/device_push_topic'
@@ -149,6 +157,10 @@ require 'zyphr/models/list_waa_s_applications200_response'
149
157
  require 'zyphr/models/list_waa_s_endpoint_deliveries200_response'
150
158
  require 'zyphr/models/list_waa_s_endpoints200_response'
151
159
  require 'zyphr/models/list_waa_s_event_types200_response'
160
+ require 'zyphr/models/list_workflow_executions200_response'
161
+ require 'zyphr/models/list_workflow_executions200_response_meta'
162
+ require 'zyphr/models/list_workflows200_response'
163
+ require 'zyphr/models/list_workflows200_response_meta'
152
164
  require 'zyphr/models/login_request'
153
165
  require 'zyphr/models/magic_link_send_request'
154
166
  require 'zyphr/models/magic_link_verify_request'
@@ -243,6 +255,7 @@ require 'zyphr/models/register_request'
243
255
  require 'zyphr/models/remove_topic_subscribers_request'
244
256
  require 'zyphr/models/rename_web_authn_credential_request'
245
257
  require 'zyphr/models/render_template_request'
258
+ require 'zyphr/models/reorder_workflow_steps_request'
246
259
  require 'zyphr/models/replay_webhook_events_request'
247
260
  require 'zyphr/models/request_meta'
248
261
  require 'zyphr/models/reset_password_request'
@@ -313,7 +326,6 @@ require 'zyphr/models/sms_config_delete_response_data'
313
326
  require 'zyphr/models/sms_config_response'
314
327
  require 'zyphr/models/sms_detail_response'
315
328
  require 'zyphr/models/sms_list_response'
316
- require 'zyphr/models/sms_list_response_meta'
317
329
  require 'zyphr/models/sms_message'
318
330
  require 'zyphr/models/sms_message_detail'
319
331
  require 'zyphr/models/subscribe_push_topic_request'
@@ -335,7 +347,6 @@ require 'zyphr/models/template_response'
335
347
  require 'zyphr/models/test_webhook_transform_request'
336
348
  require 'zyphr/models/topic'
337
349
  require 'zyphr/models/topic_delete_response'
338
- require 'zyphr/models/topic_delete_response_data'
339
350
  require 'zyphr/models/topic_list_response'
340
351
  require 'zyphr/models/topic_response'
341
352
  require 'zyphr/models/topic_stats_data'
@@ -347,6 +358,9 @@ require 'zyphr/models/topic_subscribers_add_response'
347
358
  require 'zyphr/models/topic_subscribers_add_result'
348
359
  require 'zyphr/models/topic_subscribers_remove_response'
349
360
  require 'zyphr/models/topic_subscribers_remove_result'
361
+ require 'zyphr/models/trigger_workflow202_response'
362
+ require 'zyphr/models/trigger_workflow202_response_data'
363
+ require 'zyphr/models/trigger_workflow_request'
350
364
  require 'zyphr/models/unread_count_data'
351
365
  require 'zyphr/models/unread_count_response'
352
366
  require 'zyphr/models/unsubscribe'
@@ -367,11 +381,13 @@ require 'zyphr/models/update_waa_s_application_request'
367
381
  require 'zyphr/models/update_waa_s_endpoint_request'
368
382
  require 'zyphr/models/update_waa_s_event_type_request'
369
383
  require 'zyphr/models/update_webhook_request'
384
+ require 'zyphr/models/update_workflow_request'
385
+ require 'zyphr/models/update_workflow_status_request'
386
+ require 'zyphr/models/update_workflow_step_request'
370
387
  require 'zyphr/models/upsert_auth_email_template_request'
371
388
  require 'zyphr/models/upsert_sms_config_request'
372
389
  require 'zyphr/models/user_devices_delete_response'
373
390
  require 'zyphr/models/user_devices_delete_response_data'
374
- require 'zyphr/models/v1_muse_subjects_suggest_post_request'
375
391
  require 'zyphr/models/validate_reset_token_request'
376
392
  require 'zyphr/models/validate_reset_token_response'
377
393
  require 'zyphr/models/validate_reset_token_response_data'
@@ -447,10 +463,14 @@ require 'zyphr/models/webhook_version'
447
463
  require 'zyphr/models/webhook_versions_response'
448
464
  require 'zyphr/models/webhook_versions_response_data'
449
465
  require 'zyphr/models/withdraw_subscriber_consent_request'
466
+ require 'zyphr/models/workflow'
450
467
  require 'zyphr/models/workflow_execution'
451
468
  require 'zyphr/models/workflow_execution_status'
469
+ require 'zyphr/models/workflow_status'
470
+ require 'zyphr/models/workflow_step'
452
471
  require 'zyphr/models/workflow_step_execution'
453
472
  require 'zyphr/models/workflow_step_execution_status'
473
+ require 'zyphr/models/workflow_step_type'
454
474
 
455
475
  # APIs
456
476
  require 'zyphr/api/auth_email_otp_api'
@@ -474,7 +494,6 @@ require 'zyphr/api/emails_api'
474
494
  require 'zyphr/api/executions_api'
475
495
  require 'zyphr/api/inbound_email_api'
476
496
  require 'zyphr/api/inbox_api'
477
- require 'zyphr/api/muse_api'
478
497
  require 'zyphr/api/push_api'
479
498
  require 'zyphr/api/sms_api'
480
499
  require 'zyphr/api/slack_api'
@@ -489,6 +508,7 @@ require 'zyphr/api/waa_s_event_types_api'
489
508
  require 'zyphr/api/waa_s_events_api'
490
509
  require 'zyphr/api/waa_s_portal_api'
491
510
  require 'zyphr/api/webhooks_api'
511
+ require 'zyphr/api/workflows_api'
492
512
 
493
513
  module Zyphr
494
514
  class << self
@@ -70,7 +70,7 @@ describe 'AuthRegistrationApi' do
70
70
 
71
71
  # unit tests for sign_in_with_game_center
72
72
  # Sign in with Apple Game Center
73
- # Exchange an Apple Game Center identity-verification assertion for a Zyphr end-user session. Zyphr independently re-verifies the assertion server-side (Apple certificate chain, RSA-SHA256 signature, timestamp freshness, single-use replay guard, and bundle-id binding) before provisioning-or-looking-up the user and minting tokens. The user is keyed on the modern scoped &#x60;playerId&#x60; (gamePlayerID). ## Producing the assertion (Integration) The assertion is produced **on-device by the iOS app** — there is no server-side way to mint it. The app calls GameKit&#39;s &#x60;GKLocalPlayer.fetchItems(forIdentityVerificationSignature:)&#x60;, which returns &#x60;publicKeyURL&#x60;, &#x60;signature&#x60;, &#x60;salt&#x60;, and &#x60;timestamp&#x60;; combine those with the local player&#39;s &#x60;gamePlayerID&#x60; and the app&#39;s bundle identifier and submit them here. Two integration shapes are supported: - **client-direct** — the iOS app holds the Zyphr application public key and calls this endpoint itself. - **backend-relayed** — the app forwards the fetched assertion fields to the customer&#39;s own backend, which relays them to this endpoint; the app never holds Zyphr keys. (This is the common shape for games.) On any verification failure the response is a single opaque &#x60;401&#x60; &#x60;invalid_assertion&#x60; — the specific control that failed is never disclosed.
73
+ # Exchange an Apple Game Center identity-verification assertion for a Zyphr end-user session. Zyphr independently re-verifies the assertion server-side (Apple certificate chain, RSA-SHA256 signature, timestamp freshness, single-use replay guard, and bundle-id binding) before provisioning-or-looking-up the user and minting tokens. The user is keyed on the player&#39;s &#x60;teamPlayerID&#x60; (the id GameKit signs the assertion over). ## Producing the assertion (Integration) The assertion is produced **on-device by the iOS app** — there is no server-side way to mint it. The app calls GameKit&#39;s &#x60;GKLocalPlayer.fetchItems(forIdentityVerificationSignature:)&#x60;, which returns &#x60;publicKeyURL&#x60;, &#x60;signature&#x60;, &#x60;salt&#x60;, and &#x60;timestamp&#x60;; combine those with the local player&#39;s &#x60;teamPlayerID&#x60; (NOT &#x60;gamePlayerID&#x60;) and the app&#39;s bundle identifier and submit them here. Two integration shapes are supported: - **client-direct** — the iOS app holds the Zyphr application public key and calls this endpoint itself. - **backend-relayed** — the app forwards the fetched assertion fields to the customer&#39;s own backend, which relays them to this endpoint; the app never holds Zyphr keys. (This is the common shape for games.) On any verification failure the response is a single opaque &#x60;401&#x60; &#x60;invalid_assertion&#x60; — the specific control that failed is never disclosed.
74
74
  # @param sign_in_with_game_center_request
75
75
  # @param [Hash] opts the optional parameters
76
76
  # @return [AuthResultResponse]