rcs-js 2.0.0-rc.10 → 2.0.0-rc.11
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/dist/cjs/Client.d.ts +3 -0
- package/dist/cjs/Client.js +15 -10
- package/dist/cjs/api/resources/brands/client/Client.d.ts +2 -0
- package/dist/cjs/api/resources/brands/client/Client.js +6 -0
- package/dist/cjs/api/resources/campaigns/resources/dlc/client/Client.d.ts +6 -6
- package/dist/cjs/api/resources/campaigns/resources/dlc/client/Client.js +6 -6
- package/dist/cjs/api/resources/campaigns/resources/rcs/client/requests/UpsertRcsCampaignParams.d.ts +2 -2
- package/dist/cjs/api/resources/index.d.ts +2 -0
- package/dist/cjs/api/resources/index.js +3 -1
- package/dist/cjs/api/resources/messages/client/Client.d.ts +3 -0
- package/dist/cjs/api/resources/messages/client/Client.js +9 -0
- package/dist/cjs/api/resources/messages/resources/mms/client/Client.d.ts +1 -0
- package/dist/cjs/api/resources/messages/resources/mms/client/Client.js +3 -0
- package/dist/cjs/api/resources/messages/resources/rcs/client/Client.d.ts +1 -0
- package/dist/cjs/api/resources/messages/resources/rcs/client/Client.js +3 -0
- package/dist/cjs/api/resources/messages/resources/sms/client/Client.d.ts +1 -0
- package/dist/cjs/api/resources/messages/resources/sms/client/Client.js +3 -0
- package/dist/cjs/api/resources/phoneNumbers/resources/campaign/client/Client.d.ts +2 -0
- package/dist/cjs/api/resources/phoneNumbers/resources/campaign/client/Client.js +6 -0
- package/dist/cjs/api/resources/phoneNumbers/resources/webhook/client/Client.d.ts +1 -0
- package/dist/cjs/api/resources/phoneNumbers/resources/webhook/client/Client.js +3 -0
- package/dist/cjs/api/resources/rcs/client/Client.d.ts +121 -0
- package/dist/cjs/api/resources/rcs/client/Client.js +320 -0
- package/dist/cjs/api/resources/rcs/client/index.d.ts +2 -0
- package/dist/cjs/api/resources/rcs/client/index.js +17 -0
- package/dist/cjs/api/resources/rcs/client/requests/RcsCapabilitiesQuery.d.ts +13 -0
- package/dist/cjs/api/resources/rcs/client/requests/RcsCapabilitiesQuery.js +5 -0
- package/dist/cjs/api/resources/rcs/client/requests/RcsLinkRequest.d.ts +22 -0
- package/dist/cjs/api/resources/rcs/client/requests/RcsLinkRequest.js +5 -0
- package/dist/cjs/api/resources/rcs/client/requests/RcsWhitelistRequest.d.ts +16 -0
- package/dist/cjs/api/resources/rcs/client/requests/RcsWhitelistRequest.js +5 -0
- package/dist/cjs/api/resources/rcs/client/requests/index.d.ts +3 -0
- package/dist/cjs/api/resources/rcs/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/rcs/index.d.ts +1 -0
- package/dist/cjs/api/resources/rcs/index.js +17 -0
- package/dist/cjs/api/resources/status/resources/get/client/Client.d.ts +2 -2
- package/dist/cjs/api/resources/status/resources/get/client/Client.js +2 -2
- package/dist/cjs/api/types/ConversationList.d.ts +4 -4
- package/dist/cjs/api/types/DlcCampaignStatus.d.ts +2 -2
- package/dist/cjs/api/types/ExtendedRcsCampaign.d.ts +2 -2
- package/dist/cjs/api/types/RcsCampaign.d.ts +2 -2
- package/dist/cjs/api/types/RcsCapabilitiesResult.d.ts +8 -0
- package/dist/cjs/api/types/RcsCapabilitiesResult.js +5 -0
- package/dist/cjs/api/types/RcsCapability.d.ts +36 -0
- package/dist/cjs/api/types/RcsCapability.js +5 -0
- package/dist/cjs/api/types/RcsLinkResult.d.ts +13 -0
- package/dist/cjs/api/types/RcsLinkResult.js +5 -0
- package/dist/cjs/api/types/RcsValidateContent.d.ts +1 -0
- package/dist/cjs/api/types/RcsWhitelistResponse.d.ts +10 -0
- package/dist/cjs/api/types/RcsWhitelistResponse.js +5 -0
- package/dist/cjs/api/types/index.d.ts +4 -0
- package/dist/cjs/api/types/index.js +4 -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/brands/client/Client.d.mts +2 -0
- package/dist/esm/api/resources/brands/client/Client.mjs +6 -0
- package/dist/esm/api/resources/campaigns/resources/dlc/client/Client.d.mts +6 -6
- package/dist/esm/api/resources/campaigns/resources/dlc/client/Client.mjs +6 -6
- package/dist/esm/api/resources/campaigns/resources/rcs/client/requests/UpsertRcsCampaignParams.d.mts +2 -2
- package/dist/esm/api/resources/index.d.mts +2 -0
- package/dist/esm/api/resources/index.mjs +2 -0
- package/dist/esm/api/resources/messages/client/Client.d.mts +3 -0
- package/dist/esm/api/resources/messages/client/Client.mjs +9 -0
- package/dist/esm/api/resources/messages/resources/mms/client/Client.d.mts +1 -0
- package/dist/esm/api/resources/messages/resources/mms/client/Client.mjs +3 -0
- package/dist/esm/api/resources/messages/resources/rcs/client/Client.d.mts +1 -0
- package/dist/esm/api/resources/messages/resources/rcs/client/Client.mjs +3 -0
- package/dist/esm/api/resources/messages/resources/sms/client/Client.d.mts +1 -0
- package/dist/esm/api/resources/messages/resources/sms/client/Client.mjs +3 -0
- package/dist/esm/api/resources/phoneNumbers/resources/campaign/client/Client.d.mts +2 -0
- package/dist/esm/api/resources/phoneNumbers/resources/campaign/client/Client.mjs +6 -0
- package/dist/esm/api/resources/phoneNumbers/resources/webhook/client/Client.d.mts +1 -0
- package/dist/esm/api/resources/phoneNumbers/resources/webhook/client/Client.mjs +3 -0
- package/dist/esm/api/resources/rcs/client/Client.d.mts +121 -0
- package/dist/esm/api/resources/rcs/client/Client.mjs +283 -0
- package/dist/esm/api/resources/rcs/client/index.d.mts +2 -0
- package/dist/esm/api/resources/rcs/client/index.mjs +1 -0
- package/dist/esm/api/resources/rcs/client/requests/RcsCapabilitiesQuery.d.mts +13 -0
- package/dist/esm/api/resources/rcs/client/requests/RcsCapabilitiesQuery.mjs +4 -0
- package/dist/esm/api/resources/rcs/client/requests/RcsLinkRequest.d.mts +22 -0
- package/dist/esm/api/resources/rcs/client/requests/RcsLinkRequest.mjs +4 -0
- package/dist/esm/api/resources/rcs/client/requests/RcsWhitelistRequest.d.mts +16 -0
- package/dist/esm/api/resources/rcs/client/requests/RcsWhitelistRequest.mjs +4 -0
- package/dist/esm/api/resources/rcs/client/requests/index.d.mts +3 -0
- package/dist/esm/api/resources/rcs/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/rcs/index.d.mts +1 -0
- package/dist/esm/api/resources/rcs/index.mjs +1 -0
- package/dist/esm/api/resources/status/resources/get/client/Client.d.mts +2 -2
- package/dist/esm/api/resources/status/resources/get/client/Client.mjs +2 -2
- package/dist/esm/api/types/ConversationList.d.mts +4 -4
- package/dist/esm/api/types/DlcCampaignStatus.d.mts +2 -2
- package/dist/esm/api/types/ExtendedRcsCampaign.d.mts +2 -2
- package/dist/esm/api/types/RcsCampaign.d.mts +2 -2
- package/dist/esm/api/types/RcsCapabilitiesResult.d.mts +8 -0
- package/dist/esm/api/types/RcsCapabilitiesResult.mjs +4 -0
- package/dist/esm/api/types/RcsCapability.d.mts +36 -0
- package/dist/esm/api/types/RcsCapability.mjs +4 -0
- package/dist/esm/api/types/RcsLinkResult.d.mts +13 -0
- package/dist/esm/api/types/RcsLinkResult.mjs +4 -0
- package/dist/esm/api/types/RcsValidateContent.d.mts +1 -0
- package/dist/esm/api/types/RcsWhitelistResponse.d.mts +10 -0
- package/dist/esm/api/types/RcsWhitelistResponse.mjs +4 -0
- package/dist/esm/api/types/index.d.mts +4 -0
- package/dist/esm/api/types/index.mjs +4 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +237 -8
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
39
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
40
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
41
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
42
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
43
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
44
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.Rcs = void 0;
|
|
49
|
+
const environments = __importStar(require("../../../../environments.js"));
|
|
50
|
+
const core = __importStar(require("../../../../core/index.js"));
|
|
51
|
+
const Pinnacle = __importStar(require("../../../index.js"));
|
|
52
|
+
const headers_js_1 = require("../../../../core/headers.js");
|
|
53
|
+
const errors = __importStar(require("../../../../errors/index.js"));
|
|
54
|
+
class Rcs {
|
|
55
|
+
constructor(_options) {
|
|
56
|
+
this._options = _options;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Check RCS capabilities for one or more phone numbers.
|
|
60
|
+
*
|
|
61
|
+
* This endpoint allows you to verify which RCS features (cards, buttons, etc.) are supported
|
|
62
|
+
* on specific phone numbers before sending RCS messages to them.
|
|
63
|
+
*
|
|
64
|
+
* @param {Pinnacle.RcsCapabilitiesQuery} request
|
|
65
|
+
* @param {Rcs.RequestOptions} requestOptions - Request-specific configuration.
|
|
66
|
+
*
|
|
67
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
68
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
69
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
70
|
+
* @throws {@link Pinnacle.NotImplementedError}
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* await client.rcs.getCapabilities({
|
|
74
|
+
* phoneNumbers: ["+12345678901", "+19876543210"]
|
|
75
|
+
* })
|
|
76
|
+
*/
|
|
77
|
+
getCapabilities(request, requestOptions) {
|
|
78
|
+
return core.HttpResponsePromise.fromPromise(this.__getCapabilities(request, requestOptions));
|
|
79
|
+
}
|
|
80
|
+
__getCapabilities(request, requestOptions) {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
var _a, _b, _c;
|
|
83
|
+
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
84
|
+
const _response = yield core.fetcher({
|
|
85
|
+
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, "rcs/capabilities"),
|
|
86
|
+
method: "POST",
|
|
87
|
+
headers: _headers,
|
|
88
|
+
contentType: "application/json",
|
|
89
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
90
|
+
requestType: "json",
|
|
91
|
+
body: request,
|
|
92
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
93
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
94
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
95
|
+
});
|
|
96
|
+
if (_response.ok) {
|
|
97
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
98
|
+
}
|
|
99
|
+
if (_response.error.reason === "status-code") {
|
|
100
|
+
switch (_response.error.statusCode) {
|
|
101
|
+
case 400:
|
|
102
|
+
throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
|
|
103
|
+
case 401:
|
|
104
|
+
throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
105
|
+
case 500:
|
|
106
|
+
throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
|
|
107
|
+
case 501:
|
|
108
|
+
throw new Pinnacle.NotImplementedError(_response.error.body, _response.rawResponse);
|
|
109
|
+
default:
|
|
110
|
+
throw new errors.PinnacleError({
|
|
111
|
+
statusCode: _response.error.statusCode,
|
|
112
|
+
body: _response.error.body,
|
|
113
|
+
rawResponse: _response.rawResponse,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
switch (_response.error.reason) {
|
|
118
|
+
case "non-json":
|
|
119
|
+
throw new errors.PinnacleError({
|
|
120
|
+
statusCode: _response.error.statusCode,
|
|
121
|
+
body: _response.error.rawBody,
|
|
122
|
+
rawResponse: _response.rawResponse,
|
|
123
|
+
});
|
|
124
|
+
case "timeout":
|
|
125
|
+
throw new errors.PinnacleTimeoutError("Timeout exceeded when calling POST /rcs/capabilities.");
|
|
126
|
+
case "unknown":
|
|
127
|
+
throw new errors.PinnacleError({
|
|
128
|
+
message: _response.error.errorMessage,
|
|
129
|
+
rawResponse: _response.rawResponse,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Whitelist a phone number for testing with your test RCS agent.
|
|
136
|
+
*
|
|
137
|
+
* ## Overview
|
|
138
|
+
* During development and testing, RCS agents can only send messages to whitelisted phone numbers.
|
|
139
|
+
* Use this endpoint to add test devices to your agent's whitelist before sending test messages.
|
|
140
|
+
*
|
|
141
|
+
* ## Verification Process
|
|
142
|
+
* After whitelisting a number, you'll need to complete verification:
|
|
143
|
+
*
|
|
144
|
+
* 1. Check the test device for an "RBM Tester Management" request
|
|
145
|
+
* 2. Accept the request on the device
|
|
146
|
+
* 3. Enter the 4-digit verification code in the Pinnacle dashboard at:
|
|
147
|
+
* ```
|
|
148
|
+
* https://app.pinnacle.sh/dashboard/brands/{brandId}?campaignId={campaignId}&campaignType=RCS
|
|
149
|
+
* ```
|
|
150
|
+
*
|
|
151
|
+
* > **Important Notes**
|
|
152
|
+
* >
|
|
153
|
+
* > - **Testing only:** This is only required for test agents. Production agents can message any RCS-enabled number
|
|
154
|
+
* > - **AT&T limitation:** Whitelisting may currently fail for AT&T numbers
|
|
155
|
+
* > - **Verification required:** The whitelist request isn't complete until you verify the device.
|
|
156
|
+
*
|
|
157
|
+
* @param {Pinnacle.RcsWhitelistRequest} request
|
|
158
|
+
* @param {Rcs.RequestOptions} requestOptions - Request-specific configuration.
|
|
159
|
+
*
|
|
160
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
161
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
162
|
+
* @throws {@link Pinnacle.NotFoundError}
|
|
163
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
164
|
+
* @throws {@link Pinnacle.NotImplementedError}
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* await client.rcs.whitelist({
|
|
168
|
+
* agentId: "agent_XXXXXXXXXXXX",
|
|
169
|
+
* phoneNumber: "+12345678901"
|
|
170
|
+
* })
|
|
171
|
+
*/
|
|
172
|
+
whitelist(request, requestOptions) {
|
|
173
|
+
return core.HttpResponsePromise.fromPromise(this.__whitelist(request, requestOptions));
|
|
174
|
+
}
|
|
175
|
+
__whitelist(request, requestOptions) {
|
|
176
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
177
|
+
var _a, _b, _c;
|
|
178
|
+
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
179
|
+
const _response = yield core.fetcher({
|
|
180
|
+
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, "rcs/whitelist"),
|
|
181
|
+
method: "POST",
|
|
182
|
+
headers: _headers,
|
|
183
|
+
contentType: "application/json",
|
|
184
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
185
|
+
requestType: "json",
|
|
186
|
+
body: request,
|
|
187
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
188
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
189
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
190
|
+
});
|
|
191
|
+
if (_response.ok) {
|
|
192
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
193
|
+
}
|
|
194
|
+
if (_response.error.reason === "status-code") {
|
|
195
|
+
switch (_response.error.statusCode) {
|
|
196
|
+
case 400:
|
|
197
|
+
throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
|
|
198
|
+
case 401:
|
|
199
|
+
throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
200
|
+
case 404:
|
|
201
|
+
throw new Pinnacle.NotFoundError(_response.error.body, _response.rawResponse);
|
|
202
|
+
case 500:
|
|
203
|
+
throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
|
|
204
|
+
case 501:
|
|
205
|
+
throw new Pinnacle.NotImplementedError(_response.error.body, _response.rawResponse);
|
|
206
|
+
default:
|
|
207
|
+
throw new errors.PinnacleError({
|
|
208
|
+
statusCode: _response.error.statusCode,
|
|
209
|
+
body: _response.error.body,
|
|
210
|
+
rawResponse: _response.rawResponse,
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
switch (_response.error.reason) {
|
|
215
|
+
case "non-json":
|
|
216
|
+
throw new errors.PinnacleError({
|
|
217
|
+
statusCode: _response.error.statusCode,
|
|
218
|
+
body: _response.error.rawBody,
|
|
219
|
+
rawResponse: _response.rawResponse,
|
|
220
|
+
});
|
|
221
|
+
case "timeout":
|
|
222
|
+
throw new errors.PinnacleTimeoutError("Timeout exceeded when calling POST /rcs/whitelist.");
|
|
223
|
+
case "unknown":
|
|
224
|
+
throw new errors.PinnacleError({
|
|
225
|
+
message: _response.error.errorMessage,
|
|
226
|
+
rawResponse: _response.rawResponse,
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Generate a link for initiating an RCS conversation with your agent.
|
|
233
|
+
*
|
|
234
|
+
* Users can click these links to start conversations with your RCS agent directly
|
|
235
|
+
* from websites, emails, or other applications.
|
|
236
|
+
*
|
|
237
|
+
* @param {Pinnacle.RcsLinkRequest} request
|
|
238
|
+
* @param {Rcs.RequestOptions} requestOptions - Request-specific configuration.
|
|
239
|
+
*
|
|
240
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
241
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
242
|
+
* @throws {@link Pinnacle.NotFoundError}
|
|
243
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
244
|
+
* @throws {@link Pinnacle.NotImplementedError}
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* await client.rcs.getLink({
|
|
248
|
+
* agentId: "agent_XXXXXXXXXXXX",
|
|
249
|
+
* testMode: false,
|
|
250
|
+
* phoneNumber: "+12345678901",
|
|
251
|
+
* body: "Hello, I need help with my order"
|
|
252
|
+
* })
|
|
253
|
+
*/
|
|
254
|
+
getLink(request, requestOptions) {
|
|
255
|
+
return core.HttpResponsePromise.fromPromise(this.__getLink(request, requestOptions));
|
|
256
|
+
}
|
|
257
|
+
__getLink(request, requestOptions) {
|
|
258
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
259
|
+
var _a, _b, _c;
|
|
260
|
+
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
261
|
+
const _response = yield core.fetcher({
|
|
262
|
+
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, "rcs/link"),
|
|
263
|
+
method: "POST",
|
|
264
|
+
headers: _headers,
|
|
265
|
+
contentType: "application/json",
|
|
266
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
267
|
+
requestType: "json",
|
|
268
|
+
body: request,
|
|
269
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
270
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
271
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
272
|
+
});
|
|
273
|
+
if (_response.ok) {
|
|
274
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
275
|
+
}
|
|
276
|
+
if (_response.error.reason === "status-code") {
|
|
277
|
+
switch (_response.error.statusCode) {
|
|
278
|
+
case 400:
|
|
279
|
+
throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
|
|
280
|
+
case 401:
|
|
281
|
+
throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
282
|
+
case 404:
|
|
283
|
+
throw new Pinnacle.NotFoundError(_response.error.body, _response.rawResponse);
|
|
284
|
+
case 500:
|
|
285
|
+
throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
|
|
286
|
+
case 501:
|
|
287
|
+
throw new Pinnacle.NotImplementedError(_response.error.body, _response.rawResponse);
|
|
288
|
+
default:
|
|
289
|
+
throw new errors.PinnacleError({
|
|
290
|
+
statusCode: _response.error.statusCode,
|
|
291
|
+
body: _response.error.body,
|
|
292
|
+
rawResponse: _response.rawResponse,
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
switch (_response.error.reason) {
|
|
297
|
+
case "non-json":
|
|
298
|
+
throw new errors.PinnacleError({
|
|
299
|
+
statusCode: _response.error.statusCode,
|
|
300
|
+
body: _response.error.rawBody,
|
|
301
|
+
rawResponse: _response.rawResponse,
|
|
302
|
+
});
|
|
303
|
+
case "timeout":
|
|
304
|
+
throw new errors.PinnacleTimeoutError("Timeout exceeded when calling POST /rcs/link.");
|
|
305
|
+
case "unknown":
|
|
306
|
+
throw new errors.PinnacleError({
|
|
307
|
+
message: _response.error.errorMessage,
|
|
308
|
+
rawResponse: _response.rawResponse,
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
_getCustomAuthorizationHeaders() {
|
|
314
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
315
|
+
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
316
|
+
return { "PINNACLE-API-KEY": apiKeyValue };
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
exports.Rcs = Rcs;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./requests/index.js"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* phoneNumbers: ["+12345678901", "+19876543210"]
|
|
8
|
+
* }
|
|
9
|
+
*/
|
|
10
|
+
export interface RcsCapabilitiesQuery {
|
|
11
|
+
/** List of phone numbers to check RCS capabilities for (E.164 format) */
|
|
12
|
+
phoneNumbers: string[];
|
|
13
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* agentId: "agent_XXXXXXXXXXXX",
|
|
8
|
+
* testMode: false,
|
|
9
|
+
* phoneNumber: "+12345678901",
|
|
10
|
+
* body: "Hello, I need help with my order"
|
|
11
|
+
* }
|
|
12
|
+
*/
|
|
13
|
+
export interface RcsLinkRequest {
|
|
14
|
+
/** The RCS agent ID (must be prefixed with 'agent_') */
|
|
15
|
+
agentId: string;
|
|
16
|
+
/** Link to the test agent or the production agent if false */
|
|
17
|
+
testMode?: boolean;
|
|
18
|
+
/** Fallback phone number (E.164 format) to use if the phone number does not support RCS. If not provided, no url will be generated. */
|
|
19
|
+
phoneNumber?: string;
|
|
20
|
+
/** Optional message body to pre-fill after the user clicks the link */
|
|
21
|
+
body?: string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* agentId: "agent_XXXXXXXXXXXX",
|
|
8
|
+
* phoneNumber: "+12345678901"
|
|
9
|
+
* }
|
|
10
|
+
*/
|
|
11
|
+
export interface RcsWhitelistRequest {
|
|
12
|
+
/** The RCS agent ID (must be prefixed with 'agent_') */
|
|
13
|
+
agentId: string;
|
|
14
|
+
/** Phone number to whitelist for testing (E.164 format) */
|
|
15
|
+
phoneNumber: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./client/index.js"), exports);
|
|
@@ -64,9 +64,9 @@ export declare class Get {
|
|
|
64
64
|
tollFree(campaignId: number, requestOptions?: Get.RequestOptions): core.HttpResponsePromise<Pinnacle.TollFreeCampaignStatus>;
|
|
65
65
|
private __tollFree;
|
|
66
66
|
/**
|
|
67
|
-
* Retrieve a
|
|
67
|
+
* Retrieve a 10DLC campaign's status.
|
|
68
68
|
*
|
|
69
|
-
* @param {number} campaignId - ID of the
|
|
69
|
+
* @param {number} campaignId - ID of the 10DLC campaign.
|
|
70
70
|
* @param {Get.RequestOptions} requestOptions - Request-specific configuration.
|
|
71
71
|
*
|
|
72
72
|
* @throws {@link Pinnacle.BadRequestError}
|
|
@@ -198,9 +198,9 @@ class Get {
|
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
200
|
/**
|
|
201
|
-
* Retrieve a
|
|
201
|
+
* Retrieve a 10DLC campaign's status.
|
|
202
202
|
*
|
|
203
|
-
* @param {number} campaignId - ID of the
|
|
203
|
+
* @param {number} campaignId - ID of the 10DLC campaign.
|
|
204
204
|
* @param {Get.RequestOptions} requestOptions - Request-specific configuration.
|
|
205
205
|
*
|
|
206
206
|
* @throws {@link Pinnacle.BadRequestError}
|
|
@@ -5,10 +5,10 @@ import * as Pinnacle from "../index.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* Response for list conversation.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
9
|
-
|
|
8
|
+
export type ConversationList = {
|
|
9
|
+
error?: string | undefined;
|
|
10
|
+
} | {
|
|
10
11
|
count: number;
|
|
11
12
|
conversations: Pinnacle.Conversation[];
|
|
12
|
-
/** Indicates if more conversations are available beyond the current page. */
|
|
13
13
|
hasMore: boolean;
|
|
14
|
-
}
|
|
14
|
+
};
|
|
@@ -24,7 +24,7 @@ export interface DlcCampaignStatus {
|
|
|
24
24
|
*/
|
|
25
25
|
status: Pinnacle.ProfileStatusEnum;
|
|
26
26
|
/**
|
|
27
|
-
* Status of
|
|
27
|
+
* Status of local long code numbers that are being attached to this campaign. <br>
|
|
28
28
|
*
|
|
29
29
|
* Note that phone numbers can only be attached to `VERIFIED` campaigns via the [attach campaign endpoint](../phone-numbers/attach-campaign).
|
|
30
30
|
*/
|
|
@@ -32,7 +32,7 @@ export interface DlcCampaignStatus {
|
|
|
32
32
|
}
|
|
33
33
|
export declare namespace DlcCampaignStatus {
|
|
34
34
|
/**
|
|
35
|
-
* Status of
|
|
35
|
+
* Status of local long code numbers that are being attached to this campaign. <br>
|
|
36
36
|
*
|
|
37
37
|
* Note that phone numbers can only be attached to `VERIFIED` campaigns via the [attach campaign endpoint](../phone-numbers/attach-campaign).
|
|
38
38
|
*/
|
|
@@ -37,9 +37,9 @@ export declare namespace ExtendedRcsCampaign {
|
|
|
37
37
|
description?: string;
|
|
38
38
|
/** List of emails. */
|
|
39
39
|
emails?: Agent.Emails.Item[];
|
|
40
|
-
/** Link to the agent's hero. */
|
|
40
|
+
/** Link to the agent's hero. Hero must be an image file with dimensions 1440x448px. */
|
|
41
41
|
heroUrl?: string;
|
|
42
|
-
/** Link to the agent's icon. */
|
|
42
|
+
/** Link to the agent's icon. Icon must be an image file with dimensions 224x224px. */
|
|
43
43
|
iconUrl?: string;
|
|
44
44
|
/** Name of the agent. */
|
|
45
45
|
name?: string;
|
|
@@ -37,9 +37,9 @@ export declare namespace RcsCampaign {
|
|
|
37
37
|
phones?: Agent.Phones.Item[];
|
|
38
38
|
/** List of urls. */
|
|
39
39
|
websites?: Agent.Websites.Item[];
|
|
40
|
-
/** Link to the agent's hero. */
|
|
40
|
+
/** Link to the agent's hero. Hero must be an image file with dimensions 1440x448px. */
|
|
41
41
|
heroUrl?: string;
|
|
42
|
-
/** Link to the agent's icon. */
|
|
42
|
+
/** Link to the agent's icon. Icon must be an image file with dimensions 224x224px. */
|
|
43
43
|
iconUrl?: string;
|
|
44
44
|
}
|
|
45
45
|
namespace Agent {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Pinnacle from "../index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Response containing RCS capabilities for requested phone numbers
|
|
7
|
+
*/
|
|
8
|
+
export type RcsCapabilitiesResult = Record<string, (Pinnacle.RcsCapability | null) | undefined>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* RCS capabilities for a phone number
|
|
6
|
+
*/
|
|
7
|
+
export interface RcsCapability {
|
|
8
|
+
cards: RcsCapability.Cards;
|
|
9
|
+
/** Supported button action types inside the rich cards or quick replies. Each key is a button action type that defines a specific button type in the Pinnacle API. */
|
|
10
|
+
actions: RcsCapability.Actions;
|
|
11
|
+
}
|
|
12
|
+
export declare namespace RcsCapability {
|
|
13
|
+
interface Cards {
|
|
14
|
+
/** Whether the phone number supports standalone rich cards (`cards.length == 1`) */
|
|
15
|
+
standalone: boolean;
|
|
16
|
+
/** Whether the phone number supports carousel rich cards */
|
|
17
|
+
carousel: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Supported button action types inside the rich cards or quick replies. Each key is a button action type that defines a specific button type in the Pinnacle API.
|
|
21
|
+
*/
|
|
22
|
+
interface Actions {
|
|
23
|
+
/** Buttons that open URLs are supported */
|
|
24
|
+
openUrl: boolean;
|
|
25
|
+
/** Buttons that make phone calls are supported */
|
|
26
|
+
call: boolean;
|
|
27
|
+
/** Buttons that trigger actions are supported */
|
|
28
|
+
trigger: boolean;
|
|
29
|
+
/** Buttons that request user location are supported */
|
|
30
|
+
requestUserLocation: boolean;
|
|
31
|
+
/** Buttons are supported */
|
|
32
|
+
scheduleEvent: boolean;
|
|
33
|
+
/** Buttons that send location are supported */
|
|
34
|
+
sendLocation: boolean;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Response containing the generated RCS service id and/or url. You can always create a link with the service id that is returned.
|
|
6
|
+
* To create a link follow the format: sms://{PHONE_NUMBER}?service_id={SERVICE_ID}&body={URL_ENCODED_BODY}
|
|
7
|
+
*/
|
|
8
|
+
export interface RcsLinkResult {
|
|
9
|
+
/** The generated RCS link URL. If no phone number is provided, no url will be generated. */
|
|
10
|
+
url?: string;
|
|
11
|
+
/** The service ID used for the link */
|
|
12
|
+
serviceId: string;
|
|
13
|
+
}
|
|
@@ -12,6 +12,7 @@ Pinnacle.RcsTextContent
|
|
|
12
12
|
* See [supported media types](https://app.pinnacle.sh/supported-file-types?type=RCS-MEDIA). */
|
|
13
13
|
| {
|
|
14
14
|
media: string;
|
|
15
|
+
quickReplies: Pinnacle.RichButton[];
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* Message containing cards, each with its own title, subtitle, and/or buttons. Quick replies can also be added. <br>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Response indicating success of whitelisting operation
|
|
6
|
+
*/
|
|
7
|
+
export interface RcsWhitelistResponse {
|
|
8
|
+
/** Whether the whitelisting operation was successful */
|
|
9
|
+
success: boolean;
|
|
10
|
+
}
|