surge_api 0.10.0 → 0.11.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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/README.md +6 -6
  4. data/lib/surge_api/internal/cursor.rb +2 -2
  5. data/lib/surge_api/models/campaign_list_params.rb +34 -0
  6. data/lib/surge_api/models/message.rb +18 -3
  7. data/lib/surge_api/models/message_delivered_webhook_event.rb +9 -1
  8. data/lib/surge_api/models/message_failed_webhook_event.rb +9 -1
  9. data/lib/surge_api/models/message_received_webhook_event.rb +9 -1
  10. data/lib/surge_api/models/message_sent_webhook_event.rb +9 -1
  11. data/lib/surge_api/models/recording_delete_params.rb +14 -0
  12. data/lib/surge_api/models/recording_delete_response.rb +101 -0
  13. data/lib/surge_api/models.rb +4 -0
  14. data/lib/surge_api/resources/campaigns.rb +30 -0
  15. data/lib/surge_api/resources/recordings.rb +21 -0
  16. data/lib/surge_api/version.rb +1 -1
  17. data/lib/surge_api.rb +3 -0
  18. data/rbi/surge_api/models/campaign_list_params.rbi +59 -0
  19. data/rbi/surge_api/models/message.rbi +42 -6
  20. data/rbi/surge_api/models/message_delivered_webhook_event.rbi +8 -0
  21. data/rbi/surge_api/models/message_failed_webhook_event.rbi +8 -0
  22. data/rbi/surge_api/models/message_received_webhook_event.rbi +8 -0
  23. data/rbi/surge_api/models/message_sent_webhook_event.rbi +8 -0
  24. data/rbi/surge_api/models/recording_delete_params.rbi +27 -0
  25. data/rbi/surge_api/models/recording_delete_response.rbi +211 -0
  26. data/rbi/surge_api/models.rbi +4 -0
  27. data/rbi/surge_api/resources/campaigns.rbi +21 -0
  28. data/rbi/surge_api/resources/recordings.rbi +15 -0
  29. data/sig/surge_api/models/campaign_list_params.rbs +32 -0
  30. data/sig/surge_api/models/message.rbs +33 -5
  31. data/sig/surge_api/models/message_delivered_webhook_event.rbs +5 -0
  32. data/sig/surge_api/models/message_failed_webhook_event.rbs +5 -0
  33. data/sig/surge_api/models/message_received_webhook_event.rbs +5 -0
  34. data/sig/surge_api/models/message_sent_webhook_event.rbs +5 -0
  35. data/sig/surge_api/models/recording_delete_params.rbs +15 -0
  36. data/sig/surge_api/models/recording_delete_response.rbs +94 -0
  37. data/sig/surge_api/models.rbs +4 -0
  38. data/sig/surge_api/resources/campaigns.rbs +7 -0
  39. data/sig/surge_api/resources/recordings.rbs +5 -0
  40. metadata +11 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4ab0d460fe03be9712dc7d4ad68bc64e6ebb931573b9fe9ff91b8f36f2979514
4
- data.tar.gz: 20488d8ba034a202671fa5cb1c3e0bde2c863bfa7826ed3ffb718911c34515ee
3
+ metadata.gz: 21d19ad8088d287a26c0293ecbec97d29a879616d98b219dbcb8c672c699f58d
4
+ data.tar.gz: eb81ac34997ec986242cdd64006a69d31f7bb76555a8a711644fcc06210c1293
5
5
  SHA512:
6
- metadata.gz: abd73bd158429ed55c7343a89e85ce56ed40979df1278b20937250787bf360b91e1de84494abd4f1d2e9c2f3dc8f2bbfbedec04f1666b2d9b5798f976cda985f
7
- data.tar.gz: bcbd4c0adb4baba0a737a833232f02abb63588f31a8d9ff70c39dee65037db86032efc12f34499c57ff46bd6b6b27c5276d6a9af4600fb290aced6e0014cda80
6
+ metadata.gz: af5bc8ed33052eb78f9a1bcb9e165e594f2b684891c6a159315903847da918c38ce1a4b8cb60bdb10b5cc4d144eb1a7398f816c90606268189408f9da6de25d0
7
+ data.tar.gz: 17951922f214b0a5d290fd520658d9964ae51972e5761199272d3193a91bfa3f2b52cc1fa749f4235174d42733472d732b2c20a4dd6767509b5b89b06e86d82b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.0 (2026-02-22)
4
+
5
+ Full Changelog: [v0.10.0...v0.11.0](https://github.com/surgeapi/ruby-sdk/compare/v0.10.0...v0.11.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** add list campaigns endpoint ([253f71e](https://github.com/surgeapi/ruby-sdk/commit/253f71e0ac6ba81778c59aeddf33a6a80b898ac3))
10
+ * **api:** add metadata to message webhooks ([6827521](https://github.com/surgeapi/ruby-sdk/commit/68275214c295b5b102ef3c05a62ed08a03794ac6))
11
+ * **api:** delete recording endpoint ([64d7bf2](https://github.com/surgeapi/ruby-sdk/commit/64d7bf2f8730fa7a11a4b38c07ade41a850bf5a8))
12
+ * **api:** make attachment type an enum ([2897de1](https://github.com/surgeapi/ruby-sdk/commit/2897de13cd5eb3c95c30b251b7baf7edf5c0b6d7))
13
+
14
+
15
+ ### Chores
16
+
17
+ * **internal:** remove mock server code ([1411557](https://github.com/surgeapi/ruby-sdk/commit/1411557864e6741dc576fe5802cbd2bb2dcaa9e6))
18
+ * **test:** update skip reason message ([cbb9e45](https://github.com/surgeapi/ruby-sdk/commit/cbb9e4564283c9b1e733c443bba93cefe10d0f85))
19
+ * update mock server docs ([cd3da3a](https://github.com/surgeapi/ruby-sdk/commit/cd3da3a27ea9d4d5a511ecf8ea82ca4fbe00eaef))
20
+
3
21
  ## 0.10.0 (2026-02-12)
4
22
 
5
23
  Full Changelog: [v0.9.0...v0.10.0](https://github.com/surgeapi/ruby-sdk/compare/v0.9.0...v0.10.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.10.0"
20
+ gem "surge_api", "~> 0.11.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -44,15 +44,15 @@ List methods in the Surge API are paginated.
44
44
  This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:
45
45
 
46
46
  ```ruby
47
- page = surge.contacts.list
47
+ page = surge.campaigns.list
48
48
 
49
49
  # Fetch single item from page.
50
- contact = page.data[0]
51
- puts(contact.id)
50
+ campaign = page.data[0]
51
+ puts(campaign.id)
52
52
 
53
53
  # Automatically fetches more pages as needed.
54
- page.auto_paging_each do |contact|
55
- puts(contact.id)
54
+ page.auto_paging_each do |campaign|
55
+ puts(campaign.id)
56
56
  end
57
57
  ```
58
58
 
@@ -10,8 +10,8 @@ module SurgeAPI
10
10
  # end
11
11
  #
12
12
  # @example
13
- # cursor.auto_paging_each do |contact|
14
- # puts(contact)
13
+ # cursor.auto_paging_each do |campaign|
14
+ # puts(campaign)
15
15
  # end
16
16
  class Cursor
17
17
  include SurgeAPI::Internal::Type::BasePage
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Campaigns#list
6
+ class CampaignListParams < 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::CampaignListParams} 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
@@ -68,8 +68,8 @@ module SurgeAPI
68
68
  # @!attribute type
69
69
  # The type of attachment.
70
70
  #
71
- # @return [String, nil]
72
- optional :type, String
71
+ # @return [Symbol, SurgeAPI::Models::Message::Attachment::Type, nil]
72
+ optional :type, enum: -> { SurgeAPI::Message::Attachment::Type }
73
73
 
74
74
  # @!attribute url
75
75
  # The URL of the attachment.
@@ -82,9 +82,24 @@ module SurgeAPI
82
82
  #
83
83
  # @param id [String] Unique identifier for the object.
84
84
  #
85
- # @param type [String] The type of attachment.
85
+ # @param type [Symbol, SurgeAPI::Models::Message::Attachment::Type] The type of attachment.
86
86
  #
87
87
  # @param url [String] The URL of the attachment.
88
+
89
+ # The type of attachment.
90
+ #
91
+ # @see SurgeAPI::Models::Message::Attachment#type
92
+ module Type
93
+ extend SurgeAPI::Internal::Type::Enum
94
+
95
+ FILE = :file
96
+ IMAGE = :image
97
+ LINK = :link
98
+ VIDEO = :video
99
+
100
+ # @!method self.values
101
+ # @return [Array<Symbol>]
102
+ end
88
103
  end
89
104
 
90
105
  # @see SurgeAPI::Models::Message#conversation
@@ -62,6 +62,12 @@ module SurgeAPI
62
62
  # @return [Time]
63
63
  required :delivered_at, Time
64
64
 
65
+ # @!attribute metadata
66
+ # Set of key-value pairs that will be stored with the object.
67
+ #
68
+ # @return [Hash{Symbol=>String}]
69
+ required :metadata, SurgeAPI::Internal::Type::HashOf[String]
70
+
65
71
  # @!attribute attachments
66
72
  # Attachments included with the message
67
73
  #
@@ -76,7 +82,7 @@ module SurgeAPI
76
82
  # @return [String, nil]
77
83
  optional :blast_id, String
78
84
 
79
- # @!method initialize(id:, body:, conversation:, delivered_at:, attachments: nil, blast_id: nil)
85
+ # @!method initialize(id:, body:, conversation:, delivered_at:, metadata:, attachments: nil, blast_id: nil)
80
86
  # Some parameter documentations has been truncated, see
81
87
  # {SurgeAPI::Models::MessageDeliveredWebhookEvent::Data} for more details.
82
88
  #
@@ -90,6 +96,8 @@ module SurgeAPI
90
96
  #
91
97
  # @param delivered_at [Time] When the message was delivered
92
98
  #
99
+ # @param metadata [Hash{Symbol=>String}] Set of key-value pairs that will be stored with the object.
100
+ #
93
101
  # @param attachments [Array<SurgeAPI::Models::MessageDeliveredWebhookEvent::Data::Attachment>] Attachments included with the message
94
102
  #
95
103
  # @param blast_id [String] The ID of the blast this message belongs to, if any. This can be used to attribu
@@ -68,6 +68,12 @@ module SurgeAPI
68
68
  # @return [String]
69
69
  required :failure_reason, String
70
70
 
71
+ # @!attribute metadata
72
+ # Set of key-value pairs that will be stored with the object.
73
+ #
74
+ # @return [Hash{Symbol=>String}]
75
+ required :metadata, SurgeAPI::Internal::Type::HashOf[String]
76
+
71
77
  # @!attribute attachments
72
78
  # Attachments included with the message
73
79
  #
@@ -82,7 +88,7 @@ module SurgeAPI
82
88
  # @return [String, nil]
83
89
  optional :blast_id, String
84
90
 
85
- # @!method initialize(id:, body:, conversation:, failed_at:, failure_reason:, attachments: nil, blast_id: nil)
91
+ # @!method initialize(id:, body:, conversation:, failed_at:, failure_reason:, metadata:, attachments: nil, blast_id: nil)
86
92
  # Some parameter documentations has been truncated, see
87
93
  # {SurgeAPI::Models::MessageFailedWebhookEvent::Data} for more details.
88
94
  #
@@ -98,6 +104,8 @@ module SurgeAPI
98
104
  #
99
105
  # @param failure_reason [String] The reason the message failed to be delivered
100
106
  #
107
+ # @param metadata [Hash{Symbol=>String}] Set of key-value pairs that will be stored with the object.
108
+ #
101
109
  # @param attachments [Array<SurgeAPI::Models::MessageFailedWebhookEvent::Data::Attachment>] Attachments included with the message
102
110
  #
103
111
  # @param blast_id [String] The ID of the blast this message belongs to, if any. This can be used to attribu
@@ -56,6 +56,12 @@ module SurgeAPI
56
56
  # @return [SurgeAPI::Models::MessageReceivedWebhookEvent::Data::Conversation]
57
57
  required :conversation, -> { SurgeAPI::MessageReceivedWebhookEvent::Data::Conversation }
58
58
 
59
+ # @!attribute metadata
60
+ # Set of key-value pairs that will be stored with the object.
61
+ #
62
+ # @return [Hash{Symbol=>String}]
63
+ required :metadata, SurgeAPI::Internal::Type::HashOf[String]
64
+
59
65
  # @!attribute received_at
60
66
  # When the message was received
61
67
  #
@@ -76,7 +82,7 @@ module SurgeAPI
76
82
  # @return [String, nil]
77
83
  optional :blast_id, String
78
84
 
79
- # @!method initialize(id:, body:, conversation:, received_at:, attachments: nil, blast_id: nil)
85
+ # @!method initialize(id:, body:, conversation:, metadata:, received_at:, attachments: nil, blast_id: nil)
80
86
  # Some parameter documentations has been truncated, see
81
87
  # {SurgeAPI::Models::MessageReceivedWebhookEvent::Data} for more details.
82
88
  #
@@ -88,6 +94,8 @@ module SurgeAPI
88
94
  #
89
95
  # @param conversation [SurgeAPI::Models::MessageReceivedWebhookEvent::Data::Conversation] The conversation this message belongs to
90
96
  #
97
+ # @param metadata [Hash{Symbol=>String}] Set of key-value pairs that will be stored with the object.
98
+ #
91
99
  # @param received_at [Time] When the message was received
92
100
  #
93
101
  # @param attachments [Array<SurgeAPI::Models::MessageReceivedWebhookEvent::Data::Attachment>] Attachments included with the message
@@ -56,6 +56,12 @@ module SurgeAPI
56
56
  # @return [SurgeAPI::Models::MessageSentWebhookEvent::Data::Conversation]
57
57
  required :conversation, -> { SurgeAPI::MessageSentWebhookEvent::Data::Conversation }
58
58
 
59
+ # @!attribute metadata
60
+ # Set of key-value pairs that will be stored with the object.
61
+ #
62
+ # @return [Hash{Symbol=>String}]
63
+ required :metadata, SurgeAPI::Internal::Type::HashOf[String]
64
+
59
65
  # @!attribute sent_at
60
66
  # When the message was sent
61
67
  #
@@ -76,7 +82,7 @@ module SurgeAPI
76
82
  # @return [String, nil]
77
83
  optional :blast_id, String
78
84
 
79
- # @!method initialize(id:, body:, conversation:, sent_at:, attachments: nil, blast_id: nil)
85
+ # @!method initialize(id:, body:, conversation:, metadata:, sent_at:, attachments: nil, blast_id: nil)
80
86
  # Some parameter documentations has been truncated, see
81
87
  # {SurgeAPI::Models::MessageSentWebhookEvent::Data} for more details.
82
88
  #
@@ -88,6 +94,8 @@ module SurgeAPI
88
94
  #
89
95
  # @param conversation [SurgeAPI::Models::MessageSentWebhookEvent::Data::Conversation] The conversation this message belongs to
90
96
  #
97
+ # @param metadata [Hash{Symbol=>String}] Set of key-value pairs that will be stored with the object.
98
+ #
91
99
  # @param sent_at [Time] When the message was sent
92
100
  #
93
101
  # @param attachments [Array<SurgeAPI::Models::MessageSentWebhookEvent::Data::Attachment>] Attachments included with the message
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Recordings#delete
6
+ class RecordingDeleteParams < 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,101 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # @see SurgeAPI::Resources::Recordings#delete
6
+ class RecordingDeleteResponse < SurgeAPI::Internal::Type::BaseModel
7
+ # @!attribute id
8
+ # The unique identifier for the recording
9
+ #
10
+ # @return [String]
11
+ required :id, String
12
+
13
+ # @!attribute call
14
+ # The call that produced this recording
15
+ #
16
+ # @return [SurgeAPI::Models::RecordingDeleteResponse::Call]
17
+ required :call, -> { SurgeAPI::Models::RecordingDeleteResponse::Call }
18
+
19
+ # @!attribute duration
20
+ # The duration of the recording in seconds
21
+ #
22
+ # @return [Integer]
23
+ required :duration, Integer
24
+
25
+ # @!method initialize(id:, call:, duration:)
26
+ # A call recording
27
+ #
28
+ # @param id [String] The unique identifier for the recording
29
+ #
30
+ # @param call [SurgeAPI::Models::RecordingDeleteResponse::Call] The call that produced this recording
31
+ #
32
+ # @param duration [Integer] The duration of the recording in seconds
33
+
34
+ # @see SurgeAPI::Models::RecordingDeleteResponse#call
35
+ class Call < SurgeAPI::Internal::Type::BaseModel
36
+ # @!attribute id
37
+ # The unique identifier for the call
38
+ #
39
+ # @return [String]
40
+ required :id, String
41
+
42
+ # @!attribute contact
43
+ # A contact who has consented to receive messages
44
+ #
45
+ # @return [SurgeAPI::Models::Contact]
46
+ required :contact, -> { SurgeAPI::Contact }
47
+
48
+ # @!attribute duration
49
+ # The duration of the call in seconds
50
+ #
51
+ # @return [Integer]
52
+ required :duration, Integer
53
+
54
+ # @!attribute initiated_at
55
+ # When the call was initiated
56
+ #
57
+ # @return [Time]
58
+ required :initiated_at, Time
59
+
60
+ # @!attribute status
61
+ # The status of the call
62
+ #
63
+ # @return [Symbol, SurgeAPI::Models::RecordingDeleteResponse::Call::Status]
64
+ required :status, enum: -> { SurgeAPI::Models::RecordingDeleteResponse::Call::Status }
65
+
66
+ # @!method initialize(id:, contact:, duration:, initiated_at:, status:)
67
+ # The call that produced this recording
68
+ #
69
+ # @param id [String] The unique identifier for the call
70
+ #
71
+ # @param contact [SurgeAPI::Models::Contact] A contact who has consented to receive messages
72
+ #
73
+ # @param duration [Integer] The duration of the call in seconds
74
+ #
75
+ # @param initiated_at [Time] When the call was initiated
76
+ #
77
+ # @param status [Symbol, SurgeAPI::Models::RecordingDeleteResponse::Call::Status] The status of the call
78
+
79
+ # The status of the call
80
+ #
81
+ # @see SurgeAPI::Models::RecordingDeleteResponse::Call#status
82
+ module Status
83
+ extend SurgeAPI::Internal::Type::Enum
84
+
85
+ BUSY = :busy
86
+ CANCELED = :canceled
87
+ COMPLETED = :completed
88
+ FAILED = :failed
89
+ IN_PROGRESS = :in_progress
90
+ MISSED = :missed
91
+ NO_ANSWER = :no_answer
92
+ QUEUED = :queued
93
+ RINGING = :ringing
94
+
95
+ # @!method self.values
96
+ # @return [Array<Symbol>]
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
@@ -63,6 +63,8 @@ module SurgeAPI
63
63
 
64
64
  CampaignCreateParams = SurgeAPI::Models::CampaignCreateParams
65
65
 
66
+ CampaignListParams = SurgeAPI::Models::CampaignListParams
67
+
66
68
  CampaignParams = SurgeAPI::Models::CampaignParams
67
69
 
68
70
  CampaignRetrieveParams = SurgeAPI::Models::CampaignRetrieveParams
@@ -115,6 +117,8 @@ module SurgeAPI
115
117
 
116
118
  RecordingCompletedWebhookEvent = SurgeAPI::Models::RecordingCompletedWebhookEvent
117
119
 
120
+ RecordingDeleteParams = SurgeAPI::Models::RecordingDeleteParams
121
+
118
122
  RecordingGetFileParams = SurgeAPI::Models::RecordingGetFileParams
119
123
 
120
124
  UnwrapWebhookEvent = SurgeAPI::Models::UnwrapWebhookEvent
@@ -55,6 +55,36 @@ module SurgeAPI
55
55
  )
56
56
  end
57
57
 
58
+ # Some parameter documentations has been truncated, see
59
+ # {SurgeAPI::Models::CampaignListParams} for more details.
60
+ #
61
+ # List all campaigns for an account with cursor-based pagination.
62
+ #
63
+ # @overload list(account_id, after: nil, before: nil, request_options: {})
64
+ #
65
+ # @param account_id [String] The account ID to list campaigns for.
66
+ #
67
+ # @param after [String] Cursor for forward pagination. Use the next_cursor from a previous response.
68
+ #
69
+ # @param before [String] Cursor for backward pagination. Use the previous_cursor from a previous response
70
+ #
71
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
72
+ #
73
+ # @return [SurgeAPI::Internal::Cursor<SurgeAPI::Models::Campaign>]
74
+ #
75
+ # @see SurgeAPI::Models::CampaignListParams
76
+ def list(account_id, params = {})
77
+ parsed, options = SurgeAPI::CampaignListParams.dump_request(params)
78
+ @client.request(
79
+ method: :get,
80
+ path: ["accounts/%1$s/campaigns", account_id],
81
+ query: parsed,
82
+ page: SurgeAPI::Internal::Cursor,
83
+ model: SurgeAPI::Campaign,
84
+ options: options
85
+ )
86
+ end
87
+
58
88
  # @api private
59
89
  #
60
90
  # @param client [SurgeAPI::Client]
@@ -3,6 +3,27 @@
3
3
  module SurgeAPI
4
4
  module Resources
5
5
  class Recordings
6
+ # Deletes a recording. The recording file will be removed from storage
7
+ # asynchronously.
8
+ #
9
+ # @overload delete(id, request_options: {})
10
+ #
11
+ # @param id [String] The ID of the recording.
12
+ #
13
+ # @param request_options [SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil]
14
+ #
15
+ # @return [SurgeAPI::Models::RecordingDeleteResponse]
16
+ #
17
+ # @see SurgeAPI::Models::RecordingDeleteParams
18
+ def delete(id, params = {})
19
+ @client.request(
20
+ method: :delete,
21
+ path: ["recordings/%1$s", id],
22
+ model: SurgeAPI::Models::RecordingDeleteResponse,
23
+ options: params[:request_options]
24
+ )
25
+ end
26
+
6
27
  # Redirects to a signed URL where the recording audio file can be downloaded. URL
7
28
  # is short-lived, so redirect should be followed immediately.
8
29
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SurgeAPI
4
- VERSION = "0.10.0"
4
+ VERSION = "0.11.0"
5
5
  end
data/lib/surge_api.rb CHANGED
@@ -67,6 +67,7 @@ require_relative "surge_api/models/call_ended_webhook_event"
67
67
  require_relative "surge_api/models/campaign"
68
68
  require_relative "surge_api/models/campaign_approved_webhook_event"
69
69
  require_relative "surge_api/models/campaign_create_params"
70
+ require_relative "surge_api/models/campaign_list_params"
70
71
  require_relative "surge_api/models/campaign_retrieve_params"
71
72
  require_relative "surge_api/models/contact"
72
73
  require_relative "surge_api/models/contact_create_params"
@@ -91,6 +92,8 @@ require_relative "surge_api/models/phone_number"
91
92
  require_relative "surge_api/models/phone_number_list_params"
92
93
  require_relative "surge_api/models/phone_number_purchase_params"
93
94
  require_relative "surge_api/models/recording_completed_webhook_event"
95
+ require_relative "surge_api/models/recording_delete_params"
96
+ require_relative "surge_api/models/recording_delete_response"
94
97
  require_relative "surge_api/models/recording_get_file_params"
95
98
  require_relative "surge_api/models/recording_get_file_response"
96
99
  require_relative "surge_api/models/unwrap_webhook_event"
@@ -0,0 +1,59 @@
1
+ # typed: strong
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ class CampaignListParams < SurgeAPI::Internal::Type::BaseModel
6
+ extend SurgeAPI::Internal::Type::RequestParameters::Converter
7
+ include SurgeAPI::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(SurgeAPI::CampaignListParams, SurgeAPI::Internal::AnyHash)
12
+ end
13
+
14
+ # Cursor for forward pagination. Use the next_cursor from a previous response.
15
+ sig { returns(T.nilable(String)) }
16
+ attr_reader :after
17
+
18
+ sig { params(after: String).void }
19
+ attr_writer :after
20
+
21
+ # Cursor for backward pagination. Use the previous_cursor from a previous
22
+ # response.
23
+ sig { returns(T.nilable(String)) }
24
+ attr_reader :before
25
+
26
+ sig { params(before: String).void }
27
+ attr_writer :before
28
+
29
+ sig do
30
+ params(
31
+ after: String,
32
+ before: String,
33
+ request_options: SurgeAPI::RequestOptions::OrHash
34
+ ).returns(T.attached_class)
35
+ end
36
+ def self.new(
37
+ # Cursor for forward pagination. Use the next_cursor from a previous response.
38
+ after: nil,
39
+ # Cursor for backward pagination. Use the previous_cursor from a previous
40
+ # response.
41
+ before: nil,
42
+ request_options: {}
43
+ )
44
+ end
45
+
46
+ sig do
47
+ override.returns(
48
+ {
49
+ after: String,
50
+ before: String,
51
+ request_options: SurgeAPI::RequestOptions
52
+ }
53
+ )
54
+ end
55
+ def to_hash
56
+ end
57
+ end
58
+ end
59
+ end
@@ -102,10 +102,12 @@ module SurgeAPI
102
102
  attr_writer :id
103
103
 
104
104
  # The type of attachment.
105
- sig { returns(T.nilable(String)) }
105
+ sig do
106
+ returns(T.nilable(SurgeAPI::Message::Attachment::Type::TaggedSymbol))
107
+ end
106
108
  attr_reader :type
107
109
 
108
- sig { params(type: String).void }
110
+ sig { params(type: SurgeAPI::Message::Attachment::Type::OrSymbol).void }
109
111
  attr_writer :type
110
112
 
111
113
  # The URL of the attachment.
@@ -117,9 +119,11 @@ module SurgeAPI
117
119
 
118
120
  # An Attachment is a file that can be sent with a message.
119
121
  sig do
120
- params(id: String, type: String, url: String).returns(
121
- T.attached_class
122
- )
122
+ params(
123
+ id: String,
124
+ type: SurgeAPI::Message::Attachment::Type::OrSymbol,
125
+ url: String
126
+ ).returns(T.attached_class)
123
127
  end
124
128
  def self.new(
125
129
  # Unique identifier for the object.
@@ -131,9 +135,41 @@ module SurgeAPI
131
135
  )
132
136
  end
133
137
 
134
- sig { override.returns({ id: String, type: String, url: String }) }
138
+ sig do
139
+ override.returns(
140
+ {
141
+ id: String,
142
+ type: SurgeAPI::Message::Attachment::Type::TaggedSymbol,
143
+ url: String
144
+ }
145
+ )
146
+ end
135
147
  def to_hash
136
148
  end
149
+
150
+ # The type of attachment.
151
+ module Type
152
+ extend SurgeAPI::Internal::Type::Enum
153
+
154
+ TaggedSymbol =
155
+ T.type_alias { T.all(Symbol, SurgeAPI::Message::Attachment::Type) }
156
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
157
+
158
+ FILE = T.let(:file, SurgeAPI::Message::Attachment::Type::TaggedSymbol)
159
+ IMAGE =
160
+ T.let(:image, SurgeAPI::Message::Attachment::Type::TaggedSymbol)
161
+ LINK = T.let(:link, SurgeAPI::Message::Attachment::Type::TaggedSymbol)
162
+ VIDEO =
163
+ T.let(:video, SurgeAPI::Message::Attachment::Type::TaggedSymbol)
164
+
165
+ sig do
166
+ override.returns(
167
+ T::Array[SurgeAPI::Message::Attachment::Type::TaggedSymbol]
168
+ )
169
+ end
170
+ def self.values
171
+ end
172
+ end
137
173
  end
138
174
 
139
175
  class Conversation < SurgeAPI::Internal::Type::BaseModel
@@ -100,6 +100,10 @@ module SurgeAPI
100
100
  sig { returns(Time) }
101
101
  attr_accessor :delivered_at
102
102
 
103
+ # Set of key-value pairs that will be stored with the object.
104
+ sig { returns(T::Hash[Symbol, String]) }
105
+ attr_accessor :metadata
106
+
103
107
  # Attachments included with the message
104
108
  sig do
105
109
  returns(
@@ -136,6 +140,7 @@ module SurgeAPI
136
140
  conversation:
137
141
  SurgeAPI::MessageDeliveredWebhookEvent::Data::Conversation::OrHash,
138
142
  delivered_at: Time,
143
+ metadata: T::Hash[Symbol, String],
139
144
  attachments:
140
145
  T::Array[
141
146
  SurgeAPI::MessageDeliveredWebhookEvent::Data::Attachment::OrHash
@@ -152,6 +157,8 @@ module SurgeAPI
152
157
  conversation:,
153
158
  # When the message was delivered
154
159
  delivered_at:,
160
+ # Set of key-value pairs that will be stored with the object.
161
+ metadata:,
155
162
  # Attachments included with the message
156
163
  attachments: nil,
157
164
  # The ID of the blast this message belongs to, if any. This can be used to
@@ -168,6 +175,7 @@ module SurgeAPI
168
175
  conversation:
169
176
  SurgeAPI::MessageDeliveredWebhookEvent::Data::Conversation,
170
177
  delivered_at: Time,
178
+ metadata: T::Hash[Symbol, String],
171
179
  attachments:
172
180
  T::Array[
173
181
  SurgeAPI::MessageDeliveredWebhookEvent::Data::Attachment