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,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Users#create_token
6
+ class UserTokenResponse < SurgeAPI::Internal::Type::BaseModel
7
+ # @!attribute token
8
+ # The created token.
9
+ #
10
+ # @return [String, nil]
11
+ optional :token, String
12
+
13
+ # @!method initialize(token: nil)
14
+ # Response when token has been created successfully
15
+ #
16
+ # @param token [String] The created token.
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Users#update
6
+ class UserUpdateParams < SurgeAPI::Internal::Type::BaseModel
7
+ extend SurgeAPI::Internal::Type::RequestParameters::Converter
8
+ include SurgeAPI::Internal::Type::RequestParameters
9
+
10
+ # @!attribute first_name
11
+ # The user's first name.
12
+ #
13
+ # @return [String]
14
+ required :first_name, String
15
+
16
+ # @!attribute last_name
17
+ # The user's last name.
18
+ #
19
+ # @return [String, nil]
20
+ optional :last_name, String
21
+
22
+ # @!attribute metadata
23
+ # Set of key-value pairs that will be stored with the object.
24
+ #
25
+ # @return [Hash{Symbol=>String}, nil]
26
+ optional :metadata, SurgeAPI::Internal::Type::HashOf[String]
27
+
28
+ # @!attribute photo_url
29
+ # URL of a photo to be used as the user's avatar.
30
+ #
31
+ # @return [String, nil]
32
+ optional :photo_url, String
33
+
34
+ # @!method initialize(first_name:, last_name: nil, metadata: nil, photo_url: nil, request_options: {})
35
+ # @param first_name [String] The user's first name.
36
+ #
37
+ # @param last_name [String] The user's last name.
38
+ #
39
+ # @param metadata [Hash{Symbol=>String}] Set of key-value pairs that will be stored with the object.
40
+ #
41
+ # @param photo_url [String] URL of a photo to be used as the user's avatar.
42
+ #
43
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}]
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Verifications#create
6
+ class Verification < SurgeAPI::Internal::Type::BaseModel
7
+ # @!attribute id
8
+ # Unique identifier for the object.
9
+ #
10
+ # @return [String]
11
+ required :id, String
12
+
13
+ # @!attribute attempt_count
14
+ # The number of times the code has been attempted.
15
+ #
16
+ # @return [Integer]
17
+ required :attempt_count, Integer
18
+
19
+ # @!attribute phone_number
20
+ # The phone number being verified. In E.164 format.
21
+ #
22
+ # @return [String]
23
+ required :phone_number, String
24
+
25
+ # @!attribute status
26
+ # The current status of the verification.
27
+ #
28
+ # @return [Symbol, SurgeAPI::Models::Verification::Status]
29
+ required :status, enum: -> { SurgeAPI::Verification::Status }
30
+
31
+ # @!method initialize(id:, attempt_count:, phone_number:, status:)
32
+ # A phone number verification
33
+ #
34
+ # @param id [String] Unique identifier for the object.
35
+ #
36
+ # @param attempt_count [Integer] The number of times the code has been attempted.
37
+ #
38
+ # @param phone_number [String] The phone number being verified. In E.164 format.
39
+ #
40
+ # @param status [Symbol, SurgeAPI::Models::Verification::Status] The current status of the verification.
41
+
42
+ # The current status of the verification.
43
+ #
44
+ # @see SurgeAPI::Models::Verification#status
45
+ module Status
46
+ extend SurgeAPI::Internal::Type::Enum
47
+
48
+ PENDING = :pending
49
+ VERIFIED = :verified
50
+ EXHAUSTED = :exhausted
51
+ EXPIRED = :expired
52
+
53
+ # @!method self.values
54
+ # @return [Array<Symbol>]
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Verifications#check
6
+ class VerificationCheck < SurgeAPI::Internal::Type::BaseModel
7
+ # @!attribute result
8
+ # The result of the code check.
9
+ #
10
+ # @return [Symbol, SurgeAPI::Models::VerificationCheck::Result, nil]
11
+ optional :result, enum: -> { SurgeAPI::VerificationCheck::Result }
12
+
13
+ # @!attribute verification
14
+ # A phone number verification
15
+ #
16
+ # @return [SurgeAPI::Models::Verification, nil]
17
+ optional :verification, -> { SurgeAPI::Verification }
18
+
19
+ # @!method initialize(result: nil, verification: nil)
20
+ # The result of checking a Verification code
21
+ #
22
+ # @param result [Symbol, SurgeAPI::Models::VerificationCheck::Result] The result of the code check.
23
+ #
24
+ # @param verification [SurgeAPI::Models::Verification] A phone number verification
25
+
26
+ # The result of the code check.
27
+ #
28
+ # @see SurgeAPI::Models::VerificationCheck#result
29
+ module Result
30
+ extend SurgeAPI::Internal::Type::Enum
31
+
32
+ OK = :ok
33
+ INCORRECT = :incorrect
34
+ EXHAUSTED = :exhausted
35
+ EXPIRED = :expired
36
+ ALREADY_VERIFIED = :already_verified
37
+
38
+ # @!method self.values
39
+ # @return [Array<Symbol>]
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Verifications#check
6
+ class VerificationCheckParams < SurgeAPI::Internal::Type::BaseModel
7
+ extend SurgeAPI::Internal::Type::RequestParameters::Converter
8
+ include SurgeAPI::Internal::Type::RequestParameters
9
+
10
+ # @!attribute code
11
+ # The Verification code that was received.
12
+ #
13
+ # @return [String]
14
+ required :code, String
15
+
16
+ # @!method initialize(code:, request_options: {})
17
+ # @param code [String] The Verification code that was received.
18
+ #
19
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}]
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Verifications#create
6
+ class VerificationCreateParams < SurgeAPI::Internal::Type::BaseModel
7
+ extend SurgeAPI::Internal::Type::RequestParameters::Converter
8
+ include SurgeAPI::Internal::Type::RequestParameters
9
+
10
+ # @!attribute phone_number
11
+ # The phone number to be verified. In E.164 format.
12
+ #
13
+ # @return [String]
14
+ required :phone_number, String
15
+
16
+ # @!method initialize(phone_number:, request_options: {})
17
+ # @param phone_number [String] The phone number to be verified. In E.164 format.
18
+ #
19
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}]
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Webhooks#unwrap
6
+ class WebhookUnwrapParams < 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,117 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ [SurgeAPI::Internal::Type::BaseModel, *SurgeAPI::Internal::Type::BaseModel.subclasses].each do |cls|
5
+ cls.define_sorbet_constant!(:OrHash) { T.type_alias { T.any(cls, SurgeAPI::Internal::AnyHash) } }
6
+ end
7
+
8
+ SurgeAPI::Internal::Util.walk_namespaces(SurgeAPI::Models).each do |mod|
9
+ case mod
10
+ in SurgeAPI::Internal::Type::Enum | SurgeAPI::Internal::Type::Union
11
+ mod.constants.each do |name|
12
+ case mod.const_get(name)
13
+ in true | false
14
+ mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T::Boolean } }
15
+ mod.define_sorbet_constant!(:OrBoolean) { T.type_alias { T::Boolean } }
16
+ in Integer
17
+ mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { Integer } }
18
+ mod.define_sorbet_constant!(:OrInteger) { T.type_alias { Integer } }
19
+ in Float
20
+ mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { Float } }
21
+ mod.define_sorbet_constant!(:OrFloat) { T.type_alias { Float } }
22
+ in Symbol
23
+ mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { Symbol } }
24
+ mod.define_sorbet_constant!(:OrSymbol) { T.type_alias { T.any(Symbol, String) } }
25
+ else
26
+ end
27
+ end
28
+ else
29
+ end
30
+ end
31
+
32
+ SurgeAPI::Internal::Util.walk_namespaces(SurgeAPI::Models)
33
+ .lazy
34
+ .grep(SurgeAPI::Internal::Type::Union)
35
+ .each do |mod|
36
+ const = :Variants
37
+ next if mod.sorbet_constant_defined?(const)
38
+
39
+ mod.define_sorbet_constant!(const) { T.type_alias { mod.to_sorbet_type } }
40
+ end
41
+
42
+ Account = SurgeAPI::Models::Account
43
+
44
+ AccountCreateParams = SurgeAPI::Models::AccountCreateParams
45
+
46
+ AccountRetrieveStatusParams = SurgeAPI::Models::AccountRetrieveStatusParams
47
+
48
+ AccountStatus = SurgeAPI::Models::AccountStatus
49
+
50
+ AccountUpdateParams = SurgeAPI::Models::AccountUpdateParams
51
+
52
+ Blast = SurgeAPI::Models::Blast
53
+
54
+ BlastCreateParams = SurgeAPI::Models::BlastCreateParams
55
+
56
+ CallEndedWebhookEvent = SurgeAPI::Models::CallEndedWebhookEvent
57
+
58
+ Campaign = SurgeAPI::Models::Campaign
59
+
60
+ CampaignApprovedWebhookEvent = SurgeAPI::Models::CampaignApprovedWebhookEvent
61
+
62
+ CampaignCreateParams = SurgeAPI::Models::CampaignCreateParams
63
+
64
+ Contact = SurgeAPI::Models::Contact
65
+
66
+ ContactCreateParams = SurgeAPI::Models::ContactCreateParams
67
+
68
+ ContactRetrieveParams = SurgeAPI::Models::ContactRetrieveParams
69
+
70
+ ContactUpdateParams = SurgeAPI::Models::ContactUpdateParams
71
+
72
+ ConversationCreatedWebhookEvent = SurgeAPI::Models::ConversationCreatedWebhookEvent
73
+
74
+ Error = SurgeAPI::Models::Error
75
+
76
+ Message = SurgeAPI::Models::Message
77
+
78
+ MessageCreateParams = SurgeAPI::Models::MessageCreateParams
79
+
80
+ MessageDeliveredWebhookEvent = SurgeAPI::Models::MessageDeliveredWebhookEvent
81
+
82
+ MessageFailedWebhookEvent = SurgeAPI::Models::MessageFailedWebhookEvent
83
+
84
+ MessageReceivedWebhookEvent = SurgeAPI::Models::MessageReceivedWebhookEvent
85
+
86
+ MessageSentWebhookEvent = SurgeAPI::Models::MessageSentWebhookEvent
87
+
88
+ Organization = SurgeAPI::Models::Organization
89
+
90
+ PhoneNumber = SurgeAPI::Models::PhoneNumber
91
+
92
+ PhoneNumberPurchaseParams = SurgeAPI::Models::PhoneNumberPurchaseParams
93
+
94
+ UnwrapWebhookEvent = SurgeAPI::Models::UnwrapWebhookEvent
95
+
96
+ User = SurgeAPI::Models::User
97
+
98
+ UserCreateParams = SurgeAPI::Models::UserCreateParams
99
+
100
+ UserCreateTokenParams = SurgeAPI::Models::UserCreateTokenParams
101
+
102
+ UserRetrieveParams = SurgeAPI::Models::UserRetrieveParams
103
+
104
+ UserTokenResponse = SurgeAPI::Models::UserTokenResponse
105
+
106
+ UserUpdateParams = SurgeAPI::Models::UserUpdateParams
107
+
108
+ Verification = SurgeAPI::Models::Verification
109
+
110
+ VerificationCheck = SurgeAPI::Models::VerificationCheck
111
+
112
+ VerificationCheckParams = SurgeAPI::Models::VerificationCheckParams
113
+
114
+ VerificationCreateParams = SurgeAPI::Models::VerificationCreateParams
115
+
116
+ WebhookUnwrapParams = SurgeAPI::Models::WebhookUnwrapParams
117
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ # Specify HTTP behaviour to use for a specific request. These options supplement
5
+ # or override those provided at the client level.
6
+ #
7
+ # When making a request, you can pass an actual {RequestOptions} instance, or
8
+ # simply pass a Hash with symbol keys matching the attributes on this class.
9
+ class RequestOptions < SurgeAPI::Internal::Type::BaseModel
10
+ # @api private
11
+ #
12
+ # @param opts [SurgeAPI::RequestOptions, Hash{Symbol=>Object}]
13
+ #
14
+ # @raise [ArgumentError]
15
+ def self.validate!(opts)
16
+ case opts
17
+ in SurgeAPI::RequestOptions | Hash
18
+ opts.to_h.each_key do |k|
19
+ unless fields.include?(k)
20
+ raise ArgumentError.new("Request `opts` keys must be one of #{fields.keys}, got #{k.inspect}")
21
+ end
22
+ end
23
+ else
24
+ raise ArgumentError.new("Request `opts` must be a Hash or RequestOptions, got #{opts.inspect}")
25
+ end
26
+ end
27
+
28
+ # @!attribute idempotency_key
29
+ # Idempotency key to send with request and all associated retries. Will only be
30
+ # sent for write requests.
31
+ #
32
+ # @return [String, nil]
33
+ optional :idempotency_key, String
34
+
35
+ # @!attribute extra_query
36
+ # Extra query params to send with the request. These are `.merge`’d into any
37
+ # `query` given at the client level.
38
+ #
39
+ # @return [Hash{String=>Array<String>, String, nil}, nil]
40
+ optional :extra_query, SurgeAPI::Internal::Type::HashOf[SurgeAPI::Internal::Type::ArrayOf[String]]
41
+
42
+ # @!attribute extra_headers
43
+ # Extra headers to send with the request. These are `.merged`’d into any
44
+ # `extra_headers` given at the client level.
45
+ #
46
+ # @return [Hash{String=>String, nil}, nil]
47
+ optional :extra_headers, SurgeAPI::Internal::Type::HashOf[String, nil?: true]
48
+
49
+ # @!attribute extra_body
50
+ # Extra data to send with the request. These are deep merged into any data
51
+ # generated as part of the normal request.
52
+ #
53
+ # @return [Object, nil]
54
+ optional :extra_body, SurgeAPI::Internal::Type::HashOf[SurgeAPI::Internal::Type::Unknown]
55
+
56
+ # @!attribute max_retries
57
+ # Maximum number of retries to attempt after a failed initial request.
58
+ #
59
+ # @return [Integer, nil]
60
+ optional :max_retries, Integer
61
+
62
+ # @!attribute timeout
63
+ # Request timeout in seconds.
64
+ #
65
+ # @return [Float, nil]
66
+ optional :timeout, Float
67
+
68
+ # @!method initialize(values = {})
69
+ # Returns a new instance of RequestOptions.
70
+ #
71
+ # @param values [Hash{Symbol=>Object}]
72
+
73
+ define_sorbet_constant!(:OrHash) do
74
+ T.type_alias { T.any(SurgeAPI::RequestOptions, SurgeAPI::Internal::AnyHash) }
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,102 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Resources
5
+ class Accounts
6
+ # Some parameter documentations has been truncated, see
7
+ # {SurgeAPI::Models::AccountCreateParams} for more details.
8
+ #
9
+ # Creates a new Account within the calling Platform.
10
+ #
11
+ # @overload create(name:, brand_name: nil, organization: nil, time_zone: nil, request_options: {})
12
+ #
13
+ # @param name [String] The name of the account that will be visible for your internal organizational pu
14
+ #
15
+ # @param brand_name [String, nil] The name by which the people this account communicates with know it. If not prov
16
+ #
17
+ # @param organization [SurgeAPI::Models::AccountCreateParams::Organization] Parameters describing the legal entity on whose behalf the account will be opera
18
+ #
19
+ # @param time_zone [String] This is the time zone in which the account is headquartered. This time zone may
20
+ #
21
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
22
+ #
23
+ # @return [SurgeAPI::Models::Account]
24
+ #
25
+ # @see SurgeAPI::Models::AccountCreateParams
26
+ def create(params)
27
+ parsed, options = SurgeAPI::AccountCreateParams.dump_request(params)
28
+ @client.request(
29
+ method: :post,
30
+ path: "accounts",
31
+ body: parsed,
32
+ model: SurgeAPI::Account,
33
+ options: options
34
+ )
35
+ end
36
+
37
+ # Some parameter documentations has been truncated, see
38
+ # {SurgeAPI::Models::AccountUpdateParams} for more details.
39
+ #
40
+ # Updates an Account
41
+ #
42
+ # @overload update(id, brand_name: nil, name: nil, organization: nil, time_zone: nil, request_options: {})
43
+ #
44
+ # @param id [String] The ID for the account to update.
45
+ #
46
+ # @param brand_name [String] The name by which the people this account communicates with know it. If not prov
47
+ #
48
+ # @param name [String] The name of the account that will be visible for your internal organizational pu
49
+ #
50
+ # @param organization [SurgeAPI::Models::AccountUpdateParams::Organization] Parameters describing the legal entity on whose behalf the account will be opera
51
+ #
52
+ # @param time_zone [String, nil] The time zone for the account
53
+ #
54
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
55
+ #
56
+ # @return [SurgeAPI::Models::Account]
57
+ #
58
+ # @see SurgeAPI::Models::AccountUpdateParams
59
+ def update(id, params = {})
60
+ parsed, options = SurgeAPI::AccountUpdateParams.dump_request(params)
61
+ @client.request(
62
+ method: :patch,
63
+ path: ["accounts/%1$s", id],
64
+ body: parsed,
65
+ model: SurgeAPI::Account,
66
+ options: options
67
+ )
68
+ end
69
+
70
+ # Check an account's status and capabilities
71
+ #
72
+ # @overload retrieve_status(account_id, capabilities: nil, request_options: {})
73
+ #
74
+ # @param account_id [String] ID of the account to check
75
+ #
76
+ # @param capabilities [Array<Symbol, SurgeAPI::Models::AccountRetrieveStatusParams::Capability>] capabilities about which to check the status
77
+ #
78
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
79
+ #
80
+ # @return [SurgeAPI::Models::AccountStatus]
81
+ #
82
+ # @see SurgeAPI::Models::AccountRetrieveStatusParams
83
+ def retrieve_status(account_id, params = {})
84
+ parsed, options = SurgeAPI::AccountRetrieveStatusParams.dump_request(params)
85
+ @client.request(
86
+ method: :get,
87
+ path: ["accounts/%1$s/status", account_id],
88
+ query: parsed,
89
+ model: SurgeAPI::AccountStatus,
90
+ options: options
91
+ )
92
+ end
93
+
94
+ # @api private
95
+ #
96
+ # @param client [SurgeAPI::Client]
97
+ def initialize(client:)
98
+ @client = client
99
+ end
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Resources
5
+ class Blasts
6
+ # Some parameter documentations has been truncated, see
7
+ # {SurgeAPI::Models::BlastCreateParams} for more details.
8
+ #
9
+ # Sends a Blast.
10
+ #
11
+ # @overload create(account_id, attachments: nil, body: nil, contacts: nil, name: nil, segments: nil, send_at: nil, to: nil, request_options: {})
12
+ #
13
+ # @param account_id [String] The account for which the blast should be sent.
14
+ #
15
+ # @param attachments [Array<SurgeAPI::Models::BlastCreateParams::Attachment>]
16
+ #
17
+ # @param body [String] The message body.
18
+ #
19
+ # @param contacts [Array<String>] Deprecated. Use `to` instead.
20
+ #
21
+ # @param name [String] Optional name for the blast.
22
+ #
23
+ # @param segments [Array<String>] Deprecated. Use `to` instead.
24
+ #
25
+ # @param send_at [Time] When to send the blast. If not provided, sends immediately.
26
+ #
27
+ # @param to [Array<String>] List of recipients to whom the blast should be sent. This can be a combination o
28
+ #
29
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
30
+ #
31
+ # @return [SurgeAPI::Models::Blast]
32
+ #
33
+ # @see SurgeAPI::Models::BlastCreateParams
34
+ def create(account_id, params = {})
35
+ parsed, options = SurgeAPI::BlastCreateParams.dump_request(params)
36
+ @client.request(
37
+ method: :post,
38
+ path: ["accounts/%1$s/blasts", account_id],
39
+ body: parsed,
40
+ model: SurgeAPI::Blast,
41
+ options: options
42
+ )
43
+ end
44
+
45
+ # @api private
46
+ #
47
+ # @param client [SurgeAPI::Client]
48
+ def initialize(client:)
49
+ @client = client
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Resources
5
+ class Campaigns
6
+ # Some parameter documentations has been truncated, see
7
+ # {SurgeAPI::Models::CampaignCreateParams} for more details.
8
+ #
9
+ # Creates a campaign to register account to send text messages.
10
+ #
11
+ # @overload create(account_id, consent_flow:, description:, message_samples:, privacy_policy_url:, use_cases:, volume:, includes: nil, link_sample: nil, terms_and_conditions_url: nil, request_options: {})
12
+ #
13
+ # @param account_id [String] The account for which the campaign should be created.
14
+ #
15
+ # @param consent_flow [String] A string explaining the method through which end users will opt in to receive me
16
+ #
17
+ # @param description [String] An explanation of the organization's purpose and how it will be using text messa
18
+ #
19
+ # @param message_samples [Array<String>] An array of 2-5 strings with examples of the messages that will be sent from thi
20
+ #
21
+ # @param privacy_policy_url [String] The URL of the privacy policy for the brand in question. This may be a shared pr
22
+ #
23
+ # @param use_cases [Array<Symbol, SurgeAPI::Models::CampaignCreateParams::UseCase>] A list containing 1-5 types of messages that will be sent with this campaign.
24
+ #
25
+ # @param volume [Symbol, SurgeAPI::Models::CampaignCreateParams::Volume] This will be one of the following:
26
+ #
27
+ # @param includes [Array<Symbol, SurgeAPI::Models::CampaignCreateParams::Include>] A list of properties that this campaign should include. These properties can be
28
+ #
29
+ # @param link_sample [String] A sample link that might be sent by this campaign. If links from other domains a
30
+ #
31
+ # @param terms_and_conditions_url [String] The URL of the terms and conditions presented to end users when they opt in to m
32
+ #
33
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
34
+ #
35
+ # @return [SurgeAPI::Models::Campaign]
36
+ #
37
+ # @see SurgeAPI::Models::CampaignCreateParams
38
+ def create(account_id, params)
39
+ parsed, options = SurgeAPI::CampaignCreateParams.dump_request(params)
40
+ @client.request(
41
+ method: :post,
42
+ path: ["accounts/%1$s/campaigns", account_id],
43
+ body: parsed,
44
+ model: SurgeAPI::Campaign,
45
+ options: options
46
+ )
47
+ end
48
+
49
+ # @api private
50
+ #
51
+ # @param client [SurgeAPI::Client]
52
+ def initialize(client:)
53
+ @client = client
54
+ end
55
+ end
56
+ end
57
+ end