@great-detail/support-sdk 0.1.2 → 0.1.3
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-5MVQFIMQ.js +1 -0
- package/dist/{chunk-2RK4MX2V.js → chunk-XHFS4EBE.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-BdOHDvcP.d.cts → index-DqEBKPNI.d.cts} +101 -63
- package/dist/{index-BdOHDvcP.d.ts → index-DqEBKPNI.d.ts} +101 -63
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/Action/ListActions.ts +1 -1
- package/src/Channel/ListChannels.ts +1 -1
- package/src/Client/index.ts +46 -42
- package/src/Contact/CreateContact.ts +3 -3
- package/src/Contact/GetContact.ts +1 -1
- package/src/Contact/ListContacts.ts +1 -1
- package/src/Contact/ListLabelContacts.ts +52 -0
- package/src/Contact/UpdateContact.ts +3 -3
- package/src/Conversation/GetConversation.ts +1 -1
- package/src/Conversation/ListConversations.ts +1 -1
- package/src/Conversation/UpdateConversation.ts +3 -3
- package/src/Label/CreateLabel.ts +3 -3
- package/src/Label/DeleteLabel.ts +1 -1
- package/src/Label/GetLabel.ts +1 -1
- package/src/Label/ListLabels.ts +1 -1
- package/src/Label/UpdateLabel.ts +3 -3
- package/src/Message/ListMessages.ts +1 -1
- package/src/Model/Correction/CreateCorrectionModel.ts +3 -3
- package/src/Model/GetModel.ts +1 -1
- package/src/Model/ListModels.ts +1 -1
- package/src/Model/Response/CreateResponseModel.ts +3 -3
- package/src/Source/GetSource.ts +1 -1
- package/src/Source/ListSources.ts +1 -1
- package/src/index.ts +1 -0
- package/dist/chunk-V75IMWOW.js +0 -1
package/src/Client/index.ts
CHANGED
|
@@ -7,32 +7,33 @@
|
|
|
7
7
|
* @see https://greatdetail.com
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import
|
|
10
|
+
import ListActions from "../Action/ListActions.js";
|
|
11
11
|
import Authentication from "../Authentication/index.js";
|
|
12
|
-
import
|
|
12
|
+
import ListChannels from "../Channel/ListChannels.js";
|
|
13
13
|
import { DEFAULT_SUPPORT_BASE_URL } from "../constants/index.js";
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
14
|
+
import CreateContact from "../Contact/CreateContact.js";
|
|
15
|
+
import GetContact from "../Contact/GetContact.js";
|
|
16
|
+
import ListContacts from "../Contact/ListContacts.js";
|
|
17
|
+
import ListLabelContacts from "../Contact/ListLabelContacts.js";
|
|
18
|
+
import UpdateContact from "../Contact/UpdateContact.js";
|
|
19
|
+
import GetConversation from "../Conversation/GetConversation.js";
|
|
20
|
+
import ListConversations from "../Conversation/ListConversations.js";
|
|
20
21
|
import ListLabelConversations from "../Conversation/ListLabelConversations.js";
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
22
|
+
import UpdateConversation from "../Conversation/UpdateConversation.js";
|
|
23
|
+
import CreateLabel from "../Label/CreateLabel.js";
|
|
24
|
+
import DeleteLabel from "../Label/DeleteLabel.js";
|
|
25
|
+
import GetLabel from "../Label/GetLabel.js";
|
|
26
|
+
import ListLabels from "../Label/ListLabels.js";
|
|
27
|
+
import UpdateLabel from "../Label/UpdateLabel.js";
|
|
27
28
|
import ListConversationMessages from "../Message/ListConversationMessages.js";
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
29
|
+
import ListMessages from "../Message/ListMessages.js";
|
|
30
|
+
import CreateCorrectionModel from "../Model/Correction/CreateCorrectionModel.js";
|
|
31
|
+
import GetModel from "../Model/GetModel.js";
|
|
32
|
+
import ListModels from "../Model/ListModels.js";
|
|
33
|
+
import CreateResponseModel from "../Model/Response/CreateResponseModel.js";
|
|
33
34
|
import RequestStandardHeaders from "../Request/RequestStandardHeaders.js";
|
|
34
|
-
import
|
|
35
|
-
import
|
|
35
|
+
import GetSource from "../Source/GetSource.js";
|
|
36
|
+
import ListSources from "../Source/ListSources.js";
|
|
36
37
|
import Transport from "../Transport/index.js";
|
|
37
38
|
|
|
38
39
|
export interface Options {
|
|
@@ -61,30 +62,30 @@ export default class Client {
|
|
|
61
62
|
|
|
62
63
|
public get action() {
|
|
63
64
|
return {
|
|
64
|
-
list: new
|
|
65
|
+
list: new ListActions(this._transport),
|
|
65
66
|
};
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
public get channel() {
|
|
69
70
|
return {
|
|
70
|
-
list: new
|
|
71
|
+
list: new ListChannels(this._transport),
|
|
71
72
|
};
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
public get contact() {
|
|
75
76
|
return {
|
|
76
|
-
get: new
|
|
77
|
-
list: new
|
|
78
|
-
update: new
|
|
79
|
-
create: new
|
|
77
|
+
get: new GetContact(this._transport),
|
|
78
|
+
list: new ListContacts(this._transport),
|
|
79
|
+
update: new UpdateContact(this._transport),
|
|
80
|
+
create: new CreateContact(this._transport),
|
|
80
81
|
};
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
public get conversation() {
|
|
84
85
|
return {
|
|
85
|
-
get: new
|
|
86
|
-
list: new
|
|
87
|
-
update: new
|
|
86
|
+
get: new GetConversation(this._transport),
|
|
87
|
+
list: new ListConversations(this._transport),
|
|
88
|
+
update: new UpdateConversation(this._transport),
|
|
88
89
|
message: {
|
|
89
90
|
list: new ListConversationMessages(this._transport),
|
|
90
91
|
},
|
|
@@ -93,11 +94,14 @@ export default class Client {
|
|
|
93
94
|
|
|
94
95
|
public get label() {
|
|
95
96
|
return {
|
|
96
|
-
create: new
|
|
97
|
-
get: new
|
|
98
|
-
list: new
|
|
99
|
-
update: new
|
|
100
|
-
delete: new
|
|
97
|
+
create: new CreateLabel(this._transport),
|
|
98
|
+
get: new GetLabel(this._transport),
|
|
99
|
+
list: new ListLabels(this._transport),
|
|
100
|
+
update: new UpdateLabel(this._transport),
|
|
101
|
+
delete: new DeleteLabel(this._transport),
|
|
102
|
+
contact: {
|
|
103
|
+
list: new ListLabelContacts(this._transport),
|
|
104
|
+
},
|
|
101
105
|
conversation: {
|
|
102
106
|
list: new ListLabelConversations(this._transport),
|
|
103
107
|
},
|
|
@@ -106,27 +110,27 @@ export default class Client {
|
|
|
106
110
|
|
|
107
111
|
public get message() {
|
|
108
112
|
return {
|
|
109
|
-
list: new
|
|
113
|
+
list: new ListMessages(this._transport),
|
|
110
114
|
};
|
|
111
115
|
}
|
|
112
116
|
|
|
113
117
|
public get model() {
|
|
114
118
|
return {
|
|
115
|
-
get: new
|
|
116
|
-
list: new
|
|
119
|
+
get: new GetModel(this._transport),
|
|
120
|
+
list: new ListModels(this._transport),
|
|
117
121
|
response: {
|
|
118
|
-
create: new
|
|
122
|
+
create: new CreateResponseModel(this._transport),
|
|
119
123
|
},
|
|
120
124
|
correction: {
|
|
121
|
-
create: new
|
|
125
|
+
create: new CreateCorrectionModel(this._transport),
|
|
122
126
|
},
|
|
123
127
|
};
|
|
124
128
|
}
|
|
125
129
|
|
|
126
130
|
public get source() {
|
|
127
131
|
return {
|
|
128
|
-
get: new
|
|
129
|
-
list: new
|
|
132
|
+
get: new GetSource(this._transport),
|
|
133
|
+
list: new ListSources(this._transport),
|
|
130
134
|
};
|
|
131
135
|
}
|
|
132
136
|
}
|
|
@@ -11,11 +11,11 @@ import { z } from "zod";
|
|
|
11
11
|
import Transport, { SendOptions } from "../Transport/index.js";
|
|
12
12
|
|
|
13
13
|
export interface Options extends SendOptions {
|
|
14
|
-
body: z.infer<typeof
|
|
14
|
+
body: z.infer<typeof CreateContact.SCHEMA>;
|
|
15
15
|
request?: RequestInit;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export default class
|
|
18
|
+
export default class CreateContact {
|
|
19
19
|
public static SCHEMA = z.object({
|
|
20
20
|
name: z.string(),
|
|
21
21
|
account: z.string(),
|
|
@@ -36,7 +36,7 @@ export default class CreateContactRequest {
|
|
|
36
36
|
...request.headers,
|
|
37
37
|
"Content-Type": "application/json",
|
|
38
38
|
},
|
|
39
|
-
body: JSON.stringify(
|
|
39
|
+
body: JSON.stringify(CreateContact.SCHEMA.parse(body)),
|
|
40
40
|
},
|
|
41
41
|
options,
|
|
42
42
|
)
|
|
@@ -14,7 +14,7 @@ export interface Options extends SendOptions {
|
|
|
14
14
|
request?: RequestInit;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export default class
|
|
17
|
+
export default class GetContact {
|
|
18
18
|
constructor(protected _transport: Transport) {}
|
|
19
19
|
|
|
20
20
|
public async send({ id, request = {}, ...options }: Options) {
|
|
@@ -13,7 +13,7 @@ export interface Options extends SendOptions {
|
|
|
13
13
|
request?: RequestInit;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export default class
|
|
16
|
+
export default class ListContacts {
|
|
17
17
|
constructor(protected _transport: Transport) {}
|
|
18
18
|
|
|
19
19
|
public async send({ request = {}, ...options }: Options = {}) {
|
|
@@ -0,0 +1,52 @@
|
|
|
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 Transport, { SendOptions } from "../Transport/index.js";
|
|
11
|
+
|
|
12
|
+
export interface Options extends SendOptions {
|
|
13
|
+
id: string;
|
|
14
|
+
request?: RequestInit;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default class ListLabelContacts {
|
|
18
|
+
constructor(protected _transport: Transport) {}
|
|
19
|
+
|
|
20
|
+
public async({ id, request = {}, ...options }: Options) {
|
|
21
|
+
return this._transport
|
|
22
|
+
.send(
|
|
23
|
+
"v1/labels/" + encodeURIComponent(id) + "/contacts",
|
|
24
|
+
{
|
|
25
|
+
...request,
|
|
26
|
+
method: "GET",
|
|
27
|
+
},
|
|
28
|
+
options,
|
|
29
|
+
)
|
|
30
|
+
.then((response) => new ListLabelContactsResponse(response));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type ListLabelContactsResponsePayload = {
|
|
35
|
+
contacts: {
|
|
36
|
+
id: string;
|
|
37
|
+
name?: string;
|
|
38
|
+
emailAddress?: string;
|
|
39
|
+
telephoneNumber?: string;
|
|
40
|
+
account: string;
|
|
41
|
+
createdAt: string;
|
|
42
|
+
updatedAt?: string;
|
|
43
|
+
}[];
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export class ListLabelContactsResponse {
|
|
47
|
+
constructor(public response: Response) {}
|
|
48
|
+
|
|
49
|
+
public async result(): Promise<ListLabelContactsResponsePayload> {
|
|
50
|
+
return this.response.json();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -12,11 +12,11 @@ import Transport, { SendOptions } from "../Transport/index.js";
|
|
|
12
12
|
|
|
13
13
|
export interface Options extends SendOptions {
|
|
14
14
|
id: string;
|
|
15
|
-
body: z.infer<typeof
|
|
15
|
+
body: z.infer<typeof UpdateContact.SCHEMA>;
|
|
16
16
|
request?: RequestInit;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export default class
|
|
19
|
+
export default class UpdateContact {
|
|
20
20
|
public static SCHEMA = z.object({
|
|
21
21
|
name: z.string().optional(),
|
|
22
22
|
emailAddress: z.string().email().optional(),
|
|
@@ -36,7 +36,7 @@ export default class UpdateContactRequest {
|
|
|
36
36
|
...request.headers,
|
|
37
37
|
"Content-Type": "application/json",
|
|
38
38
|
},
|
|
39
|
-
body: JSON.stringify(
|
|
39
|
+
body: JSON.stringify(UpdateContact.SCHEMA.parse(body)),
|
|
40
40
|
},
|
|
41
41
|
options,
|
|
42
42
|
)
|
|
@@ -14,7 +14,7 @@ export interface Options extends SendOptions {
|
|
|
14
14
|
request?: RequestInit;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export default class
|
|
17
|
+
export default class GetConversation {
|
|
18
18
|
constructor(protected _transport: Transport) {}
|
|
19
19
|
|
|
20
20
|
public async send({ id, request = {}, ...options }: Options) {
|
|
@@ -13,7 +13,7 @@ export interface Options extends SendOptions {
|
|
|
13
13
|
request?: RequestInit;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export default class
|
|
16
|
+
export default class ListConversations {
|
|
17
17
|
constructor(protected _transport: Transport) {}
|
|
18
18
|
|
|
19
19
|
public async send({ request = {}, ...options }: Options = {}) {
|
|
@@ -12,11 +12,11 @@ import Transport, { SendOptions } from "../Transport/index.js";
|
|
|
12
12
|
|
|
13
13
|
export interface Options extends SendOptions {
|
|
14
14
|
id: string;
|
|
15
|
-
body: z.infer<typeof
|
|
15
|
+
body: z.infer<typeof UpdateConversation.SCHEMA>;
|
|
16
16
|
request?: RequestInit;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export default class
|
|
19
|
+
export default class UpdateConversation {
|
|
20
20
|
public static SCHEMA = z.object({
|
|
21
21
|
hasEnded: z.boolean(),
|
|
22
22
|
});
|
|
@@ -34,7 +34,7 @@ export default class UpdateConversationRequest {
|
|
|
34
34
|
...request.headers,
|
|
35
35
|
"Content-Type": "application/json",
|
|
36
36
|
},
|
|
37
|
-
body: JSON.stringify(
|
|
37
|
+
body: JSON.stringify(UpdateConversation.SCHEMA.parse(body)),
|
|
38
38
|
},
|
|
39
39
|
options,
|
|
40
40
|
)
|
package/src/Label/CreateLabel.ts
CHANGED
|
@@ -11,11 +11,11 @@ import { z } from "zod";
|
|
|
11
11
|
import Transport, { SendOptions } from "../Transport/index.js";
|
|
12
12
|
|
|
13
13
|
export interface Options extends SendOptions {
|
|
14
|
-
body: z.infer<typeof
|
|
14
|
+
body: z.infer<typeof CreateLabel.SCHEMA>;
|
|
15
15
|
request?: RequestInit;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export default class
|
|
18
|
+
export default class CreateLabel {
|
|
19
19
|
public static SCHEMA = z.object({
|
|
20
20
|
title: z.string(),
|
|
21
21
|
description: z.string().optional(),
|
|
@@ -35,7 +35,7 @@ export default class CreateLabelRequest {
|
|
|
35
35
|
...request.headers,
|
|
36
36
|
"Content-Type": "application/json",
|
|
37
37
|
},
|
|
38
|
-
body: JSON.stringify(
|
|
38
|
+
body: JSON.stringify(CreateLabel.SCHEMA.parse(body)),
|
|
39
39
|
},
|
|
40
40
|
options,
|
|
41
41
|
)
|
package/src/Label/DeleteLabel.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface Options extends SendOptions {
|
|
|
14
14
|
request?: RequestInit;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export default class
|
|
17
|
+
export default class DeleteLabel {
|
|
18
18
|
constructor(protected _transport: Transport) {}
|
|
19
19
|
|
|
20
20
|
public async send({ id, request = {}, ...options }: Options) {
|
package/src/Label/GetLabel.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface Options extends SendOptions {
|
|
|
14
14
|
request?: RequestInit;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export default class
|
|
17
|
+
export default class GetLabel {
|
|
18
18
|
constructor(protected _transport: Transport) {}
|
|
19
19
|
|
|
20
20
|
public async send({ id, request = {}, ...options }: Options) {
|
package/src/Label/ListLabels.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface Options extends SendOptions {
|
|
|
13
13
|
request?: RequestInit;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export default class
|
|
16
|
+
export default class ListLabels {
|
|
17
17
|
constructor(protected _transport: Transport) {}
|
|
18
18
|
|
|
19
19
|
public async send({ request = {}, ...options }: Options = {}) {
|
package/src/Label/UpdateLabel.ts
CHANGED
|
@@ -12,11 +12,11 @@ import Transport, { SendOptions } from "../Transport/index.js";
|
|
|
12
12
|
|
|
13
13
|
export interface Options extends SendOptions {
|
|
14
14
|
id: string;
|
|
15
|
-
body: z.infer<typeof
|
|
15
|
+
body: z.infer<typeof UpdateLabel.SCHEMA>;
|
|
16
16
|
request?: RequestInit;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export default class
|
|
19
|
+
export default class UpdateLabel {
|
|
20
20
|
public static SCHEMA = z.object({
|
|
21
21
|
title: z.string().optional(),
|
|
22
22
|
description: z.string().optional(),
|
|
@@ -35,7 +35,7 @@ export default class UpdateLabelRequest {
|
|
|
35
35
|
...request.headers,
|
|
36
36
|
"Content-Type": "application/json",
|
|
37
37
|
},
|
|
38
|
-
body: JSON.stringify(
|
|
38
|
+
body: JSON.stringify(UpdateLabel.SCHEMA.parse(body)),
|
|
39
39
|
},
|
|
40
40
|
options,
|
|
41
41
|
)
|
|
@@ -13,7 +13,7 @@ export interface Options extends SendOptions {
|
|
|
13
13
|
request?: RequestInit;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export default class
|
|
16
|
+
export default class ListMessages {
|
|
17
17
|
constructor(protected _transport: Transport) {}
|
|
18
18
|
|
|
19
19
|
public async send({ request = {}, ...options }: Options = {}) {
|
|
@@ -12,11 +12,11 @@ import Transport, { SendOptions } from "../../Transport/index.js";
|
|
|
12
12
|
|
|
13
13
|
export interface Options extends SendOptions {
|
|
14
14
|
id: string;
|
|
15
|
-
body: z.infer<typeof
|
|
15
|
+
body: z.infer<typeof CreateCorrectionModel.SCHEMA>;
|
|
16
16
|
request?: RequestInit;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export default class
|
|
19
|
+
export default class CreateCorrectionModel {
|
|
20
20
|
public static SCHEMA = z.object({
|
|
21
21
|
input: z.string().max(65_536),
|
|
22
22
|
original: z.string().max(65_536),
|
|
@@ -36,7 +36,7 @@ export default class CreateCorrectionModelRequest {
|
|
|
36
36
|
...request.headers,
|
|
37
37
|
"Content-Type": "application/json",
|
|
38
38
|
},
|
|
39
|
-
body: JSON.stringify(
|
|
39
|
+
body: JSON.stringify(CreateCorrectionModel.SCHEMA.parse(body)),
|
|
40
40
|
},
|
|
41
41
|
options,
|
|
42
42
|
)
|
package/src/Model/GetModel.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface Options extends SendOptions {
|
|
|
14
14
|
request?: RequestInit;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export default class
|
|
17
|
+
export default class GetModel {
|
|
18
18
|
constructor(protected _transport: Transport) {}
|
|
19
19
|
|
|
20
20
|
public async send({ id, request = {}, ...options }: Options) {
|
package/src/Model/ListModels.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface Options extends SendOptions {
|
|
|
13
13
|
request?: RequestInit;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export default class
|
|
16
|
+
export default class ListModels {
|
|
17
17
|
constructor(protected _transport: Transport) {}
|
|
18
18
|
|
|
19
19
|
public async send({ request = {}, ...options }: Options = {}) {
|
|
@@ -12,11 +12,11 @@ import Transport, { SendOptions } from "../../Transport/index.js";
|
|
|
12
12
|
|
|
13
13
|
export interface Options extends SendOptions {
|
|
14
14
|
id: string;
|
|
15
|
-
body: z.infer<typeof
|
|
15
|
+
body: z.infer<typeof CreateResponseModel.SCHEMA>;
|
|
16
16
|
request?: RequestInit;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export default class
|
|
19
|
+
export default class CreateResponseModel {
|
|
20
20
|
public static SCHEMA = z
|
|
21
21
|
.array(
|
|
22
22
|
z.object({
|
|
@@ -39,7 +39,7 @@ export default class CreateResponseModelRequest {
|
|
|
39
39
|
...request.headers,
|
|
40
40
|
"Content-Type": "application/json",
|
|
41
41
|
},
|
|
42
|
-
body: JSON.stringify(
|
|
42
|
+
body: JSON.stringify(CreateResponseModel.SCHEMA.parse(body)),
|
|
43
43
|
},
|
|
44
44
|
options,
|
|
45
45
|
)
|
package/src/Source/GetSource.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface Options extends SendOptions {
|
|
|
14
14
|
request?: RequestInit;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export default class
|
|
17
|
+
export default class GetSource {
|
|
18
18
|
constructor(protected _transport: Transport) {}
|
|
19
19
|
|
|
20
20
|
public async send({ id, request = {}, ...options }: Options) {
|
|
@@ -13,7 +13,7 @@ export interface Options extends SendOptions {
|
|
|
13
13
|
request?: RequestInit;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export default class
|
|
16
|
+
export default class ListSources {
|
|
17
17
|
constructor(protected _transport: Transport) {}
|
|
18
18
|
|
|
19
19
|
public async send({ request = {}, ...options }: Options = {}) {
|
package/src/index.ts
CHANGED
|
@@ -33,6 +33,7 @@ export { type ListChannelsResponsePayload } from "./Channel/ListChannels.js";
|
|
|
33
33
|
// Contacts
|
|
34
34
|
export { type GetContactResponsePayload } from "./Contact/GetContact.js";
|
|
35
35
|
export { type ListContactsResponsePayload } from "./Contact/ListContacts.js";
|
|
36
|
+
export { type ListLabelContactsResponsePayload } from "./Contact/ListLabelContacts.js";
|
|
36
37
|
export { type UpdateContactResponsePayload } from "./Contact/UpdateContact.js";
|
|
37
38
|
export { type CreateContactResponsePayload } from "./Contact/CreateContact.js";
|
|
38
39
|
|
package/dist/chunk-V75IMWOW.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var at="https://api.support.greatdetail.com",ct={"X-Powered-By":"GDSupport/JavaScript"},ut="api-key",lt="SUPPORT_ACCESS_TOKEN",mt="SUPPORT_API_KEY",gt="SUPPORT_KEY_NAME";var i=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/actions",{...t,method:"GET"},s).then(n=>new H(n))}},H=class{constructor(t){this.response=t}async result(){return this.response.json()}};var p=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/channels",{...t,method:"GET"},s).then(n=>new M(n))}},M=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as a}from"zod";var c=class e{constructor(t){this._transport=t}static SCHEMA=a.object({name:a.string(),account:a.string(),emailAddress:a.string().email().optional(),telephoneNumber:a.string().optional()});async send({body:t,request:s={},...n}){return this._transport.send("v1/contacts",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))},n).then(r=>new N(r))}},N=class{constructor(t){this.response=t}async result(){return this.response.json()}};var d=class{constructor(t){this._transport=t}async send({id:t,request:s={},...n}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new D(r))}},D=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/contacts",{...t,method:"GET"},s).then(n=>new G(n))}},G=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as I}from"zod";var l=class e{constructor(t){this._transport=t}static SCHEMA=I.object({name:I.string().optional(),emailAddress:I.string().email().optional(),telephoneNumber:I.string().optional()});async send({id:t,body:s,request:n={},...r}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))},r).then(o=>new z(o))}},z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var m=class{constructor(t){this._transport=t}async send({id:t,request:s={},...n}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new F(r))}},F=class{constructor(t){this.response=t}async result(){return this.response.json()}};var g=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/conversations",{...t,method:"GET"},s).then(n=>new B(n))}},B=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={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...s,method:"GET"},n).then(r=>new J(r))}},J=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as dt}from"zod";var y=class e{constructor(t){this._transport=t}static SCHEMA=dt.object({hasEnded:dt.boolean()});async send({id:t,body:s,request:n={},...r}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))},r).then(o=>new K(o))}},K=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as U}from"zod";var b=class e{constructor(t){this._transport=t}static SCHEMA=U.object({title:U.string(),description:U.string().optional(),account:U.string()});async send({body:t,request:s={},...n}){return this._transport.send("v1/labels",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))},n).then(r=>new V(r))}},V=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={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"DELETE"},n).then(r=>new Y(r))}},Y=class{constructor(t){this.response=t}async result(){return this.response.json()}};var R=class{constructor(t){this._transport=t}async send({id:t,request:s={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new k(r))}},k=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/labels",{...t,method:"GET"},s).then(n=>new W(n))}},W=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as X}from"zod";var x=class e{constructor(t){this._transport=t}static SCHEMA=X.object({title:X.string().optional(),description:X.string().optional()});async send({id:t,body:s,request:n={},...r}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))},r).then(o=>new Q(o))}},Q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=class{constructor(t){this._transport=t}async send({id:t,request:s={},...n}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET"},n).then(r=>new Z(r))}},Z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/messages",{...t,method:"GET"},s).then(n=>new $(n))}},$=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as j}from"zod";var _=class e{constructor(t){this._transport=t}static SCHEMA=j.object({input:j.string().max(65536),original:j.string().max(65536),correction:j.string().max(65536)});async send({id:t,body:s,request:n={},...r}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))},r).then(o=>new tt(o))}},tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var T=class{constructor(t){this._transport=t}async send({id:t,request:s={},...n}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new et(r))}},et=class{constructor(t){this.response=t}async result(){return this.response.json()}};var C=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/models",{...t,method:"GET"},s).then(n=>new st(n))}},st=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as L}from"zod";var P=class e{constructor(t){this._transport=t}static SCHEMA=L.array(L.object({role:L.enum(["user","assistant"]),content:L.string().max(65536).nullable()})).min(1);async send({id:t,body:s,request:n={},...r}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(s))},r).then(o=>new nt(o))}},nt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var E=class{constructor(t){this._transport=t}async send({id:t,request:s={},...n}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new rt(r))}},rt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var v=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/sources",{...t,method:"GET"},s).then(n=>new ot(n))}},ot=class{constructor(t){this.response=t}async result(){return this.response.json()}};var w=class{options;constructor({baseURL:t,...s}){this.options={...s,baseURL:t}}async _filterRequest(t){for(let s of this.options.requestFilterables)t=await s.filter(t);return t}async send(t,s,{fetch:n=fetch}={}){return await n(new Request(new URL(t,this.options.baseURL),await this._filterRequest(s)))}};var q=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ct;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var it=class e{static DEFAULT_BASE_URL=at;_transport;constructor(t,{baseURL:s,...n}={}){this._transport=new w({requestFilterables:[new q,t],...n,baseURL:s?.toString()??e.getBaseURL()})}static getBaseURL(){return process.env.SUPPORT_BASE_URL??this.DEFAULT_BASE_URL}get action(){return{list:new i(this._transport)}}get channel(){return{list:new p(this._transport)}}get contact(){return{get:new d(this._transport),list:new u(this._transport),update:new l(this._transport),create:new c(this._transport)}}get conversation(){return{get:new m(this._transport),list:new g(this._transport),update:new y(this._transport),message:{list:new O(this._transport)}}}get label(){return{create:new b(this._transport),get:new R(this._transport),list:new S(this._transport),update:new x(this._transport),delete:new f(this._transport),conversation:{list:new h(this._transport)}}}get message(){return{list:new A(this._transport)}}get model(){return{get:new T(this._transport),list:new C(this._transport),response:{create:new P(this._transport)},correction:{create:new _(this._transport)}}}get source(){return{get:new E(this._transport),list:new v(this._transport)}}};var pt=class{async filter(t){return t}};export{at as a,ut as b,lt as c,mt as d,gt as e,it as f,pt as g};
|