surge_api 0.8.0 → 0.10.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 (91) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +41 -0
  3. data/README.md +29 -1
  4. data/lib/surge_api/client.rb +4 -0
  5. data/lib/surge_api/internal/cursor.rb +112 -0
  6. data/lib/surge_api/internal/transport/pooled_net_requester.rb +1 -1
  7. data/lib/surge_api/internal/util.rb +1 -1
  8. data/lib/surge_api/models/blast.rb +2 -2
  9. data/lib/surge_api/models/blast_create_params.rb +4 -4
  10. data/lib/surge_api/models/campaign.rb +27 -1
  11. data/lib/surge_api/models/campaign_retrieve_params.rb +14 -0
  12. data/lib/surge_api/models/contact_list_params.rb +34 -0
  13. data/lib/surge_api/models/message.rb +4 -4
  14. data/lib/surge_api/models/message_delivered_webhook_event.rb +3 -3
  15. data/lib/surge_api/models/message_failed_webhook_event.rb +3 -3
  16. data/lib/surge_api/models/message_list_params.rb +34 -0
  17. data/lib/surge_api/models/message_received_webhook_event.rb +3 -3
  18. data/lib/surge_api/models/message_sent_webhook_event.rb +3 -3
  19. data/lib/surge_api/models/phone_number.rb +1 -1
  20. data/lib/surge_api/models/phone_number_list_params.rb +34 -0
  21. data/lib/surge_api/models/recording_completed_webhook_event.rb +136 -0
  22. data/lib/surge_api/models/recording_get_file_params.rb +14 -0
  23. data/lib/surge_api/models/recording_get_file_response.rb +19 -0
  24. data/lib/surge_api/models/unwrap_webhook_event.rb +5 -1
  25. data/lib/surge_api/models/voicemail_received_webhook_event.rb +144 -0
  26. data/lib/surge_api/models.rb +14 -0
  27. data/lib/surge_api/resources/blasts.rb +1 -1
  28. data/lib/surge_api/resources/campaigns.rb +20 -0
  29. data/lib/surge_api/resources/contacts.rb +30 -0
  30. data/lib/surge_api/resources/messages.rb +30 -0
  31. data/lib/surge_api/resources/phone_numbers.rb +30 -0
  32. data/lib/surge_api/resources/recordings.rb +35 -0
  33. data/lib/surge_api/resources/webhooks.rb +1 -1
  34. data/lib/surge_api/version.rb +1 -1
  35. data/lib/surge_api.rb +10 -0
  36. data/rbi/surge_api/client.rbi +3 -0
  37. data/rbi/surge_api/internal/cursor.rbi +52 -0
  38. data/rbi/surge_api/internal/util.rbi +1 -1
  39. data/rbi/surge_api/models/blast.rbi +3 -6
  40. data/rbi/surge_api/models/blast_create_params.rbi +3 -6
  41. data/rbi/surge_api/models/campaign.rbi +32 -0
  42. data/rbi/surge_api/models/campaign_retrieve_params.rbi +27 -0
  43. data/rbi/surge_api/models/contact_list_params.rbi +59 -0
  44. data/rbi/surge_api/models/message.rbi +6 -12
  45. data/rbi/surge_api/models/message_delivered_webhook_event.rbi +3 -3
  46. data/rbi/surge_api/models/message_failed_webhook_event.rbi +3 -3
  47. data/rbi/surge_api/models/message_list_params.rbi +59 -0
  48. data/rbi/surge_api/models/message_received_webhook_event.rbi +3 -3
  49. data/rbi/surge_api/models/message_sent_webhook_event.rbi +3 -3
  50. data/rbi/surge_api/models/phone_number_list_params.rbi +59 -0
  51. data/rbi/surge_api/models/recording_completed_webhook_event.rbi +277 -0
  52. data/rbi/surge_api/models/recording_get_file_params.rbi +27 -0
  53. data/rbi/surge_api/models/recording_get_file_response.rbi +34 -0
  54. data/rbi/surge_api/models/unwrap_webhook_event.rbi +3 -1
  55. data/rbi/surge_api/models/voicemail_received_webhook_event.rbi +283 -0
  56. data/rbi/surge_api/models.rbi +16 -0
  57. data/rbi/surge_api/resources/blasts.rbi +1 -1
  58. data/rbi/surge_api/resources/campaigns.rbi +14 -0
  59. data/rbi/surge_api/resources/contacts.rbi +21 -0
  60. data/rbi/surge_api/resources/messages.rbi +21 -0
  61. data/rbi/surge_api/resources/phone_numbers.rbi +21 -0
  62. data/rbi/surge_api/resources/recordings.rbi +27 -0
  63. data/rbi/surge_api/resources/webhooks.rbi +3 -1
  64. data/sig/surge_api/client.rbs +2 -0
  65. data/sig/surge_api/internal/cursor.rbs +28 -0
  66. data/sig/surge_api/models/blast.rbs +4 -6
  67. data/sig/surge_api/models/blast_create_params.rbs +4 -6
  68. data/sig/surge_api/models/campaign.rbs +28 -0
  69. data/sig/surge_api/models/campaign_retrieve_params.rbs +15 -0
  70. data/sig/surge_api/models/contact_list_params.rbs +32 -0
  71. data/sig/surge_api/models/message.rbs +8 -12
  72. data/sig/surge_api/models/message_delivered_webhook_event.rbs +4 -4
  73. data/sig/surge_api/models/message_failed_webhook_event.rbs +4 -4
  74. data/sig/surge_api/models/message_list_params.rbs +32 -0
  75. data/sig/surge_api/models/message_received_webhook_event.rbs +4 -4
  76. data/sig/surge_api/models/message_sent_webhook_event.rbs +4 -4
  77. data/sig/surge_api/models/phone_number_list_params.rbs +32 -0
  78. data/sig/surge_api/models/recording_completed_webhook_event.rbs +126 -0
  79. data/sig/surge_api/models/recording_get_file_params.rbs +15 -0
  80. data/sig/surge_api/models/recording_get_file_response.rbs +13 -0
  81. data/sig/surge_api/models/unwrap_webhook_event.rbs +2 -0
  82. data/sig/surge_api/models/voicemail_received_webhook_event.rbs +131 -0
  83. data/sig/surge_api/models.rbs +14 -0
  84. data/sig/surge_api/resources/blasts.rbs +1 -1
  85. data/sig/surge_api/resources/campaigns.rbs +5 -0
  86. data/sig/surge_api/resources/contacts.rbs +7 -0
  87. data/sig/surge_api/resources/messages.rbs +7 -0
  88. data/sig/surge_api/resources/phone_numbers.rbs +7 -0
  89. data/sig/surge_api/resources/recordings.rbs +12 -0
  90. data/sig/surge_api/resources/webhooks.rbs +3 -1
  91. metadata +32 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d974f7f96df8e8e8452c8693d8afe99108691e4765da89ed06670ad635f3a48
4
- data.tar.gz: 4f7eedf44e0f6c2b0d076f2c590d07519c666ae2d20fc12a5b0cef4fa2b451dd
3
+ metadata.gz: 4ab0d460fe03be9712dc7d4ad68bc64e6ebb931573b9fe9ff91b8f36f2979514
4
+ data.tar.gz: 20488d8ba034a202671fa5cb1c3e0bde2c863bfa7826ed3ffb718911c34515ee
5
5
  SHA512:
6
- metadata.gz: 4b03295d43f70c73f3db451516682c5ff8e5e7c081db91e7ed98628500f3f7cb637952dc60631f76e6d83dbf8a571ca1c90e4fb0dc3ce00ae0b759ca1ed8bfeb
7
- data.tar.gz: 44ec0232e66a93b385447ccc5cd6ee433d7f3e944e96b69c2cf7badde81fdf46b630b9501a386067bffc10896de0eb864c2720814fe4e295fcc1a924fd8f2205
6
+ metadata.gz: abd73bd158429ed55c7343a89e85ce56ed40979df1278b20937250787bf360b91e1de84494abd4f1d2e9c2f3dc8f2bbfbedec04f1666b2d9b5798f976cda985f
7
+ data.tar.gz: bcbd4c0adb4baba0a737a833232f02abb63588f31a8d9ff70c39dee65037db86032efc12f34499c57ff46bd6b6b27c5276d6a9af4600fb290aced6e0014cda80
data/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.0 (2026-02-12)
4
+
5
+ Full Changelog: [v0.9.0...v0.10.0](https://github.com/surgeapi/ruby-sdk/compare/v0.9.0...v0.10.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** add campaign.status field ([f0ab6be](https://github.com/surgeapi/ruby-sdk/commit/f0ab6bef5d1cbca9741b3731189e5a821c6abcb3))
10
+ * **api:** add get campaign endpoint ([511d2b3](https://github.com/surgeapi/ruby-sdk/commit/511d2b3cd36a3e4a1f1737093a02f5c31296c332))
11
+ * **api:** add recording.completed webhook ([9a72a0c](https://github.com/surgeapi/ruby-sdk/commit/9a72a0c754dad51ac7b02e84c3f8ce8e6ba85378))
12
+ * **api:** add voicemail.received webhook ([37edfcd](https://github.com/surgeapi/ruby-sdk/commit/37edfcd3a2d26f42ea5a0fbf5481e046486f4456))
13
+ * **api:** get recording file ([db0184e](https://github.com/surgeapi/ruby-sdk/commit/db0184e171168f74e20d91b65cea452a32aad263))
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * **api:** make message.blast_id nullable ([9096e75](https://github.com/surgeapi/ruby-sdk/commit/9096e75d5aa6803c4b11aba0fe2c61448abf3f6a))
19
+ * **client:** loosen json header parsing ([51f4092](https://github.com/surgeapi/ruby-sdk/commit/51f409235dc8e2c377411b3f53595df8fea9b4e4))
20
+
21
+ ## 0.9.0 (2026-02-04)
22
+
23
+ Full Changelog: [v0.8.0...v0.9.0](https://github.com/surgeapi/ruby-sdk/compare/v0.8.0...v0.9.0)
24
+
25
+ ### Features
26
+
27
+ * **api:** add list contacts endpoint ([fb3eaae](https://github.com/surgeapi/ruby-sdk/commit/fb3eaae32fa15b6b7423b4ae485608e03cf027a7))
28
+ * **api:** add list messages endpoint ([ca51f12](https://github.com/surgeapi/ruby-sdk/commit/ca51f12d83bcebdd706701e8fee9a594313bd767))
29
+ * **api:** add list phone numbers endpoint ([47691df](https://github.com/surgeapi/ruby-sdk/commit/47691dfe6f91a9300c02f3f893fe2af5636f8094))
30
+ * **sdk:** add deprecation messages ([f0e959e](https://github.com/surgeapi/ruby-sdk/commit/f0e959e9a96069670284b7ebd9f9a0a28672b5dc))
31
+ * **sdks:** set up pagination ([08b1393](https://github.com/surgeapi/ruby-sdk/commit/08b13930dd2102f1886c616409f213e62b3137e5))
32
+
33
+
34
+ ### Bug Fixes
35
+
36
+ * **api:** make message body nullable ([a329e52](https://github.com/surgeapi/ruby-sdk/commit/a329e5203323524beb725f217d0261193df02ebe))
37
+ * **client:** always add content-length to post body, even when empty ([12467d3](https://github.com/surgeapi/ruby-sdk/commit/12467d365020dafafb0474504042a8e39c5ee2fd))
38
+
39
+
40
+ ### Chores
41
+
42
+ * **docs:** remove www prefix ([beaff0c](https://github.com/surgeapi/ruby-sdk/commit/beaff0c151d0e31114c490c09fb4c71196e316d8))
43
+
3
44
  ## 0.8.0 (2026-01-26)
4
45
 
5
46
  Full Changelog: [v0.7.0...v0.8.0](https://github.com/surgeapi/ruby-sdk/compare/v0.7.0...v0.8.0)
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "surge_api", "~> 0.8.0"
20
+ gem "surge_api", "~> 0.10.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -37,6 +37,34 @@ message = surge.messages.create("acct_01j9a43avnfqzbjfch6pygv1td")
37
37
  puts(message.id)
38
38
  ```
39
39
 
40
+ ### Pagination
41
+
42
+ List methods in the Surge API are paginated.
43
+
44
+ This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:
45
+
46
+ ```ruby
47
+ page = surge.contacts.list
48
+
49
+ # Fetch single item from page.
50
+ contact = page.data[0]
51
+ puts(contact.id)
52
+
53
+ # Automatically fetches more pages as needed.
54
+ page.auto_paging_each do |contact|
55
+ puts(contact.id)
56
+ end
57
+ ```
58
+
59
+ Alternatively, you can use the `#next_page?` and `#next_page` methods for more granular control working with pages.
60
+
61
+ ```ruby
62
+ if page.next_page?
63
+ new_page = page.next_page
64
+ puts(new_page.data[0].id)
65
+ end
66
+ ```
67
+
40
68
  ### Handling errors
41
69
 
42
70
  When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `SurgeAPI::Errors::APIError` will be thrown:
@@ -36,6 +36,9 @@ module SurgeAPI
36
36
  # @return [SurgeAPI::Resources::PhoneNumbers]
37
37
  attr_reader :phone_numbers
38
38
 
39
+ # @return [SurgeAPI::Resources::Recordings]
40
+ attr_reader :recordings
41
+
39
42
  # @return [SurgeAPI::Resources::Users]
40
43
  attr_reader :users
41
44
 
@@ -98,6 +101,7 @@ module SurgeAPI
98
101
  @contacts = SurgeAPI::Resources::Contacts.new(client: self)
99
102
  @messages = SurgeAPI::Resources::Messages.new(client: self)
100
103
  @phone_numbers = SurgeAPI::Resources::PhoneNumbers.new(client: self)
104
+ @recordings = SurgeAPI::Resources::Recordings.new(client: self)
101
105
  @users = SurgeAPI::Resources::Users.new(client: self)
102
106
  @verifications = SurgeAPI::Resources::Verifications.new(client: self)
103
107
  @webhooks = SurgeAPI::Resources::Webhooks.new(client: self)
@@ -0,0 +1,112 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Internal
5
+ # @generic Elem
6
+ #
7
+ # @example
8
+ # if cursor.has_next?
9
+ # cursor = cursor.next_page
10
+ # end
11
+ #
12
+ # @example
13
+ # cursor.auto_paging_each do |contact|
14
+ # puts(contact)
15
+ # end
16
+ class Cursor
17
+ include SurgeAPI::Internal::Type::BasePage
18
+
19
+ # @return [Array<generic<Elem>>, nil]
20
+ attr_accessor :data
21
+
22
+ # @return [Pagination]
23
+ attr_accessor :pagination
24
+
25
+ # @return [Boolean]
26
+ def next_page?
27
+ !data.to_a.empty? && (!pagination&.previous_cursor.to_s.empty? || !pagination&.next_cursor.to_s.empty?)
28
+ end
29
+
30
+ # @raise [SurgeAPI::HTTP::Error]
31
+ # @return [self]
32
+ def next_page
33
+ unless next_page?
34
+ message = "No more pages available. Please check #next_page? before calling ##{__method__}"
35
+ raise RuntimeError.new(message)
36
+ end
37
+
38
+ req = SurgeAPI::Internal::Util.deep_merge(
39
+ @req,
40
+ {
41
+ query: pagination&.previous_cursor.nil? ? {after: pagination&.next_cursor} : {before: pagination&.previous_cursor}
42
+ }
43
+ )
44
+ @client.request(req)
45
+ end
46
+
47
+ # @param blk [Proc]
48
+ #
49
+ # @yieldparam [generic<Elem>]
50
+ def auto_paging_each(&blk)
51
+ unless block_given?
52
+ raise ArgumentError.new("A block must be given to ##{__method__}")
53
+ end
54
+
55
+ page = self
56
+ loop do
57
+ page.data&.each(&blk)
58
+
59
+ break unless page.next_page?
60
+ page = page.next_page
61
+ end
62
+ end
63
+
64
+ # @api private
65
+ #
66
+ # @param client [SurgeAPI::Internal::Transport::BaseClient]
67
+ # @param req [Hash{Symbol=>Object}]
68
+ # @param headers [Hash{String=>String}]
69
+ # @param page_data [Hash{Symbol=>Object}]
70
+ def initialize(client:, req:, headers:, page_data:)
71
+ super
72
+
73
+ case page_data
74
+ in {data: Array => data}
75
+ @data = data.map { SurgeAPI::Internal::Type::Converter.coerce(@model, _1) }
76
+ else
77
+ end
78
+ case page_data
79
+ in {pagination: Hash | nil => pagination}
80
+ @pagination =
81
+ SurgeAPI::Internal::Type::Converter.coerce(SurgeAPI::Internal::Cursor::Pagination, pagination)
82
+ else
83
+ end
84
+ end
85
+
86
+ # @api private
87
+ #
88
+ # @return [String]
89
+ def inspect
90
+ model = SurgeAPI::Internal::Type::Converter.inspect(@model, depth: 1)
91
+
92
+ "#<#{self.class}[#{model}]:0x#{object_id.to_s(16)}>"
93
+ end
94
+
95
+ class Pagination < SurgeAPI::Internal::Type::BaseModel
96
+ # @!attribute next_cursor
97
+ #
98
+ # @return [String, nil]
99
+ optional :next_cursor, String
100
+
101
+ # @!attribute previous_cursor
102
+ #
103
+ # @return [String, nil]
104
+ optional :previous_cursor, String
105
+
106
+ # @!method initialize(next_cursor: nil, previous_cursor: nil)
107
+ # @param next_cursor [String]
108
+ # @param previous_cursor [String]
109
+ end
110
+ end
111
+ end
112
+ end
@@ -75,7 +75,7 @@ module SurgeAPI
75
75
 
76
76
  case body
77
77
  in nil
78
- nil
78
+ req["content-length"] ||= 0 unless req["transfer-encoding"]
79
79
  in String
80
80
  req["content-length"] ||= body.bytesize.to_s unless req["transfer-encoding"]
81
81
  req.body_stream = SurgeAPI::Internal::Util::ReadIOAdapter.new(body, &blk)
@@ -485,7 +485,7 @@ module SurgeAPI
485
485
  end
486
486
 
487
487
  # @type [Regexp]
488
- JSON_CONTENT = %r{^application/(?:vnd(?:\.[^.]+)*\+)?json(?!l)}
488
+ JSON_CONTENT = %r{^application/(?:[a-zA-Z0-9.-]+\+)?json(?!l)}
489
489
  # @type [Regexp]
490
490
  JSONL_CONTENT = %r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}
491
491
 
@@ -19,7 +19,7 @@ module SurgeAPI
19
19
  # The message body.
20
20
  #
21
21
  # @return [String, nil]
22
- optional :body, String
22
+ optional :body, String, nil?: true
23
23
 
24
24
  # @!attribute name
25
25
  # Optional name for the blast.
@@ -40,7 +40,7 @@ module SurgeAPI
40
40
  #
41
41
  # @param attachments [Array<SurgeAPI::Models::Blast::Attachment>]
42
42
  #
43
- # @param body [String] The message body.
43
+ # @param body [String, nil] The message body.
44
44
  #
45
45
  # @param name [String] Optional name for the blast.
46
46
  #
@@ -16,10 +16,10 @@ module SurgeAPI
16
16
  # The message body.
17
17
  #
18
18
  # @return [String, nil]
19
- optional :body, String
19
+ optional :body, String, nil?: true
20
20
 
21
21
  # @!attribute contacts
22
- # @deprecated
22
+ # @deprecated Use `to` to specify recipients instead.
23
23
  #
24
24
  # Deprecated. Use `to` instead.
25
25
  #
@@ -41,7 +41,7 @@ module SurgeAPI
41
41
  optional :name, String
42
42
 
43
43
  # @!attribute segments
44
- # @deprecated
44
+ # @deprecated Use `to` to specify recipients instead.
45
45
  #
46
46
  # Deprecated. Use `to` instead.
47
47
  #
@@ -67,7 +67,7 @@ module SurgeAPI
67
67
  #
68
68
  # @param attachments [Array<SurgeAPI::Models::BlastCreateParams::Attachment>]
69
69
  #
70
- # @param body [String] The message body.
70
+ # @param body [String, nil] The message body.
71
71
  #
72
72
  # @param contacts [Array<String>] Deprecated. Use `to` instead.
73
73
  #
@@ -60,6 +60,12 @@ module SurgeAPI
60
60
  # @return [String]
61
61
  required :privacy_policy_url, String
62
62
 
63
+ # @!attribute status
64
+ # The current status of the campaign.
65
+ #
66
+ # @return [Symbol, SurgeAPI::Models::Campaign::Status]
67
+ required :status, enum: -> { SurgeAPI::Campaign::Status }
68
+
63
69
  # @!attribute use_cases
64
70
  # A list containing 1-5 types of messages that will be sent with this campaign.
65
71
  #
@@ -125,7 +131,7 @@ module SurgeAPI
125
131
  # @return [String, nil]
126
132
  optional :terms_and_conditions_url, String
127
133
 
128
- # @!method initialize(id:, consent_flow:, description:, includes:, message_samples:, privacy_policy_url:, use_cases:, volume:, link_sample: nil, terms_and_conditions_url: nil)
134
+ # @!method initialize(id:, consent_flow:, description:, includes:, message_samples:, privacy_policy_url:, status:, use_cases:, volume:, link_sample: nil, terms_and_conditions_url: nil)
129
135
  # Some parameter documentations has been truncated, see
130
136
  # {SurgeAPI::Models::Campaign} for more details.
131
137
  #
@@ -144,6 +150,8 @@ module SurgeAPI
144
150
  #
145
151
  # @param privacy_policy_url [String] The URL of the privacy policy for the brand in question. This may be a shared pr
146
152
  #
153
+ # @param status [Symbol, SurgeAPI::Models::Campaign::Status] The current status of the campaign.
154
+ #
147
155
  # @param use_cases [Array<Symbol, SurgeAPI::Models::Campaign::UseCase>] A list containing 1-5 types of messages that will be sent with this campaign.
148
156
  #
149
157
  # @param volume [Symbol, SurgeAPI::Models::Campaign::Volume] This will be one of the following:
@@ -164,6 +172,24 @@ module SurgeAPI
164
172
  # @return [Array<Symbol>]
165
173
  end
166
174
 
175
+ # The current status of the campaign.
176
+ #
177
+ # @see SurgeAPI::Models::Campaign#status
178
+ module Status
179
+ extend SurgeAPI::Internal::Type::Enum
180
+
181
+ ACTIVE = :active
182
+ CANCELED = :canceled
183
+ CREATED = :created
184
+ DEACTIVATED = :deactivated
185
+ IN_REVIEW = :in_review
186
+ PENDING = :pending
187
+ REJECTED = :rejected
188
+
189
+ # @!method self.values
190
+ # @return [Array<Symbol>]
191
+ end
192
+
167
193
  module UseCase
168
194
  extend SurgeAPI::Internal::Type::Enum
169
195
 
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Campaigns#retrieve
6
+ class CampaignRetrieveParams < 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,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Contacts#list
6
+ class ContactListParams < SurgeAPI::Internal::Type::BaseModel
7
+ extend SurgeAPI::Internal::Type::RequestParameters::Converter
8
+ include SurgeAPI::Internal::Type::RequestParameters
9
+
10
+ # @!attribute after
11
+ # Cursor for forward pagination. Use the next_cursor from a previous response.
12
+ #
13
+ # @return [String, nil]
14
+ optional :after, String
15
+
16
+ # @!attribute before
17
+ # Cursor for backward pagination. Use the previous_cursor from a previous
18
+ # response.
19
+ #
20
+ # @return [String, nil]
21
+ optional :before, String
22
+
23
+ # @!method initialize(after: nil, before: nil, request_options: {})
24
+ # Some parameter documentations has been truncated, see
25
+ # {SurgeAPI::Models::ContactListParams} for more details.
26
+ #
27
+ # @param after [String] Cursor for forward pagination. Use the next_cursor from a previous response.
28
+ #
29
+ # @param before [String] Cursor for backward pagination. Use the previous_cursor from a previous response
30
+ #
31
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}]
32
+ end
33
+ end
34
+ end
@@ -20,13 +20,13 @@ module SurgeAPI
20
20
  # attribute messages back to a specific blast.
21
21
  #
22
22
  # @return [String, nil]
23
- optional :blast_id, String
23
+ optional :blast_id, String, nil?: true
24
24
 
25
25
  # @!attribute body
26
26
  # The message body.
27
27
  #
28
28
  # @return [String, nil]
29
- optional :body, String
29
+ optional :body, String, nil?: true
30
30
 
31
31
  # @!attribute conversation
32
32
  # A conversation with a Contact
@@ -50,9 +50,9 @@ module SurgeAPI
50
50
  #
51
51
  # @param attachments [Array<SurgeAPI::Models::Message::Attachment>]
52
52
  #
53
- # @param blast_id [String] The ID of the blast this message belongs to, if any. This can be used to attribu
53
+ # @param blast_id [String, nil] The ID of the blast this message belongs to, if any. This can be used to attribu
54
54
  #
55
- # @param body [String] The message body.
55
+ # @param body [String, nil] The message body.
56
56
  #
57
57
  # @param conversation [SurgeAPI::Models::Message::Conversation] A conversation with a Contact
58
58
  #
@@ -47,8 +47,8 @@ module SurgeAPI
47
47
  # @!attribute body
48
48
  # The content of the message
49
49
  #
50
- # @return [String]
51
- required :body, String
50
+ # @return [String, nil]
51
+ required :body, String, nil?: true
52
52
 
53
53
  # @!attribute conversation
54
54
  # The conversation this message belongs to
@@ -84,7 +84,7 @@ module SurgeAPI
84
84
  #
85
85
  # @param id [String] The unique identifier for the message
86
86
  #
87
- # @param body [String] The content of the message
87
+ # @param body [String, nil] The content of the message
88
88
  #
89
89
  # @param conversation [SurgeAPI::Models::MessageDeliveredWebhookEvent::Data::Conversation] The conversation this message belongs to
90
90
  #
@@ -47,8 +47,8 @@ module SurgeAPI
47
47
  # @!attribute body
48
48
  # The content of the message
49
49
  #
50
- # @return [String]
51
- required :body, String
50
+ # @return [String, nil]
51
+ required :body, String, nil?: true
52
52
 
53
53
  # @!attribute conversation
54
54
  # The conversation this message belongs to
@@ -90,7 +90,7 @@ module SurgeAPI
90
90
  #
91
91
  # @param id [String] The unique identifier for the message
92
92
  #
93
- # @param body [String] The content of the message
93
+ # @param body [String, nil] The content of the message
94
94
  #
95
95
  # @param conversation [SurgeAPI::Models::MessageFailedWebhookEvent::Data::Conversation] The conversation this message belongs to
96
96
  #
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Messages#list
6
+ class MessageListParams < SurgeAPI::Internal::Type::BaseModel
7
+ extend SurgeAPI::Internal::Type::RequestParameters::Converter
8
+ include SurgeAPI::Internal::Type::RequestParameters
9
+
10
+ # @!attribute after
11
+ # Cursor for forward pagination. Use the next_cursor from a previous response.
12
+ #
13
+ # @return [String, nil]
14
+ optional :after, String
15
+
16
+ # @!attribute before
17
+ # Cursor for backward pagination. Use the previous_cursor from a previous
18
+ # response.
19
+ #
20
+ # @return [String, nil]
21
+ optional :before, String
22
+
23
+ # @!method initialize(after: nil, before: nil, request_options: {})
24
+ # Some parameter documentations has been truncated, see
25
+ # {SurgeAPI::Models::MessageListParams} for more details.
26
+ #
27
+ # @param after [String] Cursor for forward pagination. Use the next_cursor from a previous response.
28
+ #
29
+ # @param before [String] Cursor for backward pagination. Use the previous_cursor from a previous response
30
+ #
31
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}]
32
+ end
33
+ end
34
+ end
@@ -47,8 +47,8 @@ module SurgeAPI
47
47
  # @!attribute body
48
48
  # The content of the message
49
49
  #
50
- # @return [String]
51
- required :body, String
50
+ # @return [String, nil]
51
+ required :body, String, nil?: true
52
52
 
53
53
  # @!attribute conversation
54
54
  # The conversation this message belongs to
@@ -84,7 +84,7 @@ module SurgeAPI
84
84
  #
85
85
  # @param id [String] The unique identifier for the message
86
86
  #
87
- # @param body [String] The content of the message
87
+ # @param body [String, nil] The content of the message
88
88
  #
89
89
  # @param conversation [SurgeAPI::Models::MessageReceivedWebhookEvent::Data::Conversation] The conversation this message belongs to
90
90
  #
@@ -47,8 +47,8 @@ module SurgeAPI
47
47
  # @!attribute body
48
48
  # The content of the message
49
49
  #
50
- # @return [String]
51
- required :body, String
50
+ # @return [String, nil]
51
+ required :body, String, nil?: true
52
52
 
53
53
  # @!attribute conversation
54
54
  # The conversation this message belongs to
@@ -84,7 +84,7 @@ module SurgeAPI
84
84
  #
85
85
  # @param id [String] The unique identifier for the message
86
86
  #
87
- # @param body [String] The content of the message
87
+ # @param body [String, nil] The content of the message
88
88
  #
89
89
  # @param conversation [SurgeAPI::Models::MessageSentWebhookEvent::Data::Conversation] The conversation this message belongs to
90
90
  #
@@ -2,7 +2,7 @@
2
2
 
3
3
  module SurgeAPI
4
4
  module Models
5
- # @see SurgeAPI::Resources::PhoneNumbers#purchase
5
+ # @see SurgeAPI::Resources::PhoneNumbers#list
6
6
  class PhoneNumber < SurgeAPI::Internal::Type::BaseModel
7
7
  # @!attribute id
8
8
  # Unique identifier for the phone number
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::PhoneNumbers#list
6
+ class PhoneNumberListParams < SurgeAPI::Internal::Type::BaseModel
7
+ extend SurgeAPI::Internal::Type::RequestParameters::Converter
8
+ include SurgeAPI::Internal::Type::RequestParameters
9
+
10
+ # @!attribute after
11
+ # Cursor for forward pagination. Use the next_cursor from a previous response.
12
+ #
13
+ # @return [String, nil]
14
+ optional :after, String
15
+
16
+ # @!attribute before
17
+ # Cursor for backward pagination. Use the previous_cursor from a previous
18
+ # response.
19
+ #
20
+ # @return [String, nil]
21
+ optional :before, String
22
+
23
+ # @!method initialize(after: nil, before: nil, request_options: {})
24
+ # Some parameter documentations has been truncated, see
25
+ # {SurgeAPI::Models::PhoneNumberListParams} for more details.
26
+ #
27
+ # @param after [String] Cursor for forward pagination. Use the next_cursor from a previous response.
28
+ #
29
+ # @param before [String] Cursor for backward pagination. Use the previous_cursor from a previous response
30
+ #
31
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}]
32
+ end
33
+ end
34
+ end