surge_api 0.1.0

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 (212) hide show
  1. checksums.yaml +7 -0
  2. data/.ignore +2 -0
  3. data/CHANGELOG.md +28 -0
  4. data/README.md +286 -0
  5. data/SECURITY.md +27 -0
  6. data/lib/surge_api/client.rb +106 -0
  7. data/lib/surge_api/errors.rb +228 -0
  8. data/lib/surge_api/file_part.rb +55 -0
  9. data/lib/surge_api/internal/transport/base_client.rb +567 -0
  10. data/lib/surge_api/internal/transport/pooled_net_requester.rb +201 -0
  11. data/lib/surge_api/internal/type/array_of.rb +168 -0
  12. data/lib/surge_api/internal/type/base_model.rb +531 -0
  13. data/lib/surge_api/internal/type/base_page.rb +55 -0
  14. data/lib/surge_api/internal/type/boolean.rb +77 -0
  15. data/lib/surge_api/internal/type/converter.rb +327 -0
  16. data/lib/surge_api/internal/type/enum.rb +131 -0
  17. data/lib/surge_api/internal/type/file_input.rb +108 -0
  18. data/lib/surge_api/internal/type/hash_of.rb +188 -0
  19. data/lib/surge_api/internal/type/request_parameters.rb +42 -0
  20. data/lib/surge_api/internal/type/union.rb +250 -0
  21. data/lib/surge_api/internal/type/unknown.rb +81 -0
  22. data/lib/surge_api/internal/util.rb +915 -0
  23. data/lib/surge_api/internal.rb +20 -0
  24. data/lib/surge_api/models/account.rb +60 -0
  25. data/lib/surge_api/models/account_create_params.rb +481 -0
  26. data/lib/surge_api/models/account_retrieve_status_params.rb +32 -0
  27. data/lib/surge_api/models/account_status.rb +104 -0
  28. data/lib/surge_api/models/account_update_params.rb +480 -0
  29. data/lib/surge_api/models/blast.rb +61 -0
  30. data/lib/surge_api/models/blast_create_params.rb +90 -0
  31. data/lib/surge_api/models/call_ended_webhook_event.rb +106 -0
  32. data/lib/surge_api/models/campaign.rb +208 -0
  33. data/lib/surge_api/models/campaign_approved_webhook_event.rb +74 -0
  34. data/lib/surge_api/models/campaign_create_params.rb +202 -0
  35. data/lib/surge_api/models/contact.rb +59 -0
  36. data/lib/surge_api/models/contact_create_params.rb +54 -0
  37. data/lib/surge_api/models/contact_retrieve_params.rb +14 -0
  38. data/lib/surge_api/models/contact_update_params.rb +54 -0
  39. data/lib/surge_api/models/conversation_created_webhook_event.rb +70 -0
  40. data/lib/surge_api/models/error.rb +34 -0
  41. data/lib/surge_api/models/message.rb +146 -0
  42. data/lib/surge_api/models/message_create_params.rb +153 -0
  43. data/lib/surge_api/models/message_delivered_webhook_event.rb +159 -0
  44. data/lib/surge_api/models/message_failed_webhook_event.rb +167 -0
  45. data/lib/surge_api/models/message_received_webhook_event.rb +159 -0
  46. data/lib/surge_api/models/message_sent_webhook_event.rb +159 -0
  47. data/lib/surge_api/models/organization.rb +419 -0
  48. data/lib/surge_api/models/phone_number.rb +48 -0
  49. data/lib/surge_api/models/phone_number_purchase_params.rb +65 -0
  50. data/lib/surge_api/models/unwrap_webhook_event.rb +26 -0
  51. data/lib/surge_api/models/user.rb +51 -0
  52. data/lib/surge_api/models/user_create_params.rb +46 -0
  53. data/lib/surge_api/models/user_create_token_params.rb +22 -0
  54. data/lib/surge_api/models/user_retrieve_params.rb +14 -0
  55. data/lib/surge_api/models/user_token_response.rb +19 -0
  56. data/lib/surge_api/models/user_update_params.rb +46 -0
  57. data/lib/surge_api/models/verification.rb +58 -0
  58. data/lib/surge_api/models/verification_check.rb +43 -0
  59. data/lib/surge_api/models/verification_check_params.rb +22 -0
  60. data/lib/surge_api/models/verification_create_params.rb +22 -0
  61. data/lib/surge_api/models/webhook_unwrap_params.rb +14 -0
  62. data/lib/surge_api/models.rb +117 -0
  63. data/lib/surge_api/request_options.rb +77 -0
  64. data/lib/surge_api/resources/accounts.rb +102 -0
  65. data/lib/surge_api/resources/blasts.rb +53 -0
  66. data/lib/surge_api/resources/campaigns.rb +57 -0
  67. data/lib/surge_api/resources/contacts.rb +99 -0
  68. data/lib/surge_api/resources/messages.rb +75 -0
  69. data/lib/surge_api/resources/phone_numbers.rb +48 -0
  70. data/lib/surge_api/resources/users.rb +119 -0
  71. data/lib/surge_api/resources/verifications.rb +60 -0
  72. data/lib/surge_api/resources/webhooks.rb +22 -0
  73. data/lib/surge_api/version.rb +5 -0
  74. data/lib/surge_api.rb +100 -0
  75. data/manifest.yaml +15 -0
  76. data/rbi/surge_api/client.rbi +73 -0
  77. data/rbi/surge_api/errors.rbi +205 -0
  78. data/rbi/surge_api/file_part.rbi +37 -0
  79. data/rbi/surge_api/internal/transport/base_client.rbi +292 -0
  80. data/rbi/surge_api/internal/transport/pooled_net_requester.rbi +79 -0
  81. data/rbi/surge_api/internal/type/array_of.rbi +104 -0
  82. data/rbi/surge_api/internal/type/base_model.rbi +302 -0
  83. data/rbi/surge_api/internal/type/base_page.rbi +42 -0
  84. data/rbi/surge_api/internal/type/boolean.rbi +58 -0
  85. data/rbi/surge_api/internal/type/converter.rbi +216 -0
  86. data/rbi/surge_api/internal/type/enum.rbi +82 -0
  87. data/rbi/surge_api/internal/type/file_input.rbi +59 -0
  88. data/rbi/surge_api/internal/type/hash_of.rbi +104 -0
  89. data/rbi/surge_api/internal/type/request_parameters.rbi +29 -0
  90. data/rbi/surge_api/internal/type/union.rbi +128 -0
  91. data/rbi/surge_api/internal/type/unknown.rbi +58 -0
  92. data/rbi/surge_api/internal/util.rbi +487 -0
  93. data/rbi/surge_api/internal.rbi +16 -0
  94. data/rbi/surge_api/models/account.rbi +83 -0
  95. data/rbi/surge_api/models/account_create_params.rbi +1104 -0
  96. data/rbi/surge_api/models/account_retrieve_status_params.rbi +96 -0
  97. data/rbi/surge_api/models/account_status.rbi +185 -0
  98. data/rbi/surge_api/models/account_update_params.rbi +1105 -0
  99. data/rbi/surge_api/models/blast.rbi +108 -0
  100. data/rbi/surge_api/models/blast_create_params.rbi +145 -0
  101. data/rbi/surge_api/models/call_ended_webhook_event.rbi +205 -0
  102. data/rbi/surge_api/models/campaign.rbi +331 -0
  103. data/rbi/surge_api/models/campaign_approved_webhook_event.rbi +149 -0
  104. data/rbi/surge_api/models/campaign_create_params.rbi +386 -0
  105. data/rbi/surge_api/models/contact.rbi +88 -0
  106. data/rbi/surge_api/models/contact_create_params.rbi +87 -0
  107. data/rbi/surge_api/models/contact_retrieve_params.rbi +27 -0
  108. data/rbi/surge_api/models/contact_update_params.rbi +87 -0
  109. data/rbi/surge_api/models/conversation_created_webhook_event.rbi +129 -0
  110. data/rbi/surge_api/models/error.rbi +51 -0
  111. data/rbi/surge_api/models/message.rbi +283 -0
  112. data/rbi/surge_api/models/message_create_params.rbi +281 -0
  113. data/rbi/surge_api/models/message_delivered_webhook_event.rbi +331 -0
  114. data/rbi/surge_api/models/message_failed_webhook_event.rbi +335 -0
  115. data/rbi/surge_api/models/message_received_webhook_event.rbi +331 -0
  116. data/rbi/surge_api/models/message_sent_webhook_event.rbi +322 -0
  117. data/rbi/surge_api/models/organization.rbi +649 -0
  118. data/rbi/surge_api/models/phone_number.rbi +72 -0
  119. data/rbi/surge_api/models/phone_number_purchase_params.rbi +122 -0
  120. data/rbi/surge_api/models/unwrap_webhook_event.rbi +26 -0
  121. data/rbi/surge_api/models/user.rbi +80 -0
  122. data/rbi/surge_api/models/user_create_params.rbi +76 -0
  123. data/rbi/surge_api/models/user_create_token_params.rbi +46 -0
  124. data/rbi/surge_api/models/user_retrieve_params.rbi +27 -0
  125. data/rbi/surge_api/models/user_token_response.rbi +31 -0
  126. data/rbi/surge_api/models/user_update_params.rbi +76 -0
  127. data/rbi/surge_api/models/verification.rbi +86 -0
  128. data/rbi/surge_api/models/verification_check.rbi +84 -0
  129. data/rbi/surge_api/models/verification_check_params.rbi +40 -0
  130. data/rbi/surge_api/models/verification_create_params.rbi +40 -0
  131. data/rbi/surge_api/models/webhook_unwrap_params.rbi +27 -0
  132. data/rbi/surge_api/models.rbi +80 -0
  133. data/rbi/surge_api/request_options.rbi +59 -0
  134. data/rbi/surge_api/resources/accounts.rbi +94 -0
  135. data/rbi/surge_api/resources/blasts.rbi +48 -0
  136. data/rbi/surge_api/resources/campaigns.rbi +115 -0
  137. data/rbi/surge_api/resources/contacts.rbi +85 -0
  138. data/rbi/surge_api/resources/messages.rbi +72 -0
  139. data/rbi/surge_api/resources/phone_numbers.rbi +43 -0
  140. data/rbi/surge_api/resources/users.rbi +96 -0
  141. data/rbi/surge_api/resources/verifications.rbi +43 -0
  142. data/rbi/surge_api/resources/webhooks.rbi +31 -0
  143. data/rbi/surge_api/version.rbi +5 -0
  144. data/sig/surge_api/client.rbs +42 -0
  145. data/sig/surge_api/errors.rbs +117 -0
  146. data/sig/surge_api/file_part.rbs +21 -0
  147. data/sig/surge_api/internal/transport/base_client.rbs +131 -0
  148. data/sig/surge_api/internal/transport/pooled_net_requester.rbs +45 -0
  149. data/sig/surge_api/internal/type/array_of.rbs +48 -0
  150. data/sig/surge_api/internal/type/base_model.rbs +102 -0
  151. data/sig/surge_api/internal/type/base_page.rbs +24 -0
  152. data/sig/surge_api/internal/type/boolean.rbs +26 -0
  153. data/sig/surge_api/internal/type/converter.rbs +79 -0
  154. data/sig/surge_api/internal/type/enum.rbs +32 -0
  155. data/sig/surge_api/internal/type/file_input.rbs +25 -0
  156. data/sig/surge_api/internal/type/hash_of.rbs +48 -0
  157. data/sig/surge_api/internal/type/request_parameters.rbs +17 -0
  158. data/sig/surge_api/internal/type/union.rbs +52 -0
  159. data/sig/surge_api/internal/type/unknown.rbs +26 -0
  160. data/sig/surge_api/internal/util.rbs +185 -0
  161. data/sig/surge_api/internal.rbs +9 -0
  162. data/sig/surge_api/models/account.rbs +40 -0
  163. data/sig/surge_api/models/account_create_params.rbs +433 -0
  164. data/sig/surge_api/models/account_retrieve_status_params.rbs +40 -0
  165. data/sig/surge_api/models/account_status.rbs +71 -0
  166. data/sig/surge_api/models/account_update_params.rbs +435 -0
  167. data/sig/surge_api/models/blast.rbs +64 -0
  168. data/sig/surge_api/models/blast_create_params.rbs +82 -0
  169. data/sig/surge_api/models/call_ended_webhook_event.rbs +99 -0
  170. data/sig/surge_api/models/campaign.rbs +122 -0
  171. data/sig/surge_api/models/campaign_approved_webhook_event.rbs +67 -0
  172. data/sig/surge_api/models/campaign_create_params.rbs +127 -0
  173. data/sig/surge_api/models/contact.rbs +53 -0
  174. data/sig/surge_api/models/contact_create_params.rbs +54 -0
  175. data/sig/surge_api/models/contact_retrieve_params.rbs +15 -0
  176. data/sig/surge_api/models/contact_update_params.rbs +54 -0
  177. data/sig/surge_api/models/conversation_created_webhook_event.rbs +62 -0
  178. data/sig/surge_api/models/error.rbs +27 -0
  179. data/sig/surge_api/models/message.rbs +138 -0
  180. data/sig/surge_api/models/message_create_params.rbs +140 -0
  181. data/sig/surge_api/models/message_delivered_webhook_event.rbs +143 -0
  182. data/sig/surge_api/models/message_failed_webhook_event.rbs +148 -0
  183. data/sig/surge_api/models/message_received_webhook_event.rbs +143 -0
  184. data/sig/surge_api/models/message_sent_webhook_event.rbs +143 -0
  185. data/sig/surge_api/models/organization.rbs +385 -0
  186. data/sig/surge_api/models/phone_number.rbs +37 -0
  187. data/sig/surge_api/models/phone_number_purchase_params.rbs +62 -0
  188. data/sig/surge_api/models/unwrap_webhook_event.rbs +18 -0
  189. data/sig/surge_api/models/user.rbs +48 -0
  190. data/sig/surge_api/models/user_create_params.rbs +47 -0
  191. data/sig/surge_api/models/user_create_token_params.rbs +26 -0
  192. data/sig/surge_api/models/user_retrieve_params.rbs +15 -0
  193. data/sig/surge_api/models/user_token_response.rbs +15 -0
  194. data/sig/surge_api/models/user_update_params.rbs +47 -0
  195. data/sig/surge_api/models/verification.rbs +48 -0
  196. data/sig/surge_api/models/verification_check.rbs +45 -0
  197. data/sig/surge_api/models/verification_check_params.rbs +23 -0
  198. data/sig/surge_api/models/verification_create_params.rbs +23 -0
  199. data/sig/surge_api/models/webhook_unwrap_params.rbs +15 -0
  200. data/sig/surge_api/models.rbs +77 -0
  201. data/sig/surge_api/request_options.rbs +34 -0
  202. data/sig/surge_api/resources/accounts.rbs +30 -0
  203. data/sig/surge_api/resources/blasts.rbs +19 -0
  204. data/sig/surge_api/resources/campaigns.rbs +21 -0
  205. data/sig/surge_api/resources/contacts.rbs +32 -0
  206. data/sig/surge_api/resources/messages.rbs +18 -0
  207. data/sig/surge_api/resources/phone_numbers.rbs +16 -0
  208. data/sig/surge_api/resources/users.rbs +36 -0
  209. data/sig/surge_api/resources/verifications.rbs +18 -0
  210. data/sig/surge_api/resources/webhooks.rbs +17 -0
  211. data/sig/surge_api/version.rbs +3 -0
  212. metadata +269 -0
@@ -0,0 +1,159 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ class MessageDeliveredWebhookEvent < SurgeAPI::Internal::Type::BaseModel
6
+ # @!attribute account_id
7
+ # The ID of the account in which this event occurred
8
+ #
9
+ # @return [String]
10
+ required :account_id, String
11
+
12
+ # @!attribute data
13
+ # The data associated with the event
14
+ #
15
+ # @return [SurgeAPI::Models::MessageDeliveredWebhookEvent::Data]
16
+ required :data, -> { SurgeAPI::MessageDeliveredWebhookEvent::Data }
17
+
18
+ # @!attribute timestamp
19
+ # The timestamp when this event occurred, in ISO8601 format
20
+ #
21
+ # @return [Time]
22
+ required :timestamp, Time
23
+
24
+ # @!attribute type
25
+ # The type of the event. Always `message.delivered` for this event.
26
+ #
27
+ # @return [Symbol, :"message.delivered"]
28
+ required :type, const: :"message.delivered"
29
+
30
+ # @!method initialize(account_id:, data:, timestamp:, type: :"message.delivered")
31
+ # @param account_id [String] The ID of the account in which this event occurred
32
+ #
33
+ # @param data [SurgeAPI::Models::MessageDeliveredWebhookEvent::Data] The data associated with the event
34
+ #
35
+ # @param timestamp [Time] The timestamp when this event occurred, in ISO8601 format
36
+ #
37
+ # @param type [Symbol, :"message.delivered"] The type of the event. Always `message.delivered` for this event.
38
+
39
+ # @see SurgeAPI::Models::MessageDeliveredWebhookEvent#data
40
+ class Data < SurgeAPI::Internal::Type::BaseModel
41
+ # @!attribute id
42
+ # The unique identifier for the message
43
+ #
44
+ # @return [String]
45
+ required :id, String
46
+
47
+ # @!attribute body
48
+ # The content of the message
49
+ #
50
+ # @return [String]
51
+ required :body, String
52
+
53
+ # @!attribute conversation
54
+ # The conversation this message belongs to
55
+ #
56
+ # @return [SurgeAPI::Models::MessageDeliveredWebhookEvent::Data::Conversation]
57
+ required :conversation, -> { SurgeAPI::MessageDeliveredWebhookEvent::Data::Conversation }
58
+
59
+ # @!attribute delivered_at
60
+ # When the message was delivered
61
+ #
62
+ # @return [Time]
63
+ required :delivered_at, Time
64
+
65
+ # @!attribute attachments
66
+ # Attachments included with the message
67
+ #
68
+ # @return [Array<SurgeAPI::Models::MessageDeliveredWebhookEvent::Data::Attachment>, nil]
69
+ optional :attachments,
70
+ -> { SurgeAPI::Internal::Type::ArrayOf[SurgeAPI::MessageDeliveredWebhookEvent::Data::Attachment] }
71
+
72
+ # @!method initialize(id:, body:, conversation:, delivered_at:, attachments: nil)
73
+ # The data associated with the event
74
+ #
75
+ # @param id [String] The unique identifier for the message
76
+ #
77
+ # @param body [String] The content of the message
78
+ #
79
+ # @param conversation [SurgeAPI::Models::MessageDeliveredWebhookEvent::Data::Conversation] The conversation this message belongs to
80
+ #
81
+ # @param delivered_at [Time] When the message was delivered
82
+ #
83
+ # @param attachments [Array<SurgeAPI::Models::MessageDeliveredWebhookEvent::Data::Attachment>] Attachments included with the message
84
+
85
+ # @see SurgeAPI::Models::MessageDeliveredWebhookEvent::Data#conversation
86
+ class Conversation < SurgeAPI::Internal::Type::BaseModel
87
+ # @!attribute id
88
+ # The unique identifier for the conversation
89
+ #
90
+ # @return [String]
91
+ required :id, String
92
+
93
+ # @!attribute contact
94
+ # A contact who has consented to receive messages
95
+ #
96
+ # @return [SurgeAPI::Models::Contact]
97
+ required :contact, -> { SurgeAPI::Contact }
98
+
99
+ # @!attribute phone_number
100
+ # A phone number that can be used to send and receive messages and calls
101
+ #
102
+ # @return [SurgeAPI::Models::PhoneNumber]
103
+ required :phone_number, -> { SurgeAPI::PhoneNumber }
104
+
105
+ # @!method initialize(id:, contact:, phone_number:)
106
+ # The conversation this message belongs to
107
+ #
108
+ # @param id [String] The unique identifier for the conversation
109
+ #
110
+ # @param contact [SurgeAPI::Models::Contact] A contact who has consented to receive messages
111
+ #
112
+ # @param phone_number [SurgeAPI::Models::PhoneNumber] A phone number that can be used to send and receive messages and calls
113
+ end
114
+
115
+ class Attachment < SurgeAPI::Internal::Type::BaseModel
116
+ # @!attribute id
117
+ # The unique identifier for the attachment
118
+ #
119
+ # @return [String]
120
+ required :id, String
121
+
122
+ # @!attribute type
123
+ # The type of attachment
124
+ #
125
+ # @return [Symbol, SurgeAPI::Models::MessageDeliveredWebhookEvent::Data::Attachment::Type]
126
+ required :type, enum: -> { SurgeAPI::MessageDeliveredWebhookEvent::Data::Attachment::Type }
127
+
128
+ # @!attribute url
129
+ # The URL where the attachment can be downloaded
130
+ #
131
+ # @return [String]
132
+ required :url, String
133
+
134
+ # @!method initialize(id:, type:, url:)
135
+ # @param id [String] The unique identifier for the attachment
136
+ #
137
+ # @param type [Symbol, SurgeAPI::Models::MessageDeliveredWebhookEvent::Data::Attachment::Type] The type of attachment
138
+ #
139
+ # @param url [String] The URL where the attachment can be downloaded
140
+
141
+ # The type of attachment
142
+ #
143
+ # @see SurgeAPI::Models::MessageDeliveredWebhookEvent::Data::Attachment#type
144
+ module Type
145
+ extend SurgeAPI::Internal::Type::Enum
146
+
147
+ FILE = :file
148
+ IMAGE = :image
149
+ LINK = :link
150
+ VIDEO = :video
151
+
152
+ # @!method self.values
153
+ # @return [Array<Symbol>]
154
+ end
155
+ end
156
+ end
157
+ end
158
+ end
159
+ end
@@ -0,0 +1,167 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ class MessageFailedWebhookEvent < SurgeAPI::Internal::Type::BaseModel
6
+ # @!attribute account_id
7
+ # The ID of the account in which this event occurred
8
+ #
9
+ # @return [String]
10
+ required :account_id, String
11
+
12
+ # @!attribute data
13
+ # The data associated with the event
14
+ #
15
+ # @return [SurgeAPI::Models::MessageFailedWebhookEvent::Data]
16
+ required :data, -> { SurgeAPI::MessageFailedWebhookEvent::Data }
17
+
18
+ # @!attribute timestamp
19
+ # The timestamp when this event occurred, in ISO8601 format
20
+ #
21
+ # @return [Time]
22
+ required :timestamp, Time
23
+
24
+ # @!attribute type
25
+ # The type of the event. Always `message.failed` for this event.
26
+ #
27
+ # @return [Symbol, :"message.failed"]
28
+ required :type, const: :"message.failed"
29
+
30
+ # @!method initialize(account_id:, data:, timestamp:, type: :"message.failed")
31
+ # @param account_id [String] The ID of the account in which this event occurred
32
+ #
33
+ # @param data [SurgeAPI::Models::MessageFailedWebhookEvent::Data] The data associated with the event
34
+ #
35
+ # @param timestamp [Time] The timestamp when this event occurred, in ISO8601 format
36
+ #
37
+ # @param type [Symbol, :"message.failed"] The type of the event. Always `message.failed` for this event.
38
+
39
+ # @see SurgeAPI::Models::MessageFailedWebhookEvent#data
40
+ class Data < SurgeAPI::Internal::Type::BaseModel
41
+ # @!attribute id
42
+ # The unique identifier for the message
43
+ #
44
+ # @return [String]
45
+ required :id, String
46
+
47
+ # @!attribute body
48
+ # The content of the message
49
+ #
50
+ # @return [String]
51
+ required :body, String
52
+
53
+ # @!attribute conversation
54
+ # The conversation this message belongs to
55
+ #
56
+ # @return [SurgeAPI::Models::MessageFailedWebhookEvent::Data::Conversation]
57
+ required :conversation, -> { SurgeAPI::MessageFailedWebhookEvent::Data::Conversation }
58
+
59
+ # @!attribute failed_at
60
+ # When the message failed
61
+ #
62
+ # @return [Time]
63
+ required :failed_at, Time
64
+
65
+ # @!attribute failure_reason
66
+ # The reason the message failed to be delivered
67
+ #
68
+ # @return [String]
69
+ required :failure_reason, String
70
+
71
+ # @!attribute attachments
72
+ # Attachments included with the message
73
+ #
74
+ # @return [Array<SurgeAPI::Models::MessageFailedWebhookEvent::Data::Attachment>, nil]
75
+ optional :attachments,
76
+ -> { SurgeAPI::Internal::Type::ArrayOf[SurgeAPI::MessageFailedWebhookEvent::Data::Attachment] }
77
+
78
+ # @!method initialize(id:, body:, conversation:, failed_at:, failure_reason:, attachments: nil)
79
+ # The data associated with the event
80
+ #
81
+ # @param id [String] The unique identifier for the message
82
+ #
83
+ # @param body [String] The content of the message
84
+ #
85
+ # @param conversation [SurgeAPI::Models::MessageFailedWebhookEvent::Data::Conversation] The conversation this message belongs to
86
+ #
87
+ # @param failed_at [Time] When the message failed
88
+ #
89
+ # @param failure_reason [String] The reason the message failed to be delivered
90
+ #
91
+ # @param attachments [Array<SurgeAPI::Models::MessageFailedWebhookEvent::Data::Attachment>] Attachments included with the message
92
+
93
+ # @see SurgeAPI::Models::MessageFailedWebhookEvent::Data#conversation
94
+ class Conversation < SurgeAPI::Internal::Type::BaseModel
95
+ # @!attribute id
96
+ # The unique identifier for the conversation
97
+ #
98
+ # @return [String]
99
+ required :id, String
100
+
101
+ # @!attribute contact
102
+ # A contact who has consented to receive messages
103
+ #
104
+ # @return [SurgeAPI::Models::Contact]
105
+ required :contact, -> { SurgeAPI::Contact }
106
+
107
+ # @!attribute phone_number
108
+ # A phone number that can be used to send and receive messages and calls
109
+ #
110
+ # @return [SurgeAPI::Models::PhoneNumber]
111
+ required :phone_number, -> { SurgeAPI::PhoneNumber }
112
+
113
+ # @!method initialize(id:, contact:, phone_number:)
114
+ # The conversation this message belongs to
115
+ #
116
+ # @param id [String] The unique identifier for the conversation
117
+ #
118
+ # @param contact [SurgeAPI::Models::Contact] A contact who has consented to receive messages
119
+ #
120
+ # @param phone_number [SurgeAPI::Models::PhoneNumber] A phone number that can be used to send and receive messages and calls
121
+ end
122
+
123
+ class Attachment < SurgeAPI::Internal::Type::BaseModel
124
+ # @!attribute id
125
+ # The unique identifier for the attachment
126
+ #
127
+ # @return [String]
128
+ required :id, String
129
+
130
+ # @!attribute type
131
+ # The type of attachment
132
+ #
133
+ # @return [Symbol, SurgeAPI::Models::MessageFailedWebhookEvent::Data::Attachment::Type]
134
+ required :type, enum: -> { SurgeAPI::MessageFailedWebhookEvent::Data::Attachment::Type }
135
+
136
+ # @!attribute url
137
+ # The URL to download the attachment
138
+ #
139
+ # @return [String]
140
+ required :url, String
141
+
142
+ # @!method initialize(id:, type:, url:)
143
+ # @param id [String] The unique identifier for the attachment
144
+ #
145
+ # @param type [Symbol, SurgeAPI::Models::MessageFailedWebhookEvent::Data::Attachment::Type] The type of attachment
146
+ #
147
+ # @param url [String] The URL to download the attachment
148
+
149
+ # The type of attachment
150
+ #
151
+ # @see SurgeAPI::Models::MessageFailedWebhookEvent::Data::Attachment#type
152
+ module Type
153
+ extend SurgeAPI::Internal::Type::Enum
154
+
155
+ FILE = :file
156
+ IMAGE = :image
157
+ LINK = :link
158
+ VIDEO = :video
159
+
160
+ # @!method self.values
161
+ # @return [Array<Symbol>]
162
+ end
163
+ end
164
+ end
165
+ end
166
+ end
167
+ end
@@ -0,0 +1,159 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ class MessageReceivedWebhookEvent < SurgeAPI::Internal::Type::BaseModel
6
+ # @!attribute account_id
7
+ # The ID of the account in which this event occurred
8
+ #
9
+ # @return [String]
10
+ required :account_id, String
11
+
12
+ # @!attribute data
13
+ # The data associated with the event
14
+ #
15
+ # @return [SurgeAPI::Models::MessageReceivedWebhookEvent::Data]
16
+ required :data, -> { SurgeAPI::MessageReceivedWebhookEvent::Data }
17
+
18
+ # @!attribute timestamp
19
+ # The timestamp when this event occurred, in ISO8601 format
20
+ #
21
+ # @return [Time]
22
+ required :timestamp, Time
23
+
24
+ # @!attribute type
25
+ # The type of the event. Always `message.received` for this event.
26
+ #
27
+ # @return [Symbol, :"message.received"]
28
+ required :type, const: :"message.received"
29
+
30
+ # @!method initialize(account_id:, data:, timestamp:, type: :"message.received")
31
+ # @param account_id [String] The ID of the account in which this event occurred
32
+ #
33
+ # @param data [SurgeAPI::Models::MessageReceivedWebhookEvent::Data] The data associated with the event
34
+ #
35
+ # @param timestamp [Time] The timestamp when this event occurred, in ISO8601 format
36
+ #
37
+ # @param type [Symbol, :"message.received"] The type of the event. Always `message.received` for this event.
38
+
39
+ # @see SurgeAPI::Models::MessageReceivedWebhookEvent#data
40
+ class Data < SurgeAPI::Internal::Type::BaseModel
41
+ # @!attribute id
42
+ # The unique identifier for the message
43
+ #
44
+ # @return [String]
45
+ required :id, String
46
+
47
+ # @!attribute body
48
+ # The content of the message
49
+ #
50
+ # @return [String]
51
+ required :body, String
52
+
53
+ # @!attribute conversation
54
+ # The conversation this message belongs to
55
+ #
56
+ # @return [SurgeAPI::Models::MessageReceivedWebhookEvent::Data::Conversation]
57
+ required :conversation, -> { SurgeAPI::MessageReceivedWebhookEvent::Data::Conversation }
58
+
59
+ # @!attribute received_at
60
+ # When the message was received
61
+ #
62
+ # @return [Time]
63
+ required :received_at, Time
64
+
65
+ # @!attribute attachments
66
+ # Attachments included with the message
67
+ #
68
+ # @return [Array<SurgeAPI::Models::MessageReceivedWebhookEvent::Data::Attachment>, nil]
69
+ optional :attachments,
70
+ -> { SurgeAPI::Internal::Type::ArrayOf[SurgeAPI::MessageReceivedWebhookEvent::Data::Attachment] }
71
+
72
+ # @!method initialize(id:, body:, conversation:, received_at:, attachments: nil)
73
+ # The data associated with the event
74
+ #
75
+ # @param id [String] The unique identifier for the message
76
+ #
77
+ # @param body [String] The content of the message
78
+ #
79
+ # @param conversation [SurgeAPI::Models::MessageReceivedWebhookEvent::Data::Conversation] The conversation this message belongs to
80
+ #
81
+ # @param received_at [Time] When the message was received
82
+ #
83
+ # @param attachments [Array<SurgeAPI::Models::MessageReceivedWebhookEvent::Data::Attachment>] Attachments included with the message
84
+
85
+ # @see SurgeAPI::Models::MessageReceivedWebhookEvent::Data#conversation
86
+ class Conversation < SurgeAPI::Internal::Type::BaseModel
87
+ # @!attribute id
88
+ # The unique identifier for the conversation
89
+ #
90
+ # @return [String]
91
+ required :id, String
92
+
93
+ # @!attribute contact
94
+ # A contact who has consented to receive messages
95
+ #
96
+ # @return [SurgeAPI::Models::Contact]
97
+ required :contact, -> { SurgeAPI::Contact }
98
+
99
+ # @!attribute phone_number
100
+ # A phone number that can be used to send and receive messages and calls
101
+ #
102
+ # @return [SurgeAPI::Models::PhoneNumber]
103
+ required :phone_number, -> { SurgeAPI::PhoneNumber }
104
+
105
+ # @!method initialize(id:, contact:, phone_number:)
106
+ # The conversation this message belongs to
107
+ #
108
+ # @param id [String] The unique identifier for the conversation
109
+ #
110
+ # @param contact [SurgeAPI::Models::Contact] A contact who has consented to receive messages
111
+ #
112
+ # @param phone_number [SurgeAPI::Models::PhoneNumber] A phone number that can be used to send and receive messages and calls
113
+ end
114
+
115
+ class Attachment < SurgeAPI::Internal::Type::BaseModel
116
+ # @!attribute id
117
+ # The unique identifier for the attachment
118
+ #
119
+ # @return [String]
120
+ required :id, String
121
+
122
+ # @!attribute type
123
+ # The type of attachment
124
+ #
125
+ # @return [Symbol, SurgeAPI::Models::MessageReceivedWebhookEvent::Data::Attachment::Type]
126
+ required :type, enum: -> { SurgeAPI::MessageReceivedWebhookEvent::Data::Attachment::Type }
127
+
128
+ # @!attribute url
129
+ # The URL to download the attachment
130
+ #
131
+ # @return [String]
132
+ required :url, String
133
+
134
+ # @!method initialize(id:, type:, url:)
135
+ # @param id [String] The unique identifier for the attachment
136
+ #
137
+ # @param type [Symbol, SurgeAPI::Models::MessageReceivedWebhookEvent::Data::Attachment::Type] The type of attachment
138
+ #
139
+ # @param url [String] The URL to download the attachment
140
+
141
+ # The type of attachment
142
+ #
143
+ # @see SurgeAPI::Models::MessageReceivedWebhookEvent::Data::Attachment#type
144
+ module Type
145
+ extend SurgeAPI::Internal::Type::Enum
146
+
147
+ FILE = :file
148
+ IMAGE = :image
149
+ LINK = :link
150
+ VIDEO = :video
151
+
152
+ # @!method self.values
153
+ # @return [Array<Symbol>]
154
+ end
155
+ end
156
+ end
157
+ end
158
+ end
159
+ end
@@ -0,0 +1,159 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ class MessageSentWebhookEvent < SurgeAPI::Internal::Type::BaseModel
6
+ # @!attribute account_id
7
+ # The ID of the account in which this event occurred
8
+ #
9
+ # @return [String]
10
+ required :account_id, String
11
+
12
+ # @!attribute data
13
+ # The data associated with the event
14
+ #
15
+ # @return [SurgeAPI::Models::MessageSentWebhookEvent::Data]
16
+ required :data, -> { SurgeAPI::MessageSentWebhookEvent::Data }
17
+
18
+ # @!attribute timestamp
19
+ # The timestamp when this event occurred, in ISO8601 format
20
+ #
21
+ # @return [Time]
22
+ required :timestamp, Time
23
+
24
+ # @!attribute type
25
+ # The type of the event. Always `message.sent` for this event.
26
+ #
27
+ # @return [Symbol, :"message.sent"]
28
+ required :type, const: :"message.sent"
29
+
30
+ # @!method initialize(account_id:, data:, timestamp:, type: :"message.sent")
31
+ # @param account_id [String] The ID of the account in which this event occurred
32
+ #
33
+ # @param data [SurgeAPI::Models::MessageSentWebhookEvent::Data] The data associated with the event
34
+ #
35
+ # @param timestamp [Time] The timestamp when this event occurred, in ISO8601 format
36
+ #
37
+ # @param type [Symbol, :"message.sent"] The type of the event. Always `message.sent` for this event.
38
+
39
+ # @see SurgeAPI::Models::MessageSentWebhookEvent#data
40
+ class Data < SurgeAPI::Internal::Type::BaseModel
41
+ # @!attribute id
42
+ # The unique identifier for the message
43
+ #
44
+ # @return [String]
45
+ required :id, String
46
+
47
+ # @!attribute body
48
+ # The content of the message
49
+ #
50
+ # @return [String]
51
+ required :body, String
52
+
53
+ # @!attribute conversation
54
+ # The conversation this message belongs to
55
+ #
56
+ # @return [SurgeAPI::Models::MessageSentWebhookEvent::Data::Conversation]
57
+ required :conversation, -> { SurgeAPI::MessageSentWebhookEvent::Data::Conversation }
58
+
59
+ # @!attribute sent_at
60
+ # When the message was sent
61
+ #
62
+ # @return [Time]
63
+ required :sent_at, Time
64
+
65
+ # @!attribute attachments
66
+ # Attachments included with the message
67
+ #
68
+ # @return [Array<SurgeAPI::Models::MessageSentWebhookEvent::Data::Attachment>, nil]
69
+ optional :attachments,
70
+ -> { SurgeAPI::Internal::Type::ArrayOf[SurgeAPI::MessageSentWebhookEvent::Data::Attachment] }
71
+
72
+ # @!method initialize(id:, body:, conversation:, sent_at:, attachments: nil)
73
+ # The data associated with the event
74
+ #
75
+ # @param id [String] The unique identifier for the message
76
+ #
77
+ # @param body [String] The content of the message
78
+ #
79
+ # @param conversation [SurgeAPI::Models::MessageSentWebhookEvent::Data::Conversation] The conversation this message belongs to
80
+ #
81
+ # @param sent_at [Time] When the message was sent
82
+ #
83
+ # @param attachments [Array<SurgeAPI::Models::MessageSentWebhookEvent::Data::Attachment>] Attachments included with the message
84
+
85
+ # @see SurgeAPI::Models::MessageSentWebhookEvent::Data#conversation
86
+ class Conversation < SurgeAPI::Internal::Type::BaseModel
87
+ # @!attribute id
88
+ # The unique identifier for the conversation
89
+ #
90
+ # @return [String]
91
+ required :id, String
92
+
93
+ # @!attribute contact
94
+ # A contact who has consented to receive messages
95
+ #
96
+ # @return [SurgeAPI::Models::Contact]
97
+ required :contact, -> { SurgeAPI::Contact }
98
+
99
+ # @!attribute phone_number
100
+ # A phone number that can be used to send and receive messages and calls
101
+ #
102
+ # @return [SurgeAPI::Models::PhoneNumber]
103
+ required :phone_number, -> { SurgeAPI::PhoneNumber }
104
+
105
+ # @!method initialize(id:, contact:, phone_number:)
106
+ # The conversation this message belongs to
107
+ #
108
+ # @param id [String] The unique identifier for the conversation
109
+ #
110
+ # @param contact [SurgeAPI::Models::Contact] A contact who has consented to receive messages
111
+ #
112
+ # @param phone_number [SurgeAPI::Models::PhoneNumber] A phone number that can be used to send and receive messages and calls
113
+ end
114
+
115
+ class Attachment < SurgeAPI::Internal::Type::BaseModel
116
+ # @!attribute id
117
+ # The unique identifier for the attachment
118
+ #
119
+ # @return [String]
120
+ required :id, String
121
+
122
+ # @!attribute type
123
+ # The type of attachment
124
+ #
125
+ # @return [Symbol, SurgeAPI::Models::MessageSentWebhookEvent::Data::Attachment::Type]
126
+ required :type, enum: -> { SurgeAPI::MessageSentWebhookEvent::Data::Attachment::Type }
127
+
128
+ # @!attribute url
129
+ # The URL to download the attachment
130
+ #
131
+ # @return [String]
132
+ required :url, String
133
+
134
+ # @!method initialize(id:, type:, url:)
135
+ # @param id [String] The unique identifier for the attachment
136
+ #
137
+ # @param type [Symbol, SurgeAPI::Models::MessageSentWebhookEvent::Data::Attachment::Type] The type of attachment
138
+ #
139
+ # @param url [String] The URL to download the attachment
140
+
141
+ # The type of attachment
142
+ #
143
+ # @see SurgeAPI::Models::MessageSentWebhookEvent::Data::Attachment#type
144
+ module Type
145
+ extend SurgeAPI::Internal::Type::Enum
146
+
147
+ FILE = :file
148
+ IMAGE = :image
149
+ LINK = :link
150
+ VIDEO = :video
151
+
152
+ # @!method self.values
153
+ # @return [Array<Symbol>]
154
+ end
155
+ end
156
+ end
157
+ end
158
+ end
159
+ end