rcs 2.0.1 → 2.0.2
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.
- checksums.yaml +4 -4
- data/lib/rcs/audiences/client.rb +347 -0
- data/lib/rcs/audiences/contacts/client.rb +173 -0
- data/lib/rcs/audiences/types/audiences_get_response.rb +58 -0
- data/lib/rcs/types/audience_count_only.rb +87 -0
- data/lib/rcs/types/audience_with_pagination.rb +114 -0
- data/lib/rcs/types/delete_audience_response.rb +57 -0
- data/lib/rcs/types/pagination.rb +81 -0
- data/lib/rcs/types/sent_mms_details.rb +18 -4
- data/lib/rcs.rb +7 -0
- data/lib/requests.rb +2 -2
- data/lib/types_export.rb +5 -0
- metadata +9 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9ae139d400bbfa1ab360ba9c8330f3cdf286e7ef16772032ff9dba8be4b54f21
|
|
4
|
+
data.tar.gz: f2041515877561cffa19ad82eda057813788dd59f5e6423b89005197085f98ec
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9923fb9be738fd30e395689c60cddd25046dbc073bdf1af1792cb2260e7e43bdd1da99d9e74a7c8fd344d3c34aba7375cdcbb1749e8d35bad1779e759f71c574
|
|
7
|
+
data.tar.gz: fa778ca98424e492675eb4906a908b97dabeacfa4c5fe72c0f79d88ae562e00a838b94a1cafb3902bf940a0e0697cc467d77a476b45a91d50fb86e8913938954
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../../requests"
|
|
4
|
+
require_relative "types/audiences_get_response"
|
|
5
|
+
require_relative "../types/audience_count_only"
|
|
6
|
+
require_relative "../types/delete_audience_response"
|
|
7
|
+
require "async"
|
|
8
|
+
|
|
9
|
+
module Pinnacle
|
|
10
|
+
class AudiencesClient
|
|
11
|
+
# @return [Pinnacle::RequestClient]
|
|
12
|
+
attr_reader :request_client
|
|
13
|
+
|
|
14
|
+
# @param request_client [Pinnacle::RequestClient]
|
|
15
|
+
# @return [Pinnacle::AudiencesClient]
|
|
16
|
+
def initialize(request_client:)
|
|
17
|
+
@request_client = request_client
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Retrieve an audience by ID with optional pagination.
|
|
21
|
+
#
|
|
22
|
+
# @param id [String] Audience ID. This identifier is a string that always begins with the prefix
|
|
23
|
+
# `aud_`, for example: `aud_abc123`.
|
|
24
|
+
# @param page [Integer] Page number. If provided with or without limit, returns paginated contacts.
|
|
25
|
+
# @param limit [Integer] Items per page. If provided with or without page, returns paginated contacts.
|
|
26
|
+
# @param request_options [Pinnacle::RequestOptions]
|
|
27
|
+
# @return [Pinnacle::Types::AudienceWithPagination, Pinnacle::Types::AudienceCountOnly]
|
|
28
|
+
# @example
|
|
29
|
+
# api = Pinnacle::Client.new(
|
|
30
|
+
# base_url: "https://api.example.com",
|
|
31
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
|
32
|
+
# api_key: "YOUR_API_KEY"
|
|
33
|
+
# )
|
|
34
|
+
# api.audiences.get(id: "aud_abc123")
|
|
35
|
+
def get(id:, page: nil, limit: nil, request_options: nil)
|
|
36
|
+
response = @request_client.conn.get do |req|
|
|
37
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
38
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
39
|
+
req.headers = {
|
|
40
|
+
**(req.headers || {}),
|
|
41
|
+
**@request_client.get_headers,
|
|
42
|
+
**(request_options&.additional_headers || {})
|
|
43
|
+
}.compact
|
|
44
|
+
req.params = {
|
|
45
|
+
**(request_options&.additional_query_parameters || {}),
|
|
46
|
+
"id": id,
|
|
47
|
+
"page": page,
|
|
48
|
+
"limit": limit
|
|
49
|
+
}.compact
|
|
50
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
51
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
52
|
+
end
|
|
53
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/audiences"
|
|
54
|
+
end
|
|
55
|
+
Pinnacle::Audiences::Types::AudiencesGetResponse.from_json(json_object: response.body)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Create a new audience with optional initial contacts. Phone numbers that don't
|
|
59
|
+
# exist will be auto-created as contacts.
|
|
60
|
+
#
|
|
61
|
+
# @param name [String] Audience name.
|
|
62
|
+
# @param description [String] Audience description.
|
|
63
|
+
# @param contacts [Array<String>] Optional array of phone numbers (E.164 format) or contact IDs.
|
|
64
|
+
# @param request_options [Pinnacle::RequestOptions]
|
|
65
|
+
# @return [Pinnacle::Types::AudienceCountOnly]
|
|
66
|
+
# @example
|
|
67
|
+
# api = Pinnacle::Client.new(
|
|
68
|
+
# base_url: "https://api.example.com",
|
|
69
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
|
70
|
+
# api_key: "YOUR_API_KEY"
|
|
71
|
+
# )
|
|
72
|
+
# api.audiences.create(name: "Marketing Campaign Q1", description: "Contacts for Q1 marketing push")
|
|
73
|
+
def create(name:, description: nil, contacts: nil, request_options: nil)
|
|
74
|
+
response = @request_client.conn.post do |req|
|
|
75
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
76
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
77
|
+
req.headers = {
|
|
78
|
+
**(req.headers || {}),
|
|
79
|
+
**@request_client.get_headers,
|
|
80
|
+
**(request_options&.additional_headers || {})
|
|
81
|
+
}.compact
|
|
82
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
83
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
84
|
+
end
|
|
85
|
+
req.body = {
|
|
86
|
+
**(request_options&.additional_body_parameters || {}),
|
|
87
|
+
name: name,
|
|
88
|
+
description: description,
|
|
89
|
+
contacts: contacts
|
|
90
|
+
}.compact
|
|
91
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/audiences"
|
|
92
|
+
end
|
|
93
|
+
Pinnacle::Types::AudienceCountOnly.from_json(json_object: response.body)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Permanently delete an audience and all its contact associations.
|
|
97
|
+
# Note: This will NOT delete the contacts themselves, only the audience and its
|
|
98
|
+
# memberships.
|
|
99
|
+
#
|
|
100
|
+
# @param id [String] Audience ID. This identifier is a string that always begins with the prefix
|
|
101
|
+
# `aud_`, for example: `aud_abc123`.
|
|
102
|
+
# @param request_options [Pinnacle::RequestOptions]
|
|
103
|
+
# @return [Pinnacle::Types::DeleteAudienceResponse]
|
|
104
|
+
# @example
|
|
105
|
+
# api = Pinnacle::Client.new(
|
|
106
|
+
# base_url: "https://api.example.com",
|
|
107
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
|
108
|
+
# api_key: "YOUR_API_KEY"
|
|
109
|
+
# )
|
|
110
|
+
# api.audiences.delete(id: "aud_abc123")
|
|
111
|
+
def delete(id:, request_options: nil)
|
|
112
|
+
response = @request_client.conn.delete do |req|
|
|
113
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
114
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
115
|
+
req.headers = {
|
|
116
|
+
**(req.headers || {}),
|
|
117
|
+
**@request_client.get_headers,
|
|
118
|
+
**(request_options&.additional_headers || {})
|
|
119
|
+
}.compact
|
|
120
|
+
req.params = { **(request_options&.additional_query_parameters || {}), "id": id }.compact
|
|
121
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
122
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
123
|
+
end
|
|
124
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/audiences"
|
|
125
|
+
end
|
|
126
|
+
Pinnacle::Types::DeleteAudienceResponse.from_json(json_object: response.body)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Update audience metadata. This endpoint does NOT modify contacts.
|
|
130
|
+
# To add or remove contacts, use the [Add
|
|
131
|
+
# Contacts](/api-reference/audiences/add-contacts) or [Remove
|
|
132
|
+
# Contacts](/api-reference/audiences/remove-contacts) endpoints.
|
|
133
|
+
#
|
|
134
|
+
# @param id [String] Audience ID to update. This identifier is a string that always begins with the
|
|
135
|
+
# prefix `aud_`, for example: `aud_abc123`.
|
|
136
|
+
# @param name [String] New audience name.
|
|
137
|
+
# @param description [String] New audience description.
|
|
138
|
+
# @param request_options [Pinnacle::RequestOptions]
|
|
139
|
+
# @return [Pinnacle::Types::AudienceCountOnly]
|
|
140
|
+
# @example
|
|
141
|
+
# api = Pinnacle::Client.new(
|
|
142
|
+
# base_url: "https://api.example.com",
|
|
143
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
|
144
|
+
# api_key: "YOUR_API_KEY"
|
|
145
|
+
# )
|
|
146
|
+
# api.audiences.update(
|
|
147
|
+
# id: "aud_abc123",
|
|
148
|
+
# name: "Updated Audience Name",
|
|
149
|
+
# description: "New description"
|
|
150
|
+
# )
|
|
151
|
+
def update(id:, name: nil, description: nil, request_options: nil)
|
|
152
|
+
response = @request_client.conn.patch do |req|
|
|
153
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
154
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
155
|
+
req.headers = {
|
|
156
|
+
**(req.headers || {}),
|
|
157
|
+
**@request_client.get_headers,
|
|
158
|
+
**(request_options&.additional_headers || {})
|
|
159
|
+
}.compact
|
|
160
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
161
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
162
|
+
end
|
|
163
|
+
req.body = {
|
|
164
|
+
**(request_options&.additional_body_parameters || {}),
|
|
165
|
+
id: id,
|
|
166
|
+
name: name,
|
|
167
|
+
description: description
|
|
168
|
+
}.compact
|
|
169
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/audiences"
|
|
170
|
+
end
|
|
171
|
+
Pinnacle::Types::AudienceCountOnly.from_json(json_object: response.body)
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
class AsyncAudiencesClient
|
|
176
|
+
# @return [Pinnacle::AsyncRequestClient]
|
|
177
|
+
attr_reader :request_client
|
|
178
|
+
|
|
179
|
+
# @param request_client [Pinnacle::AsyncRequestClient]
|
|
180
|
+
# @return [Pinnacle::AsyncAudiencesClient]
|
|
181
|
+
def initialize(request_client:)
|
|
182
|
+
@request_client = request_client
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# Retrieve an audience by ID with optional pagination.
|
|
186
|
+
#
|
|
187
|
+
# @param id [String] Audience ID. This identifier is a string that always begins with the prefix
|
|
188
|
+
# `aud_`, for example: `aud_abc123`.
|
|
189
|
+
# @param page [Integer] Page number. If provided with or without limit, returns paginated contacts.
|
|
190
|
+
# @param limit [Integer] Items per page. If provided with or without page, returns paginated contacts.
|
|
191
|
+
# @param request_options [Pinnacle::RequestOptions]
|
|
192
|
+
# @return [Pinnacle::Types::AudienceWithPagination, Pinnacle::Types::AudienceCountOnly]
|
|
193
|
+
# @example
|
|
194
|
+
# api = Pinnacle::Client.new(
|
|
195
|
+
# base_url: "https://api.example.com",
|
|
196
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
|
197
|
+
# api_key: "YOUR_API_KEY"
|
|
198
|
+
# )
|
|
199
|
+
# api.audiences.get(id: "aud_abc123")
|
|
200
|
+
def get(id:, page: nil, limit: nil, request_options: nil)
|
|
201
|
+
Async do
|
|
202
|
+
response = @request_client.conn.get do |req|
|
|
203
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
204
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
205
|
+
req.headers = {
|
|
206
|
+
**(req.headers || {}),
|
|
207
|
+
**@request_client.get_headers,
|
|
208
|
+
**(request_options&.additional_headers || {})
|
|
209
|
+
}.compact
|
|
210
|
+
req.params = {
|
|
211
|
+
**(request_options&.additional_query_parameters || {}),
|
|
212
|
+
"id": id,
|
|
213
|
+
"page": page,
|
|
214
|
+
"limit": limit
|
|
215
|
+
}.compact
|
|
216
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
217
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
218
|
+
end
|
|
219
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/audiences"
|
|
220
|
+
end
|
|
221
|
+
Pinnacle::Audiences::Types::AudiencesGetResponse.from_json(json_object: response.body)
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
# Create a new audience with optional initial contacts. Phone numbers that don't
|
|
226
|
+
# exist will be auto-created as contacts.
|
|
227
|
+
#
|
|
228
|
+
# @param name [String] Audience name.
|
|
229
|
+
# @param description [String] Audience description.
|
|
230
|
+
# @param contacts [Array<String>] Optional array of phone numbers (E.164 format) or contact IDs.
|
|
231
|
+
# @param request_options [Pinnacle::RequestOptions]
|
|
232
|
+
# @return [Pinnacle::Types::AudienceCountOnly]
|
|
233
|
+
# @example
|
|
234
|
+
# api = Pinnacle::Client.new(
|
|
235
|
+
# base_url: "https://api.example.com",
|
|
236
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
|
237
|
+
# api_key: "YOUR_API_KEY"
|
|
238
|
+
# )
|
|
239
|
+
# api.audiences.create(name: "Marketing Campaign Q1", description: "Contacts for Q1 marketing push")
|
|
240
|
+
def create(name:, description: nil, contacts: nil, request_options: nil)
|
|
241
|
+
Async do
|
|
242
|
+
response = @request_client.conn.post do |req|
|
|
243
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
244
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
245
|
+
req.headers = {
|
|
246
|
+
**(req.headers || {}),
|
|
247
|
+
**@request_client.get_headers,
|
|
248
|
+
**(request_options&.additional_headers || {})
|
|
249
|
+
}.compact
|
|
250
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
251
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
252
|
+
end
|
|
253
|
+
req.body = {
|
|
254
|
+
**(request_options&.additional_body_parameters || {}),
|
|
255
|
+
name: name,
|
|
256
|
+
description: description,
|
|
257
|
+
contacts: contacts
|
|
258
|
+
}.compact
|
|
259
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/audiences"
|
|
260
|
+
end
|
|
261
|
+
Pinnacle::Types::AudienceCountOnly.from_json(json_object: response.body)
|
|
262
|
+
end
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
# Permanently delete an audience and all its contact associations.
|
|
266
|
+
# Note: This will NOT delete the contacts themselves, only the audience and its
|
|
267
|
+
# memberships.
|
|
268
|
+
#
|
|
269
|
+
# @param id [String] Audience ID. This identifier is a string that always begins with the prefix
|
|
270
|
+
# `aud_`, for example: `aud_abc123`.
|
|
271
|
+
# @param request_options [Pinnacle::RequestOptions]
|
|
272
|
+
# @return [Pinnacle::Types::DeleteAudienceResponse]
|
|
273
|
+
# @example
|
|
274
|
+
# api = Pinnacle::Client.new(
|
|
275
|
+
# base_url: "https://api.example.com",
|
|
276
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
|
277
|
+
# api_key: "YOUR_API_KEY"
|
|
278
|
+
# )
|
|
279
|
+
# api.audiences.delete(id: "aud_abc123")
|
|
280
|
+
def delete(id:, request_options: nil)
|
|
281
|
+
Async do
|
|
282
|
+
response = @request_client.conn.delete do |req|
|
|
283
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
284
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
285
|
+
req.headers = {
|
|
286
|
+
**(req.headers || {}),
|
|
287
|
+
**@request_client.get_headers,
|
|
288
|
+
**(request_options&.additional_headers || {})
|
|
289
|
+
}.compact
|
|
290
|
+
req.params = { **(request_options&.additional_query_parameters || {}), "id": id }.compact
|
|
291
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
292
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
293
|
+
end
|
|
294
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/audiences"
|
|
295
|
+
end
|
|
296
|
+
Pinnacle::Types::DeleteAudienceResponse.from_json(json_object: response.body)
|
|
297
|
+
end
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
# Update audience metadata. This endpoint does NOT modify contacts.
|
|
301
|
+
# To add or remove contacts, use the [Add
|
|
302
|
+
# Contacts](/api-reference/audiences/add-contacts) or [Remove
|
|
303
|
+
# Contacts](/api-reference/audiences/remove-contacts) endpoints.
|
|
304
|
+
#
|
|
305
|
+
# @param id [String] Audience ID to update. This identifier is a string that always begins with the
|
|
306
|
+
# prefix `aud_`, for example: `aud_abc123`.
|
|
307
|
+
# @param name [String] New audience name.
|
|
308
|
+
# @param description [String] New audience description.
|
|
309
|
+
# @param request_options [Pinnacle::RequestOptions]
|
|
310
|
+
# @return [Pinnacle::Types::AudienceCountOnly]
|
|
311
|
+
# @example
|
|
312
|
+
# api = Pinnacle::Client.new(
|
|
313
|
+
# base_url: "https://api.example.com",
|
|
314
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
|
315
|
+
# api_key: "YOUR_API_KEY"
|
|
316
|
+
# )
|
|
317
|
+
# api.audiences.update(
|
|
318
|
+
# id: "aud_abc123",
|
|
319
|
+
# name: "Updated Audience Name",
|
|
320
|
+
# description: "New description"
|
|
321
|
+
# )
|
|
322
|
+
def update(id:, name: nil, description: nil, request_options: nil)
|
|
323
|
+
Async do
|
|
324
|
+
response = @request_client.conn.patch do |req|
|
|
325
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
326
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
327
|
+
req.headers = {
|
|
328
|
+
**(req.headers || {}),
|
|
329
|
+
**@request_client.get_headers,
|
|
330
|
+
**(request_options&.additional_headers || {})
|
|
331
|
+
}.compact
|
|
332
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
333
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
334
|
+
end
|
|
335
|
+
req.body = {
|
|
336
|
+
**(request_options&.additional_body_parameters || {}),
|
|
337
|
+
id: id,
|
|
338
|
+
name: name,
|
|
339
|
+
description: description
|
|
340
|
+
}.compact
|
|
341
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/audiences"
|
|
342
|
+
end
|
|
343
|
+
Pinnacle::Types::AudienceCountOnly.from_json(json_object: response.body)
|
|
344
|
+
end
|
|
345
|
+
end
|
|
346
|
+
end
|
|
347
|
+
end
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../../../requests"
|
|
4
|
+
require_relative "../../types/audience_count_only"
|
|
5
|
+
require "async"
|
|
6
|
+
|
|
7
|
+
module Pinnacle
|
|
8
|
+
module Audiences
|
|
9
|
+
class ContactsClient
|
|
10
|
+
# @return [Pinnacle::RequestClient]
|
|
11
|
+
attr_reader :request_client
|
|
12
|
+
|
|
13
|
+
# @param request_client [Pinnacle::RequestClient]
|
|
14
|
+
# @return [Pinnacle::Audiences::ContactsClient]
|
|
15
|
+
def initialize(request_client:)
|
|
16
|
+
@request_client = request_client
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Remove contacts from an existing audience. This operation is idempotent.
|
|
20
|
+
# - Only removes contacts that exist in the audience
|
|
21
|
+
# - Contacts not in the audience are ignored
|
|
22
|
+
#
|
|
23
|
+
# @param id [String] Audience ID. This identifier is a string that always begins with the prefix
|
|
24
|
+
# `aud_`, for example: `aud_abc123`.
|
|
25
|
+
# @param contacts [Array<String>] Array of phone numbers (E.164 format) or contact IDs (minimum 1 item).
|
|
26
|
+
# @param request_options [Pinnacle::RequestOptions]
|
|
27
|
+
# @return [Pinnacle::Types::AudienceCountOnly]
|
|
28
|
+
# @example
|
|
29
|
+
# api = Pinnacle::Client.new(
|
|
30
|
+
# base_url: "https://api.example.com",
|
|
31
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
|
32
|
+
# api_key: "YOUR_API_KEY"
|
|
33
|
+
# )
|
|
34
|
+
# api.audiences.contacts.remove(id: "aud_abc123", contacts: ["+12125551234", "co_def456"])
|
|
35
|
+
def remove(id:, contacts:, request_options: nil)
|
|
36
|
+
response = @request_client.conn.delete do |req|
|
|
37
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
38
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
39
|
+
req.headers = {
|
|
40
|
+
**(req.headers || {}),
|
|
41
|
+
**@request_client.get_headers,
|
|
42
|
+
**(request_options&.additional_headers || {})
|
|
43
|
+
}.compact
|
|
44
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
45
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
46
|
+
end
|
|
47
|
+
req.body = { **(request_options&.additional_body_parameters || {}), id: id, contacts: contacts }.compact
|
|
48
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/audiences/contacts"
|
|
49
|
+
end
|
|
50
|
+
Pinnacle::Types::AudienceCountOnly.from_json(json_object: response.body)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Add contacts to an existing audience. This operation is additive and idempotent.
|
|
54
|
+
# - Phone numbers that don't exist will be auto-created as contacts
|
|
55
|
+
# - Duplicate adds are ignored
|
|
56
|
+
# - Contacts already in the audience are ignored
|
|
57
|
+
#
|
|
58
|
+
# @param id [String] Audience ID. This identifier is a string that always begins with the prefix
|
|
59
|
+
# `aud_`, for example: `aud_abc123`.
|
|
60
|
+
# @param contacts [Array<String>] Array of phone numbers (E.164 format) or contact IDs (minimum 1 item).
|
|
61
|
+
# @param request_options [Pinnacle::RequestOptions]
|
|
62
|
+
# @return [Pinnacle::Types::AudienceCountOnly]
|
|
63
|
+
# @example
|
|
64
|
+
# api = Pinnacle::Client.new(
|
|
65
|
+
# base_url: "https://api.example.com",
|
|
66
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
|
67
|
+
# api_key: "YOUR_API_KEY"
|
|
68
|
+
# )
|
|
69
|
+
# api.audiences.contacts.add(id: "aud_abc123", contacts: ["+12125551234", "co_def456", "+13105551234"])
|
|
70
|
+
def add(id:, contacts:, request_options: nil)
|
|
71
|
+
response = @request_client.conn.patch do |req|
|
|
72
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
73
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
74
|
+
req.headers = {
|
|
75
|
+
**(req.headers || {}),
|
|
76
|
+
**@request_client.get_headers,
|
|
77
|
+
**(request_options&.additional_headers || {})
|
|
78
|
+
}.compact
|
|
79
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
80
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
81
|
+
end
|
|
82
|
+
req.body = { **(request_options&.additional_body_parameters || {}), id: id, contacts: contacts }.compact
|
|
83
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/audiences/contacts"
|
|
84
|
+
end
|
|
85
|
+
Pinnacle::Types::AudienceCountOnly.from_json(json_object: response.body)
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
class AsyncContactsClient
|
|
90
|
+
# @return [Pinnacle::AsyncRequestClient]
|
|
91
|
+
attr_reader :request_client
|
|
92
|
+
|
|
93
|
+
# @param request_client [Pinnacle::AsyncRequestClient]
|
|
94
|
+
# @return [Pinnacle::Audiences::AsyncContactsClient]
|
|
95
|
+
def initialize(request_client:)
|
|
96
|
+
@request_client = request_client
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Remove contacts from an existing audience. This operation is idempotent.
|
|
100
|
+
# - Only removes contacts that exist in the audience
|
|
101
|
+
# - Contacts not in the audience are ignored
|
|
102
|
+
#
|
|
103
|
+
# @param id [String] Audience ID. This identifier is a string that always begins with the prefix
|
|
104
|
+
# `aud_`, for example: `aud_abc123`.
|
|
105
|
+
# @param contacts [Array<String>] Array of phone numbers (E.164 format) or contact IDs (minimum 1 item).
|
|
106
|
+
# @param request_options [Pinnacle::RequestOptions]
|
|
107
|
+
# @return [Pinnacle::Types::AudienceCountOnly]
|
|
108
|
+
# @example
|
|
109
|
+
# api = Pinnacle::Client.new(
|
|
110
|
+
# base_url: "https://api.example.com",
|
|
111
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
|
112
|
+
# api_key: "YOUR_API_KEY"
|
|
113
|
+
# )
|
|
114
|
+
# api.audiences.contacts.remove(id: "aud_abc123", contacts: ["+12125551234", "co_def456"])
|
|
115
|
+
def remove(id:, contacts:, request_options: nil)
|
|
116
|
+
Async do
|
|
117
|
+
response = @request_client.conn.delete do |req|
|
|
118
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
119
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
120
|
+
req.headers = {
|
|
121
|
+
**(req.headers || {}),
|
|
122
|
+
**@request_client.get_headers,
|
|
123
|
+
**(request_options&.additional_headers || {})
|
|
124
|
+
}.compact
|
|
125
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
126
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
127
|
+
end
|
|
128
|
+
req.body = { **(request_options&.additional_body_parameters || {}), id: id, contacts: contacts }.compact
|
|
129
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/audiences/contacts"
|
|
130
|
+
end
|
|
131
|
+
Pinnacle::Types::AudienceCountOnly.from_json(json_object: response.body)
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Add contacts to an existing audience. This operation is additive and idempotent.
|
|
136
|
+
# - Phone numbers that don't exist will be auto-created as contacts
|
|
137
|
+
# - Duplicate adds are ignored
|
|
138
|
+
# - Contacts already in the audience are ignored
|
|
139
|
+
#
|
|
140
|
+
# @param id [String] Audience ID. This identifier is a string that always begins with the prefix
|
|
141
|
+
# `aud_`, for example: `aud_abc123`.
|
|
142
|
+
# @param contacts [Array<String>] Array of phone numbers (E.164 format) or contact IDs (minimum 1 item).
|
|
143
|
+
# @param request_options [Pinnacle::RequestOptions]
|
|
144
|
+
# @return [Pinnacle::Types::AudienceCountOnly]
|
|
145
|
+
# @example
|
|
146
|
+
# api = Pinnacle::Client.new(
|
|
147
|
+
# base_url: "https://api.example.com",
|
|
148
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
|
149
|
+
# api_key: "YOUR_API_KEY"
|
|
150
|
+
# )
|
|
151
|
+
# api.audiences.contacts.add(id: "aud_abc123", contacts: ["+12125551234", "co_def456", "+13105551234"])
|
|
152
|
+
def add(id:, contacts:, request_options: nil)
|
|
153
|
+
Async do
|
|
154
|
+
response = @request_client.conn.patch do |req|
|
|
155
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
156
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
157
|
+
req.headers = {
|
|
158
|
+
**(req.headers || {}),
|
|
159
|
+
**@request_client.get_headers,
|
|
160
|
+
**(request_options&.additional_headers || {})
|
|
161
|
+
}.compact
|
|
162
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
163
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
164
|
+
end
|
|
165
|
+
req.body = { **(request_options&.additional_body_parameters || {}), id: id, contacts: contacts }.compact
|
|
166
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/audiences/contacts"
|
|
167
|
+
end
|
|
168
|
+
Pinnacle::Types::AudienceCountOnly.from_json(json_object: response.body)
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "json"
|
|
4
|
+
require_relative "../../types/audience_with_pagination"
|
|
5
|
+
require_relative "../../types/audience_count_only"
|
|
6
|
+
|
|
7
|
+
module Pinnacle
|
|
8
|
+
module Audiences
|
|
9
|
+
module Types
|
|
10
|
+
class AudiencesGetResponse
|
|
11
|
+
# Deserialize a JSON object to an instance of AudiencesGetResponse
|
|
12
|
+
#
|
|
13
|
+
# @param json_object [String]
|
|
14
|
+
# @return [Pinnacle::Audiences::Types::AudiencesGetResponse]
|
|
15
|
+
def self.from_json(json_object:)
|
|
16
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
17
|
+
begin
|
|
18
|
+
Pinnacle::Types::AudienceWithPagination.validate_raw(obj: struct)
|
|
19
|
+
return Pinnacle::Types::AudienceWithPagination.from_json(json_object: struct) unless struct.nil?
|
|
20
|
+
|
|
21
|
+
return nil
|
|
22
|
+
rescue StandardError
|
|
23
|
+
# noop
|
|
24
|
+
end
|
|
25
|
+
begin
|
|
26
|
+
Pinnacle::Types::AudienceCountOnly.validate_raw(obj: struct)
|
|
27
|
+
return Pinnacle::Types::AudienceCountOnly.from_json(json_object: struct) unless struct.nil?
|
|
28
|
+
|
|
29
|
+
return nil
|
|
30
|
+
rescue StandardError
|
|
31
|
+
# noop
|
|
32
|
+
end
|
|
33
|
+
struct
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
37
|
+
# hash and check each fields type against the current object's property
|
|
38
|
+
# definitions.
|
|
39
|
+
#
|
|
40
|
+
# @param obj [Object]
|
|
41
|
+
# @return [Void]
|
|
42
|
+
def self.validate_raw(obj:)
|
|
43
|
+
begin
|
|
44
|
+
return Pinnacle::Types::AudienceWithPagination.validate_raw(obj: obj)
|
|
45
|
+
rescue StandardError
|
|
46
|
+
# noop
|
|
47
|
+
end
|
|
48
|
+
begin
|
|
49
|
+
return Pinnacle::Types::AudienceCountOnly.validate_raw(obj: obj)
|
|
50
|
+
rescue StandardError
|
|
51
|
+
# noop
|
|
52
|
+
end
|
|
53
|
+
raise("Passed value matched no type within the union, validation failed.")
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "ostruct"
|
|
4
|
+
require "json"
|
|
5
|
+
|
|
6
|
+
module Pinnacle
|
|
7
|
+
module Types
|
|
8
|
+
class AudienceCountOnly
|
|
9
|
+
# @return [String] Audience public ID. This identifier is a string that always begins with the
|
|
10
|
+
# prefix `aud_`, for example: `aud_abc123`.
|
|
11
|
+
attr_reader :id
|
|
12
|
+
# @return [String] Audience name.
|
|
13
|
+
attr_reader :name
|
|
14
|
+
# @return [String] Audience description.
|
|
15
|
+
attr_reader :description
|
|
16
|
+
# @return [Integer] Total number of contacts in audience.
|
|
17
|
+
# Use the [Get Audience](/api-reference/audiences/get) endpoint with the
|
|
18
|
+
# pagination parameters to get the audience with its contacts.
|
|
19
|
+
attr_reader :contact_count
|
|
20
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
21
|
+
attr_reader :additional_properties
|
|
22
|
+
# @return [Object]
|
|
23
|
+
attr_reader :_field_set
|
|
24
|
+
protected :_field_set
|
|
25
|
+
|
|
26
|
+
OMIT = Object.new
|
|
27
|
+
|
|
28
|
+
# @param id [String] Audience public ID. This identifier is a string that always begins with the
|
|
29
|
+
# prefix `aud_`, for example: `aud_abc123`.
|
|
30
|
+
# @param name [String] Audience name.
|
|
31
|
+
# @param description [String] Audience description.
|
|
32
|
+
# @param contact_count [Integer] Total number of contacts in audience.
|
|
33
|
+
# Use the [Get Audience](/api-reference/audiences/get) endpoint with the
|
|
34
|
+
# pagination parameters to get the audience with its contacts.
|
|
35
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
36
|
+
# @return [Pinnacle::Types::AudienceCountOnly]
|
|
37
|
+
def initialize(id:, name:, description:, contact_count:, additional_properties: nil)
|
|
38
|
+
@id = id
|
|
39
|
+
@name = name
|
|
40
|
+
@description = description
|
|
41
|
+
@contact_count = contact_count
|
|
42
|
+
@additional_properties = additional_properties
|
|
43
|
+
@_field_set = { "id": id, "name": name, "description": description, "contactCount": contact_count }
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Deserialize a JSON object to an instance of AudienceCountOnly
|
|
47
|
+
#
|
|
48
|
+
# @param json_object [String]
|
|
49
|
+
# @return [Pinnacle::Types::AudienceCountOnly]
|
|
50
|
+
def self.from_json(json_object:)
|
|
51
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
52
|
+
parsed_json = JSON.parse(json_object)
|
|
53
|
+
id = parsed_json["id"]
|
|
54
|
+
name = parsed_json["name"]
|
|
55
|
+
description = parsed_json["description"]
|
|
56
|
+
contact_count = parsed_json["contactCount"]
|
|
57
|
+
new(
|
|
58
|
+
id: id,
|
|
59
|
+
name: name,
|
|
60
|
+
description: description,
|
|
61
|
+
contact_count: contact_count,
|
|
62
|
+
additional_properties: struct
|
|
63
|
+
)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Serialize an instance of AudienceCountOnly to a JSON object
|
|
67
|
+
#
|
|
68
|
+
# @return [String]
|
|
69
|
+
def to_json(*_args)
|
|
70
|
+
@_field_set&.to_json
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
74
|
+
# hash and check each fields type against the current object's property
|
|
75
|
+
# definitions.
|
|
76
|
+
#
|
|
77
|
+
# @param obj [Object]
|
|
78
|
+
# @return [Void]
|
|
79
|
+
def self.validate_raw(obj:)
|
|
80
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
81
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
82
|
+
obj.description.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|
|
83
|
+
obj.contact_count.is_a?(Integer) != false || raise("Passed value for field obj.contact_count is not the expected type, validation failed.")
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "contact"
|
|
4
|
+
require_relative "pagination"
|
|
5
|
+
require "ostruct"
|
|
6
|
+
require "json"
|
|
7
|
+
|
|
8
|
+
module Pinnacle
|
|
9
|
+
module Types
|
|
10
|
+
class AudienceWithPagination
|
|
11
|
+
# @return [String] Audience public ID. This identifier is a string that always begins with the
|
|
12
|
+
# prefix `aud_`, for example: `aud_abc123`.
|
|
13
|
+
attr_reader :id
|
|
14
|
+
# @return [String] Audience name.
|
|
15
|
+
attr_reader :name
|
|
16
|
+
# @return [String] Audience description.
|
|
17
|
+
attr_reader :description
|
|
18
|
+
# @return [Array<Pinnacle::Types::Contact>] Array of contact objects (paginated).
|
|
19
|
+
attr_reader :contacts
|
|
20
|
+
# @return [Integer] Total number of contacts in audience.
|
|
21
|
+
attr_reader :contact_count
|
|
22
|
+
# @return [Pinnacle::Types::Pagination]
|
|
23
|
+
attr_reader :pagination
|
|
24
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
25
|
+
attr_reader :additional_properties
|
|
26
|
+
# @return [Object]
|
|
27
|
+
attr_reader :_field_set
|
|
28
|
+
protected :_field_set
|
|
29
|
+
|
|
30
|
+
OMIT = Object.new
|
|
31
|
+
|
|
32
|
+
# @param id [String] Audience public ID. This identifier is a string that always begins with the
|
|
33
|
+
# prefix `aud_`, for example: `aud_abc123`.
|
|
34
|
+
# @param name [String] Audience name.
|
|
35
|
+
# @param description [String] Audience description.
|
|
36
|
+
# @param contacts [Array<Pinnacle::Types::Contact>] Array of contact objects (paginated).
|
|
37
|
+
# @param contact_count [Integer] Total number of contacts in audience.
|
|
38
|
+
# @param pagination [Pinnacle::Types::Pagination]
|
|
39
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
40
|
+
# @return [Pinnacle::Types::AudienceWithPagination]
|
|
41
|
+
def initialize(id:, name:, description:, contacts:, contact_count:, pagination:, additional_properties: nil)
|
|
42
|
+
@id = id
|
|
43
|
+
@name = name
|
|
44
|
+
@description = description
|
|
45
|
+
@contacts = contacts
|
|
46
|
+
@contact_count = contact_count
|
|
47
|
+
@pagination = pagination
|
|
48
|
+
@additional_properties = additional_properties
|
|
49
|
+
@_field_set = {
|
|
50
|
+
"id": id,
|
|
51
|
+
"name": name,
|
|
52
|
+
"description": description,
|
|
53
|
+
"contacts": contacts,
|
|
54
|
+
"contactCount": contact_count,
|
|
55
|
+
"pagination": pagination
|
|
56
|
+
}
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Deserialize a JSON object to an instance of AudienceWithPagination
|
|
60
|
+
#
|
|
61
|
+
# @param json_object [String]
|
|
62
|
+
# @return [Pinnacle::Types::AudienceWithPagination]
|
|
63
|
+
def self.from_json(json_object:)
|
|
64
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
65
|
+
parsed_json = JSON.parse(json_object)
|
|
66
|
+
id = parsed_json["id"]
|
|
67
|
+
name = parsed_json["name"]
|
|
68
|
+
description = parsed_json["description"]
|
|
69
|
+
contacts = parsed_json["contacts"]&.map do |item|
|
|
70
|
+
item = item.to_json
|
|
71
|
+
Pinnacle::Types::Contact.from_json(json_object: item)
|
|
72
|
+
end
|
|
73
|
+
contact_count = parsed_json["contactCount"]
|
|
74
|
+
if parsed_json["pagination"].nil?
|
|
75
|
+
pagination = nil
|
|
76
|
+
else
|
|
77
|
+
pagination = parsed_json["pagination"].to_json
|
|
78
|
+
pagination = Pinnacle::Types::Pagination.from_json(json_object: pagination)
|
|
79
|
+
end
|
|
80
|
+
new(
|
|
81
|
+
id: id,
|
|
82
|
+
name: name,
|
|
83
|
+
description: description,
|
|
84
|
+
contacts: contacts,
|
|
85
|
+
contact_count: contact_count,
|
|
86
|
+
pagination: pagination,
|
|
87
|
+
additional_properties: struct
|
|
88
|
+
)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Serialize an instance of AudienceWithPagination to a JSON object
|
|
92
|
+
#
|
|
93
|
+
# @return [String]
|
|
94
|
+
def to_json(*_args)
|
|
95
|
+
@_field_set&.to_json
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
99
|
+
# hash and check each fields type against the current object's property
|
|
100
|
+
# definitions.
|
|
101
|
+
#
|
|
102
|
+
# @param obj [Object]
|
|
103
|
+
# @return [Void]
|
|
104
|
+
def self.validate_raw(obj:)
|
|
105
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
106
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
107
|
+
obj.description.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|
|
108
|
+
obj.contacts.is_a?(Array) != false || raise("Passed value for field obj.contacts is not the expected type, validation failed.")
|
|
109
|
+
obj.contact_count.is_a?(Integer) != false || raise("Passed value for field obj.contact_count is not the expected type, validation failed.")
|
|
110
|
+
Pinnacle::Types::Pagination.validate_raw(obj: obj.pagination)
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "ostruct"
|
|
4
|
+
require "json"
|
|
5
|
+
|
|
6
|
+
module Pinnacle
|
|
7
|
+
module Types
|
|
8
|
+
class DeleteAudienceResponse
|
|
9
|
+
# @return [Boolean] Indicates successful deletion.
|
|
10
|
+
attr_reader :success
|
|
11
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
12
|
+
attr_reader :additional_properties
|
|
13
|
+
# @return [Object]
|
|
14
|
+
attr_reader :_field_set
|
|
15
|
+
protected :_field_set
|
|
16
|
+
|
|
17
|
+
OMIT = Object.new
|
|
18
|
+
|
|
19
|
+
# @param success [Boolean] Indicates successful deletion.
|
|
20
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
21
|
+
# @return [Pinnacle::Types::DeleteAudienceResponse]
|
|
22
|
+
def initialize(success:, additional_properties: nil)
|
|
23
|
+
@success = success
|
|
24
|
+
@additional_properties = additional_properties
|
|
25
|
+
@_field_set = { "success": success }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Deserialize a JSON object to an instance of DeleteAudienceResponse
|
|
29
|
+
#
|
|
30
|
+
# @param json_object [String]
|
|
31
|
+
# @return [Pinnacle::Types::DeleteAudienceResponse]
|
|
32
|
+
def self.from_json(json_object:)
|
|
33
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
34
|
+
parsed_json = JSON.parse(json_object)
|
|
35
|
+
success = parsed_json["success"]
|
|
36
|
+
new(success: success, additional_properties: struct)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Serialize an instance of DeleteAudienceResponse to a JSON object
|
|
40
|
+
#
|
|
41
|
+
# @return [String]
|
|
42
|
+
def to_json(*_args)
|
|
43
|
+
@_field_set&.to_json
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
47
|
+
# hash and check each fields type against the current object's property
|
|
48
|
+
# definitions.
|
|
49
|
+
#
|
|
50
|
+
# @param obj [Object]
|
|
51
|
+
# @return [Void]
|
|
52
|
+
def self.validate_raw(obj:)
|
|
53
|
+
obj.success.is_a?(Boolean) != false || raise("Passed value for field obj.success is not the expected type, validation failed.")
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "ostruct"
|
|
4
|
+
require "json"
|
|
5
|
+
|
|
6
|
+
module Pinnacle
|
|
7
|
+
module Types
|
|
8
|
+
class Pagination
|
|
9
|
+
# @return [Integer] Current page number (1-indexed).
|
|
10
|
+
attr_reader :page
|
|
11
|
+
# @return [Integer] Items per page (max 100, default 50).
|
|
12
|
+
attr_reader :limit
|
|
13
|
+
# @return [Integer] Total number of contacts in the audience.
|
|
14
|
+
attr_reader :total
|
|
15
|
+
# @return [Boolean] Whether more pages exist.
|
|
16
|
+
attr_reader :has_more
|
|
17
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
18
|
+
attr_reader :additional_properties
|
|
19
|
+
# @return [Object]
|
|
20
|
+
attr_reader :_field_set
|
|
21
|
+
protected :_field_set
|
|
22
|
+
|
|
23
|
+
OMIT = Object.new
|
|
24
|
+
|
|
25
|
+
# @param page [Integer] Current page number (1-indexed).
|
|
26
|
+
# @param limit [Integer] Items per page (max 100, default 50).
|
|
27
|
+
# @param total [Integer] Total number of contacts in the audience.
|
|
28
|
+
# @param has_more [Boolean] Whether more pages exist.
|
|
29
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
30
|
+
# @return [Pinnacle::Types::Pagination]
|
|
31
|
+
def initialize(page:, limit:, total:, has_more:, additional_properties: nil)
|
|
32
|
+
@page = page
|
|
33
|
+
@limit = limit
|
|
34
|
+
@total = total
|
|
35
|
+
@has_more = has_more
|
|
36
|
+
@additional_properties = additional_properties
|
|
37
|
+
@_field_set = { "page": page, "limit": limit, "total": total, "hasMore": has_more }
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Deserialize a JSON object to an instance of Pagination
|
|
41
|
+
#
|
|
42
|
+
# @param json_object [String]
|
|
43
|
+
# @return [Pinnacle::Types::Pagination]
|
|
44
|
+
def self.from_json(json_object:)
|
|
45
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
46
|
+
parsed_json = JSON.parse(json_object)
|
|
47
|
+
page = parsed_json["page"]
|
|
48
|
+
limit = parsed_json["limit"]
|
|
49
|
+
total = parsed_json["total"]
|
|
50
|
+
has_more = parsed_json["hasMore"]
|
|
51
|
+
new(
|
|
52
|
+
page: page,
|
|
53
|
+
limit: limit,
|
|
54
|
+
total: total,
|
|
55
|
+
has_more: has_more,
|
|
56
|
+
additional_properties: struct
|
|
57
|
+
)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Serialize an instance of Pagination to a JSON object
|
|
61
|
+
#
|
|
62
|
+
# @return [String]
|
|
63
|
+
def to_json(*_args)
|
|
64
|
+
@_field_set&.to_json
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
68
|
+
# hash and check each fields type against the current object's property
|
|
69
|
+
# definitions.
|
|
70
|
+
#
|
|
71
|
+
# @param obj [Object]
|
|
72
|
+
# @return [Void]
|
|
73
|
+
def self.validate_raw(obj:)
|
|
74
|
+
obj.page.is_a?(Integer) != false || raise("Passed value for field obj.page is not the expected type, validation failed.")
|
|
75
|
+
obj.limit.is_a?(Integer) != false || raise("Passed value for field obj.limit is not the expected type, validation failed.")
|
|
76
|
+
obj.total.is_a?(Integer) != false || raise("Passed value for field obj.total is not the expected type, validation failed.")
|
|
77
|
+
obj.has_more.is_a?(Boolean) != false || raise("Passed value for field obj.has_more is not the expected type, validation failed.")
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
@@ -6,8 +6,15 @@ require "json"
|
|
|
6
6
|
module Pinnacle
|
|
7
7
|
module Types
|
|
8
8
|
class SentMmsDetails
|
|
9
|
-
# @return [Array<String>] Array of unique identifiers for
|
|
10
|
-
#
|
|
9
|
+
# @return [Array<String>] Array of unique message identifiers for an individual MMS send. Each identifier
|
|
10
|
+
# is a string that always begins with the prefix `msg_`, for example:
|
|
11
|
+
# `msg_1234567890`. <br><br>
|
|
12
|
+
# When media assets are too large to fit in a single MMS and
|
|
13
|
+
# `options.multiple_messages` is set to true, the content is automatically split
|
|
14
|
+
# across multiple messages. Each split message gets its own ID, and all IDs are
|
|
15
|
+
# returned in this array. <br><br>
|
|
16
|
+
# Note: When sending to audiences, you'll receive multiple response objects (one
|
|
17
|
+
# per recipient), each containing its own messageIds array.
|
|
11
18
|
attr_reader :message_ids
|
|
12
19
|
# @return [Float] Total number of segments used across the message.
|
|
13
20
|
attr_reader :segments
|
|
@@ -27,8 +34,15 @@ module Pinnacle
|
|
|
27
34
|
|
|
28
35
|
OMIT = Object.new
|
|
29
36
|
|
|
30
|
-
# @param message_ids [Array<String>] Array of unique identifiers for
|
|
31
|
-
#
|
|
37
|
+
# @param message_ids [Array<String>] Array of unique message identifiers for an individual MMS send. Each identifier
|
|
38
|
+
# is a string that always begins with the prefix `msg_`, for example:
|
|
39
|
+
# `msg_1234567890`. <br><br>
|
|
40
|
+
# When media assets are too large to fit in a single MMS and
|
|
41
|
+
# `options.multiple_messages` is set to true, the content is automatically split
|
|
42
|
+
# across multiple messages. Each split message gets its own ID, and all IDs are
|
|
43
|
+
# returned in this array. <br><br>
|
|
44
|
+
# Note: When sending to audiences, you'll receive multiple response objects (one
|
|
45
|
+
# per recipient), each containing its own messageIds array.
|
|
32
46
|
# @param segments [Float] Total number of segments used across the message.
|
|
33
47
|
# @param total_cost [Float] Total cost of sending the message.
|
|
34
48
|
# @param sender [String] Sender's phone number in E.164 format.
|
data/lib/rcs.rb
CHANGED
|
@@ -4,6 +4,7 @@ require_relative "environment"
|
|
|
4
4
|
require_relative "types_export"
|
|
5
5
|
require_relative "requests"
|
|
6
6
|
require_relative "rcs/brands/client"
|
|
7
|
+
require_relative "rcs/audiences/client"
|
|
7
8
|
require_relative "rcs/contacts/client"
|
|
8
9
|
require_relative "rcs/conversations/client"
|
|
9
10
|
require_relative "rcs/messages/client"
|
|
@@ -18,6 +19,8 @@ module Pinnacle
|
|
|
18
19
|
class Client
|
|
19
20
|
# @return [Pinnacle::BrandsClient]
|
|
20
21
|
attr_reader :brands
|
|
22
|
+
# @return [Pinnacle::AudiencesClient]
|
|
23
|
+
attr_reader :audiences
|
|
21
24
|
# @return [Pinnacle::ContactsClient]
|
|
22
25
|
attr_reader :contacts
|
|
23
26
|
# @return [Pinnacle::ConversationsClient]
|
|
@@ -53,6 +56,7 @@ module Pinnacle
|
|
|
53
56
|
api_key: api_key
|
|
54
57
|
)
|
|
55
58
|
@brands = Pinnacle::BrandsClient.new(request_client: @request_client)
|
|
59
|
+
@audiences = Pinnacle::AudiencesClient.new(request_client: @request_client)
|
|
56
60
|
@contacts = Pinnacle::ContactsClient.new(request_client: @request_client)
|
|
57
61
|
@conversations = Pinnacle::ConversationsClient.new(request_client: @request_client)
|
|
58
62
|
@messages = Pinnacle::MessagesClient.new(request_client: @request_client)
|
|
@@ -68,6 +72,8 @@ module Pinnacle
|
|
|
68
72
|
class AsyncClient
|
|
69
73
|
# @return [Pinnacle::AsyncBrandsClient]
|
|
70
74
|
attr_reader :brands
|
|
75
|
+
# @return [Pinnacle::AsyncAudiencesClient]
|
|
76
|
+
attr_reader :audiences
|
|
71
77
|
# @return [Pinnacle::AsyncContactsClient]
|
|
72
78
|
attr_reader :contacts
|
|
73
79
|
# @return [Pinnacle::AsyncConversationsClient]
|
|
@@ -103,6 +109,7 @@ module Pinnacle
|
|
|
103
109
|
api_key: api_key
|
|
104
110
|
)
|
|
105
111
|
@brands = Pinnacle::AsyncBrandsClient.new(request_client: @async_request_client)
|
|
112
|
+
@audiences = Pinnacle::AsyncAudiencesClient.new(request_client: @async_request_client)
|
|
106
113
|
@contacts = Pinnacle::AsyncContactsClient.new(request_client: @async_request_client)
|
|
107
114
|
@conversations = Pinnacle::AsyncConversationsClient.new(request_client: @async_request_client)
|
|
108
115
|
@messages = Pinnacle::AsyncMessagesClient.new(request_client: @async_request_client)
|
data/lib/requests.rb
CHANGED
|
@@ -43,7 +43,7 @@ module Pinnacle
|
|
|
43
43
|
|
|
44
44
|
# @return [Hash{String => String}]
|
|
45
45
|
def get_headers
|
|
46
|
-
headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "rcs", "X-Fern-SDK-Version": "2.0.
|
|
46
|
+
headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "rcs", "X-Fern-SDK-Version": "2.0.2" }
|
|
47
47
|
headers["PINNACLE-API-KEY"] = ((@api_key.is_a? Method) ? @api_key.call : @api_key) unless @api_key.nil?
|
|
48
48
|
headers
|
|
49
49
|
end
|
|
@@ -87,7 +87,7 @@ module Pinnacle
|
|
|
87
87
|
|
|
88
88
|
# @return [Hash{String => String}]
|
|
89
89
|
def get_headers
|
|
90
|
-
headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "rcs", "X-Fern-SDK-Version": "2.0.
|
|
90
|
+
headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "rcs", "X-Fern-SDK-Version": "2.0.2" }
|
|
91
91
|
headers["PINNACLE-API-KEY"] = ((@api_key.is_a? Method) ? @api_key.call : @api_key) unless @api_key.nil?
|
|
92
92
|
headers
|
|
93
93
|
end
|
data/lib/types_export.rb
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
require_relative "rcs/brands/types/autofill_brand_options"
|
|
4
4
|
require_relative "rcs/brands/types/brand_contact"
|
|
5
|
+
require_relative "rcs/types/audience_with_pagination"
|
|
6
|
+
require_relative "rcs/types/audience_count_only"
|
|
7
|
+
require_relative "rcs/audiences/types/audiences_get_response"
|
|
5
8
|
require_relative "rcs/conversations/types/conversations_list_messages_request_sort_order"
|
|
6
9
|
require_relative "rcs/conversations/types/conversations_list_messages_request_direction"
|
|
7
10
|
require_relative "rcs/conversations/types/conversations_list_messages_request_status"
|
|
@@ -119,6 +122,8 @@ require_relative "rcs/types/rcs_campaign_schema_extra_opt_out"
|
|
|
119
122
|
require_relative "rcs/types/rcs_campaign_schema_extra_use_case"
|
|
120
123
|
require_relative "rcs/types/extended_rcs_campaign"
|
|
121
124
|
require_relative "rcs/types/contact"
|
|
125
|
+
require_relative "rcs/types/pagination"
|
|
126
|
+
require_relative "rcs/types/delete_audience_response"
|
|
122
127
|
require_relative "rcs/types/optional_contact"
|
|
123
128
|
require_relative "rcs/types/updated_contact_id"
|
|
124
129
|
require_relative "rcs/types/contact_id"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rcs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ''
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-11-
|
|
11
|
+
date: 2025-11-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: async-http-faraday
|
|
@@ -99,6 +99,9 @@ files:
|
|
|
99
99
|
- lib/environment.rb
|
|
100
100
|
- lib/gemconfig.rb
|
|
101
101
|
- lib/rcs.rb
|
|
102
|
+
- lib/rcs/audiences/client.rb
|
|
103
|
+
- lib/rcs/audiences/contacts/client.rb
|
|
104
|
+
- lib/rcs/audiences/types/audiences_get_response.rb
|
|
102
105
|
- lib/rcs/brands/client.rb
|
|
103
106
|
- lib/rcs/brands/types/autofill_brand_options.rb
|
|
104
107
|
- lib/rcs/brands/types/brand_contact.rb
|
|
@@ -175,6 +178,8 @@ files:
|
|
|
175
178
|
- lib/rcs/types/attach_webhook_params.rb
|
|
176
179
|
- lib/rcs/types/attach_webhook_response_webhook.rb
|
|
177
180
|
- lib/rcs/types/attached_phone_number_result.rb
|
|
181
|
+
- lib/rcs/types/audience_count_only.rb
|
|
182
|
+
- lib/rcs/types/audience_with_pagination.rb
|
|
178
183
|
- lib/rcs/types/autofill_campaign_params.rb
|
|
179
184
|
- lib/rcs/types/autofill_dlc_campaign_response.rb
|
|
180
185
|
- lib/rcs/types/autofill_dlc_response_keywords.rb
|
|
@@ -215,6 +220,7 @@ files:
|
|
|
215
220
|
- lib/rcs/types/conversation_sender.rb
|
|
216
221
|
- lib/rcs/types/create_and_attach_webhook_by_url_params.rb
|
|
217
222
|
- lib/rcs/types/create_url_options.rb
|
|
223
|
+
- lib/rcs/types/delete_audience_response.rb
|
|
218
224
|
- lib/rcs/types/detached_phone_number_result.rb
|
|
219
225
|
- lib/rcs/types/detached_webhook_info.rb
|
|
220
226
|
- lib/rcs/types/detailed_phone_number_enum.rb
|
|
@@ -275,6 +281,7 @@ files:
|
|
|
275
281
|
- lib/rcs/types/optional_contact.rb
|
|
276
282
|
- lib/rcs/types/optional_contacts.rb
|
|
277
283
|
- lib/rcs/types/options.rb
|
|
284
|
+
- lib/rcs/types/pagination.rb
|
|
278
285
|
- lib/rcs/types/phone.rb
|
|
279
286
|
- lib/rcs/types/phone_capabilities.rb
|
|
280
287
|
- lib/rcs/types/phone_enum.rb
|