rcs-js 2.0.0-rc.10 → 2.0.0-rc.12
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/Client.d.ts +1 -0
- package/dist/cjs/api/resources/campaigns/resources/rcs/client/Client.js +3 -0
- 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 +3 -2
- package/dist/cjs/api/resources/messages/resources/rcs/client/Client.js +4 -1
- 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/RcsLinkRequest.d.ts +22 -0
- package/dist/cjs/api/resources/rcs/client/requests/RcsWhitelistRequest.d.ts +16 -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/resources/tools/resources/file/client/Client.d.ts +21 -0
- package/dist/cjs/api/resources/tools/resources/file/client/Client.js +74 -0
- package/dist/cjs/api/resources/tools/resources/file/client/requests/RefreshFileParams.d.ts +21 -0
- package/dist/cjs/api/resources/tools/resources/file/client/requests/RefreshFileParams.js +5 -0
- package/dist/cjs/api/resources/tools/resources/file/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/tools/resources/url/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/tools/resources/url/client/Client.js +1 -1
- package/dist/cjs/api/types/AutofillDlcCampaignResponse.d.ts +11 -11
- package/dist/cjs/api/types/ButtonClicked.d.ts +11 -0
- package/dist/cjs/api/types/ButtonClicked.js +5 -0
- package/dist/cjs/api/types/ButtonClickedData.d.ts +56 -0
- package/dist/cjs/api/types/ButtonClickedData.js +16 -0
- package/dist/cjs/api/types/ConversationList.d.ts +4 -4
- package/dist/cjs/api/types/CreateUrlOptions.d.ts +1 -1
- package/dist/cjs/api/types/DlcCampaignStatus.d.ts +2 -2
- package/dist/cjs/api/types/DlcCampaignWithExtendedBrandAndStatus.d.ts +13 -10
- package/dist/cjs/api/types/ExtendedBrand.d.ts +7 -4
- package/dist/cjs/api/types/ExtendedRcsCampaign.d.ts +11 -10
- package/dist/cjs/api/types/MessageContent.d.ts +2 -2
- package/dist/cjs/api/types/MessageEvent.d.ts +56 -0
- package/dist/cjs/api/types/MessageEvent.js +13 -0
- package/dist/cjs/api/types/ProfileStatusEnum.d.ts +7 -4
- package/dist/cjs/api/types/RcsBase.d.ts +2 -0
- package/dist/cjs/api/types/RcsButtonCall.d.ts +2 -0
- package/dist/cjs/api/types/RcsButtonOpenUrl.d.ts +2 -0
- package/dist/cjs/api/types/RcsButtonRequestUserLocation.d.ts +2 -0
- package/dist/cjs/api/types/RcsButtonScheduleEvent.d.ts +2 -0
- package/dist/cjs/api/types/RcsButtonSendLocation.d.ts +2 -0
- package/dist/cjs/api/types/RcsButtonTrigger.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/RefreshedFile.d.ts +9 -0
- package/dist/cjs/api/types/RefreshedFile.js +5 -0
- package/dist/cjs/api/types/{Rcs.d.ts → RichMessage.d.ts} +1 -1
- package/dist/cjs/api/types/RichMessage.js +5 -0
- package/dist/cjs/api/types/index.d.ts +9 -3
- package/dist/cjs/api/types/index.js +9 -3
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wrapper/PinnacleClient.d.ts +9 -0
- package/dist/cjs/wrapper/PinnacleClient.js +17 -0
- package/dist/cjs/wrapper/messages/Client.d.ts +13 -0
- package/dist/cjs/wrapper/messages/Client.js +49 -0
- package/dist/cjs/wrapper/tools/Client.d.ts +6 -0
- package/dist/cjs/wrapper/tools/Client.js +12 -0
- package/dist/cjs/wrapper/tools/FileUploader.d.ts +15 -0
- package/dist/cjs/wrapper/tools/FileUploader.js +162 -0
- 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/Client.d.mts +1 -0
- package/dist/esm/api/resources/campaigns/resources/rcs/client/Client.mjs +3 -0
- 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 +3 -2
- package/dist/esm/api/resources/messages/resources/rcs/client/Client.mjs +4 -1
- 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/RcsLinkRequest.d.mts +22 -0
- package/dist/esm/api/resources/rcs/client/requests/RcsWhitelistRequest.d.mts +16 -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/resources/tools/resources/file/client/Client.d.mts +21 -0
- package/dist/esm/api/resources/tools/resources/file/client/Client.mjs +74 -0
- package/dist/esm/api/resources/tools/resources/file/client/requests/RefreshFileParams.d.mts +21 -0
- package/dist/esm/api/resources/tools/resources/file/client/requests/RefreshFileParams.mjs +4 -0
- package/dist/esm/api/resources/tools/resources/file/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/tools/resources/url/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/tools/resources/url/client/Client.mjs +1 -1
- package/dist/esm/api/types/AutofillDlcCampaignResponse.d.mts +11 -11
- package/dist/esm/api/types/ButtonClicked.d.mts +11 -0
- package/dist/esm/api/types/ButtonClicked.mjs +4 -0
- package/dist/esm/api/types/ButtonClickedData.d.mts +56 -0
- package/dist/esm/api/types/ButtonClickedData.mjs +13 -0
- package/dist/esm/api/types/ConversationList.d.mts +4 -4
- package/dist/esm/api/types/CreateUrlOptions.d.mts +1 -1
- package/dist/esm/api/types/DlcCampaignStatus.d.mts +2 -2
- package/dist/esm/api/types/DlcCampaignWithExtendedBrandAndStatus.d.mts +13 -10
- package/dist/esm/api/types/ExtendedBrand.d.mts +7 -4
- package/dist/esm/api/types/ExtendedRcsCampaign.d.mts +11 -10
- package/dist/esm/api/types/MessageContent.d.mts +2 -2
- package/dist/esm/api/types/MessageEvent.d.mts +56 -0
- package/dist/esm/api/types/MessageEvent.mjs +10 -0
- package/dist/esm/api/types/ProfileStatusEnum.d.mts +7 -4
- package/dist/esm/api/types/RcsBase.d.mts +2 -0
- package/dist/esm/api/types/RcsButtonCall.d.mts +2 -0
- package/dist/esm/api/types/RcsButtonOpenUrl.d.mts +2 -0
- package/dist/esm/api/types/RcsButtonRequestUserLocation.d.mts +2 -0
- package/dist/esm/api/types/RcsButtonScheduleEvent.d.mts +2 -0
- package/dist/esm/api/types/RcsButtonSendLocation.d.mts +2 -0
- package/dist/esm/api/types/RcsButtonTrigger.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/RefreshedFile.d.mts +9 -0
- package/dist/esm/api/types/RefreshedFile.mjs +4 -0
- package/dist/esm/api/types/{Rcs.d.mts → RichMessage.d.mts} +1 -1
- package/dist/esm/api/types/RichMessage.mjs +4 -0
- package/dist/esm/api/types/index.d.mts +9 -3
- package/dist/esm/api/types/index.mjs +9 -3
- package/dist/esm/index.d.mts +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/esm/wrapper/PinnacleClient.d.mts +9 -0
- package/dist/esm/wrapper/PinnacleClient.mjs +13 -0
- package/dist/esm/wrapper/messages/Client.d.mts +13 -0
- package/dist/esm/wrapper/messages/Client.mjs +45 -0
- package/dist/esm/wrapper/tools/Client.d.mts +6 -0
- package/dist/esm/wrapper/tools/Client.mjs +8 -0
- package/dist/esm/wrapper/tools/FileUploader.d.mts +15 -0
- package/dist/esm/wrapper/tools/FileUploader.mjs +125 -0
- package/package.json +7 -3
- package/reference.md +313 -10
- package/dist/cjs/api/types/ClickAction.d.ts +0 -28
- package/dist/cjs/api/types/InboundButton.d.ts +0 -11
- package/dist/esm/api/types/ClickAction.d.mts +0 -28
- package/dist/esm/api/types/InboundButton.d.mts +0 -11
- /package/dist/cjs/api/{types/ClickAction.js → resources/rcs/client/requests/RcsCapabilitiesQuery.js} +0 -0
- /package/dist/cjs/api/{types/InboundButton.js → resources/rcs/client/requests/RcsLinkRequest.js} +0 -0
- /package/dist/cjs/api/{types/Rcs.js → resources/rcs/client/requests/RcsWhitelistRequest.js} +0 -0
- /package/dist/esm/api/{types/ClickAction.mjs → resources/rcs/client/requests/RcsCapabilitiesQuery.mjs} +0 -0
- /package/dist/esm/api/{types/InboundButton.mjs → resources/rcs/client/requests/RcsLinkRequest.mjs} +0 -0
- /package/dist/esm/api/{types/Rcs.mjs → resources/rcs/client/requests/RcsWhitelistRequest.mjs} +0 -0
|
@@ -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}
|
|
@@ -53,6 +53,27 @@ export declare class File_ {
|
|
|
53
53
|
*/
|
|
54
54
|
upload(request: Pinnacle.tools.UploadFileParams, requestOptions?: File_.RequestOptions): core.HttpResponsePromise<Pinnacle.UploadResults>;
|
|
55
55
|
private __upload;
|
|
56
|
+
/**
|
|
57
|
+
* Refresh expiring presigned URLs for Pinnacle-hosted files to extend their access time.
|
|
58
|
+
*
|
|
59
|
+
* <Callout type="info">
|
|
60
|
+
* This only works for presigned download URLs. At this moment, you cannot refresh a presigned upload URL, generate a new one instead.
|
|
61
|
+
* </Callout>
|
|
62
|
+
*
|
|
63
|
+
* @param {Pinnacle.tools.RefreshFileParams} request
|
|
64
|
+
* @param {File_.RequestOptions} requestOptions - Request-specific configuration.
|
|
65
|
+
*
|
|
66
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
67
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
68
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* await client.tools.file.refresh({
|
|
72
|
+
* uris: ["https://server.trypinnacle.app/storage/v1/object/sign/vault/3/test.jpg?token=oldtoken", "https://server.trypinnacle.app/storage/v1/object/sign/vault/3/document.pdf?token=oldtoken2", "icons/3/test.jpg", "invalid/url", "https://google.com"]
|
|
73
|
+
* })
|
|
74
|
+
*/
|
|
75
|
+
refresh(request: Pinnacle.tools.RefreshFileParams, requestOptions?: File_.RequestOptions): core.HttpResponsePromise<Pinnacle.RefreshedFile[]>;
|
|
76
|
+
private __refresh;
|
|
56
77
|
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
57
78
|
"PINNACLE-API-KEY": string;
|
|
58
79
|
}>;
|
|
@@ -132,6 +132,80 @@ class File_ {
|
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Refresh expiring presigned URLs for Pinnacle-hosted files to extend their access time.
|
|
137
|
+
*
|
|
138
|
+
* <Callout type="info">
|
|
139
|
+
* This only works for presigned download URLs. At this moment, you cannot refresh a presigned upload URL, generate a new one instead.
|
|
140
|
+
* </Callout>
|
|
141
|
+
*
|
|
142
|
+
* @param {Pinnacle.tools.RefreshFileParams} request
|
|
143
|
+
* @param {File_.RequestOptions} requestOptions - Request-specific configuration.
|
|
144
|
+
*
|
|
145
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
146
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
147
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* await client.tools.file.refresh({
|
|
151
|
+
* uris: ["https://server.trypinnacle.app/storage/v1/object/sign/vault/3/test.jpg?token=oldtoken", "https://server.trypinnacle.app/storage/v1/object/sign/vault/3/document.pdf?token=oldtoken2", "icons/3/test.jpg", "invalid/url", "https://google.com"]
|
|
152
|
+
* })
|
|
153
|
+
*/
|
|
154
|
+
refresh(request, requestOptions) {
|
|
155
|
+
return core.HttpResponsePromise.fromPromise(this.__refresh(request, requestOptions));
|
|
156
|
+
}
|
|
157
|
+
__refresh(request, requestOptions) {
|
|
158
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
159
|
+
var _a, _b, _c;
|
|
160
|
+
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);
|
|
161
|
+
const _response = yield core.fetcher({
|
|
162
|
+
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, "tools/files/refresh"),
|
|
163
|
+
method: "POST",
|
|
164
|
+
headers: _headers,
|
|
165
|
+
contentType: "application/json",
|
|
166
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
167
|
+
requestType: "json",
|
|
168
|
+
body: request,
|
|
169
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
170
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
171
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
172
|
+
});
|
|
173
|
+
if (_response.ok) {
|
|
174
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
175
|
+
}
|
|
176
|
+
if (_response.error.reason === "status-code") {
|
|
177
|
+
switch (_response.error.statusCode) {
|
|
178
|
+
case 400:
|
|
179
|
+
throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
|
|
180
|
+
case 401:
|
|
181
|
+
throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
182
|
+
case 500:
|
|
183
|
+
throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
|
|
184
|
+
default:
|
|
185
|
+
throw new errors.PinnacleError({
|
|
186
|
+
statusCode: _response.error.statusCode,
|
|
187
|
+
body: _response.error.body,
|
|
188
|
+
rawResponse: _response.rawResponse,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
switch (_response.error.reason) {
|
|
193
|
+
case "non-json":
|
|
194
|
+
throw new errors.PinnacleError({
|
|
195
|
+
statusCode: _response.error.statusCode,
|
|
196
|
+
body: _response.error.rawBody,
|
|
197
|
+
rawResponse: _response.rawResponse,
|
|
198
|
+
});
|
|
199
|
+
case "timeout":
|
|
200
|
+
throw new errors.PinnacleTimeoutError("Timeout exceeded when calling POST /tools/files/refresh.");
|
|
201
|
+
case "unknown":
|
|
202
|
+
throw new errors.PinnacleError({
|
|
203
|
+
message: _response.error.errorMessage,
|
|
204
|
+
rawResponse: _response.rawResponse,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
}
|
|
135
209
|
_getCustomAuthorizationHeaders() {
|
|
136
210
|
return __awaiter(this, void 0, void 0, function* () {
|
|
137
211
|
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* uris: ["https://server.trypinnacle.app/storage/v1/object/sign/vault/3/test.jpg?token=oldtoken", "https://server.trypinnacle.app/storage/v1/object/sign/vault/3/document.pdf?token=oldtoken2", "icons/3/test.jpg", "invalid/url", "https://google.com"]
|
|
8
|
+
* }
|
|
9
|
+
*/
|
|
10
|
+
export interface RefreshFileParams {
|
|
11
|
+
/**
|
|
12
|
+
* Array of file URIs to refresh for extended access. <br>
|
|
13
|
+
*
|
|
14
|
+
* Accepted formats:
|
|
15
|
+
* - **Full presigned URLs**: `https://server.trypinnacle.app/storage/v1/object/sign/...`
|
|
16
|
+
* - **Short URIs**: `{BUCKET}/${TEAM_ID}/...` (e.g., `vault/3/document.pdf`)
|
|
17
|
+
*
|
|
18
|
+
* Invalid or external URLs will be returned unchanged in the response.
|
|
19
|
+
*/
|
|
20
|
+
uris: string[];
|
|
21
|
+
}
|
|
@@ -67,7 +67,7 @@ export declare class Url {
|
|
|
67
67
|
get(linkId: string, requestOptions?: Url.RequestOptions): core.HttpResponsePromise<Pinnacle.ShortenedUrlWithClickData>;
|
|
68
68
|
private __get;
|
|
69
69
|
/**
|
|
70
|
-
* Update the destination or
|
|
70
|
+
* Update the destination or expiration date of an existing shortened URL. Expiring links cannot be updated into a permalink.
|
|
71
71
|
*
|
|
72
72
|
* @param {string} linkId - Unique identifier from your shortened URL. For example, for `https://pncl.to/ePzVxILF`, the `linkId` is `ePzVxILF`. <br>
|
|
73
73
|
*
|
|
@@ -196,7 +196,7 @@ class Url {
|
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
198
|
/**
|
|
199
|
-
* Update the destination or
|
|
199
|
+
* Update the destination or expiration date of an existing shortened URL. Expiring links cannot be updated into a permalink.
|
|
200
200
|
*
|
|
201
201
|
* @param {string} linkId - Unique identifier from your shortened URL. For example, for `https://pncl.to/ePzVxILF`, the `linkId` is `ePzVxILF`. <br>
|
|
202
202
|
*
|