rcs 2.0.21 → 2.0.22.pre.rc.1

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 (86) hide show
  1. checksums.yaml +4 -4
  2. data/.fernignore +2 -0
  3. data/CONTRIBUTING.md +8 -12
  4. data/README.md +1 -1
  5. data/lib/pinnacle/calls/client.rb +386 -0
  6. data/lib/pinnacle/calls/types/calls_download_recording_request.rb +13 -0
  7. data/lib/pinnacle/calls/types/calls_list_events_request.rb +15 -0
  8. data/lib/pinnacle/calls/types/calls_list_request.rb +25 -0
  9. data/lib/pinnacle/calls/types/create_call_params.rb +19 -0
  10. data/lib/pinnacle/calls/types/create_stream_token_params.rb +17 -0
  11. data/lib/pinnacle/calls/types/update_call_params.rb +13 -0
  12. data/lib/pinnacle/campaigns/dlc/client.rb +1 -1
  13. data/lib/pinnacle/campaigns/rcs/client.rb +1 -1
  14. data/lib/pinnacle/campaigns/toll_free/client.rb +1 -1
  15. data/lib/pinnacle/client.rb +29 -14
  16. data/lib/pinnacle/conferences/client.rb +212 -0
  17. data/lib/pinnacle/conferences/participants/client.rb +209 -0
  18. data/lib/pinnacle/conferences/participants/types/participants_add_request.rb +17 -0
  19. data/lib/pinnacle/conferences/participants/types/update_conference_participant_params.rb +23 -0
  20. data/lib/pinnacle/conferences/types/conferences_list_request.rb +13 -0
  21. data/lib/pinnacle/conferences/types/create_conference_params.rb +23 -0
  22. data/lib/pinnacle/conferences/types/update_conference_params.rb +19 -0
  23. data/lib/pinnacle/forms/client.rb +1 -1
  24. data/lib/pinnacle/network/client.rb +34 -0
  25. data/lib/pinnacle/network/requests/client.rb +94 -0
  26. data/lib/pinnacle/network/requests/types/list_network_requests_params.rb +21 -0
  27. data/lib/pinnacle/network/silent_auth/client.rb +107 -0
  28. data/lib/pinnacle/network/silent_auth/types/silent_auth_check_request.rb +15 -0
  29. data/lib/pinnacle/network/silent_auth/types/silent_auth_request.rb +17 -0
  30. data/lib/pinnacle/network/sim_swap/client.rb +55 -0
  31. data/lib/pinnacle/network/sim_swap/types/sim_swap_request.rb +15 -0
  32. data/lib/pinnacle/network/subscriber_match/client.rb +55 -0
  33. data/lib/pinnacle/network/subscriber_match/types/subscriber_match_request.rb +15 -0
  34. data/lib/pinnacle/types/add_conference_participant_params.rb +15 -0
  35. data/lib/pinnacle/types/agent_summary_carrier_launches.rb +1 -1
  36. data/lib/pinnacle/types/call.rb +35 -0
  37. data/lib/pinnacle/types/call_direction.rb +12 -0
  38. data/lib/pinnacle/types/call_event.rb +27 -0
  39. data/lib/pinnacle/types/call_event_source.rb +14 -0
  40. data/lib/pinnacle/types/call_metadata.rb +23 -0
  41. data/lib/pinnacle/types/call_state.rb +19 -0
  42. data/lib/pinnacle/types/call_status_event.rb +14 -0
  43. data/lib/pinnacle/types/call_status_event_call.rb +17 -0
  44. data/lib/pinnacle/types/call_stream_token.rb +13 -0
  45. data/lib/pinnacle/types/conference.rb +33 -0
  46. data/lib/pinnacle/types/conference_ended_reason.rb +16 -0
  47. data/lib/pinnacle/types/conference_participant.rb +34 -0
  48. data/lib/pinnacle/types/conference_status.rb +13 -0
  49. data/lib/pinnacle/types/created_call.rb +33 -0
  50. data/lib/pinnacle/types/dial.rb +30 -0
  51. data/lib/pinnacle/types/e_164_phone_number.rb +23 -0
  52. data/lib/pinnacle/types/existing_call_participant_params.rb +20 -0
  53. data/lib/pinnacle/types/hosted_silent_auth_response.rb +13 -0
  54. data/lib/pinnacle/types/json_silent_auth_response.rb +13 -0
  55. data/lib/pinnacle/types/list_call_events_response.rb +11 -0
  56. data/lib/pinnacle/types/list_calls_response.rb +11 -0
  57. data/lib/pinnacle/types/list_conferences_response.rb +9 -0
  58. data/lib/pinnacle/types/list_network_requests_response.rb +13 -0
  59. data/lib/pinnacle/types/list_participants_response.rb +9 -0
  60. data/lib/pinnacle/types/network_insight_status.rb +14 -0
  61. data/lib/pinnacle/types/network_request_id.rb +23 -0
  62. data/lib/pinnacle/types/network_request_result.rb +16 -0
  63. data/lib/pinnacle/types/network_request_status.rb +15 -0
  64. data/lib/pinnacle/types/network_request_summary.rb +27 -0
  65. data/lib/pinnacle/types/network_request_type.rb +13 -0
  66. data/lib/pinnacle/types/participant_announce.rb +15 -0
  67. data/lib/pinnacle/types/participant_label.rb +23 -0
  68. data/lib/pinnacle/types/participant_left_reason.rb +17 -0
  69. data/lib/pinnacle/types/participant_status.rb +15 -0
  70. data/lib/pinnacle/types/play.rb +9 -0
  71. data/lib/pinnacle/types/recording_download.rb +11 -0
  72. data/lib/pinnacle/types/recording_state.rb +14 -0
  73. data/lib/pinnacle/types/silent_auth_check_response.rb +11 -0
  74. data/lib/pinnacle/types/silent_auth_check_response_status.rb +12 -0
  75. data/lib/pinnacle/types/silent_auth_response.rb +15 -0
  76. data/lib/pinnacle/types/sim_swap_response.rb +15 -0
  77. data/lib/pinnacle/types/speak.rb +11 -0
  78. data/lib/pinnacle/types/subscriber_match_attributes.rb +30 -0
  79. data/lib/pinnacle/types/subscriber_match_response.rb +13 -0
  80. data/lib/pinnacle/types/subscriber_match_response_matches.rb +41 -0
  81. data/lib/pinnacle/types/subscriber_match_result.rb +18 -0
  82. data/lib/pinnacle/types/webhook_event_enum.rb +1 -0
  83. data/lib/pinnacle/types/whisper_to.rb +23 -0
  84. data/lib/pinnacle/version.rb +1 -1
  85. data/lib/pinnacle.rb +144 -72
  86. metadata +74 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa587a023b2f42d4e52973dfd7f3b234494cdfe661b8c756337172bfa4def1eb
4
- data.tar.gz: 0b52f0f7ceeed61cadf529a7a8b3ba606d855ec76d22a94bcb31d162a1ea7a5f
3
+ metadata.gz: f6d19dac500402b5f28b4cc9117ebb14ab0692ca03f197f59b14d805e724c422
4
+ data.tar.gz: e03cc25e82a1657cfcc9744167ad349d83a1df58c39a8c82d203ce938b2fe395
5
5
  SHA512:
6
- metadata.gz: 7feff411555ed1af41d9eab7c8fbf64f72f0176fac321fbb4ffbad23360e0e204f2ca3e66470ba1b56fb6e5540d0b1e49e13d6cdd37be0627819c8fa29015d47
7
- data.tar.gz: 97f9b374e2c6b28bf8b0c44276a52264c63dfe6d72f1bd901c7901d5bb2db4f4eab41a97d0ea02febd372e512f6c0c70a5d6dfc3f8290f499def4758a51b403a
6
+ metadata.gz: 20900184fd1576895e5308831d377869983bdbfb3efff26128d0f39bec2b60240c7c7699f5f2d460fcbd59dabfa771422d11caa0ef6fd82e90eb521ffba3215f
7
+ data.tar.gz: 5c060f0d6688bb6bf3e88432b325369dff246dd130b1c7d64e31d12bb97b95a47200f34d3582a96d32a182476dde6c7a33c469d80d55686f6afafc56a60daffb
data/.fernignore CHANGED
@@ -1,9 +1,11 @@
1
1
  # Specify files that shouldn't be modified by Fern
2
2
  README.md
3
+ CONTRIBUTING.md
3
4
  lib/pinnacle/wrapper
4
5
  lib/pinnacle/pinnacle_client.rb
5
6
  lib/rcs.rb
6
7
  .github/workflows/ci.yml
8
+ .github/workflows/regenerate-sdk.yml
7
9
  .fern/replay.lock
8
10
  .fern/replay.yml
9
11
  .gitattributes
data/CONTRIBUTING.md CHANGED
@@ -49,7 +49,7 @@ bundle exec rubocop -a
49
49
 
50
50
  ## About Generated Code
51
51
 
52
- **Important**: Most files in this SDK are automatically generated by [Fern](https://buildwithfern.com) from the API definition. Direct modifications to generated files will be overwritten the next time the SDK is generated.
52
+ **Important**: Most files in this SDK are automatically generated from Pinnacle's API definition by the repository-owned SDK pipeline. Direct modifications to generated files will be overwritten the next time the SDK is generated.
53
53
 
54
54
  ### Generated Files
55
55
 
@@ -69,18 +69,15 @@ For custom code that should persist across SDK regenerations:
69
69
  2. Add file patterns for files you want to preserve (similar to `.gitignore` syntax)
70
70
  3. Add your custom code to those files
71
71
 
72
- Files listed in `.fernignore` will not be overwritten when the SDK is regenerated.
72
+ Files and patterns listed in `.fernignore` will not be overwritten when the SDK is regenerated.
73
73
 
74
- For more information, see the [Fern documentation on custom code](https://buildwithfern.com/learn/sdks/overview/custom-code).
75
-
76
- #### Option 2: Contribute to the Generator
74
+ #### Option 2: Change the Generator
77
75
 
78
76
  If you want to change how code is generated for all users of this SDK:
79
77
 
80
- 1. The Ruby SDK generator lives in the [Fern repository](https://github.com/fern-api/fern)
81
- 2. Generator code is located at `generators/ruby-v2/`
82
- 3. Follow the [Fern contributing guidelines](https://github.com/fern-api/fern/blob/main/CONTRIBUTING.md)
83
- 4. Submit a pull request with your changes to the generator
78
+ 1. Open an issue in this repository describing the generator-wide change.
79
+ 2. Pinnacle maintainers update the private generator source and generation workflow.
80
+ 3. The regenerated SDK is reviewed and tested in this repository before release.
84
81
 
85
82
  This approach is best for:
86
83
  - Bug fixes in generated code
@@ -111,9 +108,8 @@ This project uses RuboCop for code formatting. Run `bundle exec rubocop` before
111
108
 
112
109
  If you have questions or run into issues:
113
110
 
114
- 1. Check the [Fern documentation](https://buildwithfern.com)
115
- 2. Search existing [GitHub issues](https://github.com/fern-api/fern/issues)
116
- 3. Open a new issue if your question hasn't been addressed
111
+ 1. Search existing issues in this repository.
112
+ 2. Open a new issue if your question has not been addressed.
117
113
 
118
114
  ## License
119
115
 
data/README.md CHANGED
@@ -4,7 +4,7 @@ The Pinnacle Ruby library provides access to the Pinnacle API from Ruby.
4
4
 
5
5
  ## Documentation
6
6
 
7
- API reference documentation is available [here](docs.trypinnacle.app).
7
+ API reference documentation is available at [docs.pinnacle.sh](https://docs.pinnacle.sh).
8
8
 
9
9
  ## Installation
10
10
 
@@ -0,0 +1,386 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pinnacle
4
+ module Calls
5
+ class Client
6
+ # @param client [Pinnacle::Internal::Http::RawClient]
7
+ #
8
+ # @return [void]
9
+ def initialize(client:)
10
+ @client = client
11
+ end
12
+
13
+ # List voice calls for your team. Results are sorted newest first.
14
+ #
15
+ # @param request_options [Hash]
16
+ # @param params [Hash]
17
+ # @option request_options [String] :base_url
18
+ # @option request_options [Hash{String => Object}] :additional_headers
19
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
20
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
21
+ # @option request_options [Integer] :timeout_in_seconds
22
+ # @option params [Integer, nil] :limit
23
+ # @option params [String, nil] :cursor
24
+ # @option params [Pinnacle::Types::CallState, nil] :state
25
+ # @option params [Pinnacle::Types::CallDirection, nil] :direction
26
+ # @option params [String, nil] :from
27
+ # @option params [String, nil] :to
28
+ # @option params [String, nil] :created_after
29
+ # @option params [String, nil] :created_before
30
+ #
31
+ # @return [Pinnacle::Types::ListCallsResponse]
32
+ def list(request_options: {}, **params)
33
+ params = Pinnacle::Internal::Types::Utils.normalize_keys(params)
34
+ query_params = {}
35
+ query_params["limit"] = params[:limit] if params.key?(:limit)
36
+ query_params["cursor"] = params[:cursor] if params.key?(:cursor)
37
+ query_params["state"] = params[:state] if params.key?(:state)
38
+ query_params["direction"] = params[:direction] if params.key?(:direction)
39
+ query_params["from"] = params[:from] if params.key?(:from)
40
+ query_params["to"] = params[:to] if params.key?(:to)
41
+ query_params["created_after"] = params[:created_after] if params.key?(:created_after)
42
+ query_params["created_before"] = params[:created_before] if params.key?(:created_before)
43
+
44
+ request = Pinnacle::Internal::JSON::Request.new(
45
+ base_url: request_options[:base_url],
46
+ method: "GET",
47
+ path: "calls",
48
+ query: query_params,
49
+ request_options: request_options
50
+ )
51
+ begin
52
+ response = @client.send(request)
53
+ rescue Net::HTTPRequestTimeout
54
+ raise Pinnacle::Errors::TimeoutError
55
+ end
56
+ code = response.code.to_i
57
+ if code.between?(200, 299)
58
+ Pinnacle::Types::ListCallsResponse.load(response.body)
59
+ else
60
+ error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code)
61
+ raise error_class.new(response.body, code: code)
62
+ end
63
+ end
64
+
65
+ # Start an outbound voice call from a voice-enabled phone number owned by
66
+ # your team.
67
+ #
68
+ # **Retrying safely.** Send an `Idempotency-Key` header and the call is
69
+ # placed at most once, however many times the request is repeated. This
70
+ # matters more here than on most endpoints: a retry without one dials the
71
+ # recipient a second time.
72
+ #
73
+ # - Same key, same request: returns the original call with `200` instead
74
+ # of `201`, and no new call is placed.
75
+ # - Same key, different request: `422`. The key is bound to the request
76
+ # it was first used with, so returning the unrelated original call
77
+ # would be worse than refusing.
78
+ # - Same key while the first attempt is still in flight: `409`. Retry
79
+ # once it settles.
80
+ #
81
+ # Keys are scoped to your team and expire after 24 hours. Two requests
82
+ # count as the same when `to`, `from`, `record` and `metadata` match;
83
+ # metadata key order is not significant.
84
+ #
85
+ # @param request_options [Hash]
86
+ # @param params [Pinnacle::Calls::Types::CreateCallParams]
87
+ # @option request_options [String] :base_url
88
+ # @option request_options [Hash{String => Object}] :additional_headers
89
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
90
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
91
+ # @option request_options [Integer] :timeout_in_seconds
92
+ # @option params [String, nil] :idempotency_key
93
+ #
94
+ # @return [Pinnacle::Types::CreatedCall]
95
+ def create(request_options: {}, **params)
96
+ params = Pinnacle::Internal::Types::Utils.normalize_keys(params)
97
+ request_data = Pinnacle::Calls::Types::CreateCallParams.new(params).to_h
98
+ non_body_param_names = %w[Idempotency-Key]
99
+ body = request_data.except(*non_body_param_names)
100
+
101
+ headers = {}
102
+ headers["Idempotency-Key"] = params[:idempotency_key] if params[:idempotency_key]
103
+
104
+ request = Pinnacle::Internal::JSON::Request.new(
105
+ base_url: request_options[:base_url],
106
+ method: "POST",
107
+ path: "calls",
108
+ headers: headers,
109
+ body: body,
110
+ request_options: request_options
111
+ )
112
+ begin
113
+ response = @client.send(request)
114
+ rescue Net::HTTPRequestTimeout
115
+ raise Pinnacle::Errors::TimeoutError
116
+ end
117
+ code = response.code.to_i
118
+ if code.between?(200, 299)
119
+ Pinnacle::Types::CreatedCall.load(response.body)
120
+ else
121
+ error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code)
122
+ raise error_class.new(response.body, code: code)
123
+ end
124
+ end
125
+
126
+ # Retrieve one voice call by its Pinnacle call ID.
127
+ #
128
+ # @param request_options [Hash]
129
+ # @param params [Hash]
130
+ # @option request_options [String] :base_url
131
+ # @option request_options [Hash{String => Object}] :additional_headers
132
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
133
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
134
+ # @option request_options [Integer] :timeout_in_seconds
135
+ # @option params [String] :id
136
+ #
137
+ # @return [Pinnacle::Types::Call]
138
+ def get(request_options: {}, **params)
139
+ params = Pinnacle::Internal::Types::Utils.normalize_keys(params)
140
+ request = Pinnacle::Internal::JSON::Request.new(
141
+ base_url: request_options[:base_url],
142
+ method: "GET",
143
+ path: "calls/#{URI.encode_uri_component(params[:id].to_s)}",
144
+ request_options: request_options
145
+ )
146
+ begin
147
+ response = @client.send(request)
148
+ rescue Net::HTTPRequestTimeout
149
+ raise Pinnacle::Errors::TimeoutError
150
+ end
151
+ code = response.code.to_i
152
+ if code.between?(200, 299)
153
+ Pinnacle::Types::Call.load(response.body)
154
+ else
155
+ error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code)
156
+ raise error_class.new(response.body, code: code)
157
+ end
158
+ end
159
+
160
+ # End a live call. Terminal calls are returned unchanged.
161
+ #
162
+ # @param request_options [Hash]
163
+ # @param params [Hash]
164
+ # @option request_options [String] :base_url
165
+ # @option request_options [Hash{String => Object}] :additional_headers
166
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
167
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
168
+ # @option request_options [Integer] :timeout_in_seconds
169
+ # @option params [String] :id
170
+ #
171
+ # @return [Pinnacle::Types::Call]
172
+ def cancel(request_options: {}, **params)
173
+ params = Pinnacle::Internal::Types::Utils.normalize_keys(params)
174
+ request = Pinnacle::Internal::JSON::Request.new(
175
+ base_url: request_options[:base_url],
176
+ method: "DELETE",
177
+ path: "calls/#{URI.encode_uri_component(params[:id].to_s)}",
178
+ request_options: request_options
179
+ )
180
+ begin
181
+ response = @client.send(request)
182
+ rescue Net::HTTPRequestTimeout
183
+ raise Pinnacle::Errors::TimeoutError
184
+ end
185
+ code = response.code.to_i
186
+ if code.between?(200, 299)
187
+ Pinnacle::Types::Call.load(response.body)
188
+ else
189
+ error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code)
190
+ raise error_class.new(response.body, code: code)
191
+ end
192
+ end
193
+
194
+ # Replace a call's metadata. For live calls, future call events carry the updated metadata.
195
+ #
196
+ # @param request_options [Hash]
197
+ # @param params [Pinnacle::Calls::Types::UpdateCallParams]
198
+ # @option request_options [String] :base_url
199
+ # @option request_options [Hash{String => Object}] :additional_headers
200
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
201
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
202
+ # @option request_options [Integer] :timeout_in_seconds
203
+ # @option params [String] :id
204
+ #
205
+ # @return [Pinnacle::Types::Call]
206
+ def update(request_options: {}, **params)
207
+ params = Pinnacle::Internal::Types::Utils.normalize_keys(params)
208
+ request_data = Pinnacle::Calls::Types::UpdateCallParams.new(params).to_h
209
+ non_body_param_names = %w[id]
210
+ body = request_data.except(*non_body_param_names)
211
+
212
+ request = Pinnacle::Internal::JSON::Request.new(
213
+ base_url: request_options[:base_url],
214
+ method: "PATCH",
215
+ path: "calls/#{URI.encode_uri_component(params[:id].to_s)}",
216
+ body: body,
217
+ request_options: request_options
218
+ )
219
+ begin
220
+ response = @client.send(request)
221
+ rescue Net::HTTPRequestTimeout
222
+ raise Pinnacle::Errors::TimeoutError
223
+ end
224
+ code = response.code.to_i
225
+ if code.between?(200, 299)
226
+ Pinnacle::Types::Call.load(response.body)
227
+ else
228
+ error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code)
229
+ raise error_class.new(response.body, code: code)
230
+ end
231
+ end
232
+
233
+ # List the event timeline for a call.
234
+ #
235
+ # @param request_options [Hash]
236
+ # @param params [Hash]
237
+ # @option request_options [String] :base_url
238
+ # @option request_options [Hash{String => Object}] :additional_headers
239
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
240
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
241
+ # @option request_options [Integer] :timeout_in_seconds
242
+ # @option params [String] :id
243
+ # @option params [Integer, nil] :limit
244
+ # @option params [String, nil] :cursor
245
+ #
246
+ # @return [Pinnacle::Types::ListCallEventsResponse]
247
+ def list_events(request_options: {}, **params)
248
+ params = Pinnacle::Internal::Types::Utils.normalize_keys(params)
249
+ query_params = {}
250
+ query_params["limit"] = params[:limit] if params.key?(:limit)
251
+ query_params["cursor"] = params[:cursor] if params.key?(:cursor)
252
+
253
+ request = Pinnacle::Internal::JSON::Request.new(
254
+ base_url: request_options[:base_url],
255
+ method: "GET",
256
+ path: "calls/#{URI.encode_uri_component(params[:id].to_s)}/events",
257
+ query: query_params,
258
+ request_options: request_options
259
+ )
260
+ begin
261
+ response = @client.send(request)
262
+ rescue Net::HTTPRequestTimeout
263
+ raise Pinnacle::Errors::TimeoutError
264
+ end
265
+ code = response.code.to_i
266
+ if code.between?(200, 299)
267
+ Pinnacle::Types::ListCallEventsResponse.load(response.body)
268
+ else
269
+ error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code)
270
+ raise error_class.new(response.body, code: code)
271
+ end
272
+ end
273
+
274
+ # Mint a short-lived WebSocket token for a call. Use the returned `stream_url` to connect to Pinnacle's
275
+ # bidirectional voice stream.
276
+ #
277
+ # @param request_options [Hash]
278
+ # @param params [Pinnacle::Calls::Types::CreateStreamTokenParams]
279
+ # @option request_options [String] :base_url
280
+ # @option request_options [Hash{String => Object}] :additional_headers
281
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
282
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
283
+ # @option request_options [Integer] :timeout_in_seconds
284
+ # @option params [String] :id
285
+ #
286
+ # @return [Pinnacle::Types::CallStreamToken]
287
+ def create_stream_token(request_options: {}, **params)
288
+ params = Pinnacle::Internal::Types::Utils.normalize_keys(params)
289
+ request_data = Pinnacle::Calls::Types::CreateStreamTokenParams.new(params).to_h
290
+ non_body_param_names = %w[id]
291
+ body = request_data.except(*non_body_param_names)
292
+
293
+ request = Pinnacle::Internal::JSON::Request.new(
294
+ base_url: request_options[:base_url],
295
+ method: "POST",
296
+ path: "calls/#{URI.encode_uri_component(params[:id].to_s)}/stream-token",
297
+ body: body,
298
+ request_options: request_options
299
+ )
300
+ begin
301
+ response = @client.send(request)
302
+ rescue Net::HTTPRequestTimeout
303
+ raise Pinnacle::Errors::TimeoutError
304
+ end
305
+ code = response.code.to_i
306
+ if code.between?(200, 299)
307
+ Pinnacle::Types::CallStreamToken.load(response.body)
308
+ else
309
+ error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code)
310
+ raise error_class.new(response.body, code: code)
311
+ end
312
+ end
313
+
314
+ # Return a short-lived signed URL for the call recording.
315
+ #
316
+ # @param request_options [Hash]
317
+ # @param params [Hash]
318
+ # @option request_options [String] :base_url
319
+ # @option request_options [Hash{String => Object}] :additional_headers
320
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
321
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
322
+ # @option request_options [Integer] :timeout_in_seconds
323
+ # @option params [String] :id
324
+ # @option params [Integer, nil] :expires_in
325
+ #
326
+ # @return [Pinnacle::Types::RecordingDownload]
327
+ def download_recording(request_options: {}, **params)
328
+ params = Pinnacle::Internal::Types::Utils.normalize_keys(params)
329
+ query_params = {}
330
+ query_params["expires_in"] = params[:expires_in] if params.key?(:expires_in)
331
+
332
+ request = Pinnacle::Internal::JSON::Request.new(
333
+ base_url: request_options[:base_url],
334
+ method: "GET",
335
+ path: "calls/#{URI.encode_uri_component(params[:id].to_s)}/recording",
336
+ query: query_params,
337
+ request_options: request_options
338
+ )
339
+ begin
340
+ response = @client.send(request)
341
+ rescue Net::HTTPRequestTimeout
342
+ raise Pinnacle::Errors::TimeoutError
343
+ end
344
+ code = response.code.to_i
345
+ if code.between?(200, 299)
346
+ Pinnacle::Types::RecordingDownload.load(response.body)
347
+ else
348
+ error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code)
349
+ raise error_class.new(response.body, code: code)
350
+ end
351
+ end
352
+
353
+ # Delete the canonical recording and queued fragments for a terminal call.
354
+ #
355
+ # @param request_options [Hash]
356
+ # @param params [Hash]
357
+ # @option request_options [String] :base_url
358
+ # @option request_options [Hash{String => Object}] :additional_headers
359
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
360
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
361
+ # @option request_options [Integer] :timeout_in_seconds
362
+ # @option params [String] :id
363
+ #
364
+ # @return [untyped]
365
+ def delete_recording(request_options: {}, **params)
366
+ params = Pinnacle::Internal::Types::Utils.normalize_keys(params)
367
+ request = Pinnacle::Internal::JSON::Request.new(
368
+ base_url: request_options[:base_url],
369
+ method: "DELETE",
370
+ path: "calls/#{URI.encode_uri_component(params[:id].to_s)}/recording",
371
+ request_options: request_options
372
+ )
373
+ begin
374
+ response = @client.send(request)
375
+ rescue Net::HTTPRequestTimeout
376
+ raise Pinnacle::Errors::TimeoutError
377
+ end
378
+ code = response.code.to_i
379
+ return if code.between?(200, 299)
380
+
381
+ error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code)
382
+ raise error_class.new(response.body, code: code)
383
+ end
384
+ end
385
+ end
386
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pinnacle
4
+ module Calls
5
+ module Types
6
+ class CallsDownloadRecordingRequest < Internal::Types::Model
7
+ field :id, -> { String }, optional: false, nullable: false
8
+
9
+ field :expires_in, -> { Integer }, optional: true, nullable: false
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pinnacle
4
+ module Calls
5
+ module Types
6
+ class CallsListEventsRequest < Internal::Types::Model
7
+ field :id, -> { String }, optional: false, nullable: false
8
+
9
+ field :limit, -> { Integer }, optional: true, nullable: false
10
+
11
+ field :cursor, -> { String }, optional: true, nullable: false
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pinnacle
4
+ module Calls
5
+ module Types
6
+ class CallsListRequest < Internal::Types::Model
7
+ field :limit, -> { Integer }, optional: true, nullable: false
8
+
9
+ field :cursor, -> { String }, optional: true, nullable: false
10
+
11
+ field :state, -> { Pinnacle::Types::CallState }, optional: true, nullable: false
12
+
13
+ field :direction, -> { Pinnacle::Types::CallDirection }, optional: true, nullable: false
14
+
15
+ field :from, -> { String }, optional: true, nullable: false
16
+
17
+ field :to, -> { String }, optional: true, nullable: false
18
+
19
+ field :created_after, -> { String }, optional: true, nullable: false
20
+
21
+ field :created_before, -> { String }, optional: true, nullable: false
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pinnacle
4
+ module Calls
5
+ module Types
6
+ class CreateCallParams < Internal::Types::Model
7
+ field :idempotency_key, -> { String }, optional: true, nullable: false, api_name: "Idempotency-Key"
8
+
9
+ field :to, -> { String }, optional: false, nullable: false
10
+
11
+ field :from, -> { String }, optional: false, nullable: false
12
+
13
+ field :record, -> { Internal::Types::Boolean }, optional: true, nullable: false
14
+
15
+ field :metadata, -> { Internal::Types::Hash[String, String] }, optional: true, nullable: false
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pinnacle
4
+ module Calls
5
+ module Types
6
+ class CreateStreamTokenParams < Internal::Types::Model
7
+ field :id, -> { String }, optional: false, nullable: false
8
+
9
+ field :commands_enabled, -> { Internal::Types::Boolean }, optional: true, nullable: false
10
+
11
+ field :stream_id, -> { String }, optional: true, nullable: false
12
+
13
+ field :record, -> { Internal::Types::Boolean }, optional: true, nullable: false
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pinnacle
4
+ module Calls
5
+ module Types
6
+ class UpdateCallParams < Internal::Types::Model
7
+ field :id, -> { String }, optional: false, nullable: false
8
+
9
+ field :metadata, -> { Internal::Types::Hash[String, String] }, optional: false, nullable: false
10
+ end
11
+ end
12
+ end
13
+ end
@@ -119,7 +119,7 @@ module Pinnacle
119
119
  # **To create a new campaign:** Omit `campaignId` — one will be generated automatically.
120
120
  #
121
121
  # **Before you start:** Create a [brand](/api-reference/brands/upsert) first — you'll need its `id` for the
122
- # [`brand`](#request.body.brand) field.
122
+ # [`brand`](#request-body.applicationjson.body.brand) field.
123
123
  #
124
124
  # All fields are **required** unless specified otherwise, and will be validated when
125
125
  # [submitted](/api-reference/campaigns/10-dlc/submit).
@@ -119,7 +119,7 @@ module Pinnacle
119
119
  # **To create a new campaign:** Omit `campaignId` — one will be generated automatically.
120
120
  #
121
121
  # **Before you start:** Create a [brand](/api-reference/brands/upsert) first — you'll need its `id` for the
122
- # [`brand`](#request.body.brand) field.
122
+ # [`brand`](#request-body.applicationjson.body.brand) field.
123
123
  #
124
124
  # All fields are **required** unless specified otherwise, and will be validated when
125
125
  # [submitted](/api-reference/campaigns/rcs/submit).
@@ -119,7 +119,7 @@ module Pinnacle
119
119
  # **To create a new campaign:** Omit `campaignId` — one will be generated automatically.
120
120
  #
121
121
  # **Before you start:** Create a [brand](/api-reference/brands/upsert) first — you'll need its `id` for the
122
- # [`brand`](#request.body.brand) field.
122
+ # [`brand`](#request-body.applicationjson.body.brand) field.
123
123
  #
124
124
  # All fields are **required** unless specified otherwise, and will be validated when
125
125
  # [submitted](/api-reference/campaigns/toll-free/submit).