@great-detail/support-sdk 0.2.8 → 0.2.10
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/chunk-KG7KNOPC.js +1 -0
- package/dist/{chunk-IQESWTED.js → chunk-ZYSG2PTQ.js} +1 -1
- package/dist/cli/index.cjs +1 -1
- package/dist/cli/index.d.cts +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/{index-DsZ1QEUj.d.cts → index-BMsEq65I.d.cts} +178 -13
- package/dist/{index-DsZ1QEUj.d.ts → index-BMsEq65I.d.ts} +178 -13
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +20 -3
- package/dist/index.d.ts +20 -3
- package/dist/index.js +1 -1
- package/package.json +1 -2
- package/src/Action/index.ts +10 -0
- package/src/Boilerplate/CreateBoilerplate.ts +59 -0
- package/src/Boilerplate/GetBoilerplate.ts +47 -0
- package/src/Boilerplate/ListBoilerplates.ts +46 -0
- package/src/Boilerplate/UpdateBoilerplate.ts +59 -0
- package/src/Boilerplate/index.ts +13 -0
- package/src/Channel/index.ts +10 -0
- package/src/Client/index.ts +13 -0
- package/src/Contact/index.ts +14 -0
- package/src/Conversation/index.ts +13 -0
- package/src/Label/index.ts +14 -0
- package/src/Message/index.ts +11 -0
- package/src/Model/index.ts +15 -0
- package/src/Note/index.ts +15 -0
- package/src/Source/index.ts +11 -0
- package/src/Subscription/CreateContactSubscription.ts +62 -0
- package/src/Subscription/index.ts +10 -0
- package/src/index.ts +11 -47
- package/dist/chunk-UWNMFEJS.js +0 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Great Detail Support System.
|
|
3
|
+
*
|
|
4
|
+
* @copyright 2024 Great Detail Ltd
|
|
5
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
+
* @see https://greatdetail.com
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
import FetchTransport from "../Transport/FetchTransport.js";
|
|
12
|
+
|
|
13
|
+
export interface Options {
|
|
14
|
+
id: string;
|
|
15
|
+
body: z.infer<typeof UpdateBoilerplate.SCHEMA>;
|
|
16
|
+
request?: RequestInit;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default class UpdateBoilerplate {
|
|
20
|
+
public static SCHEMA = z.object({
|
|
21
|
+
title: z.string().optional(),
|
|
22
|
+
content: z.string().optional(),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
constructor(protected _transport: FetchTransport) {}
|
|
26
|
+
|
|
27
|
+
public async send({ id, body, request = {} }: Options) {
|
|
28
|
+
return this._transport
|
|
29
|
+
.send("v1/boilerplates/" + encodeURIComponent(id), {
|
|
30
|
+
...request,
|
|
31
|
+
method: "PATCH",
|
|
32
|
+
headers: {
|
|
33
|
+
...request.headers,
|
|
34
|
+
"Content-Type": "application/json",
|
|
35
|
+
},
|
|
36
|
+
body: JSON.stringify(UpdateBoilerplate.SCHEMA.parse(body)),
|
|
37
|
+
})
|
|
38
|
+
.then((response) => new UpdateBoilerplateResponse(response));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type UpdateBoilerplateResponsePayload = {
|
|
43
|
+
boilerplate: {
|
|
44
|
+
id: string;
|
|
45
|
+
title: string;
|
|
46
|
+
content: string;
|
|
47
|
+
account: string;
|
|
48
|
+
createdAt: string;
|
|
49
|
+
updatedAt: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export class UpdateBoilerplateResponse {
|
|
54
|
+
constructor(public response: Response) {}
|
|
55
|
+
|
|
56
|
+
public async result(): Promise<UpdateBoilerplateResponsePayload> {
|
|
57
|
+
return this.response.json();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Great Detail Support System.
|
|
3
|
+
*
|
|
4
|
+
* @copyright 2024 Great Detail Ltd
|
|
5
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
+
* @see https://greatdetail.com
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export { type CreateBoilerplateResponsePayload } from "./CreateBoilerplate.js";
|
|
11
|
+
export { type GetBoilerplateResponsePayload } from "./GetBoilerplate.js";
|
|
12
|
+
export { type ListBoilerplatesResponsePayload } from "./ListBoilerplates.js";
|
|
13
|
+
export { type UpdateBoilerplateResponsePayload } from "./UpdateBoilerplate.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Great Detail Support System.
|
|
3
|
+
*
|
|
4
|
+
* @copyright 2024 Great Detail Ltd
|
|
5
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
+
* @see https://greatdetail.com
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export { type ListChannelsResponsePayload } from "./ListChannels.js";
|
package/src/Client/index.ts
CHANGED
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
|
|
10
10
|
import ListActions from "../Action/ListActions.js";
|
|
11
11
|
import Authentication from "../Authentication/index.js";
|
|
12
|
+
import CreateBoilerplate from "../Boilerplate/CreateBoilerplate.js";
|
|
13
|
+
import GetBoilerplate from "../Boilerplate/GetBoilerplate.js";
|
|
14
|
+
import ListBoilerplates from "../Boilerplate/ListBoilerplates.js";
|
|
15
|
+
import UpdateBoilerplate from "../Boilerplate/UpdateBoilerplate.js";
|
|
12
16
|
import ListChannels from "../Channel/ListChannels.js";
|
|
13
17
|
import { BASE_URL_ENV_VAR } from "../constants/environment.js";
|
|
14
18
|
import { DEFAULT_SUPPORT_BASE_URL } from "../constants/index.js";
|
|
@@ -74,6 +78,15 @@ export default class Client {
|
|
|
74
78
|
};
|
|
75
79
|
}
|
|
76
80
|
|
|
81
|
+
public get boilerplate() {
|
|
82
|
+
return {
|
|
83
|
+
get: new GetBoilerplate(this._transport),
|
|
84
|
+
list: new ListBoilerplates(this._transport),
|
|
85
|
+
create: new CreateBoilerplate(this._transport),
|
|
86
|
+
update: new UpdateBoilerplate(this._transport),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
77
90
|
public get channel() {
|
|
78
91
|
return {
|
|
79
92
|
list: new ListChannels(this._transport),
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Great Detail Support System.
|
|
3
|
+
*
|
|
4
|
+
* @copyright 2024 Great Detail Ltd
|
|
5
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
+
* @see https://greatdetail.com
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export { type CreateContactResponsePayload } from "./CreateContact.js";
|
|
11
|
+
export { type GetContactResponsePayload } from "./GetContact.js";
|
|
12
|
+
export { type ListContactsResponsePayload } from "./ListContacts.js";
|
|
13
|
+
export { type ListLabelContactsResponsePayload } from "./ListLabelContacts.js";
|
|
14
|
+
export { type UpdateContactResponsePayload } from "./UpdateContact.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Great Detail Support System.
|
|
3
|
+
*
|
|
4
|
+
* @copyright 2024 Great Detail Ltd
|
|
5
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
+
* @see https://greatdetail.com
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export { type GetConversationResponsePayload } from "./GetConversation.js";
|
|
11
|
+
export { type ListConversationsResponsePayload } from "./ListConversations.js";
|
|
12
|
+
export { type ListLabelConversationsResponsePayload } from "./ListLabelConversations.js";
|
|
13
|
+
export { type UpdateConversationResponsePayload } from "./UpdateConversation.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Great Detail Support System.
|
|
3
|
+
*
|
|
4
|
+
* @copyright 2024 Great Detail Ltd
|
|
5
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
+
* @see https://greatdetail.com
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export { type CreateLabelResponsePayload } from "./CreateLabel.js";
|
|
11
|
+
export { type DeleteLabelResponsePayload } from "./DeleteLabel.js";
|
|
12
|
+
export { type GetLabelResponsePayload } from "./GetLabel.js";
|
|
13
|
+
export { type ListLabelsResponsePayload } from "./ListLabels.js";
|
|
14
|
+
export { type UpdateLabelResponsePayload } from "./UpdateLabel.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Great Detail Support System.
|
|
3
|
+
*
|
|
4
|
+
* @copyright 2024 Great Detail Ltd
|
|
5
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
+
* @see https://greatdetail.com
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export { type ListConversationMessagesResponsePayload } from "./ListConversationMessages.js";
|
|
11
|
+
export { type ListMessagesResponsePayload } from "./ListMessages.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Great Detail Support System.
|
|
3
|
+
*
|
|
4
|
+
* @copyright 2024 Great Detail Ltd
|
|
5
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
+
* @see https://greatdetail.com
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export { type GetModelResponsePayload } from "./GetModel.js";
|
|
11
|
+
export { type ListModelsResponsePayload } from "./ListModels.js";
|
|
12
|
+
|
|
13
|
+
export { type CreateCorrectionResponsePayload } from "./Correction/CreateCorrectionModel.js";
|
|
14
|
+
|
|
15
|
+
export { type CreateResponseResponsePayload } from "./Response/CreateResponseModel.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Great Detail Support System.
|
|
3
|
+
*
|
|
4
|
+
* @copyright 2024 Great Detail Ltd
|
|
5
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
+
* @see https://greatdetail.com
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export { type CreateContactNoteResponsePayload } from "./CreateContactNote.js";
|
|
11
|
+
export { type CreateConversationNoteResponsePayload } from "./CreateConversationNote.js";
|
|
12
|
+
export { type GetNoteResponsePayload } from "./GetNote.js";
|
|
13
|
+
export { type ListContactNotesResponsePayload } from "./ListContactNotes.js";
|
|
14
|
+
export { type ListConversationNotesResponsePayload } from "./ListConversationNotes.js";
|
|
15
|
+
export { type UpdateNoteResponsePayload } from "./UpdateNote.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Great Detail Support System.
|
|
3
|
+
*
|
|
4
|
+
* @copyright 2024 Great Detail Ltd
|
|
5
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
+
* @see https://greatdetail.com
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export { type GetSourceResponsePayload } from "./GetSource.js";
|
|
11
|
+
export { type ListSourcesResponsePayload } from "./ListSources.js";
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Great Detail Support System.
|
|
3
|
+
*
|
|
4
|
+
* @copyright 2024 Great Detail Ltd
|
|
5
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
+
* @see https://greatdetail.com
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
import FetchTransport from "../Transport/FetchTransport.js";
|
|
12
|
+
|
|
13
|
+
export interface Options {
|
|
14
|
+
id: string;
|
|
15
|
+
body: z.infer<typeof CreateContactSubscription.SCHEMA>;
|
|
16
|
+
request?: RequestInit;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default class CreateContactSubscription {
|
|
20
|
+
public static SCHEMA = z.discriminatedUnion("type", [
|
|
21
|
+
z.object({
|
|
22
|
+
type: z.literal("vapid"),
|
|
23
|
+
endpoint: z.string().url(),
|
|
24
|
+
keys: z.object({
|
|
25
|
+
p256dh: z.string(),
|
|
26
|
+
auth: z.string(),
|
|
27
|
+
}),
|
|
28
|
+
}),
|
|
29
|
+
]);
|
|
30
|
+
|
|
31
|
+
constructor(protected _transport: FetchTransport) {}
|
|
32
|
+
|
|
33
|
+
public async send({ id, body, request = {} }: Options) {
|
|
34
|
+
return this._transport
|
|
35
|
+
.send("v1/contacts/" + encodeURIComponent(id) + "/subscriptions", {
|
|
36
|
+
...request,
|
|
37
|
+
method: "POST",
|
|
38
|
+
headers: {
|
|
39
|
+
...request.headers,
|
|
40
|
+
"Content-Type": "application/json",
|
|
41
|
+
},
|
|
42
|
+
body: JSON.stringify(CreateContactSubscription.SCHEMA.parse(body)),
|
|
43
|
+
})
|
|
44
|
+
.then((response) => new CreateContactSubscriptionResponse(response));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type CreateContactSubscriptionResponsePayload = {
|
|
49
|
+
subscription: {
|
|
50
|
+
id: string;
|
|
51
|
+
createdAt: string;
|
|
52
|
+
updatedAt: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export class CreateContactSubscriptionResponse {
|
|
57
|
+
constructor(public response: Response) {}
|
|
58
|
+
|
|
59
|
+
public async result(): Promise<CreateContactSubscriptionResponsePayload> {
|
|
60
|
+
return this.response.json();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Great Detail Support System.
|
|
3
|
+
*
|
|
4
|
+
* @copyright 2024 Great Detail Ltd
|
|
5
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
+
* @see https://greatdetail.com
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export { type CreateContactSubscriptionResponsePayload } from "./CreateContactSubscription.js";
|
package/src/index.ts
CHANGED
|
@@ -24,50 +24,14 @@ export { default as KeyAuthentication } from "./Authentication/KeyAuthentication
|
|
|
24
24
|
export { default as TokenAuthentication } from "./Authentication/TokenAuthentication.js";
|
|
25
25
|
export { default as PublicAuthentication } from "./Authentication/PublicAuthentication.js";
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
export
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
export
|
|
35
|
-
export
|
|
36
|
-
export
|
|
37
|
-
export
|
|
38
|
-
export { type CreateContactResponsePayload } from "./Contact/CreateContact.js";
|
|
39
|
-
|
|
40
|
-
// Conversations
|
|
41
|
-
export { type GetConversationResponsePayload } from "./Conversation/GetConversation.js";
|
|
42
|
-
export { type ListConversationsResponsePayload } from "./Conversation/ListConversations.js";
|
|
43
|
-
export { type ListLabelConversationsResponsePayload } from "./Conversation/ListLabelConversations.js";
|
|
44
|
-
export { type UpdateConversationResponsePayload } from "./Conversation/UpdateConversation.js";
|
|
45
|
-
|
|
46
|
-
// Labels
|
|
47
|
-
export { type CreateLabelResponsePayload } from "./Label/CreateLabel.js";
|
|
48
|
-
export { type DeleteLabelResponsePayload } from "./Label/DeleteLabel.js";
|
|
49
|
-
export { type GetLabelResponsePayload } from "./Label/GetLabel.js";
|
|
50
|
-
export { type ListLabelsResponsePayload } from "./Label/ListLabels.js";
|
|
51
|
-
export { type UpdateLabelResponsePayload } from "./Label/UpdateLabel.js";
|
|
52
|
-
|
|
53
|
-
// Messages
|
|
54
|
-
export { type ListConversationMessagesResponsePayload } from "./Message/ListConversationMessages.js";
|
|
55
|
-
export { type ListMessagesResponsePayload } from "./Message/ListMessages.js";
|
|
56
|
-
|
|
57
|
-
// Models
|
|
58
|
-
export { type GetModelResponsePayload } from "./Model/GetModel.js";
|
|
59
|
-
export { type ListModelsResponsePayload } from "./Model/ListModels.js";
|
|
60
|
-
export { type CreateCorrectionResponsePayload } from "./Model/Correction/CreateCorrectionModel.js";
|
|
61
|
-
export { type CreateResponseResponsePayload } from "./Model/Response/CreateResponseModel.js";
|
|
62
|
-
|
|
63
|
-
// Notes
|
|
64
|
-
export { type GetNoteResponsePayload } from "./Note/GetNote.js";
|
|
65
|
-
export { type UpdateNoteResponsePayload } from "./Note/UpdateNote.js";
|
|
66
|
-
export { type ListConversationNotesResponsePayload } from "./Note/ListConversationNotes.js";
|
|
67
|
-
export { type ListContactNotesResponsePayload } from "./Note/ListContactNotes.js";
|
|
68
|
-
export { type CreateConversationNoteResponsePayload } from "./Note/CreateConversationNote.js";
|
|
69
|
-
export { type CreateContactNoteResponsePayload } from "./Note/CreateContactNote.js";
|
|
70
|
-
|
|
71
|
-
// Sources
|
|
72
|
-
export { type GetSourceResponsePayload } from "./Source/GetSource.js";
|
|
73
|
-
export { type ListSourcesResponsePayload } from "./Source/ListSources.js";
|
|
27
|
+
export * from "./Action/index.js";
|
|
28
|
+
export * from "./Boilerplate/index.js";
|
|
29
|
+
export * from "./Channel/index.js";
|
|
30
|
+
export * from "./Contact/index.js";
|
|
31
|
+
export * from "./Conversation/index.js";
|
|
32
|
+
export * from "./Label/index.js";
|
|
33
|
+
export * from "./Message/index.js";
|
|
34
|
+
export * from "./Model/index.js";
|
|
35
|
+
export * from "./Note/index.js";
|
|
36
|
+
export * from "./Source/index.js";
|
|
37
|
+
export * from "./Subscription/index.js";
|
package/dist/chunk-UWNMFEJS.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var Nt=Object.defineProperty;var Dt=(e,t)=>{for(var s in t)Nt(e,s,{get:t[s],enumerable:!0})};var Ot="https://api.support.greatdetail.com",wt={"X-Powered-By":"GDSupport/JavaScript"},Jt="api-key";var p=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"}).then(s=>new W(s))}},W=class{constructor(t){this.response=t}async result(){return this.response.json()}};var c=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"}).then(s=>new X(s))}},X=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as d}from"zod";var u=class e{constructor(t){this._transport=t}static SCHEMA=d.object({name:d.string(),account:d.string(),emailAddress:d.string().email().optional(),telephoneNumber:d.string().optional()});async send({body:t,request:s={}}){return this._transport.send("v1/contacts",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(r=>new Q(r))}},Q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var l=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new Z(r))}},Z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var m=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"}).then(s=>new tt(s))}},tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var g=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...s,method:"GET"}).then(r=>new et(r))}},et=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as k}from"zod";var h=class e{constructor(t){this._transport=t}static SCHEMA=k.object({name:k.string().optional(),emailAddress:k.string().email().optional(),telephoneNumber:k.string().optional()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new st(n))}},st=class{constructor(t){this.response=t}async result(){return this.response.json()}};var f=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new rt(r))}},rt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"}).then(s=>new nt(s))}},nt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var y=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...s,method:"GET"}).then(r=>new ot(r))}},ot=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as Ft}from"zod";var R=class e{constructor(t){this._transport=t}static SCHEMA=Ft.object({hasEnded:Ft.boolean()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new it(n))}},it=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as K}from"zod";var x=class e{constructor(t){this._transport=t}static SCHEMA=K.object({title:K.string(),description:K.string().optional(),account:K.string()});async send({body:t,request:s={}}){return this._transport.send("v1/labels",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(r=>new at(r))}},at=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"DELETE"}).then(r=>new pt(r))}},pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var C=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new ct(r))}},ct=class{constructor(t){this.response=t}async result(){return this.response.json()}};var T=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"}).then(s=>new dt(s))}},dt=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as ut}from"zod";var _=class e{constructor(t){this._transport=t}static SCHEMA=ut.object({title:ut.string().optional(),description:ut.string().optional()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new lt(n))}},lt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var P=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET"}).then(r=>new mt(r))}},mt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"}).then(s=>new gt(s))}},gt=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as Y}from"zod";var E=class e{constructor(t){this._transport=t}static SCHEMA=Y.object({input:Y.string().max(65536),original:Y.string().max(65536),correction:Y.string().max(65536)});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new ht(n))}},ht=class{constructor(t){this.response=t}async result(){return this.response.json()}};var v=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new ft(r))}},ft=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"}).then(s=>new bt(s))}},bt=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as $}from"zod";var w=class e{constructor(t){this._transport=t}static SCHEMA=$.array($.object({role:$.enum(["user","assistant"]),content:$.string().max(65536).nullable()})).min(1);async send({id:t,body:s,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new yt(n))}},yt=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as Ut}from"zod";var F=class e{constructor(t){this._transport=t}static SCHEMA=Ut.object({content:Ut.string()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new Rt(n))}},Rt=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as qt}from"zod";var U=class e{constructor(t){this._transport=t}static SCHEMA=qt.object({content:qt.string()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new xt(n))}},xt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var q=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new At(r))}},At=class{constructor(t){this.response=t}async result(){return this.response.json()}};var I=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...s,method:"GET"}).then(r=>new Ct(r))}},Ct=class{constructor(t){this.response=t}async result(){return this.response.json()}};var j=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...s,method:"GET"}).then(r=>new Tt(r))}},Tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as It}from"zod";var L=class e{constructor(t){this._transport=t}static SCHEMA=It.object({content:It.string().optional()});async send({id:t,body:s,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"PATCH",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))}).then(n=>new _t(n))}},_t=class{constructor(t){this.response=t}async result(){return this.response.json()}};var H=class{constructor(t){this._transport=t}async send({id:t,request:s={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...s,method:"GET"}).then(r=>new Pt(r))}},Pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var N=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"}).then(s=>new St(s))}},St=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Fe="SUPPORT_ACCESS_TOKEN",Ue="SUPPORT_API_KEY",qe="SUPPORT_KEY_NAME",jt="SUPPORT_BASE_URL";var M=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:s={}}){let r=s.variant??"vcard",n=s.format??(s.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(r)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};var G=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=wt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};import Mt from"is-network-error";import Gt from"ky";var o=class extends Error{};var i=class extends o{};var D=class extends i{static unauthenticated(){return new this("An unauthenticated request occurred")}};var z=class extends i{static forbidden(){return new this("A forbidden request occurred")}};var a=class extends o{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,s){return new this(`Forbidden method for request: ${t} ${s}`)}};var J=class extends o{};var B=class extends o{static badRequest(){return new this("Bad request")}};var V=class{options;constructor({baseURL:t,...s}){this.options={...s,baseURL:t}}getURL(t){return new URL(t,this.options.baseURL).toString()}getRequest(t,s){s.headers=new Headers(s.headers);for(let r of this.options.requestFilterables){let n=r.getHeaders();for(let[Lt,Ht]of Object.entries(n))s.headers.set(Lt,Ht)}return new Request(this.getURL(t),s)}async send(t,s){return await Gt(this.getRequest(t,s)).then(r=>{if(!r.ok){let n=r.status;switch(console.error(JSON.stringify(r)),n){case 400:throw B.badRequest();case 401:throw D.unauthenticated();case 403:throw z.forbidden();case 404:throw a.notFound(t);case 405:throw a.forbiddenMethod(t,s.method??"GET")}}return r}).catch(r=>{throw Mt(r)?new J("A network error occurred",{cause:r}):r})}};var Et=class e{static DEFAULT_BASE_URL=Ot;_transport;constructor(t,{baseURL:s,...r}={}){this._transport=new V({requestFilterables:[new G,t],...r,baseURL:s?.toString()??e.getBaseURL()})}static getBaseURL(){return process.env[jt]??this.DEFAULT_BASE_URL}get action(){return{list:new p(this._transport)}}get channel(){return{list:new c(this._transport)}}get contact(){return{get:new l(this._transport),list:new m(this._transport),update:new h(this._transport),create:new u(this._transport),vcf:{get:new M(this._transport)},note:{list:new I(this._transport),create:new F(this._transport)}}}get conversation(){return{get:new f(this._transport),list:new b(this._transport),update:new R(this._transport),message:{list:new P(this._transport)},note:{list:new j(this._transport),create:new U(this._transport)}}}get label(){return{create:new x(this._transport),get:new C(this._transport),list:new T(this._transport),update:new _(this._transport),delete:new A(this._transport),contact:{list:new g(this._transport)},conversation:{list:new y(this._transport)}}}get message(){return{list:new S(this._transport)}}get model(){return{get:new v(this._transport),list:new O(this._transport),response:{create:new w(this._transport)},correction:{create:new E(this._transport)}}}get note(){return{get:new q(this._transport),update:new L(this._transport)}}get source(){return{get:new H(this._transport),list:new N(this._transport)}}};var vt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};export{Dt as a,Ot as b,Jt as c,Fe as d,Ue as e,qe as f,o as g,i as h,D as i,z as j,a as k,J as l,B as m,Et as n,vt as o};
|