rcs-js 2.0.3 → 2.0.5-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.
- package/README.md +36 -1
- package/dist/cjs/Client.d.ts +3 -0
- package/dist/cjs/Client.js +25 -20
- package/dist/cjs/api/resources/audiences/client/Client.d.ts +129 -0
- package/dist/cjs/api/resources/audiences/client/Client.js +385 -0
- package/dist/cjs/api/resources/audiences/client/index.d.ts +2 -0
- package/dist/cjs/api/resources/audiences/client/index.js +17 -0
- package/dist/cjs/api/resources/audiences/client/requests/AudiencesDeleteRequest.d.ts +13 -0
- package/dist/cjs/api/resources/audiences/client/requests/AudiencesDeleteRequest.js +5 -0
- package/dist/cjs/api/resources/audiences/client/requests/AudiencesGetRequest.d.ts +22 -0
- package/dist/cjs/api/resources/audiences/client/requests/AudiencesGetRequest.js +5 -0
- package/dist/cjs/api/resources/audiences/client/requests/CreateAudienceParams.d.ts +31 -0
- package/dist/cjs/api/resources/audiences/client/requests/CreateAudienceParams.js +5 -0
- package/dist/cjs/api/resources/audiences/client/requests/UpdateAudienceParams.d.ts +19 -0
- package/dist/cjs/api/resources/audiences/client/requests/UpdateAudienceParams.js +5 -0
- package/dist/cjs/api/resources/audiences/client/requests/index.d.ts +4 -0
- package/dist/cjs/api/resources/audiences/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/audiences/index.d.ts +3 -0
- package/dist/cjs/api/resources/audiences/index.js +19 -0
- package/dist/cjs/api/resources/audiences/resources/contacts/client/Client.d.ts +80 -0
- package/dist/cjs/api/resources/audiences/resources/contacts/client/Client.js +220 -0
- package/dist/cjs/api/resources/audiences/resources/contacts/client/index.d.ts +2 -0
- package/dist/cjs/api/resources/audiences/resources/contacts/client/index.js +17 -0
- package/dist/cjs/api/resources/audiences/resources/contacts/client/requests/AddContactsParams.d.ts +16 -0
- package/dist/cjs/api/resources/audiences/resources/contacts/client/requests/AddContactsParams.js +5 -0
- package/dist/cjs/api/resources/audiences/resources/contacts/client/requests/RemoveContactsParams.d.ts +16 -0
- package/dist/cjs/api/resources/audiences/resources/contacts/client/requests/RemoveContactsParams.js +5 -0
- package/dist/cjs/api/resources/audiences/resources/contacts/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/audiences/resources/contacts/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/audiences/resources/contacts/index.d.ts +1 -0
- package/dist/cjs/api/resources/audiences/resources/contacts/index.js +17 -0
- package/dist/cjs/api/resources/audiences/resources/index.d.ts +2 -0
- package/dist/cjs/api/resources/audiences/resources/index.js +41 -0
- package/dist/cjs/api/resources/audiences/types/AudiencesGetResponse.d.ts +11 -0
- package/dist/cjs/api/resources/audiences/types/AudiencesGetResponse.js +5 -0
- package/dist/cjs/api/resources/audiences/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/audiences/types/index.js +17 -0
- package/dist/cjs/api/resources/index.d.ts +3 -0
- package/dist/cjs/api/resources/index.js +4 -1
- package/dist/cjs/api/resources/messages/resources/index.d.ts +1 -0
- package/dist/cjs/api/resources/messages/resources/index.js +1 -0
- package/dist/cjs/api/resources/messages/resources/rcs/client/Client.d.ts +33 -0
- package/dist/cjs/api/resources/messages/resources/rcs/client/Client.js +90 -0
- package/dist/cjs/api/resources/messages/resources/rcs/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/messages/resources/rcs/client/index.js +15 -0
- package/dist/cjs/api/resources/messages/resources/rcs/client/requests/SendTypingIndicatorSchema.d.ts +38 -0
- package/dist/cjs/api/resources/messages/resources/rcs/client/requests/SendTypingIndicatorSchema.js +5 -0
- package/dist/cjs/api/resources/messages/resources/rcs/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/messages/resources/rcs/client/requests/index.js +2 -0
- package/dist/cjs/api/types/AudienceCountOnly.d.ts +17 -0
- package/dist/cjs/api/types/AudienceCountOnly.js +5 -0
- package/dist/cjs/api/types/AudienceWithPagination.d.ts +17 -0
- package/dist/cjs/api/types/AudienceWithPagination.js +5 -0
- package/dist/cjs/api/types/DeleteAudienceResponse.d.ts +7 -0
- package/dist/cjs/api/types/DeleteAudienceResponse.js +5 -0
- package/dist/cjs/api/types/Options.d.ts +21 -0
- package/dist/cjs/api/types/Options.js +5 -0
- package/dist/cjs/api/types/Pagination.d.ts +13 -0
- package/dist/cjs/api/types/Pagination.js +5 -0
- package/dist/cjs/api/types/RcsButtonOpenUrl.d.ts +31 -2
- package/dist/cjs/api/types/RcsButtonOpenUrl.js +9 -0
- package/dist/cjs/api/types/RcsButtonSendLocation.d.ts +8 -2
- package/dist/cjs/api/types/RichCardsMessage.d.ts +51 -1
- package/dist/cjs/api/types/RichCardsMessage.js +18 -0
- package/dist/cjs/api/types/SendTypingIndicatorResponse.d.ts +22 -0
- package/dist/cjs/api/types/SendTypingIndicatorResponse.js +5 -0
- package/dist/cjs/api/types/index.d.ts +6 -0
- package/dist/cjs/api/types/index.js +6 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.d.mts +3 -0
- package/dist/esm/Client.mjs +7 -2
- package/dist/esm/api/resources/audiences/client/Client.d.mts +129 -0
- package/dist/esm/api/resources/audiences/client/Client.mjs +348 -0
- package/dist/esm/api/resources/audiences/client/index.d.mts +2 -0
- package/dist/esm/api/resources/audiences/client/index.mjs +1 -0
- package/dist/esm/api/resources/audiences/client/requests/AudiencesDeleteRequest.d.mts +13 -0
- package/dist/esm/api/resources/audiences/client/requests/AudiencesDeleteRequest.mjs +4 -0
- package/dist/esm/api/resources/audiences/client/requests/AudiencesGetRequest.d.mts +22 -0
- package/dist/esm/api/resources/audiences/client/requests/AudiencesGetRequest.mjs +4 -0
- package/dist/esm/api/resources/audiences/client/requests/CreateAudienceParams.d.mts +31 -0
- package/dist/esm/api/resources/audiences/client/requests/CreateAudienceParams.mjs +4 -0
- package/dist/esm/api/resources/audiences/client/requests/UpdateAudienceParams.d.mts +19 -0
- package/dist/esm/api/resources/audiences/client/requests/UpdateAudienceParams.mjs +4 -0
- package/dist/esm/api/resources/audiences/client/requests/index.d.mts +4 -0
- package/dist/esm/api/resources/audiences/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/audiences/index.d.mts +3 -0
- package/dist/esm/api/resources/audiences/index.mjs +3 -0
- package/dist/esm/api/resources/audiences/resources/contacts/client/Client.d.mts +80 -0
- package/dist/esm/api/resources/audiences/resources/contacts/client/Client.mjs +183 -0
- package/dist/esm/api/resources/audiences/resources/contacts/client/index.d.mts +2 -0
- package/dist/esm/api/resources/audiences/resources/contacts/client/index.mjs +1 -0
- package/dist/esm/api/resources/audiences/resources/contacts/client/requests/AddContactsParams.d.mts +16 -0
- package/dist/esm/api/resources/audiences/resources/contacts/client/requests/AddContactsParams.mjs +4 -0
- package/dist/esm/api/resources/audiences/resources/contacts/client/requests/RemoveContactsParams.d.mts +16 -0
- package/dist/esm/api/resources/audiences/resources/contacts/client/requests/RemoveContactsParams.mjs +4 -0
- package/dist/esm/api/resources/audiences/resources/contacts/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/audiences/resources/contacts/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/audiences/resources/contacts/index.d.mts +1 -0
- package/dist/esm/api/resources/audiences/resources/contacts/index.mjs +1 -0
- package/dist/esm/api/resources/audiences/resources/index.d.mts +2 -0
- package/dist/esm/api/resources/audiences/resources/index.mjs +2 -0
- package/dist/esm/api/resources/audiences/types/AudiencesGetResponse.d.mts +11 -0
- package/dist/esm/api/resources/audiences/types/AudiencesGetResponse.mjs +4 -0
- package/dist/esm/api/resources/audiences/types/index.d.mts +1 -0
- package/dist/esm/api/resources/audiences/types/index.mjs +1 -0
- package/dist/esm/api/resources/index.d.mts +3 -0
- package/dist/esm/api/resources/index.mjs +3 -0
- package/dist/esm/api/resources/messages/resources/index.d.mts +1 -0
- package/dist/esm/api/resources/messages/resources/index.mjs +1 -0
- package/dist/esm/api/resources/messages/resources/rcs/client/Client.d.mts +33 -0
- package/dist/esm/api/resources/messages/resources/rcs/client/Client.mjs +90 -0
- package/dist/esm/api/resources/messages/resources/rcs/client/index.d.mts +1 -0
- package/dist/esm/api/resources/messages/resources/rcs/client/index.mjs +1 -1
- package/dist/esm/api/resources/messages/resources/rcs/client/requests/SendTypingIndicatorSchema.d.mts +38 -0
- package/dist/esm/api/resources/messages/resources/rcs/client/requests/SendTypingIndicatorSchema.mjs +4 -0
- package/dist/esm/api/resources/messages/resources/rcs/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/messages/resources/rcs/client/requests/index.mjs +1 -0
- package/dist/esm/api/types/AudienceCountOnly.d.mts +17 -0
- package/dist/esm/api/types/AudienceCountOnly.mjs +4 -0
- package/dist/esm/api/types/AudienceWithPagination.d.mts +17 -0
- package/dist/esm/api/types/AudienceWithPagination.mjs +4 -0
- package/dist/esm/api/types/DeleteAudienceResponse.d.mts +7 -0
- package/dist/esm/api/types/DeleteAudienceResponse.mjs +4 -0
- package/dist/esm/api/types/Options.d.mts +21 -0
- package/dist/esm/api/types/Options.mjs +4 -0
- package/dist/esm/api/types/Pagination.d.mts +13 -0
- package/dist/esm/api/types/Pagination.mjs +4 -0
- package/dist/esm/api/types/RcsButtonOpenUrl.d.mts +31 -2
- package/dist/esm/api/types/RcsButtonOpenUrl.mjs +8 -1
- package/dist/esm/api/types/RcsButtonSendLocation.d.mts +8 -2
- package/dist/esm/api/types/RichCardsMessage.d.mts +51 -1
- package/dist/esm/api/types/RichCardsMessage.mjs +17 -1
- package/dist/esm/api/types/SendTypingIndicatorResponse.d.mts +22 -0
- package/dist/esm/api/types/SendTypingIndicatorResponse.mjs +4 -0
- package/dist/esm/api/types/index.d.mts +6 -0
- package/dist/esm/api/types/index.mjs +6 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
- package/reference.md +487 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
8
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
9
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
10
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
import * as environments from "../../../../../../environments.mjs";
|
|
14
|
+
import * as core from "../../../../../../core/index.mjs";
|
|
15
|
+
import * as Pinnacle from "../../../../../index.mjs";
|
|
16
|
+
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.mjs";
|
|
17
|
+
import * as errors from "../../../../../../errors/index.mjs";
|
|
18
|
+
export class Contacts {
|
|
19
|
+
constructor(_options = {}) {
|
|
20
|
+
this._options = _options;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Remove contacts from an existing audience. This operation is idempotent.
|
|
24
|
+
*
|
|
25
|
+
* - Only removes contacts that exist in the audience
|
|
26
|
+
* - Contacts not in the audience are ignored
|
|
27
|
+
*
|
|
28
|
+
* @param {Pinnacle.audiences.RemoveContactsParams} request
|
|
29
|
+
* @param {Contacts.RequestOptions} requestOptions - Request-specific configuration.
|
|
30
|
+
*
|
|
31
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
32
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
33
|
+
* @throws {@link Pinnacle.NotFoundError}
|
|
34
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* await client.audiences.contacts.remove({
|
|
38
|
+
* id: "aud_abc123",
|
|
39
|
+
* contacts: ["+12125551234", "cont_def456"]
|
|
40
|
+
* })
|
|
41
|
+
*/
|
|
42
|
+
remove(request, requestOptions) {
|
|
43
|
+
return core.HttpResponsePromise.fromPromise(this.__remove(request, requestOptions));
|
|
44
|
+
}
|
|
45
|
+
__remove(request, requestOptions) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
var _a, _b, _c;
|
|
48
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
49
|
+
const _response = yield core.fetcher({
|
|
50
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PinnacleEnvironment.Default, "audiences/contacts"),
|
|
51
|
+
method: "DELETE",
|
|
52
|
+
headers: _headers,
|
|
53
|
+
contentType: "application/json",
|
|
54
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
55
|
+
requestType: "json",
|
|
56
|
+
body: request,
|
|
57
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
58
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
59
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
60
|
+
});
|
|
61
|
+
if (_response.ok) {
|
|
62
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
63
|
+
}
|
|
64
|
+
if (_response.error.reason === "status-code") {
|
|
65
|
+
switch (_response.error.statusCode) {
|
|
66
|
+
case 400:
|
|
67
|
+
throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
|
|
68
|
+
case 401:
|
|
69
|
+
throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
70
|
+
case 404:
|
|
71
|
+
throw new Pinnacle.NotFoundError(_response.error.body, _response.rawResponse);
|
|
72
|
+
case 500:
|
|
73
|
+
throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
|
|
74
|
+
default:
|
|
75
|
+
throw new errors.PinnacleError({
|
|
76
|
+
statusCode: _response.error.statusCode,
|
|
77
|
+
body: _response.error.body,
|
|
78
|
+
rawResponse: _response.rawResponse,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
switch (_response.error.reason) {
|
|
83
|
+
case "non-json":
|
|
84
|
+
throw new errors.PinnacleError({
|
|
85
|
+
statusCode: _response.error.statusCode,
|
|
86
|
+
body: _response.error.rawBody,
|
|
87
|
+
rawResponse: _response.rawResponse,
|
|
88
|
+
});
|
|
89
|
+
case "timeout":
|
|
90
|
+
throw new errors.PinnacleTimeoutError("Timeout exceeded when calling DELETE /audiences/contacts.");
|
|
91
|
+
case "unknown":
|
|
92
|
+
throw new errors.PinnacleError({
|
|
93
|
+
message: _response.error.errorMessage,
|
|
94
|
+
rawResponse: _response.rawResponse,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Add contacts to an existing audience. This operation is additive and idempotent.
|
|
101
|
+
*
|
|
102
|
+
* - Phone numbers that don't exist will be auto-created as contacts
|
|
103
|
+
* - Duplicate adds are ignored
|
|
104
|
+
* - Contacts already in the audience are ignored
|
|
105
|
+
*
|
|
106
|
+
* @param {Pinnacle.audiences.AddContactsParams} request
|
|
107
|
+
* @param {Contacts.RequestOptions} requestOptions - Request-specific configuration.
|
|
108
|
+
*
|
|
109
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
110
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
111
|
+
* @throws {@link Pinnacle.NotFoundError}
|
|
112
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* await client.audiences.contacts.add({
|
|
116
|
+
* id: "aud_abc123",
|
|
117
|
+
* contacts: ["+12125551234", "cont_def456", "+13105551234"]
|
|
118
|
+
* })
|
|
119
|
+
*/
|
|
120
|
+
add(request, requestOptions) {
|
|
121
|
+
return core.HttpResponsePromise.fromPromise(this.__add(request, requestOptions));
|
|
122
|
+
}
|
|
123
|
+
__add(request, requestOptions) {
|
|
124
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
var _a, _b, _c;
|
|
126
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
127
|
+
const _response = yield core.fetcher({
|
|
128
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PinnacleEnvironment.Default, "audiences/contacts"),
|
|
129
|
+
method: "PATCH",
|
|
130
|
+
headers: _headers,
|
|
131
|
+
contentType: "application/json",
|
|
132
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
133
|
+
requestType: "json",
|
|
134
|
+
body: request,
|
|
135
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
136
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
137
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
138
|
+
});
|
|
139
|
+
if (_response.ok) {
|
|
140
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
141
|
+
}
|
|
142
|
+
if (_response.error.reason === "status-code") {
|
|
143
|
+
switch (_response.error.statusCode) {
|
|
144
|
+
case 400:
|
|
145
|
+
throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
|
|
146
|
+
case 401:
|
|
147
|
+
throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
148
|
+
case 404:
|
|
149
|
+
throw new Pinnacle.NotFoundError(_response.error.body, _response.rawResponse);
|
|
150
|
+
case 500:
|
|
151
|
+
throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
|
|
152
|
+
default:
|
|
153
|
+
throw new errors.PinnacleError({
|
|
154
|
+
statusCode: _response.error.statusCode,
|
|
155
|
+
body: _response.error.body,
|
|
156
|
+
rawResponse: _response.rawResponse,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
switch (_response.error.reason) {
|
|
161
|
+
case "non-json":
|
|
162
|
+
throw new errors.PinnacleError({
|
|
163
|
+
statusCode: _response.error.statusCode,
|
|
164
|
+
body: _response.error.rawBody,
|
|
165
|
+
rawResponse: _response.rawResponse,
|
|
166
|
+
});
|
|
167
|
+
case "timeout":
|
|
168
|
+
throw new errors.PinnacleTimeoutError("Timeout exceeded when calling PATCH /audiences/contacts.");
|
|
169
|
+
case "unknown":
|
|
170
|
+
throw new errors.PinnacleError({
|
|
171
|
+
message: _response.error.errorMessage,
|
|
172
|
+
rawResponse: _response.rawResponse,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
_getCustomAuthorizationHeaders() {
|
|
178
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
179
|
+
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
180
|
+
return { "PINNACLE-API-KEY": apiKeyValue };
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
package/dist/esm/api/resources/audiences/resources/contacts/client/requests/AddContactsParams.d.mts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* id: "aud_abc123",
|
|
8
|
+
* contacts: ["+12125551234", "cont_def456", "+13105551234"]
|
|
9
|
+
* }
|
|
10
|
+
*/
|
|
11
|
+
export interface AddContactsParams {
|
|
12
|
+
/** Audience ID. This identifier is a string that always begins with the prefix `aud_`, for example: `aud_abc123`. */
|
|
13
|
+
id: string;
|
|
14
|
+
/** Array of phone numbers (E.164 format) or contact IDs (minimum 1 item). */
|
|
15
|
+
contacts: string[];
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* id: "aud_abc123",
|
|
8
|
+
* contacts: ["+12125551234", "cont_def456"]
|
|
9
|
+
* }
|
|
10
|
+
*/
|
|
11
|
+
export interface RemoveContactsParams {
|
|
12
|
+
/** Audience ID. This identifier is a string that always begins with the prefix `aud_`, for example: `aud_abc123`. */
|
|
13
|
+
id: string;
|
|
14
|
+
/** Array of phone numbers (E.164 format) or contact IDs (minimum 1 item). */
|
|
15
|
+
contacts: string[];
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Pinnacle from "../../../index.mjs";
|
|
5
|
+
export type AudiencesGetResponse =
|
|
6
|
+
/**
|
|
7
|
+
* Returned when page and/or limit parameters are provided. */
|
|
8
|
+
Pinnacle.AudienceWithPagination
|
|
9
|
+
/**
|
|
10
|
+
* Returned when no pagination parameters are provided. */
|
|
11
|
+
| Pinnacle.AudienceCountOnly;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./AudiencesGetResponse.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./AudiencesGetResponse.mjs";
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export * as audiences from "./audiences/index.mjs";
|
|
2
|
+
export * from "./audiences/types/index.mjs";
|
|
1
3
|
export * as conversations from "./conversations/index.mjs";
|
|
2
4
|
export * from "./conversations/types/index.mjs";
|
|
3
5
|
export * as phoneNumbers from "./phoneNumbers/index.mjs";
|
|
@@ -11,6 +13,7 @@ export * as webhooks from "./webhooks/index.mjs";
|
|
|
11
13
|
export * as status from "./status/index.mjs";
|
|
12
14
|
export * as tools from "./tools/index.mjs";
|
|
13
15
|
export * from "./brands/client/requests/index.mjs";
|
|
16
|
+
export * from "./audiences/client/requests/index.mjs";
|
|
14
17
|
export * from "./contacts/client/requests/index.mjs";
|
|
15
18
|
export * from "./conversations/client/requests/index.mjs";
|
|
16
19
|
export * from "./messages/client/requests/index.mjs";
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export * as audiences from "./audiences/index.mjs";
|
|
2
|
+
export * from "./audiences/types/index.mjs";
|
|
1
3
|
export * as conversations from "./conversations/index.mjs";
|
|
2
4
|
export * from "./conversations/types/index.mjs";
|
|
3
5
|
export * as phoneNumbers from "./phoneNumbers/index.mjs";
|
|
@@ -11,6 +13,7 @@ export * as webhooks from "./webhooks/index.mjs";
|
|
|
11
13
|
export * as status from "./status/index.mjs";
|
|
12
14
|
export * as tools from "./tools/index.mjs";
|
|
13
15
|
export * from "./brands/client/requests/index.mjs";
|
|
16
|
+
export * from "./audiences/client/requests/index.mjs";
|
|
14
17
|
export * from "./contacts/client/requests/index.mjs";
|
|
15
18
|
export * from "./conversations/client/requests/index.mjs";
|
|
16
19
|
export * from "./messages/client/requests/index.mjs";
|
|
@@ -58,6 +58,39 @@ export declare class Rcs {
|
|
|
58
58
|
*/
|
|
59
59
|
send(request: Pinnacle.RichMessage, requestOptions?: Rcs.RequestOptions): core.HttpResponsePromise<Pinnacle.messages.RcsSendResponse>;
|
|
60
60
|
private __send;
|
|
61
|
+
/**
|
|
62
|
+
* Send a typing indicator from an RCS agent to a recipient.
|
|
63
|
+
*
|
|
64
|
+
* This endpoint allows RCS agents to display a typing indicator to recipients. The indicator is a message bubble with animated typing dots like this: <img src="https://server.trypinnacle.app/storage/v1/object/public/pinnacle-public-assets/ios-typing-indicator.png" alt="Typing Indicator" style="display: inline; height: 1.5em; vertical-align: middle; margin: 0 4px;" />
|
|
65
|
+
*
|
|
66
|
+
* **Use Case:** Typing indicators are especially useful for providing feedback to users while the agent is thinking or generating a response that may take some time, creating a more engaging conversational experience.
|
|
67
|
+
*
|
|
68
|
+
* **Expiration:** Typing indicators automatically expire after around 20 seconds or when the agent sends a message, whichever comes first.
|
|
69
|
+
*
|
|
70
|
+
* **Frequency:** You can send typing indicators as many times as needed, though only one will be displayed at a time. Sending multiple typing indicators will extend the duration of the current indicator.
|
|
71
|
+
*
|
|
72
|
+
* > **Note:** Typing indicators are best-effort hints, not delivery-guaranteed state. The platform is allowed to coalesce or drop them, and the client UI decides when to show/hide.
|
|
73
|
+
*
|
|
74
|
+
* @param {Pinnacle.messages.SendTypingIndicatorSchema} request
|
|
75
|
+
* @param {Rcs.RequestOptions} requestOptions - Request-specific configuration.
|
|
76
|
+
*
|
|
77
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
78
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
79
|
+
* @throws {@link Pinnacle.NotFoundError}
|
|
80
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
81
|
+
* @throws {@link Pinnacle.NotImplementedError}
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* await client.messages.rcs.sendTyping({
|
|
85
|
+
* agentId: "agent_pinnacle",
|
|
86
|
+
* to: "+14154746461",
|
|
87
|
+
* options: {
|
|
88
|
+
* test_mode: false
|
|
89
|
+
* }
|
|
90
|
+
* })
|
|
91
|
+
*/
|
|
92
|
+
sendTyping(request: Pinnacle.messages.SendTypingIndicatorSchema, requestOptions?: Rcs.RequestOptions): core.HttpResponsePromise<Pinnacle.SendTypingIndicatorResponse>;
|
|
93
|
+
private __sendTyping;
|
|
61
94
|
/**
|
|
62
95
|
* Validate RCS message content without sending it.
|
|
63
96
|
*
|
|
@@ -107,6 +107,96 @@ export class Rcs {
|
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Send a typing indicator from an RCS agent to a recipient.
|
|
112
|
+
*
|
|
113
|
+
* This endpoint allows RCS agents to display a typing indicator to recipients. The indicator is a message bubble with animated typing dots like this: <img src="https://server.trypinnacle.app/storage/v1/object/public/pinnacle-public-assets/ios-typing-indicator.png" alt="Typing Indicator" style="display: inline; height: 1.5em; vertical-align: middle; margin: 0 4px;" />
|
|
114
|
+
*
|
|
115
|
+
* **Use Case:** Typing indicators are especially useful for providing feedback to users while the agent is thinking or generating a response that may take some time, creating a more engaging conversational experience.
|
|
116
|
+
*
|
|
117
|
+
* **Expiration:** Typing indicators automatically expire after around 20 seconds or when the agent sends a message, whichever comes first.
|
|
118
|
+
*
|
|
119
|
+
* **Frequency:** You can send typing indicators as many times as needed, though only one will be displayed at a time. Sending multiple typing indicators will extend the duration of the current indicator.
|
|
120
|
+
*
|
|
121
|
+
* > **Note:** Typing indicators are best-effort hints, not delivery-guaranteed state. The platform is allowed to coalesce or drop them, and the client UI decides when to show/hide.
|
|
122
|
+
*
|
|
123
|
+
* @param {Pinnacle.messages.SendTypingIndicatorSchema} request
|
|
124
|
+
* @param {Rcs.RequestOptions} requestOptions - Request-specific configuration.
|
|
125
|
+
*
|
|
126
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
127
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
128
|
+
* @throws {@link Pinnacle.NotFoundError}
|
|
129
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
130
|
+
* @throws {@link Pinnacle.NotImplementedError}
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* await client.messages.rcs.sendTyping({
|
|
134
|
+
* agentId: "agent_pinnacle",
|
|
135
|
+
* to: "+14154746461",
|
|
136
|
+
* options: {
|
|
137
|
+
* test_mode: false
|
|
138
|
+
* }
|
|
139
|
+
* })
|
|
140
|
+
*/
|
|
141
|
+
sendTyping(request, requestOptions) {
|
|
142
|
+
return core.HttpResponsePromise.fromPromise(this.__sendTyping(request, requestOptions));
|
|
143
|
+
}
|
|
144
|
+
__sendTyping(request, requestOptions) {
|
|
145
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
var _a, _b, _c;
|
|
147
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
148
|
+
const _response = yield core.fetcher({
|
|
149
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PinnacleEnvironment.Default, "messages/typing"),
|
|
150
|
+
method: "POST",
|
|
151
|
+
headers: _headers,
|
|
152
|
+
contentType: "application/json",
|
|
153
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
154
|
+
requestType: "json",
|
|
155
|
+
body: request,
|
|
156
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
157
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
158
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
159
|
+
});
|
|
160
|
+
if (_response.ok) {
|
|
161
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
162
|
+
}
|
|
163
|
+
if (_response.error.reason === "status-code") {
|
|
164
|
+
switch (_response.error.statusCode) {
|
|
165
|
+
case 400:
|
|
166
|
+
throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
|
|
167
|
+
case 401:
|
|
168
|
+
throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
169
|
+
case 404:
|
|
170
|
+
throw new Pinnacle.NotFoundError(_response.error.body, _response.rawResponse);
|
|
171
|
+
case 500:
|
|
172
|
+
throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
|
|
173
|
+
case 501:
|
|
174
|
+
throw new Pinnacle.NotImplementedError(_response.error.body, _response.rawResponse);
|
|
175
|
+
default:
|
|
176
|
+
throw new errors.PinnacleError({
|
|
177
|
+
statusCode: _response.error.statusCode,
|
|
178
|
+
body: _response.error.body,
|
|
179
|
+
rawResponse: _response.rawResponse,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
switch (_response.error.reason) {
|
|
184
|
+
case "non-json":
|
|
185
|
+
throw new errors.PinnacleError({
|
|
186
|
+
statusCode: _response.error.statusCode,
|
|
187
|
+
body: _response.error.rawBody,
|
|
188
|
+
rawResponse: _response.rawResponse,
|
|
189
|
+
});
|
|
190
|
+
case "timeout":
|
|
191
|
+
throw new errors.PinnacleTimeoutError("Timeout exceeded when calling POST /messages/typing.");
|
|
192
|
+
case "unknown":
|
|
193
|
+
throw new errors.PinnacleError({
|
|
194
|
+
message: _response.error.errorMessage,
|
|
195
|
+
rawResponse: _response.rawResponse,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
110
200
|
/**
|
|
111
201
|
* Validate RCS message content without sending it.
|
|
112
202
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* agentId: "agent_pinnacle",
|
|
8
|
+
* to: "+14154746461",
|
|
9
|
+
* options: {
|
|
10
|
+
* test_mode: false
|
|
11
|
+
* }
|
|
12
|
+
* }
|
|
13
|
+
*/
|
|
14
|
+
export interface SendTypingIndicatorSchema {
|
|
15
|
+
/**
|
|
16
|
+
* The unique identifier of the RCS agent sending the typing indicator. <br>
|
|
17
|
+
*
|
|
18
|
+
* Format: `agent_` followed by alphanumeric characters (e.g., `agent_pinnacle`).
|
|
19
|
+
*/
|
|
20
|
+
agentId: string;
|
|
21
|
+
/**
|
|
22
|
+
* The recipient's phone number in E.164 format. <br>
|
|
23
|
+
*
|
|
24
|
+
* Must include country code with a leading plus sign (e.g., `+14155551234`).
|
|
25
|
+
*/
|
|
26
|
+
to: string;
|
|
27
|
+
/** Configure how your typing indicator is sent. */
|
|
28
|
+
options?: SendTypingIndicatorSchema.Options;
|
|
29
|
+
}
|
|
30
|
+
export declare namespace SendTypingIndicatorSchema {
|
|
31
|
+
/**
|
|
32
|
+
* Configure how your typing indicator is sent.
|
|
33
|
+
*/
|
|
34
|
+
interface Options {
|
|
35
|
+
/** Send via the test agent to whitelisted test devices. Useful for development and debugging. */
|
|
36
|
+
test_mode?: boolean;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type SendTypingIndicatorSchema } from "./SendTypingIndicatorSchema.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
export interface AudienceCountOnly {
|
|
5
|
+
/** Audience public ID. This identifier is a string that always begins with the prefix `aud_`, for example: `aud_abc123`. */
|
|
6
|
+
id: string;
|
|
7
|
+
/** Audience name. */
|
|
8
|
+
name: string;
|
|
9
|
+
/** Audience description. */
|
|
10
|
+
description: string;
|
|
11
|
+
/**
|
|
12
|
+
* Total number of contacts in audience.
|
|
13
|
+
*
|
|
14
|
+
* Use the [Get Audience](/api-reference/audiences/get) endpoint with the pagination parameters to get the audience with its contacts.
|
|
15
|
+
*/
|
|
16
|
+
contactCount: number;
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Pinnacle from "../index.mjs";
|
|
5
|
+
export interface AudienceWithPagination {
|
|
6
|
+
/** Audience public ID. This identifier is a string that always begins with the prefix `aud_`, for example: `aud_abc123`. */
|
|
7
|
+
id: string;
|
|
8
|
+
/** Audience name. */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Audience description. */
|
|
11
|
+
description: string;
|
|
12
|
+
/** Array of contact objects (paginated). */
|
|
13
|
+
contacts: Pinnacle.Contact[];
|
|
14
|
+
/** Total number of contacts in audience. */
|
|
15
|
+
contactCount: number;
|
|
16
|
+
pagination: Pinnacle.Pagination;
|
|
17
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Pinnacle from "../index.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* Configure how your RCS message is sent and tracked.
|
|
7
|
+
*/
|
|
8
|
+
export interface Options {
|
|
9
|
+
schedule?: Pinnacle.MessageSchedule;
|
|
10
|
+
/** Send via the test agent to whitelisted test devices. Useful for development and debugging. */
|
|
11
|
+
test_mode?: boolean;
|
|
12
|
+
tracking?: Pinnacle.Tracking;
|
|
13
|
+
/** Media files and card media will be transcoded to a supported RCS format. This adds a small delay to sending the message. Ignored for rich text messages. */
|
|
14
|
+
transcode?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Validate your message for any unsupported files. <br>
|
|
17
|
+
*
|
|
18
|
+
* If failed, errors will be thrown and the message will not send.
|
|
19
|
+
*/
|
|
20
|
+
validate?: boolean;
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
export interface Pagination {
|
|
5
|
+
/** Current page number (1-indexed). */
|
|
6
|
+
page: number;
|
|
7
|
+
/** Items per page (max 100, default 50). */
|
|
8
|
+
limit: number;
|
|
9
|
+
/** Total number of contacts in the audience. */
|
|
10
|
+
total: number;
|
|
11
|
+
/** Whether more pages exist. */
|
|
12
|
+
hasMore: boolean;
|
|
13
|
+
}
|