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,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Contacts#create
6
+ class Contact < SurgeAPI::Internal::Type::BaseModel
7
+ # @!attribute id
8
+ # Unique identifier for the object.
9
+ #
10
+ # @return [String]
11
+ required :id, String
12
+
13
+ # @!attribute phone_number
14
+ # The contact's phone number in E.164 format.
15
+ #
16
+ # @return [String]
17
+ required :phone_number, String
18
+
19
+ # @!attribute email
20
+ # The contact's email address.
21
+ #
22
+ # @return [String, nil]
23
+ optional :email, String
24
+
25
+ # @!attribute first_name
26
+ # The contact's first name.
27
+ #
28
+ # @return [String, nil]
29
+ optional :first_name, String
30
+
31
+ # @!attribute last_name
32
+ # The contact's last name.
33
+ #
34
+ # @return [String, nil]
35
+ optional :last_name, String
36
+
37
+ # @!attribute metadata
38
+ # Set of key-value pairs that will be stored with the object.
39
+ #
40
+ # @return [Hash{Symbol=>String}, nil]
41
+ optional :metadata, SurgeAPI::Internal::Type::HashOf[String]
42
+
43
+ # @!method initialize(id:, phone_number:, email: nil, first_name: nil, last_name: nil, metadata: nil)
44
+ # A contact who has consented to receive messages
45
+ #
46
+ # @param id [String] Unique identifier for the object.
47
+ #
48
+ # @param phone_number [String] The contact's phone number in E.164 format.
49
+ #
50
+ # @param email [String] The contact's email address.
51
+ #
52
+ # @param first_name [String] The contact's first name.
53
+ #
54
+ # @param last_name [String] The contact's last name.
55
+ #
56
+ # @param metadata [Hash{Symbol=>String}] Set of key-value pairs that will be stored with the object.
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Contacts#create
6
+ class ContactCreateParams < SurgeAPI::Internal::Type::BaseModel
7
+ extend SurgeAPI::Internal::Type::RequestParameters::Converter
8
+ include SurgeAPI::Internal::Type::RequestParameters
9
+
10
+ # @!attribute phone_number
11
+ # The contact's phone number in E.164 format.
12
+ #
13
+ # @return [String]
14
+ required :phone_number, String
15
+
16
+ # @!attribute email
17
+ # The contact's email address.
18
+ #
19
+ # @return [String, nil]
20
+ optional :email, String
21
+
22
+ # @!attribute first_name
23
+ # The contact's first name.
24
+ #
25
+ # @return [String, nil]
26
+ optional :first_name, String
27
+
28
+ # @!attribute last_name
29
+ # The contact's last name.
30
+ #
31
+ # @return [String, nil]
32
+ optional :last_name, String
33
+
34
+ # @!attribute metadata
35
+ # Set of key-value pairs that will be stored with the object.
36
+ #
37
+ # @return [Hash{Symbol=>String}, nil]
38
+ optional :metadata, SurgeAPI::Internal::Type::HashOf[String]
39
+
40
+ # @!method initialize(phone_number:, email: nil, first_name: nil, last_name: nil, metadata: nil, request_options: {})
41
+ # @param phone_number [String] The contact's phone number in E.164 format.
42
+ #
43
+ # @param email [String] The contact's email address.
44
+ #
45
+ # @param first_name [String] The contact's first name.
46
+ #
47
+ # @param last_name [String] The contact's last name.
48
+ #
49
+ # @param metadata [Hash{Symbol=>String}] Set of key-value pairs that will be stored with the object.
50
+ #
51
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}]
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Contacts#retrieve
6
+ class ContactRetrieveParams < SurgeAPI::Internal::Type::BaseModel
7
+ extend SurgeAPI::Internal::Type::RequestParameters::Converter
8
+ include SurgeAPI::Internal::Type::RequestParameters
9
+
10
+ # @!method initialize(request_options: {})
11
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}]
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Contacts#update
6
+ class ContactUpdateParams < SurgeAPI::Internal::Type::BaseModel
7
+ extend SurgeAPI::Internal::Type::RequestParameters::Converter
8
+ include SurgeAPI::Internal::Type::RequestParameters
9
+
10
+ # @!attribute phone_number
11
+ # The contact's phone number in E.164 format.
12
+ #
13
+ # @return [String]
14
+ required :phone_number, String
15
+
16
+ # @!attribute email
17
+ # The contact's email address.
18
+ #
19
+ # @return [String, nil]
20
+ optional :email, String
21
+
22
+ # @!attribute first_name
23
+ # The contact's first name.
24
+ #
25
+ # @return [String, nil]
26
+ optional :first_name, String
27
+
28
+ # @!attribute last_name
29
+ # The contact's last name.
30
+ #
31
+ # @return [String, nil]
32
+ optional :last_name, String
33
+
34
+ # @!attribute metadata
35
+ # Set of key-value pairs that will be stored with the object.
36
+ #
37
+ # @return [Hash{Symbol=>String}, nil]
38
+ optional :metadata, SurgeAPI::Internal::Type::HashOf[String]
39
+
40
+ # @!method initialize(phone_number:, email: nil, first_name: nil, last_name: nil, metadata: nil, request_options: {})
41
+ # @param phone_number [String] The contact's phone number in E.164 format.
42
+ #
43
+ # @param email [String] The contact's email address.
44
+ #
45
+ # @param first_name [String] The contact's first name.
46
+ #
47
+ # @param last_name [String] The contact's last name.
48
+ #
49
+ # @param metadata [Hash{Symbol=>String}] Set of key-value pairs that will be stored with the object.
50
+ #
51
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}]
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ class ConversationCreatedWebhookEvent < 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::ConversationCreatedWebhookEvent::Data]
16
+ required :data, -> { SurgeAPI::ConversationCreatedWebhookEvent::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 `conversation.created` for this event.
26
+ #
27
+ # @return [Symbol, :"conversation.created"]
28
+ required :type, const: :"conversation.created"
29
+
30
+ # @!method initialize(account_id:, data:, timestamp:, type: :"conversation.created")
31
+ # @param account_id [String] The ID of the account in which this event occurred
32
+ #
33
+ # @param data [SurgeAPI::Models::ConversationCreatedWebhookEvent::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, :"conversation.created"] The type of the event. Always `conversation.created` for this event.
38
+
39
+ # @see SurgeAPI::Models::ConversationCreatedWebhookEvent#data
40
+ class Data < SurgeAPI::Internal::Type::BaseModel
41
+ # @!attribute id
42
+ # The unique identifier for the conversation
43
+ #
44
+ # @return [String]
45
+ required :id, String
46
+
47
+ # @!attribute contact
48
+ # A contact who has consented to receive messages
49
+ #
50
+ # @return [SurgeAPI::Models::Contact]
51
+ required :contact, -> { SurgeAPI::Contact }
52
+
53
+ # @!attribute phone_number
54
+ # A phone number that can be used to send and receive messages and calls
55
+ #
56
+ # @return [SurgeAPI::Models::PhoneNumber]
57
+ required :phone_number, -> { SurgeAPI::PhoneNumber }
58
+
59
+ # @!method initialize(id:, contact:, phone_number:)
60
+ # The data associated with the event
61
+ #
62
+ # @param id [String] The unique identifier for the conversation
63
+ #
64
+ # @param contact [SurgeAPI::Models::Contact] A contact who has consented to receive messages
65
+ #
66
+ # @param phone_number [SurgeAPI::Models::PhoneNumber] A phone number that can be used to send and receive messages and calls
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ class Error < SurgeAPI::Internal::Type::BaseModel
6
+ # @!attribute message
7
+ # A human-readable error message.
8
+ #
9
+ # @return [String]
10
+ required :message, String
11
+
12
+ # @!attribute type
13
+ # A unique error code.
14
+ #
15
+ # @return [String]
16
+ required :type, String
17
+
18
+ # @!attribute detail
19
+ # Additional details about the error.
20
+ #
21
+ # @return [Hash{Symbol=>Object}, nil]
22
+ optional :detail, SurgeAPI::Internal::Type::HashOf[SurgeAPI::Internal::Type::Unknown]
23
+
24
+ # @!method initialize(message:, type:, detail: nil)
25
+ # An error response
26
+ #
27
+ # @param message [String] A human-readable error message.
28
+ #
29
+ # @param type [String] A unique error code.
30
+ #
31
+ # @param detail [Hash{Symbol=>Object}] Additional details about the error.
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,146 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Messages#create
6
+ class Message < SurgeAPI::Internal::Type::BaseModel
7
+ # @!attribute id
8
+ # Unique identifier for the object.
9
+ #
10
+ # @return [String, nil]
11
+ optional :id, String
12
+
13
+ # @!attribute attachments
14
+ #
15
+ # @return [Array<SurgeAPI::Models::Message::Attachment>, nil]
16
+ optional :attachments, -> { SurgeAPI::Internal::Type::ArrayOf[SurgeAPI::Message::Attachment] }
17
+
18
+ # @!attribute body
19
+ # The message body.
20
+ #
21
+ # @return [String, nil]
22
+ optional :body, String
23
+
24
+ # @!attribute conversation
25
+ # A conversation with a Contact
26
+ #
27
+ # @return [SurgeAPI::Models::Message::Conversation, nil]
28
+ optional :conversation, -> { SurgeAPI::Message::Conversation }
29
+
30
+ # @!method initialize(id: nil, attachments: nil, body: nil, conversation: nil)
31
+ # A Message is a communication sent to a Contact.
32
+ #
33
+ # @param id [String] Unique identifier for the object.
34
+ #
35
+ # @param attachments [Array<SurgeAPI::Models::Message::Attachment>]
36
+ #
37
+ # @param body [String] The message body.
38
+ #
39
+ # @param conversation [SurgeAPI::Models::Message::Conversation] A conversation with a Contact
40
+
41
+ class Attachment < SurgeAPI::Internal::Type::BaseModel
42
+ # @!attribute id
43
+ # Unique identifier for the object.
44
+ #
45
+ # @return [String, nil]
46
+ optional :id, String
47
+
48
+ # @!attribute type
49
+ # The type of attachment.
50
+ #
51
+ # @return [String, nil]
52
+ optional :type, String
53
+
54
+ # @!attribute url
55
+ # The URL of the attachment.
56
+ #
57
+ # @return [String, nil]
58
+ optional :url, String
59
+
60
+ # @!method initialize(id: nil, type: nil, url: nil)
61
+ # An Attachment is a file that can be sent with a message.
62
+ #
63
+ # @param id [String] Unique identifier for the object.
64
+ #
65
+ # @param type [String] The type of attachment.
66
+ #
67
+ # @param url [String] The URL of the attachment.
68
+ end
69
+
70
+ # @see SurgeAPI::Models::Message#conversation
71
+ class Conversation < SurgeAPI::Internal::Type::BaseModel
72
+ # @!attribute id
73
+ # Unique identifier for the object.
74
+ #
75
+ # @return [String]
76
+ required :id, String
77
+
78
+ # @!attribute contact
79
+ # A contact who has consented to receive messages
80
+ #
81
+ # @return [SurgeAPI::Models::Contact]
82
+ required :contact, -> { SurgeAPI::Contact }
83
+
84
+ # @!attribute phone_number
85
+ # This is the phone number tied to the Surge account.
86
+ #
87
+ # @return [SurgeAPI::Models::Message::Conversation::PhoneNumber, nil]
88
+ optional :phone_number, -> { SurgeAPI::Message::Conversation::PhoneNumber }
89
+
90
+ # @!method initialize(id:, contact:, phone_number: nil)
91
+ # A conversation with a Contact
92
+ #
93
+ # @param id [String] Unique identifier for the object.
94
+ #
95
+ # @param contact [SurgeAPI::Models::Contact] A contact who has consented to receive messages
96
+ #
97
+ # @param phone_number [SurgeAPI::Models::Message::Conversation::PhoneNumber] This is the phone number tied to the Surge account.
98
+
99
+ # @see SurgeAPI::Models::Message::Conversation#phone_number
100
+ class PhoneNumber < SurgeAPI::Internal::Type::BaseModel
101
+ # @!attribute id
102
+ # Unique identifier for the phone number
103
+ #
104
+ # @return [String]
105
+ required :id, String
106
+
107
+ # @!attribute number
108
+ # The canonical format of the phone number.
109
+ #
110
+ # @return [String]
111
+ required :number, String
112
+
113
+ # @!attribute type
114
+ # Whether the phone number is local, toll-free, or short code
115
+ #
116
+ # @return [Symbol, SurgeAPI::Models::Message::Conversation::PhoneNumber::Type]
117
+ required :type, enum: -> { SurgeAPI::Message::Conversation::PhoneNumber::Type }
118
+
119
+ # @!method initialize(id:, number:, type:)
120
+ # This is the phone number tied to the Surge account.
121
+ #
122
+ # @param id [String] Unique identifier for the phone number
123
+ #
124
+ # @param number [String] The canonical format of the phone number.
125
+ #
126
+ # @param type [Symbol, SurgeAPI::Models::Message::Conversation::PhoneNumber::Type] Whether the phone number is local, toll-free, or short code
127
+
128
+ # Whether the phone number is local, toll-free, or short code
129
+ #
130
+ # @see SurgeAPI::Models::Message::Conversation::PhoneNumber#type
131
+ module Type
132
+ extend SurgeAPI::Internal::Type::Enum
133
+
134
+ LOCAL = :local
135
+ TOLL_FREE = :toll_free
136
+ SHORT_CODE = :short_code
137
+ DEMO = :demo
138
+
139
+ # @!method self.values
140
+ # @return [Array<Symbol>]
141
+ end
142
+ end
143
+ end
144
+ end
145
+ end
146
+ end
@@ -0,0 +1,153 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Messages#create
6
+ class MessageCreateParams < SurgeAPI::Internal::Type::BaseModel
7
+ extend SurgeAPI::Internal::Type::RequestParameters::Converter
8
+ include SurgeAPI::Internal::Type::RequestParameters
9
+
10
+ # @!attribute conversation
11
+ # Params for selecting or creating a new conversation. Either the id or the
12
+ # Contact must be given.
13
+ #
14
+ # @return [SurgeAPI::Models::MessageCreateParams::Conversation]
15
+ required :conversation, -> { SurgeAPI::MessageCreateParams::Conversation }
16
+
17
+ # @!attribute attachments
18
+ #
19
+ # @return [Array<SurgeAPI::Models::MessageCreateParams::Attachment>, nil]
20
+ optional :attachments, -> { SurgeAPI::Internal::Type::ArrayOf[SurgeAPI::MessageCreateParams::Attachment] }
21
+
22
+ # @!attribute body
23
+ # The message body.
24
+ #
25
+ # @return [String, nil]
26
+ optional :body, String
27
+
28
+ # @!attribute send_at
29
+ # An optional datetime for scheduling message up to a couple of months in the
30
+ # future.
31
+ #
32
+ # @return [Time, nil]
33
+ optional :send_at, Time
34
+
35
+ # @!attribute to
36
+ # The recipient's phone number in E.164 format. Cannot be used together with
37
+ # 'conversation'.
38
+ #
39
+ # @return [String]
40
+ required :to, String
41
+
42
+ # @!attribute from
43
+ # The sender's phone number in E.164 format or phone number ID. If omitted, uses
44
+ # the account's default phone number. Cannot be used together with 'conversation'.
45
+ #
46
+ # @return [String, nil]
47
+ optional :from, String
48
+
49
+ # @!method initialize(conversation:, to:, attachments: nil, body: nil, send_at: nil, from: nil, request_options: {})
50
+ # Some parameter documentations has been truncated, see
51
+ # {SurgeAPI::Models::MessageCreateParams} for more details.
52
+ #
53
+ # @param conversation [SurgeAPI::Models::MessageCreateParams::Conversation] Params for selecting or creating a new conversation. Either the id or the Contac
54
+ #
55
+ # @param to [String] The recipient's phone number in E.164 format. Cannot be used together with 'conv
56
+ #
57
+ # @param attachments [Array<SurgeAPI::Models::MessageCreateParams::Attachment>]
58
+ #
59
+ # @param body [String] The message body.
60
+ #
61
+ # @param send_at [Time] An optional datetime for scheduling message up to a couple of months in the futu
62
+ #
63
+ # @param from [String] The sender's phone number in E.164 format or phone number ID. If omitted, uses t
64
+ #
65
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}]
66
+
67
+ class Conversation < SurgeAPI::Internal::Type::BaseModel
68
+ # @!attribute contact
69
+ # Parameters for creating a contact
70
+ #
71
+ # @return [SurgeAPI::Models::MessageCreateParams::Conversation::Contact]
72
+ required :contact, -> { SurgeAPI::MessageCreateParams::Conversation::Contact }
73
+
74
+ # @!attribute phone_number
75
+ # The phone number from which to send the message. This can be either the phone
76
+ # number in E.164 format or a Surge phone number id.
77
+ #
78
+ # @return [String, nil]
79
+ optional :phone_number, String
80
+
81
+ # @!method initialize(contact:, phone_number: nil)
82
+ # Some parameter documentations has been truncated, see
83
+ # {SurgeAPI::Models::MessageCreateParams::Conversation} for more details.
84
+ #
85
+ # Params for selecting or creating a new conversation. Either the id or the
86
+ # Contact must be given.
87
+ #
88
+ # @param contact [SurgeAPI::Models::MessageCreateParams::Conversation::Contact] Parameters for creating a contact
89
+ #
90
+ # @param phone_number [String] The phone number from which to send the message. This can be either the phone nu
91
+
92
+ # @see SurgeAPI::Models::MessageCreateParams::Conversation#contact
93
+ class Contact < SurgeAPI::Internal::Type::BaseModel
94
+ # @!attribute phone_number
95
+ # The contact's phone number in E.164 format.
96
+ #
97
+ # @return [String]
98
+ required :phone_number, String
99
+
100
+ # @!attribute email
101
+ # The contact's email address.
102
+ #
103
+ # @return [String, nil]
104
+ optional :email, String
105
+
106
+ # @!attribute first_name
107
+ # The contact's first name.
108
+ #
109
+ # @return [String, nil]
110
+ optional :first_name, String
111
+
112
+ # @!attribute last_name
113
+ # The contact's last name.
114
+ #
115
+ # @return [String, nil]
116
+ optional :last_name, String
117
+
118
+ # @!attribute metadata
119
+ # Set of key-value pairs that will be stored with the object.
120
+ #
121
+ # @return [Hash{Symbol=>String}, nil]
122
+ optional :metadata, SurgeAPI::Internal::Type::HashOf[String]
123
+
124
+ # @!method initialize(phone_number:, email: nil, first_name: nil, last_name: nil, metadata: nil)
125
+ # Parameters for creating a contact
126
+ #
127
+ # @param phone_number [String] The contact's phone number in E.164 format.
128
+ #
129
+ # @param email [String] The contact's email address.
130
+ #
131
+ # @param first_name [String] The contact's first name.
132
+ #
133
+ # @param last_name [String] The contact's last name.
134
+ #
135
+ # @param metadata [Hash{Symbol=>String}] Set of key-value pairs that will be stored with the object.
136
+ end
137
+ end
138
+
139
+ class Attachment < SurgeAPI::Internal::Type::BaseModel
140
+ # @!attribute url
141
+ # The URL of the attachment.
142
+ #
143
+ # @return [String]
144
+ required :url, String
145
+
146
+ # @!method initialize(url:)
147
+ # Params for creating an attachment
148
+ #
149
+ # @param url [String] The URL of the attachment.
150
+ end
151
+ end
152
+ end
153
+ end