@pingroom/sdk 0.7.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +288 -44
- package/dist/client.d.ts +27 -312
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +33 -1154
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +40 -6
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +56 -4
- package/dist/errors.js.map +1 -1
- package/dist/http.d.ts +12 -1
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +47 -18
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +3 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/internal/async.d.ts +2 -0
- package/dist/internal/async.d.ts.map +1 -1
- package/dist/internal/async.js +6 -0
- package/dist/internal/async.js.map +1 -1
- package/dist/internal/guards.d.ts +16 -0
- package/dist/internal/guards.d.ts.map +1 -1
- package/dist/internal/guards.js +22 -1
- package/dist/internal/guards.js.map +1 -1
- package/dist/internal/request.d.ts +41 -0
- package/dist/internal/request.d.ts.map +1 -0
- package/dist/internal/request.js +78 -0
- package/dist/internal/request.js.map +1 -0
- package/dist/internal/retry.d.ts +65 -0
- package/dist/internal/retry.d.ts.map +1 -0
- package/dist/internal/retry.js +126 -0
- package/dist/internal/retry.js.map +1 -0
- package/dist/internal/url.d.ts +9 -0
- package/dist/internal/url.d.ts.map +1 -1
- package/dist/internal/url.js +25 -0
- package/dist/internal/url.js.map +1 -1
- package/dist/internal/validate.d.ts +13 -0
- package/dist/internal/validate.d.ts.map +1 -0
- package/dist/internal/validate.js +36 -0
- package/dist/internal/validate.js.map +1 -0
- package/dist/linkPing.d.ts.map +1 -1
- package/dist/linkPing.js +6 -2
- package/dist/linkPing.js.map +1 -1
- package/dist/liveStatus.d.ts +106 -11
- package/dist/liveStatus.d.ts.map +1 -1
- package/dist/liveStatus.js +20 -3
- package/dist/liveStatus.js.map +1 -1
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +40 -10
- package/dist/mcp.js.map +1 -1
- package/dist/namespaces/actions.d.ts +50 -0
- package/dist/namespaces/actions.d.ts.map +1 -0
- package/dist/namespaces/actions.js +219 -0
- package/dist/namespaces/actions.js.map +1 -0
- package/dist/namespaces/approvals.d.ts +23 -0
- package/dist/namespaces/approvals.d.ts.map +1 -0
- package/dist/namespaces/approvals.js +78 -0
- package/dist/namespaces/approvals.js.map +1 -0
- package/dist/namespaces/attachments.d.ts +37 -0
- package/dist/namespaces/attachments.d.ts.map +1 -0
- package/dist/namespaces/attachments.js +91 -0
- package/dist/namespaces/attachments.js.map +1 -0
- package/dist/namespaces/auth.d.ts +58 -0
- package/dist/namespaces/auth.d.ts.map +1 -0
- package/dist/namespaces/auth.js +242 -0
- package/dist/namespaces/auth.js.map +1 -0
- package/dist/namespaces/directory.d.ts +10 -0
- package/dist/namespaces/directory.d.ts.map +1 -0
- package/dist/namespaces/directory.js +19 -0
- package/dist/namespaces/directory.js.map +1 -0
- package/dist/namespaces/handoffs.d.ts +47 -0
- package/dist/namespaces/handoffs.d.ts.map +1 -0
- package/dist/namespaces/handoffs.js +126 -0
- package/dist/namespaces/handoffs.js.map +1 -0
- package/dist/namespaces/inbox.d.ts +17 -0
- package/dist/namespaces/inbox.d.ts.map +1 -0
- package/dist/namespaces/inbox.js +192 -0
- package/dist/namespaces/inbox.js.map +1 -0
- package/dist/namespaces/live.d.ts +57 -0
- package/dist/namespaces/live.d.ts.map +1 -0
- package/dist/namespaces/live.js +116 -0
- package/dist/namespaces/live.js.map +1 -0
- package/dist/namespaces/notifications.d.ts +25 -0
- package/dist/namespaces/notifications.d.ts.map +1 -0
- package/dist/namespaces/notifications.js +128 -0
- package/dist/namespaces/notifications.js.map +1 -0
- package/dist/namespaces/profile.d.ts +19 -0
- package/dist/namespaces/profile.d.ts.map +1 -0
- package/dist/namespaces/profile.js +22 -0
- package/dist/namespaces/profile.js.map +1 -0
- package/dist/namespaces/questions.d.ts +41 -0
- package/dist/namespaces/questions.d.ts.map +1 -0
- package/dist/namespaces/questions.js +107 -0
- package/dist/namespaces/questions.js.map +1 -0
- package/dist/namespaces/rooms.d.ts +13 -0
- package/dist/namespaces/rooms.d.ts.map +1 -0
- package/dist/namespaces/rooms.js +41 -0
- package/dist/namespaces/rooms.js.map +1 -0
- package/dist/namespaces/webhooks.d.ts +11 -0
- package/dist/namespaces/webhooks.d.ts.map +1 -0
- package/dist/namespaces/webhooks.js +32 -0
- package/dist/namespaces/webhooks.js.map +1 -0
- package/dist/types/approvals.d.ts +62 -0
- package/dist/types/approvals.d.ts.map +1 -0
- package/dist/types/approvals.js +2 -0
- package/dist/types/approvals.js.map +1 -0
- package/dist/types/auth.d.ts +185 -0
- package/dist/types/auth.d.ts.map +1 -0
- package/dist/types/auth.js +2 -0
- package/dist/types/auth.js.map +1 -0
- package/dist/types/common.d.ts +43 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +2 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/handoffs.d.ts +121 -0
- package/dist/types/handoffs.d.ts.map +1 -0
- package/dist/types/handoffs.js +2 -0
- package/dist/types/handoffs.js.map +1 -0
- package/dist/types/inbox.d.ts +51 -0
- package/dist/types/inbox.d.ts.map +1 -0
- package/dist/types/inbox.js +2 -0
- package/dist/types/inbox.js.map +1 -0
- package/dist/types/notifications.d.ts +376 -0
- package/dist/types/notifications.d.ts.map +1 -0
- package/dist/types/notifications.js +2 -0
- package/dist/types/notifications.js.map +1 -0
- package/dist/types/profile.d.ts +30 -0
- package/dist/types/profile.d.ts.map +1 -0
- package/dist/types/profile.js +3 -0
- package/dist/types/profile.js.map +1 -0
- package/dist/types/questions.d.ts +210 -0
- package/dist/types/questions.d.ts.map +1 -0
- package/dist/types/questions.js +2 -0
- package/dist/types/questions.js.map +1 -0
- package/dist/types/rooms.d.ts +163 -0
- package/dist/types/rooms.d.ts.map +1 -0
- package/dist/types/rooms.js +3 -0
- package/dist/types/rooms.js.map +1 -0
- package/dist/types.d.ts +9 -1035
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/webhooks.d.ts +32 -5
- package/dist/webhooks.d.ts.map +1 -1
- package/dist/webhooks.js +44 -14
- package/dist/webhooks.js.map +1 -1
- package/package.json +4 -2
- package/src/client.ts +115 -0
- package/src/errors.ts +291 -0
- package/src/http.ts +225 -0
- package/src/index.ts +97 -0
- package/src/internal/async.ts +54 -0
- package/src/internal/guards.ts +129 -0
- package/src/internal/request.ts +97 -0
- package/src/internal/retry.ts +157 -0
- package/src/internal/url.ts +78 -0
- package/src/internal/validate.ts +42 -0
- package/src/linkPing.ts +56 -0
- package/src/liveStatus.ts +337 -0
- package/src/locationPing.ts +101 -0
- package/src/mcp.ts +161 -0
- package/src/namespaces/actions.ts +234 -0
- package/src/namespaces/approvals.ts +104 -0
- package/src/namespaces/attachments.ts +106 -0
- package/src/namespaces/auth.ts +284 -0
- package/src/namespaces/directory.ts +21 -0
- package/src/namespaces/handoffs.ts +160 -0
- package/src/namespaces/inbox.ts +253 -0
- package/src/namespaces/live.ts +134 -0
- package/src/namespaces/notifications.ts +152 -0
- package/src/namespaces/profile.ts +24 -0
- package/src/namespaces/questions.ts +133 -0
- package/src/namespaces/rooms.ts +53 -0
- package/src/namespaces/webhooks.ts +38 -0
- package/src/types/approvals.ts +67 -0
- package/src/types/auth.ts +202 -0
- package/src/types/common.ts +74 -0
- package/src/types/handoffs.ts +148 -0
- package/src/types/inbox.ts +64 -0
- package/src/types/notifications.ts +393 -0
- package/src/types/profile.ts +37 -0
- package/src/types/questions.ts +226 -0
- package/src/types/rooms.ts +169 -0
- package/src/types.ts +17 -0
- package/src/version.ts +2 -0
- package/src/webhooks.ts +373 -0
- package/dist/liveActivity.d.ts +0 -101
- package/dist/liveActivity.d.ts.map +0 -1
- package/dist/liveActivity.js +0 -83
- package/dist/liveActivity.js.map +0 -1
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import type { JsonObject } from './common.js';
|
|
2
|
+
|
|
3
|
+
// --- questions ------------------------------------------------------------
|
|
4
|
+
//
|
|
5
|
+
// The general human-in-the-loop primitive. An approval is the two-option case;
|
|
6
|
+
// a Question generalizes it to 2–4 options and/or a short typed answer, with a
|
|
7
|
+
// responder scope and a mandatory-but-defaulted expiry. First valid answer wins,
|
|
8
|
+
// unless the Question is a poll (`resolution_policy: 'all'`), where everyone
|
|
9
|
+
// asked gets one final vote and `results` carries the tally.
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The authenticated human who answered a Question or handoff (never
|
|
13
|
+
* caller-supplied).
|
|
14
|
+
*
|
|
15
|
+
* Every field is redacted to `null` together when the caller is not entitled to
|
|
16
|
+
* see who answered, which is why `id` is nullable even on a decided question.
|
|
17
|
+
* The server sends all five fields from both `QuestionPresenter::responder` and
|
|
18
|
+
* the handoff presenter; the type previously declared only `id` and
|
|
19
|
+
* `display_name`, and being a closed object type that made the avatar fields
|
|
20
|
+
* unreachable without a cast.
|
|
21
|
+
*/
|
|
22
|
+
export interface QuestionResponder {
|
|
23
|
+
id: string | null;
|
|
24
|
+
display_name: string | null;
|
|
25
|
+
profile_image_url: string | null;
|
|
26
|
+
emoji: string | null;
|
|
27
|
+
color: string | null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** The lifecycle states of a Question. Terminal states are immutable. */
|
|
31
|
+
export type QuestionState = 'pending' | 'answered' | 'expired' | 'cancelled';
|
|
32
|
+
|
|
33
|
+
/** Who may answer: `direct` (one named person) or `room` (any eligible member). */
|
|
34
|
+
export type ResponderScope = 'direct' | 'room';
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* How a room Question resolves: `first` (the default — the first valid answer
|
|
38
|
+
* wins) or `all` (a poll — everyone asked votes once; it closes when they all
|
|
39
|
+
* have, or at its deadline).
|
|
40
|
+
*/
|
|
41
|
+
export type QuestionResolutionPolicy = 'first' | 'all';
|
|
42
|
+
|
|
43
|
+
/** One option offered on a Question. A bare string is shorthand for `{ value, label: value }`. */
|
|
44
|
+
export interface QuestionOptionInput {
|
|
45
|
+
/** Stable machine token returned as the answer (1–40 chars, unique per question). */
|
|
46
|
+
value: string;
|
|
47
|
+
/** Human text on the button (defaults to `value`; 1–40 chars). */
|
|
48
|
+
label?: string;
|
|
49
|
+
/** Presentation hint: `primary` = brand-strike affirmative, `danger` = cancel. */
|
|
50
|
+
style?: 'primary' | 'danger' | 'default';
|
|
51
|
+
/** Legacy boolean form of `style: 'primary'`. */
|
|
52
|
+
primary?: boolean;
|
|
53
|
+
/** Legacy boolean form of `style: 'danger'`. */
|
|
54
|
+
destructive?: boolean;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export type QuestionOptionSpec = string | QuestionOptionInput;
|
|
58
|
+
|
|
59
|
+
/** Invite a short typed answer, on its own (text-only) or alongside options. */
|
|
60
|
+
export interface QuestionTextInput {
|
|
61
|
+
placeholder?: string;
|
|
62
|
+
/** 1–60 (default 60). A value outside that range is refused with a 422. */
|
|
63
|
+
max_length?: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface QuestionInput {
|
|
67
|
+
/** The question the human reads (required, ≤ 500 chars). */
|
|
68
|
+
prompt: string;
|
|
69
|
+
/** Optional secondary line, e.g. a build number (≤ 40 chars). */
|
|
70
|
+
context?: string;
|
|
71
|
+
/** 2–4 options. Omit for the binary Approve/Deny default (the lock-screen fast path). */
|
|
72
|
+
options?: QuestionOptionSpec[];
|
|
73
|
+
/** Offer a typed answer instead of / alongside options. */
|
|
74
|
+
text_input?: QuestionTextInput;
|
|
75
|
+
/** `direct` (defaults to your bound user) or `room` (any eligible member). Default `direct`. */
|
|
76
|
+
responder_scope?: ResponderScope;
|
|
77
|
+
/**
|
|
78
|
+
* `first` (default) or `all` to poll the room: every member except your bound
|
|
79
|
+
* human gets one final vote. A poll implies `room` scope when
|
|
80
|
+
* `responder_scope` is omitted, and cannot be combined with
|
|
81
|
+
* `responder_scope: 'direct'`, `target_user_id`, or `text_input`. If your
|
|
82
|
+
* bound human is the room's only member the server falls back to a `direct`
|
|
83
|
+
* `first` Question — check `resolution_policy` on the returned Question.
|
|
84
|
+
*/
|
|
85
|
+
resolution_policy?: QuestionResolutionPolicy;
|
|
86
|
+
/** For `direct` scope: a specific room member (UUID). Defaults to the bound user. */
|
|
87
|
+
target_user_id?: string;
|
|
88
|
+
/** Seconds until expiry. Omit for the server default (1h); clamped to 30–86400. A poll with at least one vote closes `answered` at this deadline. */
|
|
89
|
+
ttl?: number;
|
|
90
|
+
data?: JsonObject;
|
|
91
|
+
correlation_id?: string;
|
|
92
|
+
reply_to?: string;
|
|
93
|
+
/** Ordered ids from `attachments.upload()` (max 4). Same single-use rules as PingInput. */
|
|
94
|
+
attachment_ids?: string[];
|
|
95
|
+
/**
|
|
96
|
+
* Sent as the `Idempotency-Key` header (1–255 printable ASCII characters,
|
|
97
|
+
* spaces allowed). Reuse this key when retrying the same question creation.
|
|
98
|
+
*/
|
|
99
|
+
idempotencyKey?: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** A resolved option on the Question wire shape. */
|
|
103
|
+
export interface QuestionOption {
|
|
104
|
+
value: string;
|
|
105
|
+
label: string;
|
|
106
|
+
primary?: boolean;
|
|
107
|
+
destructive?: boolean;
|
|
108
|
+
[key: string]: unknown;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The resolution, present once `state === 'answered'` — except on a tied poll,
|
|
113
|
+
* which is `answered` with a null `answer` (read `results` instead).
|
|
114
|
+
*/
|
|
115
|
+
export interface QuestionAnswer {
|
|
116
|
+
/** The chosen option's `value` (a poll's leading option), or null for a text-only answer. */
|
|
117
|
+
value: string | null;
|
|
118
|
+
/** The chosen option's `label`. */
|
|
119
|
+
label: string | null;
|
|
120
|
+
/** The typed answer, when the question invited one. Always null on a poll. */
|
|
121
|
+
text: string | null;
|
|
122
|
+
/**
|
|
123
|
+
* The authenticated human who answered (never caller-supplied). Present once
|
|
124
|
+
* the question is decided — but every field is redacted to `null` when the
|
|
125
|
+
* caller is not entitled to see who answered, so `id` is nullable even here.
|
|
126
|
+
* Null on a poll: the room chose the answer, and the voters are in
|
|
127
|
+
* `results.responses`. Matches `HandoffAnswer.responder`.
|
|
128
|
+
*/
|
|
129
|
+
responder: QuestionResponder | null;
|
|
130
|
+
answered_at: string | null;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** One option's tally in a poll's {@link QuestionPollResults}. */
|
|
134
|
+
export interface QuestionPollOptionResult {
|
|
135
|
+
value: string;
|
|
136
|
+
label: string;
|
|
137
|
+
/** Votes cast for this option (0 when nobody chose it). */
|
|
138
|
+
count: number;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** One cast vote in a poll's {@link QuestionPollResults.responses}. */
|
|
142
|
+
export interface QuestionPollResponse {
|
|
143
|
+
value: string;
|
|
144
|
+
label: string;
|
|
145
|
+
/** Who voted. Every field is `null` when the caller may not see who answered. */
|
|
146
|
+
responder: QuestionResponder;
|
|
147
|
+
answered_at: string | null;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** The reading person's own seat in a poll. */
|
|
151
|
+
export interface QuestionPollViewer {
|
|
152
|
+
/** Whether the poll asked this person. */
|
|
153
|
+
asked: boolean;
|
|
154
|
+
/** The value they voted, or null until they vote. */
|
|
155
|
+
response: string | null;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* A poll's tally (`resolution_policy: 'all'`). Present on every read of a poll
|
|
160
|
+
* — including while it is still `pending` — and `null` on a `first` Question.
|
|
161
|
+
*/
|
|
162
|
+
export interface QuestionPollResults {
|
|
163
|
+
/** People the poll asked, fixed when it was created. */
|
|
164
|
+
audience_count: number;
|
|
165
|
+
/** Votes cast so far (exact). */
|
|
166
|
+
response_count: number;
|
|
167
|
+
/** Every option, in display order, with its count. */
|
|
168
|
+
options: QuestionPollOptionResult[];
|
|
169
|
+
/** Up to the 100 most recent votes, oldest first. */
|
|
170
|
+
responses: QuestionPollResponse[];
|
|
171
|
+
/** Only on a signed-in person's own surfaces; always `null` on agent reads and webhook events. */
|
|
172
|
+
viewer: QuestionPollViewer | null;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** The public Question wire shape — identical across ask / get / wait / list. */
|
|
176
|
+
export interface Question {
|
|
177
|
+
id: string;
|
|
178
|
+
/** Canonical delivery notification when supplied by the server. */
|
|
179
|
+
notification_id?: string | null;
|
|
180
|
+
kind: 'question';
|
|
181
|
+
prompt: string;
|
|
182
|
+
context: string | null;
|
|
183
|
+
options: QuestionOption[];
|
|
184
|
+
text_input: { placeholder: string | null; max_length: number } | null;
|
|
185
|
+
responder_scope: ResponderScope;
|
|
186
|
+
target_user_id: string | null;
|
|
187
|
+
/** `first` or `all` (a poll). Open-ended so a future policy does not break callers. */
|
|
188
|
+
resolution_policy: QuestionResolutionPolicy | (string & {});
|
|
189
|
+
state: QuestionState;
|
|
190
|
+
/** Null until answered, and on a tied poll even once `answered`. */
|
|
191
|
+
answer: QuestionAnswer | null;
|
|
192
|
+
/** A poll's tally; `null` on a `first` Question (absent on servers before Question Protocol 1.3). */
|
|
193
|
+
results?: QuestionPollResults | null;
|
|
194
|
+
expires_at: string | null;
|
|
195
|
+
resolved_at: string | null;
|
|
196
|
+
correlation_id: string | null;
|
|
197
|
+
reply_to: string | null;
|
|
198
|
+
data: JsonObject | null;
|
|
199
|
+
created_at: string | null;
|
|
200
|
+
room?: { code: string; name: string; icon: string | null; color: string | null };
|
|
201
|
+
room_code?: string;
|
|
202
|
+
asker?: {
|
|
203
|
+
/**
|
|
204
|
+
* `'user'` for a human-asked Question (composer "Add Options"), `'agent'`
|
|
205
|
+
* when an agent asked it. Both reach an agent's listen/list feed, so this
|
|
206
|
+
* cannot be narrowed to `'agent'`.
|
|
207
|
+
*/
|
|
208
|
+
type: 'agent' | 'user';
|
|
209
|
+
id: string | null;
|
|
210
|
+
handle: string | null;
|
|
211
|
+
display_name: string | null;
|
|
212
|
+
avatar_url: string | null;
|
|
213
|
+
};
|
|
214
|
+
[key: string]: unknown;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export interface WaitQuestionInput {
|
|
218
|
+
/** Seconds the server holds the connection (0–30, default 20). */
|
|
219
|
+
timeout?: number;
|
|
220
|
+
signal?: AbortSignal;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export interface ListQuestionsInput {
|
|
224
|
+
/** Filter by state; `all` returns every state. Omit for the recent window across states. */
|
|
225
|
+
state?: QuestionState | 'all';
|
|
226
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
// --- rooms & quick actions ------------------------------------------------
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The detail every press of a quick action must carry. `location` needs
|
|
5
|
+
* `data.location`, `link` needs `data.url`, `file`/`photo`/`pdf` need
|
|
6
|
+
* `attachment_ids` (photo: jpg/png only, pdf: pdf only). A press without it is
|
|
7
|
+
* refused with `422 quick_action_input_required` and nothing is sent.
|
|
8
|
+
*/
|
|
9
|
+
export type QuickActionInputType = 'none' | 'location' | 'link' | 'file' | 'photo' | 'pdf';
|
|
10
|
+
|
|
11
|
+
export interface QuickActionInput {
|
|
12
|
+
action_number: number;
|
|
13
|
+
label: string;
|
|
14
|
+
/**
|
|
15
|
+
* Emoji or icon id. Sending `label` and `icon` both empty reserves the slot
|
|
16
|
+
* as disabled: it stays in the layout and a press answers `404
|
|
17
|
+
* action_not_configured`.
|
|
18
|
+
*/
|
|
19
|
+
icon: string;
|
|
20
|
+
sound?: string | null;
|
|
21
|
+
haptic_style?: string | null;
|
|
22
|
+
/** Every fire of this reusable action opens the acknowledgement lifecycle. */
|
|
23
|
+
requires_ack?: boolean;
|
|
24
|
+
/** Omit to keep the stored value; new slots default to `none`. */
|
|
25
|
+
input_type?: QuickActionInputType;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Body of `actions.updateLayout()`. `page_order` lists the new page positions:
|
|
30
|
+
* each entry is the ORIGINAL page number (1–4) to keep at that index, or
|
|
31
|
+
* `null` for a fresh blank page; original pages absent from the list are
|
|
32
|
+
* deleted. `actions` is the full renumbered 4–16 set. `base_action_ids` is
|
|
33
|
+
* every stored action id in `action_number` order as last read — a stale
|
|
34
|
+
* snapshot is refused with `409 quick_action_layout_changed`.
|
|
35
|
+
*/
|
|
36
|
+
export interface UpdateQuickActionLayoutInput {
|
|
37
|
+
base_action_ids: string[];
|
|
38
|
+
page_order: Array<number | null>;
|
|
39
|
+
actions: QuickActionInput[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface CreateRoomInput {
|
|
43
|
+
name: string;
|
|
44
|
+
icon: string;
|
|
45
|
+
color: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface CreatePublicRoomInput extends CreateRoomInput {
|
|
49
|
+
handle: string;
|
|
50
|
+
description?: string;
|
|
51
|
+
everyone_can_trigger?: boolean;
|
|
52
|
+
is_password_protected?: boolean;
|
|
53
|
+
password?: string;
|
|
54
|
+
actions?: QuickActionInput[];
|
|
55
|
+
category?: string;
|
|
56
|
+
show_owner?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Public-room location for nearby discovery. Send all three or none —
|
|
59
|
+
* `createPublic()` rejects a partial trio locally, the server with a 422.
|
|
60
|
+
*/
|
|
61
|
+
location_name?: string;
|
|
62
|
+
location_latitude?: number;
|
|
63
|
+
location_longitude?: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface JoinRoomInput {
|
|
67
|
+
invite_code: string;
|
|
68
|
+
password?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface UpdateQuickActionInput {
|
|
72
|
+
/**
|
|
73
|
+
* The Ping's title. Must be sent, but may be `''` — a Ping can be named by
|
|
74
|
+
* its emoji alone, and the app renders an untitled one as just the emoji.
|
|
75
|
+
*/
|
|
76
|
+
label: string;
|
|
77
|
+
icon: string;
|
|
78
|
+
sound?: string | null;
|
|
79
|
+
haptic_style?: string | null;
|
|
80
|
+
/** Every fire of this reusable action opens the acknowledgement lifecycle. */
|
|
81
|
+
requires_ack?: boolean;
|
|
82
|
+
/** Omit to keep the stored value. */
|
|
83
|
+
input_type?: QuickActionInputType;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface QuickAction {
|
|
87
|
+
id?: string;
|
|
88
|
+
action_number: number;
|
|
89
|
+
label: string;
|
|
90
|
+
icon: string;
|
|
91
|
+
sound?: string | null;
|
|
92
|
+
haptic_style?: string | null;
|
|
93
|
+
/** Every fire of this reusable action opens the acknowledgement lifecycle. */
|
|
94
|
+
requires_ack?: boolean;
|
|
95
|
+
/** Missing on pre-2026-09-16 rows; treat absent as `none`. */
|
|
96
|
+
input_type?: QuickActionInputType;
|
|
97
|
+
[key: string]: unknown;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface Room {
|
|
101
|
+
id: string;
|
|
102
|
+
name: string;
|
|
103
|
+
icon: string | null;
|
|
104
|
+
color: string | null;
|
|
105
|
+
invite_code: string;
|
|
106
|
+
is_public?: boolean;
|
|
107
|
+
handle?: string | null;
|
|
108
|
+
quick_actions?: QuickAction[];
|
|
109
|
+
/** 4, or 16 while the room owner is Pro. */
|
|
110
|
+
quick_action_limit?: 4 | 16;
|
|
111
|
+
/** Every stored slot, including pages hidden by a lapsed Pro. */
|
|
112
|
+
quick_action_count?: number;
|
|
113
|
+
location_name?: string | null;
|
|
114
|
+
location_latitude?: number | null;
|
|
115
|
+
location_longitude?: number | null;
|
|
116
|
+
[key: string]: unknown;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** Catalog ids accepted by room and webhook creation. */
|
|
120
|
+
export interface RoomIconCatalog {
|
|
121
|
+
version: number;
|
|
122
|
+
base_url: string;
|
|
123
|
+
categories: Array<{ id: string; label: string; icons: string[] }>;
|
|
124
|
+
icons: Record<string, { file: string; tags: string[] }>;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface CreateWebhookInput {
|
|
128
|
+
name: string;
|
|
129
|
+
title?: string | null;
|
|
130
|
+
message?: string | null;
|
|
131
|
+
emoji?: string | null;
|
|
132
|
+
icon?: string | null;
|
|
133
|
+
color?: string | null;
|
|
134
|
+
sound?: string | null;
|
|
135
|
+
haptic?: string | null;
|
|
136
|
+
/** Optional Quick Ping preset. Omit or use null for an independent webhook. */
|
|
137
|
+
action_number?: number | null;
|
|
138
|
+
enabled?: boolean;
|
|
139
|
+
cooldown_seconds?: number;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface UpdateWebhookInput extends Partial<CreateWebhookInput> {
|
|
143
|
+
/** Rotate the trigger URL; the previous URL stops working. */
|
|
144
|
+
regenerate_secret?: boolean;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** Incoming webhook configuration. The trigger URL contains its credential. */
|
|
148
|
+
export interface Webhook {
|
|
149
|
+
id: string;
|
|
150
|
+
room_id: string;
|
|
151
|
+
name: string;
|
|
152
|
+
title: string | null;
|
|
153
|
+
message: string | null;
|
|
154
|
+
emoji: string | null;
|
|
155
|
+
icon: string | null;
|
|
156
|
+
color: string | null;
|
|
157
|
+
sound: string | null;
|
|
158
|
+
haptic: string | null;
|
|
159
|
+
/** Null when the webhook uses its own content without a Quick Ping preset. */
|
|
160
|
+
action_number: number | null;
|
|
161
|
+
enabled: boolean;
|
|
162
|
+
cooldown_seconds: number;
|
|
163
|
+
trigger_count: number;
|
|
164
|
+
last_triggered_at?: string | null;
|
|
165
|
+
webhook_url: string;
|
|
166
|
+
created_at: string;
|
|
167
|
+
updated_at: string;
|
|
168
|
+
[key: string]: unknown;
|
|
169
|
+
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public types for the PingRoom SDK.
|
|
3
|
+
*
|
|
4
|
+
* Request payload field names mirror the HTTP API verbatim (snake_case) so the
|
|
5
|
+
* SDK is a faithful, reviewable wrapper — what you pass is what the API sees.
|
|
6
|
+
* SDK-only knobs (timeouts, signals, callbacks) use camelCase.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export type * from './types/common.js';
|
|
10
|
+
export type * from './types/auth.js';
|
|
11
|
+
export type * from './types/rooms.js';
|
|
12
|
+
export type * from './types/notifications.js';
|
|
13
|
+
export type * from './types/approvals.js';
|
|
14
|
+
export type * from './types/questions.js';
|
|
15
|
+
export type * from './types/handoffs.js';
|
|
16
|
+
export type * from './types/inbox.js';
|
|
17
|
+
export type * from './types/profile.js';
|
package/src/version.ts
ADDED