@great-detail/support-sdk 0.1.5 → 0.2.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/dist/chunk-IXJNWCJL.js +1 -0
- package/dist/{chunk-PTKKI5PQ.js → chunk-SRYAEALQ.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-Dm8jdpkD.d.cts → index-Dj17QRj0.d.cts} +141 -111
- package/dist/{index-Dm8jdpkD.d.ts → index-Dj17QRj0.d.ts} +141 -111
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +63 -6
- package/dist/index.d.ts +63 -6
- package/dist/index.js +1 -1
- package/package.json +2 -1
- package/src/Action/ListActions.ts +8 -12
- package/src/Authentication/KeyAuthentication.ts +10 -11
- package/src/Authentication/PublicAuthentication.ts +8 -2
- package/src/Authentication/TokenAuthentication.ts +9 -7
- package/src/Channel/ListChannels.ts +8 -12
- package/src/Client/index.ts +6 -5
- package/src/Contact/ContactVCF/GetContactVCF.ts +24 -5
- package/src/Contact/CreateContact.ts +12 -16
- package/src/Contact/GetContact.ts +8 -12
- package/src/Contact/ListContacts.ts +8 -12
- package/src/Contact/ListLabelContacts.ts +8 -12
- package/src/Contact/UpdateContact.ts +12 -16
- package/src/Conversation/GetConversation.ts +8 -12
- package/src/Conversation/ListConversations.ts +8 -12
- package/src/Conversation/ListLabelConversations.ts +8 -12
- package/src/Conversation/UpdateConversation.ts +12 -16
- package/src/Error/AuthError.ts +12 -0
- package/src/Error/AuthenticationError.ts +16 -0
- package/src/Error/AuthorizationError.ts +16 -0
- package/src/Error/LogicError.ts +20 -0
- package/src/Error/NetworkError.ts +12 -0
- package/src/Error/SupportError.ts +10 -0
- package/src/Error/ValidationError.ts +16 -0
- package/src/Error/index.ts +11 -0
- package/src/Label/CreateLabel.ts +12 -16
- package/src/Label/DeleteLabel.ts +8 -12
- package/src/Label/GetLabel.ts +8 -12
- package/src/Label/ListLabels.ts +8 -12
- package/src/Label/UpdateLabel.ts +12 -16
- package/src/Message/ListConversationMessages.ts +8 -12
- package/src/Message/ListMessages.ts +8 -12
- package/src/Model/Correction/CreateCorrectionModel.ts +12 -16
- package/src/Model/GetModel.ts +8 -12
- package/src/Model/ListModels.ts +8 -12
- package/src/Model/Response/CreateResponseModel.ts +12 -16
- package/src/Request/RequestFilterable.ts +5 -1
- package/src/Request/RequestStandardHeaders.ts +6 -6
- package/src/Source/GetSource.ts +8 -12
- package/src/Source/ListSources.ts +8 -12
- package/src/Transport/FetchTransport.ts +112 -0
- package/src/Transport/index.ts +2 -44
- package/src/__tests__/Client/Client.test.ts +38 -0
- package/src/constants/environment.ts +36 -0
- package/src/constants/index.ts +0 -21
- package/src/index.ts +4 -4
- package/dist/chunk-2LKRKCHH.js +0 -1
- package/src/__tests__/Authentication/KeyAuthentication.test.ts +0 -79
- package/src/__tests__/Authentication/TokenAuthentication.test.ts +0 -79
|
@@ -7,26 +7,22 @@
|
|
|
7
7
|
* @see https://greatdetail.com
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import
|
|
10
|
+
import FetchTransport from "../Transport/FetchTransport.js";
|
|
11
11
|
|
|
12
|
-
export interface Options
|
|
12
|
+
export interface Options {
|
|
13
13
|
id: string;
|
|
14
14
|
request?: RequestInit;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export default class GetConversation {
|
|
18
|
-
constructor(protected _transport:
|
|
18
|
+
constructor(protected _transport: FetchTransport) {}
|
|
19
19
|
|
|
20
|
-
public async send({ id, request = {}
|
|
20
|
+
public async send({ id, request = {} }: Options) {
|
|
21
21
|
return this._transport
|
|
22
|
-
.send(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
method: "GET",
|
|
27
|
-
},
|
|
28
|
-
options,
|
|
29
|
-
)
|
|
22
|
+
.send("v1/conversations/" + encodeURIComponent(id), {
|
|
23
|
+
...request,
|
|
24
|
+
method: "GET",
|
|
25
|
+
})
|
|
30
26
|
.then((response) => new GetConversationResponse(response));
|
|
31
27
|
}
|
|
32
28
|
}
|
|
@@ -7,25 +7,21 @@
|
|
|
7
7
|
* @see https://greatdetail.com
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import
|
|
10
|
+
import FetchTransport from "../Transport/FetchTransport.js";
|
|
11
11
|
|
|
12
|
-
export interface Options
|
|
12
|
+
export interface Options {
|
|
13
13
|
request?: RequestInit;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export default class ListConversations {
|
|
17
|
-
constructor(protected _transport:
|
|
17
|
+
constructor(protected _transport: FetchTransport) {}
|
|
18
18
|
|
|
19
|
-
public async send({ request = {}
|
|
19
|
+
public async send({ request = {} }: Options = {}) {
|
|
20
20
|
return this._transport
|
|
21
|
-
.send(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
method: "GET",
|
|
26
|
-
},
|
|
27
|
-
options,
|
|
28
|
-
)
|
|
21
|
+
.send("v1/conversations", {
|
|
22
|
+
...request,
|
|
23
|
+
method: "GET",
|
|
24
|
+
})
|
|
29
25
|
.then((response) => new ListConversationsResponse(response));
|
|
30
26
|
}
|
|
31
27
|
}
|
|
@@ -7,26 +7,22 @@
|
|
|
7
7
|
* @see https://greatdetail.com
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import
|
|
10
|
+
import FetchTransport from "../Transport/FetchTransport.js";
|
|
11
11
|
|
|
12
|
-
export interface Options
|
|
12
|
+
export interface Options {
|
|
13
13
|
id: string;
|
|
14
14
|
request?: RequestInit;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export default class ListLabelConversations {
|
|
18
|
-
constructor(protected _transport:
|
|
18
|
+
constructor(protected _transport: FetchTransport) {}
|
|
19
19
|
|
|
20
|
-
public async send({ id, request = {}
|
|
20
|
+
public async send({ id, request = {} }: Options) {
|
|
21
21
|
return this._transport
|
|
22
|
-
.send(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
method: "GET",
|
|
27
|
-
},
|
|
28
|
-
options,
|
|
29
|
-
)
|
|
22
|
+
.send("v1/labels/" + encodeURIComponent(id) + "/conversations", {
|
|
23
|
+
...request,
|
|
24
|
+
method: "GET",
|
|
25
|
+
})
|
|
30
26
|
.then((response) => new ListLabelConversationsResponse(response));
|
|
31
27
|
}
|
|
32
28
|
}
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { z } from "zod";
|
|
11
|
-
import
|
|
11
|
+
import FetchTransport from "../Transport/FetchTransport.js";
|
|
12
12
|
|
|
13
|
-
export interface Options
|
|
13
|
+
export interface Options {
|
|
14
14
|
id: string;
|
|
15
15
|
body: z.infer<typeof UpdateConversation.SCHEMA>;
|
|
16
16
|
request?: RequestInit;
|
|
@@ -21,23 +21,19 @@ export default class UpdateConversation {
|
|
|
21
21
|
hasEnded: z.boolean(),
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
constructor(protected _transport:
|
|
24
|
+
constructor(protected _transport: FetchTransport) {}
|
|
25
25
|
|
|
26
|
-
public async send({ id, body, request = {}
|
|
26
|
+
public async send({ id, body, request = {} }: Options) {
|
|
27
27
|
return this._transport
|
|
28
|
-
.send(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
...request.headers,
|
|
35
|
-
"Content-Type": "application/json",
|
|
36
|
-
},
|
|
37
|
-
body: JSON.stringify(UpdateConversation.SCHEMA.parse(body)),
|
|
28
|
+
.send("v1/conversations/" + encodeURIComponent(id), {
|
|
29
|
+
...request,
|
|
30
|
+
method: "POST",
|
|
31
|
+
headers: {
|
|
32
|
+
...request.headers,
|
|
33
|
+
"Content-Type": "application/json",
|
|
38
34
|
},
|
|
39
|
-
|
|
40
|
-
)
|
|
35
|
+
body: JSON.stringify(UpdateConversation.SCHEMA.parse(body)),
|
|
36
|
+
})
|
|
41
37
|
.then((response) => new UpdateConversationResponse(response));
|
|
42
38
|
}
|
|
43
39
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
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 SupportError from "./SupportError.js";
|
|
11
|
+
|
|
12
|
+
export default class AuthError extends SupportError {}
|
|
@@ -0,0 +1,16 @@
|
|
|
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 AuthError from "./AuthError.js";
|
|
11
|
+
|
|
12
|
+
export default class AuthenticationError extends AuthError {
|
|
13
|
+
public static unauthenticated() {
|
|
14
|
+
return new this("An unauthenticated request occurred");
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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 AuthError from "./AuthError.js";
|
|
11
|
+
|
|
12
|
+
export default class AuthorizationError extends AuthError {
|
|
13
|
+
public static forbidden() {
|
|
14
|
+
return new this("A forbidden request occurred");
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 SupportError from "./SupportError.js";
|
|
11
|
+
|
|
12
|
+
export default class LogicError extends SupportError {
|
|
13
|
+
public static notFound(url: string) {
|
|
14
|
+
return new this(`Record not found for request: ${url}`);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public static forbiddenMethod(method: string, url: string) {
|
|
18
|
+
return new this(`Forbidden method for request: ${method} ${url}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
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 SupportError from "./SupportError.js";
|
|
11
|
+
|
|
12
|
+
export default class NetworkError extends SupportError {}
|
|
@@ -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 default class SupportError extends Error {}
|
|
@@ -0,0 +1,16 @@
|
|
|
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 SupportError from "./SupportError.js";
|
|
11
|
+
|
|
12
|
+
export default class ValidationError extends SupportError {
|
|
13
|
+
public static badRequest() {
|
|
14
|
+
return new this(`Bad request`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -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 { default as SupportError } from "./SupportError.js";
|
|
11
|
+
export { default as NetworkError } from "./NetworkError.js";
|
package/src/Label/CreateLabel.ts
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { z } from "zod";
|
|
11
|
-
import
|
|
11
|
+
import FetchTransport from "../Transport/FetchTransport.js";
|
|
12
12
|
|
|
13
|
-
export interface Options
|
|
13
|
+
export interface Options {
|
|
14
14
|
body: z.infer<typeof CreateLabel.SCHEMA>;
|
|
15
15
|
request?: RequestInit;
|
|
16
16
|
}
|
|
@@ -22,23 +22,19 @@ export default class CreateLabel {
|
|
|
22
22
|
account: z.string(),
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
constructor(protected _transport:
|
|
25
|
+
constructor(protected _transport: FetchTransport) {}
|
|
26
26
|
|
|
27
|
-
public async send({ body, request = {}
|
|
27
|
+
public async send({ body, request = {} }: Options) {
|
|
28
28
|
return this._transport
|
|
29
|
-
.send(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
...request.headers,
|
|
36
|
-
"Content-Type": "application/json",
|
|
37
|
-
},
|
|
38
|
-
body: JSON.stringify(CreateLabel.SCHEMA.parse(body)),
|
|
29
|
+
.send("v1/labels", {
|
|
30
|
+
...request,
|
|
31
|
+
method: "POST",
|
|
32
|
+
headers: {
|
|
33
|
+
...request.headers,
|
|
34
|
+
"Content-Type": "application/json",
|
|
39
35
|
},
|
|
40
|
-
|
|
41
|
-
)
|
|
36
|
+
body: JSON.stringify(CreateLabel.SCHEMA.parse(body)),
|
|
37
|
+
})
|
|
42
38
|
.then((response) => new CreateLabelResponse(response));
|
|
43
39
|
}
|
|
44
40
|
}
|
package/src/Label/DeleteLabel.ts
CHANGED
|
@@ -7,26 +7,22 @@
|
|
|
7
7
|
* @see https://greatdetail.com
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import
|
|
10
|
+
import FetchTransport from "../Transport/FetchTransport.js";
|
|
11
11
|
|
|
12
|
-
export interface Options
|
|
12
|
+
export interface Options {
|
|
13
13
|
id: string;
|
|
14
14
|
request?: RequestInit;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export default class DeleteLabel {
|
|
18
|
-
constructor(protected _transport:
|
|
18
|
+
constructor(protected _transport: FetchTransport) {}
|
|
19
19
|
|
|
20
|
-
public async send({ id, request = {}
|
|
20
|
+
public async send({ id, request = {} }: Options) {
|
|
21
21
|
return this._transport
|
|
22
|
-
.send(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
method: "DELETE",
|
|
27
|
-
},
|
|
28
|
-
options,
|
|
29
|
-
)
|
|
22
|
+
.send("v1/labels/" + encodeURIComponent(id), {
|
|
23
|
+
...request,
|
|
24
|
+
method: "DELETE",
|
|
25
|
+
})
|
|
30
26
|
.then((response) => new DeleteLabelResponse(response));
|
|
31
27
|
}
|
|
32
28
|
}
|
package/src/Label/GetLabel.ts
CHANGED
|
@@ -7,26 +7,22 @@
|
|
|
7
7
|
* @see https://greatdetail.com
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import
|
|
10
|
+
import FetchTransport from "../Transport/FetchTransport.js";
|
|
11
11
|
|
|
12
|
-
export interface Options
|
|
12
|
+
export interface Options {
|
|
13
13
|
id: string;
|
|
14
14
|
request?: RequestInit;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export default class GetLabel {
|
|
18
|
-
constructor(protected _transport:
|
|
18
|
+
constructor(protected _transport: FetchTransport) {}
|
|
19
19
|
|
|
20
|
-
public async send({ id, request = {}
|
|
20
|
+
public async send({ id, request = {} }: Options) {
|
|
21
21
|
return this._transport
|
|
22
|
-
.send(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
method: "GET",
|
|
27
|
-
},
|
|
28
|
-
options,
|
|
29
|
-
)
|
|
22
|
+
.send("v1/labels/" + encodeURIComponent(id), {
|
|
23
|
+
...request,
|
|
24
|
+
method: "GET",
|
|
25
|
+
})
|
|
30
26
|
.then((response) => new GetLabelResponse(response));
|
|
31
27
|
}
|
|
32
28
|
}
|
package/src/Label/ListLabels.ts
CHANGED
|
@@ -7,25 +7,21 @@
|
|
|
7
7
|
* @see https://greatdetail.com
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import
|
|
10
|
+
import FetchTransport from "../Transport/FetchTransport.js";
|
|
11
11
|
|
|
12
|
-
export interface Options
|
|
12
|
+
export interface Options {
|
|
13
13
|
request?: RequestInit;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export default class ListLabels {
|
|
17
|
-
constructor(protected _transport:
|
|
17
|
+
constructor(protected _transport: FetchTransport) {}
|
|
18
18
|
|
|
19
|
-
public async send({ request = {}
|
|
19
|
+
public async send({ request = {} }: Options = {}) {
|
|
20
20
|
return this._transport
|
|
21
|
-
.send(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
method: "GET",
|
|
26
|
-
},
|
|
27
|
-
options,
|
|
28
|
-
)
|
|
21
|
+
.send("v1/labels", {
|
|
22
|
+
...request,
|
|
23
|
+
method: "GET",
|
|
24
|
+
})
|
|
29
25
|
.then((response) => new ListLabelsResponse(response));
|
|
30
26
|
}
|
|
31
27
|
}
|
package/src/Label/UpdateLabel.ts
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { z } from "zod";
|
|
11
|
-
import
|
|
11
|
+
import FetchTransport from "../Transport/FetchTransport.js";
|
|
12
12
|
|
|
13
|
-
export interface Options
|
|
13
|
+
export interface Options {
|
|
14
14
|
id: string;
|
|
15
15
|
body: z.infer<typeof UpdateLabel.SCHEMA>;
|
|
16
16
|
request?: RequestInit;
|
|
@@ -22,23 +22,19 @@ export default class UpdateLabel {
|
|
|
22
22
|
description: z.string().optional(),
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
constructor(protected _transport:
|
|
25
|
+
constructor(protected _transport: FetchTransport) {}
|
|
26
26
|
|
|
27
|
-
public async send({ id, body, request = {}
|
|
27
|
+
public async send({ id, body, request = {} }: Options) {
|
|
28
28
|
return this._transport
|
|
29
|
-
.send(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
...request.headers,
|
|
36
|
-
"Content-Type": "application/json",
|
|
37
|
-
},
|
|
38
|
-
body: JSON.stringify(UpdateLabel.SCHEMA.parse(body)),
|
|
29
|
+
.send("v1/labels/" + encodeURIComponent(id), {
|
|
30
|
+
...request,
|
|
31
|
+
method: "PATCH",
|
|
32
|
+
headers: {
|
|
33
|
+
...request.headers,
|
|
34
|
+
"Content-Type": "application/json",
|
|
39
35
|
},
|
|
40
|
-
|
|
41
|
-
)
|
|
36
|
+
body: JSON.stringify(UpdateLabel.SCHEMA.parse(body)),
|
|
37
|
+
})
|
|
42
38
|
.then((response) => new UpdateLabelResponse(response));
|
|
43
39
|
}
|
|
44
40
|
}
|
|
@@ -7,26 +7,22 @@
|
|
|
7
7
|
* @see https://greatdetail.com
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import
|
|
10
|
+
import FetchTransport from "../Transport/FetchTransport.js";
|
|
11
11
|
|
|
12
|
-
export interface Options
|
|
12
|
+
export interface Options {
|
|
13
13
|
id: string;
|
|
14
14
|
request?: RequestInit;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export default class ListConversationMessages {
|
|
18
|
-
constructor(protected _transport:
|
|
18
|
+
constructor(protected _transport: FetchTransport) {}
|
|
19
19
|
|
|
20
|
-
public async send({ id, request = {}
|
|
20
|
+
public async send({ id, request = {} }: Options) {
|
|
21
21
|
return this._transport
|
|
22
|
-
.send(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
method: "GET",
|
|
27
|
-
},
|
|
28
|
-
options,
|
|
29
|
-
)
|
|
22
|
+
.send("v1/conversations/" + encodeURIComponent(id) + "/messages", {
|
|
23
|
+
...request,
|
|
24
|
+
method: "GET",
|
|
25
|
+
})
|
|
30
26
|
.then((response) => new ListConversationMessagesResponse(response));
|
|
31
27
|
}
|
|
32
28
|
}
|
|
@@ -7,25 +7,21 @@
|
|
|
7
7
|
* @see https://greatdetail.com
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import
|
|
10
|
+
import FetchTransport from "../Transport/FetchTransport.js";
|
|
11
11
|
|
|
12
|
-
export interface Options
|
|
12
|
+
export interface Options {
|
|
13
13
|
request?: RequestInit;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export default class ListMessages {
|
|
17
|
-
constructor(protected _transport:
|
|
17
|
+
constructor(protected _transport: FetchTransport) {}
|
|
18
18
|
|
|
19
|
-
public async send({ request = {}
|
|
19
|
+
public async send({ request = {} }: Options = {}) {
|
|
20
20
|
return this._transport
|
|
21
|
-
.send(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
method: "GET",
|
|
26
|
-
},
|
|
27
|
-
options,
|
|
28
|
-
)
|
|
21
|
+
.send("v1/messages", {
|
|
22
|
+
...request,
|
|
23
|
+
method: "GET",
|
|
24
|
+
})
|
|
29
25
|
.then((response) => new ListMessagesResponse(response));
|
|
30
26
|
}
|
|
31
27
|
}
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { z } from "zod";
|
|
11
|
-
import
|
|
11
|
+
import FetchTransport from "../../Transport/FetchTransport.js";
|
|
12
12
|
|
|
13
|
-
export interface Options
|
|
13
|
+
export interface Options {
|
|
14
14
|
id: string;
|
|
15
15
|
body: z.infer<typeof CreateCorrectionModel.SCHEMA>;
|
|
16
16
|
request?: RequestInit;
|
|
@@ -23,23 +23,19 @@ export default class CreateCorrectionModel {
|
|
|
23
23
|
correction: z.string().max(65_536),
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
constructor(protected _transport:
|
|
26
|
+
constructor(protected _transport: FetchTransport) {}
|
|
27
27
|
|
|
28
|
-
public async send({ id, body, request = {}
|
|
28
|
+
public async send({ id, body, request = {} }: Options) {
|
|
29
29
|
return this._transport
|
|
30
|
-
.send(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
...request.headers,
|
|
37
|
-
"Content-Type": "application/json",
|
|
38
|
-
},
|
|
39
|
-
body: JSON.stringify(CreateCorrectionModel.SCHEMA.parse(body)),
|
|
30
|
+
.send("v1/models/" + encodeURIComponent(id) + "/correction", {
|
|
31
|
+
...request,
|
|
32
|
+
method: "POST",
|
|
33
|
+
headers: {
|
|
34
|
+
...request.headers,
|
|
35
|
+
"Content-Type": "application/json",
|
|
40
36
|
},
|
|
41
|
-
|
|
42
|
-
)
|
|
37
|
+
body: JSON.stringify(CreateCorrectionModel.SCHEMA.parse(body)),
|
|
38
|
+
})
|
|
43
39
|
.then((response) => new CreateCorrectionModelResponse(response));
|
|
44
40
|
}
|
|
45
41
|
}
|
package/src/Model/GetModel.ts
CHANGED
|
@@ -7,26 +7,22 @@
|
|
|
7
7
|
* @see https://greatdetail.com
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import
|
|
10
|
+
import FetchTransport from "../Transport/FetchTransport.js";
|
|
11
11
|
|
|
12
|
-
export interface Options
|
|
12
|
+
export interface Options {
|
|
13
13
|
id: string;
|
|
14
14
|
request?: RequestInit;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export default class GetModel {
|
|
18
|
-
constructor(protected _transport:
|
|
18
|
+
constructor(protected _transport: FetchTransport) {}
|
|
19
19
|
|
|
20
|
-
public async send({ id, request = {}
|
|
20
|
+
public async send({ id, request = {} }: Options) {
|
|
21
21
|
return this._transport
|
|
22
|
-
.send(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
method: "GET",
|
|
27
|
-
},
|
|
28
|
-
options,
|
|
29
|
-
)
|
|
22
|
+
.send("v1/models/" + encodeURIComponent(id), {
|
|
23
|
+
...request,
|
|
24
|
+
method: "GET",
|
|
25
|
+
})
|
|
30
26
|
.then((response) => new GetModelResponse(response));
|
|
31
27
|
}
|
|
32
28
|
}
|
package/src/Model/ListModels.ts
CHANGED
|
@@ -7,25 +7,21 @@
|
|
|
7
7
|
* @see https://greatdetail.com
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import
|
|
10
|
+
import FetchTransport from "../Transport/FetchTransport.js";
|
|
11
11
|
|
|
12
|
-
export interface Options
|
|
12
|
+
export interface Options {
|
|
13
13
|
request?: RequestInit;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export default class ListModels {
|
|
17
|
-
constructor(protected _transport:
|
|
17
|
+
constructor(protected _transport: FetchTransport) {}
|
|
18
18
|
|
|
19
|
-
public async send({ request = {}
|
|
19
|
+
public async send({ request = {} }: Options = {}) {
|
|
20
20
|
return this._transport
|
|
21
|
-
.send(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
method: "GET",
|
|
26
|
-
},
|
|
27
|
-
options,
|
|
28
|
-
)
|
|
21
|
+
.send("v1/models", {
|
|
22
|
+
...request,
|
|
23
|
+
method: "GET",
|
|
24
|
+
})
|
|
29
25
|
.then((response) => new ListModelsResponse(response));
|
|
30
26
|
}
|
|
31
27
|
}
|