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
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simulates when a user presses a `scheduleEvent` button.
|
|
3
|
+
*/
|
|
4
|
+
export interface UserButtonPressScheduleEvent {
|
|
5
|
+
/** Name of the button that you want to press. */
|
|
6
|
+
title: string;
|
|
7
|
+
/** Metadata attached to the button. */
|
|
8
|
+
metadata?: string;
|
|
9
|
+
/** ISO 8601 start time. Defaults to the current time. */
|
|
10
|
+
eventStartTime?: string;
|
|
11
|
+
/** ISO 8601 end time. Defaults to one hour after `eventStartTime`. */
|
|
12
|
+
eventEndTime?: string;
|
|
13
|
+
eventTitle?: string;
|
|
14
|
+
eventDescription?: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simulates when a user presses a `sendLocation` button.
|
|
3
|
+
*/
|
|
4
|
+
export interface UserButtonPressSendLocation {
|
|
5
|
+
/** Name of the button that you want to press. */
|
|
6
|
+
title: string;
|
|
7
|
+
/** Metadata attached to the button. */
|
|
8
|
+
metadata?: string;
|
|
9
|
+
/** Name of the location shared. */
|
|
10
|
+
name?: string;
|
|
11
|
+
/** Shared coordinates. */
|
|
12
|
+
latLong?: UserButtonPressSendLocation.LatLong;
|
|
13
|
+
}
|
|
14
|
+
export declare namespace UserButtonPressSendLocation {
|
|
15
|
+
/**
|
|
16
|
+
* Shared coordinates.
|
|
17
|
+
*/
|
|
18
|
+
interface LatLong {
|
|
19
|
+
/** Latitude of the shared location. */
|
|
20
|
+
lat?: number;
|
|
21
|
+
/** Longitude of the shared location. */
|
|
22
|
+
lng?: number;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simulates when a user presses a `trigger` button.
|
|
3
|
+
*/
|
|
4
|
+
export interface UserButtonPressTrigger {
|
|
5
|
+
/** Name of the button that you want to press. */
|
|
6
|
+
title: string;
|
|
7
|
+
/** Metadata attached to the button. */
|
|
8
|
+
metadata?: string;
|
|
9
|
+
/** Button's postback payload. */
|
|
10
|
+
payload?: string;
|
|
11
|
+
}
|
|
@@ -153,6 +153,11 @@ export * from "./SentRichMessageFallbackSms.js";
|
|
|
153
153
|
export * from "./SentSmsDetails.js";
|
|
154
154
|
export * from "./ShortenedUrl.js";
|
|
155
155
|
export * from "./ShortenedUrlWithClickData.js";
|
|
156
|
+
export * from "./SimulateMessageInput.js";
|
|
157
|
+
export * from "./SimulateUserButton.js";
|
|
158
|
+
export * from "./SimulateUserMessage.js";
|
|
159
|
+
export * from "./SimulateUserParams.js";
|
|
160
|
+
export * from "./SimulateUserResponse.js";
|
|
156
161
|
export * from "./SmsContent.js";
|
|
157
162
|
export * from "./SmsValidationResult.js";
|
|
158
163
|
export * from "./SubmissionResults.js";
|
|
@@ -169,6 +174,13 @@ export * from "./TollFreeStatusEnum.js";
|
|
|
169
174
|
export * from "./Tracking.js";
|
|
170
175
|
export * from "./UpdatedContactId.js";
|
|
171
176
|
export * from "./UploadResults.js";
|
|
177
|
+
export * from "./UserButtonPress.js";
|
|
178
|
+
export * from "./UserButtonPressCall.js";
|
|
179
|
+
export * from "./UserButtonPressOpenUrl.js";
|
|
180
|
+
export * from "./UserButtonPressRequestUserLocation.js";
|
|
181
|
+
export * from "./UserButtonPressScheduleEvent.js";
|
|
182
|
+
export * from "./UserButtonPressSendLocation.js";
|
|
183
|
+
export * from "./UserButtonPressTrigger.js";
|
|
172
184
|
export * from "./UserEvent.js";
|
|
173
185
|
export * from "./ValidateCampaignParams.js";
|
|
174
186
|
export * from "./ValidationErrorDetails.js";
|
|
@@ -169,6 +169,11 @@ __exportStar(require("./SentRichMessageFallbackSms.js"), exports);
|
|
|
169
169
|
__exportStar(require("./SentSmsDetails.js"), exports);
|
|
170
170
|
__exportStar(require("./ShortenedUrl.js"), exports);
|
|
171
171
|
__exportStar(require("./ShortenedUrlWithClickData.js"), exports);
|
|
172
|
+
__exportStar(require("./SimulateMessageInput.js"), exports);
|
|
173
|
+
__exportStar(require("./SimulateUserButton.js"), exports);
|
|
174
|
+
__exportStar(require("./SimulateUserMessage.js"), exports);
|
|
175
|
+
__exportStar(require("./SimulateUserParams.js"), exports);
|
|
176
|
+
__exportStar(require("./SimulateUserResponse.js"), exports);
|
|
172
177
|
__exportStar(require("./SmsContent.js"), exports);
|
|
173
178
|
__exportStar(require("./SmsValidationResult.js"), exports);
|
|
174
179
|
__exportStar(require("./SubmissionResults.js"), exports);
|
|
@@ -185,6 +190,13 @@ __exportStar(require("./TollFreeStatusEnum.js"), exports);
|
|
|
185
190
|
__exportStar(require("./Tracking.js"), exports);
|
|
186
191
|
__exportStar(require("./UpdatedContactId.js"), exports);
|
|
187
192
|
__exportStar(require("./UploadResults.js"), exports);
|
|
193
|
+
__exportStar(require("./UserButtonPress.js"), exports);
|
|
194
|
+
__exportStar(require("./UserButtonPressCall.js"), exports);
|
|
195
|
+
__exportStar(require("./UserButtonPressOpenUrl.js"), exports);
|
|
196
|
+
__exportStar(require("./UserButtonPressRequestUserLocation.js"), exports);
|
|
197
|
+
__exportStar(require("./UserButtonPressScheduleEvent.js"), exports);
|
|
198
|
+
__exportStar(require("./UserButtonPressSendLocation.js"), exports);
|
|
199
|
+
__exportStar(require("./UserButtonPressTrigger.js"), exports);
|
|
188
200
|
__exportStar(require("./UserEvent.js"), exports);
|
|
189
201
|
__exportStar(require("./ValidateCampaignParams.js"), exports);
|
|
190
202
|
__exportStar(require("./ValidationErrorDetails.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
1
|
+
export declare const SDK_VERSION = "2.0.19";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/Client.mjs
CHANGED
|
@@ -17,8 +17,8 @@ export class PinnacleClient {
|
|
|
17
17
|
this._options = Object.assign(Object.assign({}, _options), { logging: core.logging.createLogger(_options === null || _options === void 0 ? void 0 : _options.logging), headers: mergeHeaders({
|
|
18
18
|
"X-Fern-Language": "JavaScript",
|
|
19
19
|
"X-Fern-SDK-Name": "rcs-js",
|
|
20
|
-
"X-Fern-SDK-Version": "2.0.
|
|
21
|
-
"User-Agent": "rcs-js/2.0.
|
|
20
|
+
"X-Fern-SDK-Version": "2.0.19",
|
|
21
|
+
"User-Agent": "rcs-js/2.0.19",
|
|
22
22
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
23
23
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
24
24
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -7,6 +7,7 @@ import { Mms } from "../resources/mms/client/Client.mjs";
|
|
|
7
7
|
import { Rcs } from "../resources/rcs/client/Client.mjs";
|
|
8
8
|
import { Schedule } from "../resources/schedule/client/Client.mjs";
|
|
9
9
|
import { Schedules } from "../resources/schedules/client/Client.mjs";
|
|
10
|
+
import { Simulate } from "../resources/simulate/client/Client.mjs";
|
|
10
11
|
import { Sms } from "../resources/sms/client/Client.mjs";
|
|
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
|
*
|
|
@@ -19,6 +19,7 @@ import { Mms } from "../resources/mms/client/Client.mjs";
|
|
|
19
19
|
import { Rcs } from "../resources/rcs/client/Client.mjs";
|
|
20
20
|
import { Schedule } from "../resources/schedule/client/Client.mjs";
|
|
21
21
|
import { Schedules } from "../resources/schedules/client/Client.mjs";
|
|
22
|
+
import { Simulate } from "../resources/simulate/client/Client.mjs";
|
|
22
23
|
import { Sms } from "../resources/sms/client/Client.mjs";
|
|
23
24
|
export class Messages {
|
|
24
25
|
constructor(_options) {
|
|
@@ -52,6 +53,10 @@ export class Messages {
|
|
|
52
53
|
var _a;
|
|
53
54
|
return ((_a = this._blasts) !== null && _a !== void 0 ? _a : (this._blasts = new Blasts(this._options)));
|
|
54
55
|
}
|
|
56
|
+
get simulate() {
|
|
57
|
+
var _a;
|
|
58
|
+
return ((_a = this._simulate) !== null && _a !== void 0 ? _a : (this._simulate = new Simulate(this._options)));
|
|
59
|
+
}
|
|
55
60
|
/**
|
|
56
61
|
* Retrieve a previously sent message.
|
|
57
62
|
*
|
|
@@ -12,6 +12,7 @@ export * from "./rcs/types/index.mjs";
|
|
|
12
12
|
export * as schedule from "./schedule/index.mjs";
|
|
13
13
|
export * from "./schedules/client/requests/index.mjs";
|
|
14
14
|
export * as schedules from "./schedules/index.mjs";
|
|
15
|
+
export * as simulate from "./simulate/index.mjs";
|
|
15
16
|
export * from "./sms/client/requests/index.mjs";
|
|
16
17
|
export * as sms from "./sms/index.mjs";
|
|
17
18
|
export * from "./sms/types/index.mjs";
|
|
@@ -12,6 +12,7 @@ export * from "./rcs/types/index.mjs";
|
|
|
12
12
|
export * as schedule from "./schedule/index.mjs";
|
|
13
13
|
export * from "./schedules/client/requests/index.mjs";
|
|
14
14
|
export * as schedules from "./schedules/index.mjs";
|
|
15
|
+
export * as simulate from "./simulate/index.mjs";
|
|
15
16
|
export * from "./sms/client/requests/index.mjs";
|
|
16
17
|
export * as sms from "./sms/index.mjs";
|
|
17
18
|
export * from "./sms/types/index.mjs";
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.mjs";
|
|
2
|
+
import * as core from "../../../../../../core/index.mjs";
|
|
3
|
+
import * as Pinnacle from "../../../../../index.mjs";
|
|
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,194 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.mjs";
|
|
12
|
+
import * as core from "../../../../../../core/index.mjs";
|
|
13
|
+
import * as environments from "../../../../../../environments.mjs";
|
|
14
|
+
import * as errors from "../../../../../../errors/index.mjs";
|
|
15
|
+
import * as Pinnacle from "../../../../../index.mjs";
|
|
16
|
+
export class Simulate {
|
|
17
|
+
constructor(_options) {
|
|
18
|
+
this._options = _options;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Simulate inbound messages and button presses from a user.
|
|
22
|
+
*
|
|
23
|
+
* @param {Pinnacle.SimulateUserParams} request
|
|
24
|
+
* @param {Simulate.RequestOptions} requestOptions - Request-specific configuration.
|
|
25
|
+
*
|
|
26
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
27
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
28
|
+
* @throws {@link Pinnacle.ForbiddenError}
|
|
29
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* await client.messages.simulate.user({
|
|
33
|
+
* from: "+14155551234",
|
|
34
|
+
* to: "+14155555678",
|
|
35
|
+
* message: {
|
|
36
|
+
* text: "Hello from the test user!"
|
|
37
|
+
* }
|
|
38
|
+
* })
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* await client.messages.simulate.user({
|
|
42
|
+
* from: "+14155551234",
|
|
43
|
+
* to: "+14155555678",
|
|
44
|
+
* message: {
|
|
45
|
+
* mediaUrls: ["https://example.com/image.jpg"]
|
|
46
|
+
* }
|
|
47
|
+
* })
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* await client.messages.simulate.user({
|
|
51
|
+
* from: "+14155551234",
|
|
52
|
+
* to: "+14155555678",
|
|
53
|
+
* message: {
|
|
54
|
+
* text: "Check this out",
|
|
55
|
+
* mediaUrls: ["https://example.com/image.jpg"]
|
|
56
|
+
* }
|
|
57
|
+
* })
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* await client.messages.simulate.user({
|
|
61
|
+
* from: "+14155551234",
|
|
62
|
+
* to: "agent_abc123",
|
|
63
|
+
* button: {
|
|
64
|
+
* type: "trigger",
|
|
65
|
+
* title: "Sign Up",
|
|
66
|
+
* payload: "user_clicked_signup"
|
|
67
|
+
* }
|
|
68
|
+
* })
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* await client.messages.simulate.user({
|
|
72
|
+
* from: "+14155551234",
|
|
73
|
+
* to: "agent_abc123",
|
|
74
|
+
* button: {
|
|
75
|
+
* type: "openUrl",
|
|
76
|
+
* title: "Visit Website"
|
|
77
|
+
* }
|
|
78
|
+
* })
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* await client.messages.simulate.user({
|
|
82
|
+
* from: "+14155551234",
|
|
83
|
+
* to: "agent_abc123",
|
|
84
|
+
* button: {
|
|
85
|
+
* type: "call",
|
|
86
|
+
* title: "Call Us",
|
|
87
|
+
* payload: "+15555555555"
|
|
88
|
+
* }
|
|
89
|
+
* })
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* await client.messages.simulate.user({
|
|
93
|
+
* from: "+14155551234",
|
|
94
|
+
* to: "agent_abc123",
|
|
95
|
+
* button: {
|
|
96
|
+
* type: "scheduleEvent",
|
|
97
|
+
* title: "Add to Calendar",
|
|
98
|
+
* eventTitle: "Pinnacle Workshop",
|
|
99
|
+
* eventStartTime: "2025-12-12T10:00:00Z",
|
|
100
|
+
* eventEndTime: "2025-12-12T11:00:00Z"
|
|
101
|
+
* }
|
|
102
|
+
* })
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* await client.messages.simulate.user({
|
|
106
|
+
* from: "+14155551234",
|
|
107
|
+
* to: "agent_abc123",
|
|
108
|
+
* button: {
|
|
109
|
+
* type: "sendLocation",
|
|
110
|
+
* title: "View Location",
|
|
111
|
+
* name: "Pinnacle HQ",
|
|
112
|
+
* latLong: {
|
|
113
|
+
* lat: 37.7899,
|
|
114
|
+
* lng: -122.3969
|
|
115
|
+
* }
|
|
116
|
+
* }
|
|
117
|
+
* })
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* await client.messages.simulate.user({
|
|
121
|
+
* from: "+14155551234",
|
|
122
|
+
* to: "agent_abc123",
|
|
123
|
+
* button: {
|
|
124
|
+
* type: "requestUserLocation",
|
|
125
|
+
* title: "Share Location"
|
|
126
|
+
* }
|
|
127
|
+
* })
|
|
128
|
+
*/
|
|
129
|
+
user(request, requestOptions) {
|
|
130
|
+
return core.HttpResponsePromise.fromPromise(this.__user(request, requestOptions));
|
|
131
|
+
}
|
|
132
|
+
__user(request, requestOptions) {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
135
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
136
|
+
const _response = yield core.fetcher({
|
|
137
|
+
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"),
|
|
138
|
+
method: "POST",
|
|
139
|
+
headers: _headers,
|
|
140
|
+
contentType: "application/json",
|
|
141
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
142
|
+
requestType: "json",
|
|
143
|
+
body: request,
|
|
144
|
+
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,
|
|
145
|
+
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,
|
|
146
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
147
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
148
|
+
logging: this._options.logging,
|
|
149
|
+
});
|
|
150
|
+
if (_response.ok) {
|
|
151
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
152
|
+
}
|
|
153
|
+
if (_response.error.reason === "status-code") {
|
|
154
|
+
switch (_response.error.statusCode) {
|
|
155
|
+
case 400:
|
|
156
|
+
throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
|
|
157
|
+
case 401:
|
|
158
|
+
throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
159
|
+
case 403:
|
|
160
|
+
throw new Pinnacle.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
161
|
+
case 500:
|
|
162
|
+
throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
|
|
163
|
+
default:
|
|
164
|
+
throw new errors.PinnacleError({
|
|
165
|
+
statusCode: _response.error.statusCode,
|
|
166
|
+
body: _response.error.body,
|
|
167
|
+
rawResponse: _response.rawResponse,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
switch (_response.error.reason) {
|
|
172
|
+
case "non-json":
|
|
173
|
+
throw new errors.PinnacleError({
|
|
174
|
+
statusCode: _response.error.statusCode,
|
|
175
|
+
body: _response.error.rawBody,
|
|
176
|
+
rawResponse: _response.rawResponse,
|
|
177
|
+
});
|
|
178
|
+
case "timeout":
|
|
179
|
+
throw new errors.PinnacleTimeoutError("Timeout exceeded when calling POST /messages/simulate/user.");
|
|
180
|
+
case "unknown":
|
|
181
|
+
throw new errors.PinnacleError({
|
|
182
|
+
message: _response.error.errorMessage,
|
|
183
|
+
rawResponse: _response.rawResponse,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
_getCustomAuthorizationHeaders() {
|
|
189
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
190
|
+
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
191
|
+
return { "PINNACLE-API-KEY": apiKeyValue };
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -0,0 +1,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.mjs";
|
|
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.mjs";
|
|
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.mjs";
|
|
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.mjs";
|
|
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
|
+
}
|