rcs-js 2.0.18 → 2.0.19
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.js +2 -2
- package/dist/cjs/api/resources/messages/client/Client.d.ts +3 -0
- package/dist/cjs/api/resources/messages/client/Client.js +7 -2
- package/dist/cjs/api/resources/messages/resources/index.d.ts +1 -0
- package/dist/cjs/api/resources/messages/resources/index.js +2 -1
- package/dist/cjs/api/resources/messages/resources/simulate/client/Client.d.ts +125 -0
- package/dist/cjs/api/resources/messages/resources/simulate/client/Client.js +231 -0
- package/dist/cjs/api/resources/messages/resources/simulate/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/messages/resources/simulate/client/index.js +2 -0
- package/dist/cjs/api/resources/messages/resources/simulate/index.d.ts +1 -0
- package/dist/cjs/api/resources/messages/resources/simulate/index.js +17 -0
- package/dist/cjs/api/types/SimulateMessageInput.d.ts +10 -0
- package/dist/cjs/api/types/SimulateMessageInput.js +3 -0
- package/dist/cjs/api/types/SimulateUserButton.d.ts +11 -0
- package/dist/cjs/api/types/SimulateUserButton.js +3 -0
- package/dist/cjs/api/types/SimulateUserMessage.d.ts +11 -0
- package/dist/cjs/api/types/SimulateUserMessage.js +3 -0
- package/dist/cjs/api/types/SimulateUserParams.d.ts +11 -0
- package/dist/cjs/api/types/SimulateUserParams.js +3 -0
- package/dist/cjs/api/types/SimulateUserResponse.d.ts +6 -0
- package/dist/cjs/api/types/SimulateUserResponse.js +3 -0
- package/dist/cjs/api/types/UserButtonPress.d.ts +25 -0
- package/dist/cjs/api/types/UserButtonPress.js +3 -0
- package/dist/cjs/api/types/UserButtonPressCall.d.ts +11 -0
- package/dist/cjs/api/types/UserButtonPressCall.js +3 -0
- package/dist/cjs/api/types/UserButtonPressOpenUrl.d.ts +11 -0
- package/dist/cjs/api/types/UserButtonPressOpenUrl.js +3 -0
- package/dist/cjs/api/types/UserButtonPressRequestUserLocation.d.ts +22 -0
- package/dist/cjs/api/types/UserButtonPressRequestUserLocation.js +3 -0
- package/dist/cjs/api/types/UserButtonPressScheduleEvent.d.ts +15 -0
- package/dist/cjs/api/types/UserButtonPressScheduleEvent.js +3 -0
- package/dist/cjs/api/types/UserButtonPressSendLocation.d.ts +24 -0
- package/dist/cjs/api/types/UserButtonPressSendLocation.js +3 -0
- package/dist/cjs/api/types/UserButtonPressTrigger.d.ts +11 -0
- package/dist/cjs/api/types/UserButtonPressTrigger.js +3 -0
- package/dist/cjs/api/types/index.d.ts +12 -0
- package/dist/cjs/api/types/index.js +12 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/resources/messages/client/Client.d.mts +3 -0
- package/dist/esm/api/resources/messages/client/Client.mjs +5 -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/simulate/client/Client.d.mts +125 -0
- package/dist/esm/api/resources/messages/resources/simulate/client/Client.mjs +194 -0
- package/dist/esm/api/resources/messages/resources/simulate/client/index.d.mts +1 -0
- package/dist/esm/api/resources/messages/resources/simulate/client/index.mjs +1 -0
- package/dist/esm/api/resources/messages/resources/simulate/index.d.mts +1 -0
- package/dist/esm/api/resources/messages/resources/simulate/index.mjs +1 -0
- package/dist/esm/api/types/SimulateMessageInput.d.mts +10 -0
- package/dist/esm/api/types/SimulateMessageInput.mjs +2 -0
- package/dist/esm/api/types/SimulateUserButton.d.mts +11 -0
- package/dist/esm/api/types/SimulateUserButton.mjs +2 -0
- package/dist/esm/api/types/SimulateUserMessage.d.mts +11 -0
- package/dist/esm/api/types/SimulateUserMessage.mjs +2 -0
- package/dist/esm/api/types/SimulateUserParams.d.mts +11 -0
- package/dist/esm/api/types/SimulateUserParams.mjs +2 -0
- package/dist/esm/api/types/SimulateUserResponse.d.mts +6 -0
- package/dist/esm/api/types/SimulateUserResponse.mjs +2 -0
- package/dist/esm/api/types/UserButtonPress.d.mts +25 -0
- package/dist/esm/api/types/UserButtonPress.mjs +2 -0
- package/dist/esm/api/types/UserButtonPressCall.d.mts +11 -0
- package/dist/esm/api/types/UserButtonPressCall.mjs +2 -0
- package/dist/esm/api/types/UserButtonPressOpenUrl.d.mts +11 -0
- package/dist/esm/api/types/UserButtonPressOpenUrl.mjs +2 -0
- package/dist/esm/api/types/UserButtonPressRequestUserLocation.d.mts +22 -0
- package/dist/esm/api/types/UserButtonPressRequestUserLocation.mjs +2 -0
- package/dist/esm/api/types/UserButtonPressScheduleEvent.d.mts +15 -0
- package/dist/esm/api/types/UserButtonPressScheduleEvent.mjs +2 -0
- package/dist/esm/api/types/UserButtonPressSendLocation.d.mts +24 -0
- package/dist/esm/api/types/UserButtonPressSendLocation.mjs +2 -0
- package/dist/esm/api/types/UserButtonPressTrigger.d.mts +11 -0
- package/dist/esm/api/types/UserButtonPressTrigger.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +12 -0
- package/dist/esm/api/types/index.mjs +12 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +70 -0
package/dist/cjs/Client.js
CHANGED
|
@@ -53,8 +53,8 @@ class PinnacleClient {
|
|
|
53
53
|
this._options = Object.assign(Object.assign({}, _options), { logging: core.logging.createLogger(_options === null || _options === void 0 ? void 0 : _options.logging), headers: (0, headers_js_1.mergeHeaders)({
|
|
54
54
|
"X-Fern-Language": "JavaScript",
|
|
55
55
|
"X-Fern-SDK-Name": "rcs-js",
|
|
56
|
-
"X-Fern-SDK-Version": "2.0.
|
|
57
|
-
"User-Agent": "rcs-js/2.0.
|
|
56
|
+
"X-Fern-SDK-Version": "2.0.19",
|
|
57
|
+
"User-Agent": "rcs-js/2.0.19",
|
|
58
58
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
59
59
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
60
60
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -7,6 +7,7 @@ import { Mms } from "../resources/mms/client/Client.js";
|
|
|
7
7
|
import { Rcs } from "../resources/rcs/client/Client.js";
|
|
8
8
|
import { Schedule } from "../resources/schedule/client/Client.js";
|
|
9
9
|
import { Schedules } from "../resources/schedules/client/Client.js";
|
|
10
|
+
import { Simulate } from "../resources/simulate/client/Client.js";
|
|
10
11
|
import { Sms } from "../resources/sms/client/Client.js";
|
|
11
12
|
export declare namespace Messages {
|
|
12
13
|
interface Options extends BaseClientOptions {
|
|
@@ -23,6 +24,7 @@ export declare class Messages {
|
|
|
23
24
|
protected _schedule: Schedule | undefined;
|
|
24
25
|
protected _schedules: Schedules | undefined;
|
|
25
26
|
protected _blasts: Blasts | undefined;
|
|
27
|
+
protected _simulate: Simulate | undefined;
|
|
26
28
|
constructor(_options: Messages.Options);
|
|
27
29
|
get sms(): Sms;
|
|
28
30
|
get mms(): Mms;
|
|
@@ -31,6 +33,7 @@ export declare class Messages {
|
|
|
31
33
|
get schedule(): Schedule;
|
|
32
34
|
get schedules(): Schedules;
|
|
33
35
|
get blasts(): Blasts;
|
|
36
|
+
get simulate(): Simulate;
|
|
34
37
|
/**
|
|
35
38
|
* Retrieve a previously sent message.
|
|
36
39
|
*
|
|
@@ -55,14 +55,15 @@ const Client_js_3 = require("../resources/mms/client/Client.js");
|
|
|
55
55
|
const Client_js_4 = require("../resources/rcs/client/Client.js");
|
|
56
56
|
const Client_js_5 = require("../resources/schedule/client/Client.js");
|
|
57
57
|
const Client_js_6 = require("../resources/schedules/client/Client.js");
|
|
58
|
-
const Client_js_7 = require("../resources/
|
|
58
|
+
const Client_js_7 = require("../resources/simulate/client/Client.js");
|
|
59
|
+
const Client_js_8 = require("../resources/sms/client/Client.js");
|
|
59
60
|
class Messages {
|
|
60
61
|
constructor(_options) {
|
|
61
62
|
this._options = _options;
|
|
62
63
|
}
|
|
63
64
|
get sms() {
|
|
64
65
|
var _a;
|
|
65
|
-
return ((_a = this._sms) !== null && _a !== void 0 ? _a : (this._sms = new
|
|
66
|
+
return ((_a = this._sms) !== null && _a !== void 0 ? _a : (this._sms = new Client_js_8.Sms(this._options)));
|
|
66
67
|
}
|
|
67
68
|
get mms() {
|
|
68
69
|
var _a;
|
|
@@ -88,6 +89,10 @@ class Messages {
|
|
|
88
89
|
var _a;
|
|
89
90
|
return ((_a = this._blasts) !== null && _a !== void 0 ? _a : (this._blasts = new Client_js_2.Blasts(this._options)));
|
|
90
91
|
}
|
|
92
|
+
get simulate() {
|
|
93
|
+
var _a;
|
|
94
|
+
return ((_a = this._simulate) !== null && _a !== void 0 ? _a : (this._simulate = new Client_js_7.Simulate(this._options)));
|
|
95
|
+
}
|
|
91
96
|
/**
|
|
92
97
|
* Retrieve a previously sent message.
|
|
93
98
|
*
|
|
@@ -12,6 +12,7 @@ export * from "./rcs/types/index.js";
|
|
|
12
12
|
export * as schedule from "./schedule/index.js";
|
|
13
13
|
export * from "./schedules/client/requests/index.js";
|
|
14
14
|
export * as schedules from "./schedules/index.js";
|
|
15
|
+
export * as simulate from "./simulate/index.js";
|
|
15
16
|
export * from "./sms/client/requests/index.js";
|
|
16
17
|
export * as sms from "./sms/index.js";
|
|
17
18
|
export * from "./sms/types/index.js";
|
|
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.sms = exports.schedules = exports.schedule = exports.rcs = exports.mms = exports.blasts = exports.blast = void 0;
|
|
39
|
+
exports.sms = exports.simulate = exports.schedules = exports.schedule = exports.rcs = exports.mms = exports.blasts = exports.blast = void 0;
|
|
40
40
|
__exportStar(require("./blast/client/requests/index.js"), exports);
|
|
41
41
|
exports.blast = __importStar(require("./blast/index.js"));
|
|
42
42
|
__exportStar(require("./blast/types/index.js"), exports);
|
|
@@ -51,6 +51,7 @@ __exportStar(require("./rcs/types/index.js"), exports);
|
|
|
51
51
|
exports.schedule = __importStar(require("./schedule/index.js"));
|
|
52
52
|
__exportStar(require("./schedules/client/requests/index.js"), exports);
|
|
53
53
|
exports.schedules = __importStar(require("./schedules/index.js"));
|
|
54
|
+
exports.simulate = __importStar(require("./simulate/index.js"));
|
|
54
55
|
__exportStar(require("./sms/client/requests/index.js"), exports);
|
|
55
56
|
exports.sms = __importStar(require("./sms/index.js"));
|
|
56
57
|
__exportStar(require("./sms/types/index.js"), exports);
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.js";
|
|
2
|
+
import * as core from "../../../../../../core/index.js";
|
|
3
|
+
import * as Pinnacle from "../../../../../index.js";
|
|
4
|
+
export declare namespace Simulate {
|
|
5
|
+
interface Options extends BaseClientOptions {
|
|
6
|
+
}
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class Simulate {
|
|
11
|
+
protected readonly _options: Simulate.Options;
|
|
12
|
+
constructor(_options: Simulate.Options);
|
|
13
|
+
/**
|
|
14
|
+
* Simulate inbound messages and button presses from a user.
|
|
15
|
+
*
|
|
16
|
+
* @param {Pinnacle.SimulateUserParams} request
|
|
17
|
+
* @param {Simulate.RequestOptions} requestOptions - Request-specific configuration.
|
|
18
|
+
*
|
|
19
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
20
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
21
|
+
* @throws {@link Pinnacle.ForbiddenError}
|
|
22
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* await client.messages.simulate.user({
|
|
26
|
+
* from: "+14155551234",
|
|
27
|
+
* to: "+14155555678",
|
|
28
|
+
* message: {
|
|
29
|
+
* text: "Hello from the test user!"
|
|
30
|
+
* }
|
|
31
|
+
* })
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* await client.messages.simulate.user({
|
|
35
|
+
* from: "+14155551234",
|
|
36
|
+
* to: "+14155555678",
|
|
37
|
+
* message: {
|
|
38
|
+
* mediaUrls: ["https://example.com/image.jpg"]
|
|
39
|
+
* }
|
|
40
|
+
* })
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* await client.messages.simulate.user({
|
|
44
|
+
* from: "+14155551234",
|
|
45
|
+
* to: "+14155555678",
|
|
46
|
+
* message: {
|
|
47
|
+
* text: "Check this out",
|
|
48
|
+
* mediaUrls: ["https://example.com/image.jpg"]
|
|
49
|
+
* }
|
|
50
|
+
* })
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* await client.messages.simulate.user({
|
|
54
|
+
* from: "+14155551234",
|
|
55
|
+
* to: "agent_abc123",
|
|
56
|
+
* button: {
|
|
57
|
+
* type: "trigger",
|
|
58
|
+
* title: "Sign Up",
|
|
59
|
+
* payload: "user_clicked_signup"
|
|
60
|
+
* }
|
|
61
|
+
* })
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* await client.messages.simulate.user({
|
|
65
|
+
* from: "+14155551234",
|
|
66
|
+
* to: "agent_abc123",
|
|
67
|
+
* button: {
|
|
68
|
+
* type: "openUrl",
|
|
69
|
+
* title: "Visit Website"
|
|
70
|
+
* }
|
|
71
|
+
* })
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* await client.messages.simulate.user({
|
|
75
|
+
* from: "+14155551234",
|
|
76
|
+
* to: "agent_abc123",
|
|
77
|
+
* button: {
|
|
78
|
+
* type: "call",
|
|
79
|
+
* title: "Call Us",
|
|
80
|
+
* payload: "+15555555555"
|
|
81
|
+
* }
|
|
82
|
+
* })
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* await client.messages.simulate.user({
|
|
86
|
+
* from: "+14155551234",
|
|
87
|
+
* to: "agent_abc123",
|
|
88
|
+
* button: {
|
|
89
|
+
* type: "scheduleEvent",
|
|
90
|
+
* title: "Add to Calendar",
|
|
91
|
+
* eventTitle: "Pinnacle Workshop",
|
|
92
|
+
* eventStartTime: "2025-12-12T10:00:00Z",
|
|
93
|
+
* eventEndTime: "2025-12-12T11:00:00Z"
|
|
94
|
+
* }
|
|
95
|
+
* })
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* await client.messages.simulate.user({
|
|
99
|
+
* from: "+14155551234",
|
|
100
|
+
* to: "agent_abc123",
|
|
101
|
+
* button: {
|
|
102
|
+
* type: "sendLocation",
|
|
103
|
+
* title: "View Location",
|
|
104
|
+
* name: "Pinnacle HQ",
|
|
105
|
+
* latLong: {
|
|
106
|
+
* lat: 37.7899,
|
|
107
|
+
* lng: -122.3969
|
|
108
|
+
* }
|
|
109
|
+
* }
|
|
110
|
+
* })
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* await client.messages.simulate.user({
|
|
114
|
+
* from: "+14155551234",
|
|
115
|
+
* to: "agent_abc123",
|
|
116
|
+
* button: {
|
|
117
|
+
* type: "requestUserLocation",
|
|
118
|
+
* title: "Share Location"
|
|
119
|
+
* }
|
|
120
|
+
* })
|
|
121
|
+
*/
|
|
122
|
+
user(request: Pinnacle.SimulateUserParams, requestOptions?: Simulate.RequestOptions): core.HttpResponsePromise<Pinnacle.SimulateUserResponse>;
|
|
123
|
+
private __user;
|
|
124
|
+
protected _getCustomAuthorizationHeaders(): Promise<Record<string, string | undefined>>;
|
|
125
|
+
}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.Simulate = void 0;
|
|
47
|
+
const headers_js_1 = require("../../../../../../core/headers.js");
|
|
48
|
+
const core = __importStar(require("../../../../../../core/index.js"));
|
|
49
|
+
const environments = __importStar(require("../../../../../../environments.js"));
|
|
50
|
+
const errors = __importStar(require("../../../../../../errors/index.js"));
|
|
51
|
+
const Pinnacle = __importStar(require("../../../../../index.js"));
|
|
52
|
+
class Simulate {
|
|
53
|
+
constructor(_options) {
|
|
54
|
+
this._options = _options;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Simulate inbound messages and button presses from a user.
|
|
58
|
+
*
|
|
59
|
+
* @param {Pinnacle.SimulateUserParams} request
|
|
60
|
+
* @param {Simulate.RequestOptions} requestOptions - Request-specific configuration.
|
|
61
|
+
*
|
|
62
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
63
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
64
|
+
* @throws {@link Pinnacle.ForbiddenError}
|
|
65
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* await client.messages.simulate.user({
|
|
69
|
+
* from: "+14155551234",
|
|
70
|
+
* to: "+14155555678",
|
|
71
|
+
* message: {
|
|
72
|
+
* text: "Hello from the test user!"
|
|
73
|
+
* }
|
|
74
|
+
* })
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* await client.messages.simulate.user({
|
|
78
|
+
* from: "+14155551234",
|
|
79
|
+
* to: "+14155555678",
|
|
80
|
+
* message: {
|
|
81
|
+
* mediaUrls: ["https://example.com/image.jpg"]
|
|
82
|
+
* }
|
|
83
|
+
* })
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* await client.messages.simulate.user({
|
|
87
|
+
* from: "+14155551234",
|
|
88
|
+
* to: "+14155555678",
|
|
89
|
+
* message: {
|
|
90
|
+
* text: "Check this out",
|
|
91
|
+
* mediaUrls: ["https://example.com/image.jpg"]
|
|
92
|
+
* }
|
|
93
|
+
* })
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* await client.messages.simulate.user({
|
|
97
|
+
* from: "+14155551234",
|
|
98
|
+
* to: "agent_abc123",
|
|
99
|
+
* button: {
|
|
100
|
+
* type: "trigger",
|
|
101
|
+
* title: "Sign Up",
|
|
102
|
+
* payload: "user_clicked_signup"
|
|
103
|
+
* }
|
|
104
|
+
* })
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* await client.messages.simulate.user({
|
|
108
|
+
* from: "+14155551234",
|
|
109
|
+
* to: "agent_abc123",
|
|
110
|
+
* button: {
|
|
111
|
+
* type: "openUrl",
|
|
112
|
+
* title: "Visit Website"
|
|
113
|
+
* }
|
|
114
|
+
* })
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* await client.messages.simulate.user({
|
|
118
|
+
* from: "+14155551234",
|
|
119
|
+
* to: "agent_abc123",
|
|
120
|
+
* button: {
|
|
121
|
+
* type: "call",
|
|
122
|
+
* title: "Call Us",
|
|
123
|
+
* payload: "+15555555555"
|
|
124
|
+
* }
|
|
125
|
+
* })
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* await client.messages.simulate.user({
|
|
129
|
+
* from: "+14155551234",
|
|
130
|
+
* to: "agent_abc123",
|
|
131
|
+
* button: {
|
|
132
|
+
* type: "scheduleEvent",
|
|
133
|
+
* title: "Add to Calendar",
|
|
134
|
+
* eventTitle: "Pinnacle Workshop",
|
|
135
|
+
* eventStartTime: "2025-12-12T10:00:00Z",
|
|
136
|
+
* eventEndTime: "2025-12-12T11:00:00Z"
|
|
137
|
+
* }
|
|
138
|
+
* })
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* await client.messages.simulate.user({
|
|
142
|
+
* from: "+14155551234",
|
|
143
|
+
* to: "agent_abc123",
|
|
144
|
+
* button: {
|
|
145
|
+
* type: "sendLocation",
|
|
146
|
+
* title: "View Location",
|
|
147
|
+
* name: "Pinnacle HQ",
|
|
148
|
+
* latLong: {
|
|
149
|
+
* lat: 37.7899,
|
|
150
|
+
* lng: -122.3969
|
|
151
|
+
* }
|
|
152
|
+
* }
|
|
153
|
+
* })
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* await client.messages.simulate.user({
|
|
157
|
+
* from: "+14155551234",
|
|
158
|
+
* to: "agent_abc123",
|
|
159
|
+
* button: {
|
|
160
|
+
* type: "requestUserLocation",
|
|
161
|
+
* title: "Share Location"
|
|
162
|
+
* }
|
|
163
|
+
* })
|
|
164
|
+
*/
|
|
165
|
+
user(request, requestOptions) {
|
|
166
|
+
return core.HttpResponsePromise.fromPromise(this.__user(request, requestOptions));
|
|
167
|
+
}
|
|
168
|
+
__user(request, requestOptions) {
|
|
169
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
170
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
171
|
+
const _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);
|
|
172
|
+
const _response = yield core.fetcher({
|
|
173
|
+
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/simulate/user"),
|
|
174
|
+
method: "POST",
|
|
175
|
+
headers: _headers,
|
|
176
|
+
contentType: "application/json",
|
|
177
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
178
|
+
requestType: "json",
|
|
179
|
+
body: request,
|
|
180
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
181
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
182
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
183
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
184
|
+
logging: this._options.logging,
|
|
185
|
+
});
|
|
186
|
+
if (_response.ok) {
|
|
187
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
188
|
+
}
|
|
189
|
+
if (_response.error.reason === "status-code") {
|
|
190
|
+
switch (_response.error.statusCode) {
|
|
191
|
+
case 400:
|
|
192
|
+
throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
|
|
193
|
+
case 401:
|
|
194
|
+
throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
195
|
+
case 403:
|
|
196
|
+
throw new Pinnacle.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
197
|
+
case 500:
|
|
198
|
+
throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
|
|
199
|
+
default:
|
|
200
|
+
throw new errors.PinnacleError({
|
|
201
|
+
statusCode: _response.error.statusCode,
|
|
202
|
+
body: _response.error.body,
|
|
203
|
+
rawResponse: _response.rawResponse,
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
switch (_response.error.reason) {
|
|
208
|
+
case "non-json":
|
|
209
|
+
throw new errors.PinnacleError({
|
|
210
|
+
statusCode: _response.error.statusCode,
|
|
211
|
+
body: _response.error.rawBody,
|
|
212
|
+
rawResponse: _response.rawResponse,
|
|
213
|
+
});
|
|
214
|
+
case "timeout":
|
|
215
|
+
throw new errors.PinnacleTimeoutError("Timeout exceeded when calling POST /messages/simulate/user.");
|
|
216
|
+
case "unknown":
|
|
217
|
+
throw new errors.PinnacleError({
|
|
218
|
+
message: _response.error.errorMessage,
|
|
219
|
+
rawResponse: _response.rawResponse,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
_getCustomAuthorizationHeaders() {
|
|
225
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
226
|
+
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
227
|
+
return { "PINNACLE-API-KEY": apiKeyValue };
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
exports.Simulate = Simulate;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User message payload. At least one of `text` or `mediaUrls` must be non-empty.
|
|
3
|
+
* Send only `text` to simulate an inbound SMS; include `mediaUrls` to simulate an inbound MMS.
|
|
4
|
+
*/
|
|
5
|
+
export interface SimulateMessageInput {
|
|
6
|
+
/** Text message sent by the user. */
|
|
7
|
+
text?: string;
|
|
8
|
+
/** URLs of media files sent by the user. */
|
|
9
|
+
mediaUrls?: string[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as Pinnacle from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Simulate a button press from a user.
|
|
4
|
+
*/
|
|
5
|
+
export interface SimulateUserButton {
|
|
6
|
+
/** User phone number in E.164 format. */
|
|
7
|
+
from: string;
|
|
8
|
+
/** RCS agent ID (prefixed with `agent_`). */
|
|
9
|
+
to: string;
|
|
10
|
+
button: Pinnacle.UserButtonPress;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as Pinnacle from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Simulate an inbound message from a user.
|
|
4
|
+
*/
|
|
5
|
+
export interface SimulateUserMessage {
|
|
6
|
+
/** User phone number in E.164 format. */
|
|
7
|
+
from: string;
|
|
8
|
+
/** Receiver phone number in E.164 format or RCS agent ID (prefixed with `agent_`). */
|
|
9
|
+
to: string;
|
|
10
|
+
message: Pinnacle.SimulateMessageInput;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as Pinnacle from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Request body for simulating an inbound event from a user.
|
|
4
|
+
*/
|
|
5
|
+
export type SimulateUserParams =
|
|
6
|
+
/**
|
|
7
|
+
* Simulate an inbound message from a user. */
|
|
8
|
+
Pinnacle.SimulateUserMessage
|
|
9
|
+
/**
|
|
10
|
+
* Simulate a button press from a user. Only for RCS agents. */
|
|
11
|
+
| Pinnacle.SimulateUserButton;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type * as Pinnacle from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Discriminated union of button presses that can be simulated for a user.
|
|
4
|
+
*/
|
|
5
|
+
export type UserButtonPress = Pinnacle.UserButtonPress.Trigger | Pinnacle.UserButtonPress.OpenUrl | Pinnacle.UserButtonPress.Call | Pinnacle.UserButtonPress.ScheduleEvent | Pinnacle.UserButtonPress.SendLocation | Pinnacle.UserButtonPress.RequestUserLocation;
|
|
6
|
+
export declare namespace UserButtonPress {
|
|
7
|
+
interface Trigger extends Pinnacle.UserButtonPressTrigger {
|
|
8
|
+
type: "trigger";
|
|
9
|
+
}
|
|
10
|
+
interface OpenUrl extends Pinnacle.UserButtonPressOpenUrl {
|
|
11
|
+
type: "openUrl";
|
|
12
|
+
}
|
|
13
|
+
interface Call extends Pinnacle.UserButtonPressCall {
|
|
14
|
+
type: "call";
|
|
15
|
+
}
|
|
16
|
+
interface ScheduleEvent extends Pinnacle.UserButtonPressScheduleEvent {
|
|
17
|
+
type: "scheduleEvent";
|
|
18
|
+
}
|
|
19
|
+
interface SendLocation extends Pinnacle.UserButtonPressSendLocation {
|
|
20
|
+
type: "sendLocation";
|
|
21
|
+
}
|
|
22
|
+
interface RequestUserLocation extends Pinnacle.UserButtonPressRequestUserLocation {
|
|
23
|
+
type: "requestUserLocation";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simulates when a user presses a `call` button.
|
|
3
|
+
*/
|
|
4
|
+
export interface UserButtonPressCall {
|
|
5
|
+
/** Name of the button that you want to press. */
|
|
6
|
+
title: string;
|
|
7
|
+
/** Metadata attached to the button. */
|
|
8
|
+
metadata?: string;
|
|
9
|
+
/** Destination phone number in E.164 format. */
|
|
10
|
+
payload?: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simulates when a user presses an `openUrl` button.
|
|
3
|
+
*/
|
|
4
|
+
export interface UserButtonPressOpenUrl {
|
|
5
|
+
/** Name of the button that you want to press. */
|
|
6
|
+
title: string;
|
|
7
|
+
/** Metadata attached to the button. */
|
|
8
|
+
metadata?: string;
|
|
9
|
+
/** Destination URL of the tapped button. */
|
|
10
|
+
payload?: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simulates when a user presses a `requestUserLocation` button.
|
|
3
|
+
*/
|
|
4
|
+
export interface UserButtonPressRequestUserLocation {
|
|
5
|
+
/** Name of the button that you want to press. */
|
|
6
|
+
title: string;
|
|
7
|
+
/** Metadata attached to the button. */
|
|
8
|
+
metadata?: string;
|
|
9
|
+
/** Location the simulated user responded with. */
|
|
10
|
+
location?: UserButtonPressRequestUserLocation.Location;
|
|
11
|
+
}
|
|
12
|
+
export declare namespace UserButtonPressRequestUserLocation {
|
|
13
|
+
/**
|
|
14
|
+
* Location the simulated user responded with.
|
|
15
|
+
*/
|
|
16
|
+
interface Location {
|
|
17
|
+
text?: string;
|
|
18
|
+
latitude?: number;
|
|
19
|
+
longitude?: number;
|
|
20
|
+
address?: string;
|
|
21
|
+
}
|
|
22
|
+
}
|