@dinghy-chat/sdk 0.36.0 → 0.37.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 +28 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +47 -0
- package/dist/openapi.d.ts +2819 -8
- package/dist/resources.d.ts +97 -3
- package/package.json +1 -1
package/dist/resources.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ declare const CONVERSATION: "/v1/operator/workspaces/{workspaceId}/conversations
|
|
|
19
19
|
declare const MESSAGES: "/v1/operator/workspaces/{workspaceId}/conversations/{conversationId}/messages";
|
|
20
20
|
declare const CONTACT_BY_USER: "/v1/operator/workspaces/{workspaceId}/contacts/by-user/{userId}";
|
|
21
21
|
declare const OUTBOUND: "/v1/operator/workspaces/{workspaceId}/outbound-messages";
|
|
22
|
+
declare const CAMPAIGNS: "/v1/operator/workspaces/{workspaceId}/campaigns";
|
|
22
23
|
declare const WEBHOOKS: "/v1/operator/workspaces/{workspaceId}/webhooks";
|
|
23
24
|
declare const WEBHOOK: "/v1/operator/workspaces/{workspaceId}/webhooks/{webhookId}";
|
|
24
25
|
type Reply = Send<Omit<Body<typeof MESSAGES, "post">, "note" | "mentions">>;
|
|
@@ -253,6 +254,99 @@ export declare function outboundMessages(request: Request): {
|
|
|
253
254
|
outboundMessage: components["schemas"]["OutboundMessage"];
|
|
254
255
|
}>;
|
|
255
256
|
};
|
|
257
|
+
/** A campaign by its key, as a repository keeps it, or by its ID. */
|
|
258
|
+
type CampaignRef = string | {
|
|
259
|
+
id: string;
|
|
260
|
+
};
|
|
261
|
+
type ByKey<T extends string> = `${typeof CAMPAIGNS}/by-key/{ref}${T}`;
|
|
262
|
+
type Definition = Body<typeof CAMPAIGNS, "post">;
|
|
263
|
+
export declare function campaigns(request: Request): {
|
|
264
|
+
list: (query?: QueryOf<typeof CAMPAIGNS, "get">) => Promise<{
|
|
265
|
+
campaigns: components["schemas"]["Campaign"][];
|
|
266
|
+
sentLastWeek: number;
|
|
267
|
+
}>;
|
|
268
|
+
get: (ref: CampaignRef) => Promise<{
|
|
269
|
+
campaign: components["schemas"]["Campaign"];
|
|
270
|
+
}>;
|
|
271
|
+
/** A new campaign, as a draft. Its key must be free. */
|
|
272
|
+
create: (body: Definition) => Promise<{
|
|
273
|
+
campaign: components["schemas"]["Campaign"];
|
|
274
|
+
}>;
|
|
275
|
+
/** Creates the campaign with this key as a draft, or replaces it. Its status stays. */
|
|
276
|
+
upsert: ({ key, ...rest }: Definition) => Promise<{
|
|
277
|
+
campaign: components["schemas"]["Campaign"];
|
|
278
|
+
} | {
|
|
279
|
+
campaign: components["schemas"]["Campaign"];
|
|
280
|
+
}>;
|
|
281
|
+
/** Replaces the parts the patch gives. */
|
|
282
|
+
update: (ref: CampaignRef, body: Body<ByKey<"">, "patch">) => Promise<{
|
|
283
|
+
campaign: components["schemas"]["Campaign"];
|
|
284
|
+
}>;
|
|
285
|
+
pause: (ref: CampaignRef) => Promise<{
|
|
286
|
+
campaign: components["schemas"]["Campaign"];
|
|
287
|
+
} | {
|
|
288
|
+
campaign: components["schemas"]["Campaign"];
|
|
289
|
+
} | {
|
|
290
|
+
campaign: components["schemas"]["Campaign"];
|
|
291
|
+
}>;
|
|
292
|
+
/** Starts a draft, or resumes a paused campaign. */
|
|
293
|
+
resume: (ref: CampaignRef) => Promise<{
|
|
294
|
+
campaign: components["schemas"]["Campaign"];
|
|
295
|
+
} | {
|
|
296
|
+
campaign: components["schemas"]["Campaign"];
|
|
297
|
+
} | {
|
|
298
|
+
campaign: components["schemas"]["Campaign"];
|
|
299
|
+
}>;
|
|
300
|
+
end: (ref: CampaignRef) => Promise<{
|
|
301
|
+
campaign: components["schemas"]["Campaign"];
|
|
302
|
+
} | {
|
|
303
|
+
campaign: components["schemas"]["Campaign"];
|
|
304
|
+
} | {
|
|
305
|
+
campaign: components["schemas"]["Campaign"];
|
|
306
|
+
}>;
|
|
307
|
+
results: (ref: CampaignRef, query?: QueryOf<ByKey<"/results">, "get">) => Promise<{
|
|
308
|
+
days: {
|
|
309
|
+
entered: number;
|
|
310
|
+
sent: number;
|
|
311
|
+
delivered: number;
|
|
312
|
+
read: number;
|
|
313
|
+
replied: number;
|
|
314
|
+
dismissed: number;
|
|
315
|
+
goalReached: number;
|
|
316
|
+
conversationsStarted: number;
|
|
317
|
+
clicks: {
|
|
318
|
+
[key: string]: number;
|
|
319
|
+
};
|
|
320
|
+
day: string;
|
|
321
|
+
variant: string | null;
|
|
322
|
+
}[];
|
|
323
|
+
variants: {
|
|
324
|
+
entered: number;
|
|
325
|
+
sent: number;
|
|
326
|
+
delivered: number;
|
|
327
|
+
read: number;
|
|
328
|
+
replied: number;
|
|
329
|
+
dismissed: number;
|
|
330
|
+
goalReached: number;
|
|
331
|
+
conversationsStarted: number;
|
|
332
|
+
clicks: {
|
|
333
|
+
[key: string]: number;
|
|
334
|
+
};
|
|
335
|
+
variant: string | null;
|
|
336
|
+
}[];
|
|
337
|
+
}>;
|
|
338
|
+
/** Runs a live campaign for one person: it skips the audience and the trigger. */
|
|
339
|
+
send: (ref: CampaignRef, input: Send<Body<ByKey<"/send">, "post">>) => Promise<{
|
|
340
|
+
outboundMessage: components["schemas"]["OutboundMessage"];
|
|
341
|
+
} | {
|
|
342
|
+
outboundMessage: components["schemas"]["OutboundMessage"];
|
|
343
|
+
}>;
|
|
344
|
+
};
|
|
345
|
+
/** Counts an event on a contact, from your server. */
|
|
346
|
+
export declare const track: (request: Request) => (body: Body<`${typeof IN_WORKSPACE}/track`, "post">) => Promise<{
|
|
347
|
+
visitorId: string;
|
|
348
|
+
counted: boolean;
|
|
349
|
+
}>;
|
|
256
350
|
type NewWebhook = Body<typeof WEBHOOKS, "post">;
|
|
257
351
|
/** The webhook routes, which need a Full access (setup) key. */
|
|
258
352
|
export declare function webhookRoutes(request: Request): {
|
|
@@ -262,7 +356,7 @@ export declare function webhookRoutes(request: Request): {
|
|
|
262
356
|
create: (body: NewWebhook) => Promise<{
|
|
263
357
|
id: string;
|
|
264
358
|
url: string;
|
|
265
|
-
events: ("conversation.created" | "message.created" | "message.updated" | "message.deleted" | "conversation.closed" | "conversation.reopened" | "conversation.assigned" | "conversation.handoff" | "conversation.given_back" | "conversation.labeled" | "outbound_message.sent" | "outbound_message.delivered" | "outbound_message.read" | "outbound_message.clicked" | "outbound_message.replied" | "outbound_message.dismissed" | "outbound_message.cancelled" | "outbound_message.expired")[];
|
|
359
|
+
events: ("conversation.created" | "message.created" | "message.updated" | "message.deleted" | "conversation.closed" | "conversation.reopened" | "conversation.assigned" | "conversation.handoff" | "conversation.given_back" | "conversation.labeled" | "outbound_message.sent" | "outbound_message.delivered" | "outbound_message.read" | "outbound_message.clicked" | "outbound_message.replied" | "outbound_message.dismissed" | "outbound_message.cancelled" | "outbound_message.expired" | "campaign.updated")[];
|
|
266
360
|
enabled: boolean;
|
|
267
361
|
createdBy: {
|
|
268
362
|
kind: "operator" | "key";
|
|
@@ -275,7 +369,7 @@ export declare function webhookRoutes(request: Request): {
|
|
|
275
369
|
update: (webhookId: string, body: Body<typeof WEBHOOK, "patch">) => Promise<{
|
|
276
370
|
id: string;
|
|
277
371
|
url: string;
|
|
278
|
-
events: ("conversation.created" | "message.created" | "message.updated" | "message.deleted" | "conversation.closed" | "conversation.reopened" | "conversation.assigned" | "conversation.handoff" | "conversation.given_back" | "conversation.labeled" | "outbound_message.sent" | "outbound_message.delivered" | "outbound_message.read" | "outbound_message.clicked" | "outbound_message.replied" | "outbound_message.dismissed" | "outbound_message.cancelled" | "outbound_message.expired")[];
|
|
372
|
+
events: ("conversation.created" | "message.created" | "message.updated" | "message.deleted" | "conversation.closed" | "conversation.reopened" | "conversation.assigned" | "conversation.handoff" | "conversation.given_back" | "conversation.labeled" | "outbound_message.sent" | "outbound_message.delivered" | "outbound_message.read" | "outbound_message.clicked" | "outbound_message.replied" | "outbound_message.dismissed" | "outbound_message.cancelled" | "outbound_message.expired" | "campaign.updated")[];
|
|
279
373
|
enabled: boolean;
|
|
280
374
|
createdBy: {
|
|
281
375
|
kind: "operator" | "key";
|
|
@@ -289,7 +383,7 @@ export declare function webhookRoutes(request: Request): {
|
|
|
289
383
|
rotateSecret: (webhookId: string) => Promise<{
|
|
290
384
|
id: string;
|
|
291
385
|
url: string;
|
|
292
|
-
events: ("conversation.created" | "message.created" | "message.updated" | "message.deleted" | "conversation.closed" | "conversation.reopened" | "conversation.assigned" | "conversation.handoff" | "conversation.given_back" | "conversation.labeled" | "outbound_message.sent" | "outbound_message.delivered" | "outbound_message.read" | "outbound_message.clicked" | "outbound_message.replied" | "outbound_message.dismissed" | "outbound_message.cancelled" | "outbound_message.expired")[];
|
|
386
|
+
events: ("conversation.created" | "message.created" | "message.updated" | "message.deleted" | "conversation.closed" | "conversation.reopened" | "conversation.assigned" | "conversation.handoff" | "conversation.given_back" | "conversation.labeled" | "outbound_message.sent" | "outbound_message.delivered" | "outbound_message.read" | "outbound_message.clicked" | "outbound_message.replied" | "outbound_message.dismissed" | "outbound_message.cancelled" | "outbound_message.expired" | "campaign.updated")[];
|
|
293
387
|
enabled: boolean;
|
|
294
388
|
createdBy: {
|
|
295
389
|
kind: "operator" | "key";
|