@great-detail/support-sdk 0.3.4 → 0.4.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.
Files changed (81) hide show
  1. package/dist/chunk-2WFTGNNI.js +1 -0
  2. package/dist/chunk-ILW336CI.js +1 -0
  3. package/dist/cli/index.cjs +1 -1
  4. package/dist/cli/index.d.cts +1 -1
  5. package/dist/cli/index.d.ts +1 -1
  6. package/dist/cli/index.js +1 -1
  7. package/dist/cli.cjs +1 -1
  8. package/dist/cli.js +1 -1
  9. package/dist/{index-D1aGs0vV.d.cts → index-Dp-x4kXq.d.cts} +267 -825
  10. package/dist/{index-D1aGs0vV.d.ts → index-Dp-x4kXq.d.ts} +267 -825
  11. package/dist/index.cjs +1 -1
  12. package/dist/index.d.cts +15 -12
  13. package/dist/index.d.ts +15 -12
  14. package/dist/index.js +1 -1
  15. package/package.json +1 -1
  16. package/src/Action/ListActions.ts +8 -18
  17. package/src/Action/index.ts +1 -1
  18. package/src/Boilerplate/CreateBoilerplateCategoryBoilerplate.ts +24 -37
  19. package/src/Boilerplate/GetBoilerplate.ts +11 -18
  20. package/src/Boilerplate/ListBoilerplateCategoryBoilerplates.ts +8 -20
  21. package/src/Boilerplate/ListBoilerplates.ts +8 -18
  22. package/src/Boilerplate/UpdateBoilerplate.ts +17 -24
  23. package/src/Boilerplate/index.ts +5 -5
  24. package/src/BoilerplateCategory/CreateBoilerplateCategory.ts +16 -23
  25. package/src/BoilerplateCategory/GetBoilerplateCategory.ts +11 -18
  26. package/src/BoilerplateCategory/ListBoilerplateCategories.ts +11 -18
  27. package/src/BoilerplateCategory/UpdateBoilerplateCategory.ts +16 -23
  28. package/src/BoilerplateCategory/index.ts +4 -4
  29. package/src/Channel/ListChannels.ts +8 -18
  30. package/src/Channel/index.ts +1 -1
  31. package/src/Client/index.ts +1 -0
  32. package/src/Contact/CreateContact.ts +20 -30
  33. package/src/Contact/GetContact.ts +11 -18
  34. package/src/Contact/ListContacts.ts +8 -18
  35. package/src/Contact/ListLabelContacts.ts +11 -18
  36. package/src/Contact/UpdateContact.ts +17 -24
  37. package/src/Contact/index.ts +5 -5
  38. package/src/Conversation/CreateConversation.ts +58 -0
  39. package/src/Conversation/GetConversation.ts +11 -18
  40. package/src/Conversation/ListContactConversations.ts +11 -18
  41. package/src/Conversation/ListConversations.ts +8 -18
  42. package/src/Conversation/ListLabelConversations.ts +11 -18
  43. package/src/Conversation/UpdateConversation.ts +21 -28
  44. package/src/Conversation/index.ts +6 -5
  45. package/src/Label/CreateLabel.ts +19 -29
  46. package/src/Label/DeleteLabel.ts +7 -14
  47. package/src/Label/GetLabel.ts +11 -18
  48. package/src/Label/ListLabels.ts +8 -18
  49. package/src/Label/UpdateLabel.ts +16 -23
  50. package/src/Label/index.ts +5 -5
  51. package/src/Message/ListConversationMessages.ts +11 -18
  52. package/src/Message/ListMessages.ts +8 -18
  53. package/src/Message/index.ts +2 -2
  54. package/src/Model/Correction/CreateCorrectionModel.ts +7 -14
  55. package/src/Model/GetModel.ts +11 -18
  56. package/src/Model/ListModels.ts +8 -18
  57. package/src/Model/Response/CreateResponseModel.ts +13 -20
  58. package/src/Model/index.ts +4 -4
  59. package/src/Note/CreateContactNote.ts +14 -21
  60. package/src/Note/CreateConversationNote.ts +14 -21
  61. package/src/Note/GetNote.ts +11 -18
  62. package/src/Note/ListContactNotes.ts +11 -18
  63. package/src/Note/ListConversationNotes.ts +11 -18
  64. package/src/Note/UpdateNote.ts +14 -21
  65. package/src/Note/index.ts +6 -6
  66. package/src/Source/GetSource.ts +11 -18
  67. package/src/Source/ListSources.ts +8 -18
  68. package/src/Source/index.ts +2 -2
  69. package/src/Subscription/CreateContactSubscription.ts +13 -20
  70. package/src/Subscription/index.ts +1 -1
  71. package/src/Transport/FetchTransport.ts +25 -17
  72. package/src/cli/actions.ts +1 -1
  73. package/src/cli/channels.ts +1 -1
  74. package/src/cli/contacts.ts +2 -2
  75. package/src/cli/conversations.ts +2 -2
  76. package/src/cli/labels.ts +3 -3
  77. package/src/cli/messages.ts +1 -1
  78. package/src/cli/models.ts +2 -2
  79. package/src/cli/sources.ts +2 -2
  80. package/dist/chunk-JOZI4K7D.js +0 -1
  81. package/dist/chunk-KH5SOWM5.js +0 -1
@@ -16,6 +16,22 @@ export interface Options {
16
16
  request?: RequestInit;
17
17
  }
18
18
 
19
+ export type UpdateConversationResponse = {
20
+ conversation: {
21
+ id: string;
22
+ name?: string;
23
+ hasEnded: boolean;
24
+ conversationStatus:
25
+ | "AwaitingContactConversationStatus"
26
+ | "AwaitingAgentConversationStatus"
27
+ | "ResolvedConversationStatus"
28
+ | "ClosedConversationStatus";
29
+ accountChannel: string;
30
+ createdAt: string;
31
+ updatedAt: string;
32
+ };
33
+ };
34
+
19
35
  export default class UpdateConversation {
20
36
  public static SCHEMA = z.object({
21
37
  conversationStatus: z
@@ -32,8 +48,9 @@ export default class UpdateConversation {
32
48
  constructor(protected _transport: FetchTransport) {}
33
49
 
34
50
  public async send({ id, body, request = {} }: Options) {
35
- return this._transport
36
- .send("v1/conversations/" + encodeURIComponent(id), {
51
+ return this._transport.send<UpdateConversationResponse>(
52
+ "v1/conversations/" + encodeURIComponent(id),
53
+ {
37
54
  ...request,
38
55
  method: "PATCH",
39
56
  headers: {
@@ -41,31 +58,7 @@ export default class UpdateConversation {
41
58
  "Content-Type": "application/json",
42
59
  },
43
60
  body: JSON.stringify(UpdateConversation.SCHEMA.parse(body)),
44
- })
45
- .then((response) => new UpdateConversationResponse(response));
46
- }
47
- }
48
-
49
- export type UpdateConversationResponsePayload = {
50
- conversation: {
51
- id: string;
52
- name?: string;
53
- hasEnded: boolean;
54
- conversationStatus:
55
- | "AwaitingContactConversationStatus"
56
- | "AwaitingAgentConversationStatus"
57
- | "ResolvedConversationStatus"
58
- | "ClosedConversationStatus";
59
- accountChannel: string;
60
- createdAt: string;
61
- updatedAt: string;
62
- };
63
- };
64
-
65
- export class UpdateConversationResponse {
66
- constructor(public response: Response) {}
67
-
68
- public async result(): Promise<UpdateConversationResponsePayload> {
69
- return this.response.json();
61
+ },
62
+ );
70
63
  }
71
64
  }
@@ -7,8 +7,9 @@
7
7
  * @see https://greatdetail.com
8
8
  */
9
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";
14
- export { type ListContactConversationsResponsePayload } from "./ListContactConversations.js";
10
+ export { type GetConversationResponse } from "./GetConversation.js";
11
+ export { type ListConversationsResponse } from "./ListConversations.js";
12
+ export { type ListLabelConversationsResponse } from "./ListLabelConversations.js";
13
+ export { type UpdateConversationResponse } from "./UpdateConversation.js";
14
+ export { type ListContactConversationsResponse } from "./ListContactConversations.js";
15
+ export { type CreateConversationResponse } from "./CreateConversation.js";
@@ -15,31 +15,7 @@ export interface Options {
15
15
  request?: RequestInit;
16
16
  }
17
17
 
18
- export default class CreateLabel {
19
- public static SCHEMA = z.object({
20
- title: z.string(),
21
- description: z.string().optional(),
22
- account: z.string(),
23
- });
24
-
25
- constructor(protected _transport: FetchTransport) {}
26
-
27
- public async send({ body, request = {} }: Options) {
28
- return this._transport
29
- .send("v1/labels", {
30
- ...request,
31
- method: "POST",
32
- headers: {
33
- ...request.headers,
34
- "Content-Type": "application/json",
35
- },
36
- body: JSON.stringify(CreateLabel.SCHEMA.parse(body)),
37
- })
38
- .then((response) => new CreateLabelResponse(response));
39
- }
40
- }
41
-
42
- export type CreateLabelResponsePayload = {
18
+ export type CreateLabelResponse = {
43
19
  label: {
44
20
  id: string;
45
21
  title: string;
@@ -50,10 +26,24 @@ export type CreateLabelResponsePayload = {
50
26
  };
51
27
  };
52
28
 
53
- export class CreateLabelResponse {
54
- constructor(public response: Response) {}
29
+ export default class CreateLabel {
30
+ public static SCHEMA = z.object({
31
+ title: z.string(),
32
+ description: z.string().optional(),
33
+ account: z.string(),
34
+ });
55
35
 
56
- public async result(): Promise<CreateLabelResponsePayload> {
57
- return this.response.json();
36
+ constructor(protected _transport: FetchTransport) {}
37
+
38
+ public async send({ body, request = {} }: Options) {
39
+ return this._transport.send<CreateLabelResponse>("v1/labels", {
40
+ ...request,
41
+ method: "POST",
42
+ headers: {
43
+ ...request.headers,
44
+ "Content-Type": "application/json",
45
+ },
46
+ body: JSON.stringify(CreateLabel.SCHEMA.parse(body)),
47
+ });
58
48
  }
59
49
  }
@@ -14,25 +14,18 @@ export interface Options {
14
14
  request?: RequestInit;
15
15
  }
16
16
 
17
+ export type DeleteLabelResponse = Record<string, never>;
18
+
17
19
  export default class DeleteLabel {
18
20
  constructor(protected _transport: FetchTransport) {}
19
21
 
20
22
  public async send({ id, request = {} }: Options) {
21
- return this._transport
22
- .send("v1/labels/" + encodeURIComponent(id), {
23
+ return this._transport.send<DeleteLabelResponse>(
24
+ "v1/labels/" + encodeURIComponent(id),
25
+ {
23
26
  ...request,
24
27
  method: "DELETE",
25
- })
26
- .then((response) => new DeleteLabelResponse(response));
27
- }
28
- }
29
-
30
- export type DeleteLabelResponsePayload = Record<string, never>;
31
-
32
- export class DeleteLabelResponse {
33
- constructor(public response: Response) {}
34
-
35
- public async result(): Promise<DeleteLabelResponsePayload> {
36
- return this.response.json();
28
+ },
29
+ );
37
30
  }
38
31
  }
@@ -14,20 +14,7 @@ export interface Options {
14
14
  request?: RequestInit;
15
15
  }
16
16
 
17
- export default class GetLabel {
18
- constructor(protected _transport: FetchTransport) {}
19
-
20
- public async send({ id, request = {} }: Options) {
21
- return this._transport
22
- .send("v1/labels/" + encodeURIComponent(id), {
23
- ...request,
24
- method: "GET",
25
- })
26
- .then((response) => new GetLabelResponse(response));
27
- }
28
- }
29
-
30
- export type GetLabelResponsePayload = {
17
+ export type GetLabelResponse = {
31
18
  label: {
32
19
  id: string;
33
20
  title: string;
@@ -38,10 +25,16 @@ export type GetLabelResponsePayload = {
38
25
  };
39
26
  };
40
27
 
41
- export class GetLabelResponse {
42
- constructor(public response: Response) {}
28
+ export default class GetLabel {
29
+ constructor(protected _transport: FetchTransport) {}
43
30
 
44
- public async result(): Promise<GetLabelResponsePayload> {
45
- return this.response.json();
31
+ public async send({ id, request = {} }: Options) {
32
+ return this._transport.send<GetLabelResponse>(
33
+ "v1/labels/" + encodeURIComponent(id),
34
+ {
35
+ ...request,
36
+ method: "GET",
37
+ },
38
+ );
46
39
  }
47
40
  }
@@ -13,20 +13,7 @@ export interface Options {
13
13
  request?: RequestInit;
14
14
  }
15
15
 
16
- export default class ListLabels {
17
- constructor(protected _transport: FetchTransport) {}
18
-
19
- public async send({ request = {} }: Options = {}) {
20
- return this._transport
21
- .send("v1/labels", {
22
- ...request,
23
- method: "GET",
24
- })
25
- .then((response) => new ListLabelsResponse(response));
26
- }
27
- }
28
-
29
- export type ListLabelsResponsePayload = {
16
+ export type ListLabelsResponse = {
30
17
  labels: {
31
18
  id: string;
32
19
  title: string;
@@ -37,10 +24,13 @@ export type ListLabelsResponsePayload = {
37
24
  }[];
38
25
  };
39
26
 
40
- export class ListLabelsResponse {
41
- constructor(public response: Response) {}
27
+ export default class ListLabels {
28
+ constructor(protected _transport: FetchTransport) {}
42
29
 
43
- public async result(): Promise<ListLabelsResponsePayload> {
44
- return this.response.json();
30
+ public async send({ request = {} }: Options = {}) {
31
+ return this._transport.send<ListLabelsResponse>("v1/labels", {
32
+ ...request,
33
+ method: "GET",
34
+ });
45
35
  }
46
36
  }
@@ -16,6 +16,17 @@ export interface Options {
16
16
  request?: RequestInit;
17
17
  }
18
18
 
19
+ export type UpdateLabelResponse = {
20
+ label: {
21
+ id: string;
22
+ title: string;
23
+ description?: string;
24
+ account: string;
25
+ createdAt: string;
26
+ updatedAt?: string;
27
+ };
28
+ };
29
+
19
30
  export default class UpdateLabel {
20
31
  public static SCHEMA = z.object({
21
32
  title: z.string().optional(),
@@ -25,8 +36,9 @@ export default class UpdateLabel {
25
36
  constructor(protected _transport: FetchTransport) {}
26
37
 
27
38
  public async send({ id, body, request = {} }: Options) {
28
- return this._transport
29
- .send("v1/labels/" + encodeURIComponent(id), {
39
+ return this._transport.send<UpdateLabelResponse>(
40
+ "v1/labels/" + encodeURIComponent(id),
41
+ {
30
42
  ...request,
31
43
  method: "PATCH",
32
44
  headers: {
@@ -34,26 +46,7 @@ export default class UpdateLabel {
34
46
  "Content-Type": "application/json",
35
47
  },
36
48
  body: JSON.stringify(UpdateLabel.SCHEMA.parse(body)),
37
- })
38
- .then((response) => new UpdateLabelResponse(response));
39
- }
40
- }
41
-
42
- export type UpdateLabelResponsePayload = {
43
- label: {
44
- id: string;
45
- title: string;
46
- description?: string;
47
- account: string;
48
- createdAt: string;
49
- updatedAt?: string;
50
- };
51
- };
52
-
53
- export class UpdateLabelResponse {
54
- constructor(public response: Response) {}
55
-
56
- public async result(): Promise<UpdateLabelResponsePayload> {
57
- return this.response.json();
49
+ },
50
+ );
58
51
  }
59
52
  }
@@ -7,8 +7,8 @@
7
7
  * @see https://greatdetail.com
8
8
  */
9
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";
10
+ export { type CreateLabelResponse } from "./CreateLabel.js";
11
+ export { type DeleteLabelResponse } from "./DeleteLabel.js";
12
+ export { type GetLabelResponse } from "./GetLabel.js";
13
+ export { type ListLabelsResponse } from "./ListLabels.js";
14
+ export { type UpdateLabelResponse } from "./UpdateLabel.js";
@@ -14,20 +14,7 @@ export interface Options {
14
14
  request?: RequestInit;
15
15
  }
16
16
 
17
- export default class ListConversationMessages {
18
- constructor(protected _transport: FetchTransport) {}
19
-
20
- public async send({ id, request = {} }: Options) {
21
- return this._transport
22
- .send("v1/conversations/" + encodeURIComponent(id) + "/messages", {
23
- ...request,
24
- method: "GET",
25
- })
26
- .then((response) => new ListConversationMessagesResponse(response));
27
- }
28
- }
29
-
30
- export type ListConversationMessagesResponsePayload = {
17
+ export type ListConversationMessagesResponse = {
31
18
  messages: {
32
19
  id: string;
33
20
  role: "user" | "assistant";
@@ -47,10 +34,16 @@ export type ListConversationMessagesResponsePayload = {
47
34
  }[];
48
35
  };
49
36
 
50
- export class ListConversationMessagesResponse {
51
- constructor(public response: Response) {}
37
+ export default class ListConversationMessages {
38
+ constructor(protected _transport: FetchTransport) {}
52
39
 
53
- public async result(): Promise<ListConversationMessagesResponsePayload> {
54
- return this.response.json();
40
+ public async send({ id, request = {} }: Options) {
41
+ return this._transport.send(
42
+ "v1/conversations/" + encodeURIComponent(id) + "/messages",
43
+ {
44
+ ...request,
45
+ method: "GET",
46
+ },
47
+ );
55
48
  }
56
49
  }
@@ -13,20 +13,7 @@ export interface Options {
13
13
  request?: RequestInit;
14
14
  }
15
15
 
16
- export default class ListMessages {
17
- constructor(protected _transport: FetchTransport) {}
18
-
19
- public async send({ request = {} }: Options = {}) {
20
- return this._transport
21
- .send("v1/messages", {
22
- ...request,
23
- method: "GET",
24
- })
25
- .then((response) => new ListMessagesResponse(response));
26
- }
27
- }
28
-
29
- export type ListMessagesResponsePayload = {
16
+ export type ListMessagesResponse = {
30
17
  messages: {
31
18
  id: string;
32
19
  role: "user" | "assistant";
@@ -46,10 +33,13 @@ export type ListMessagesResponsePayload = {
46
33
  }[];
47
34
  };
48
35
 
49
- export class ListMessagesResponse {
50
- constructor(public response: Response) {}
36
+ export default class ListMessages {
37
+ constructor(protected _transport: FetchTransport) {}
51
38
 
52
- public async result(): Promise<ListMessagesResponsePayload> {
53
- return this.response.json();
39
+ public async send({ request = {} }: Options = {}) {
40
+ return this._transport.send<ListMessagesResponse>("v1/messages", {
41
+ ...request,
42
+ method: "GET",
43
+ });
54
44
  }
55
45
  }
@@ -7,5 +7,5 @@
7
7
  * @see https://greatdetail.com
8
8
  */
9
9
 
10
- export { type ListConversationMessagesResponsePayload } from "./ListConversationMessages.js";
11
- export { type ListMessagesResponsePayload } from "./ListMessages.js";
10
+ export { type ListConversationMessagesResponse } from "./ListConversationMessages.js";
11
+ export { type ListMessagesResponse } from "./ListMessages.js";
@@ -16,6 +16,8 @@ export interface Options {
16
16
  request?: RequestInit;
17
17
  }
18
18
 
19
+ export type CreateCorrectionResponse = unknown;
20
+
19
21
  export default class CreateCorrectionModel {
20
22
  public static SCHEMA = z.object({
21
23
  input: z.string().max(65_536),
@@ -26,8 +28,9 @@ export default class CreateCorrectionModel {
26
28
  constructor(protected _transport: FetchTransport) {}
27
29
 
28
30
  public async send({ id, body, request = {} }: Options) {
29
- return this._transport
30
- .send("v1/models/" + encodeURIComponent(id) + "/correction", {
31
+ return this._transport.send<CreateCorrectionResponse>(
32
+ "v1/models/" + encodeURIComponent(id) + "/correction",
33
+ {
31
34
  ...request,
32
35
  method: "POST",
33
36
  headers: {
@@ -35,17 +38,7 @@ export default class CreateCorrectionModel {
35
38
  "Content-Type": "application/json",
36
39
  },
37
40
  body: JSON.stringify(CreateCorrectionModel.SCHEMA.parse(body)),
38
- })
39
- .then((response) => new CreateCorrectionModelResponse(response));
40
- }
41
- }
42
-
43
- export type CreateCorrectionResponsePayload = unknown;
44
-
45
- export class CreateCorrectionModelResponse {
46
- constructor(public response: Response) {}
47
-
48
- public async result(): Promise<CreateCorrectionResponsePayload> {
49
- return this.response.json();
41
+ },
42
+ );
50
43
  }
51
44
  }
@@ -14,20 +14,7 @@ export interface Options {
14
14
  request?: RequestInit;
15
15
  }
16
16
 
17
- export default class GetModel {
18
- constructor(protected _transport: FetchTransport) {}
19
-
20
- public async send({ id, request = {} }: Options) {
21
- return this._transport
22
- .send("v1/models/" + encodeURIComponent(id), {
23
- ...request,
24
- method: "GET",
25
- })
26
- .then((response) => new GetModelResponse(response));
27
- }
28
- }
29
-
30
- export type GetModelResponsePayload = {
17
+ export type GetModelResponse = {
31
18
  model: {
32
19
  id: string;
33
20
  name: string;
@@ -37,10 +24,16 @@ export type GetModelResponsePayload = {
37
24
  };
38
25
  };
39
26
 
40
- export class GetModelResponse {
41
- constructor(public response: Response) {}
27
+ export default class GetModel {
28
+ constructor(protected _transport: FetchTransport) {}
42
29
 
43
- public async result(): Promise<GetModelResponsePayload> {
44
- return this.response.json();
30
+ public async send({ id, request = {} }: Options) {
31
+ return this._transport.send<GetModelResponse>(
32
+ "v1/models/" + encodeURIComponent(id),
33
+ {
34
+ ...request,
35
+ method: "GET",
36
+ },
37
+ );
45
38
  }
46
39
  }
@@ -13,20 +13,7 @@ export interface Options {
13
13
  request?: RequestInit;
14
14
  }
15
15
 
16
- export default class ListModels {
17
- constructor(protected _transport: FetchTransport) {}
18
-
19
- public async send({ request = {} }: Options = {}) {
20
- return this._transport
21
- .send("v1/models", {
22
- ...request,
23
- method: "GET",
24
- })
25
- .then((response) => new ListModelsResponse(response));
26
- }
27
- }
28
-
29
- export type ListModelsResponsePayload = {
16
+ export type ListModelsResponse = {
30
17
  models: {
31
18
  id: string;
32
19
  name: string;
@@ -36,10 +23,13 @@ export type ListModelsResponsePayload = {
36
23
  }[];
37
24
  };
38
25
 
39
- export class ListModelsResponse {
40
- constructor(public response: Response) {}
26
+ export default class ListModels {
27
+ constructor(protected _transport: FetchTransport) {}
41
28
 
42
- public async result(): Promise<ListModelsResponsePayload> {
43
- return this.response.json();
29
+ public async send({ request = {} }: Options = {}) {
30
+ return this._transport.send<ListModelsResponse>("v1/models", {
31
+ ...request,
32
+ method: "GET",
33
+ });
44
34
  }
45
35
  }
@@ -16,6 +16,14 @@ export interface Options {
16
16
  request?: RequestInit;
17
17
  }
18
18
 
19
+ export type CreateResponseResponse = {
20
+ message: string | null;
21
+ debug: {
22
+ duration: string;
23
+ sources: (string | undefined)[];
24
+ };
25
+ };
26
+
19
27
  export default class CreateResponseModel {
20
28
  public static SCHEMA = z
21
29
  .array(
@@ -29,8 +37,9 @@ export default class CreateResponseModel {
29
37
  constructor(protected _transport: FetchTransport) {}
30
38
 
31
39
  public async send({ id, body, request = {} }: Options) {
32
- return this._transport
33
- .send("v1/models/" + encodeURIComponent(id) + "/response", {
40
+ return this._transport.send<CreateResponseResponse>(
41
+ "v1/models/" + encodeURIComponent(id) + "/response",
42
+ {
34
43
  ...request,
35
44
  method: "POST",
36
45
  headers: {
@@ -38,23 +47,7 @@ export default class CreateResponseModel {
38
47
  "Content-Type": "application/json",
39
48
  },
40
49
  body: JSON.stringify(CreateResponseModel.SCHEMA.parse(body)),
41
- })
42
- .then((response) => new CreateResponseModelResponse(response));
43
- }
44
- }
45
-
46
- export type CreateResponseResponsePayload = {
47
- message: string | null;
48
- debug: {
49
- duration: string;
50
- sources: (string | undefined)[];
51
- };
52
- };
53
-
54
- export class CreateResponseModelResponse {
55
- constructor(public response: Response) {}
56
-
57
- public async result(): Promise<CreateResponseResponsePayload> {
58
- return this.response.json();
50
+ },
51
+ );
59
52
  }
60
53
  }
@@ -7,9 +7,9 @@
7
7
  * @see https://greatdetail.com
8
8
  */
9
9
 
10
- export { type GetModelResponsePayload } from "./GetModel.js";
11
- export { type ListModelsResponsePayload } from "./ListModels.js";
10
+ export { type GetModelResponse } from "./GetModel.js";
11
+ export { type ListModelsResponse } from "./ListModels.js";
12
12
 
13
- export { type CreateCorrectionResponsePayload } from "./Correction/CreateCorrectionModel.js";
13
+ export { type CreateCorrectionResponse } from "./Correction/CreateCorrectionModel.js";
14
14
 
15
- export { type CreateResponseResponsePayload } from "./Response/CreateResponseModel.js";
15
+ export { type CreateResponseResponse } from "./Response/CreateResponseModel.js";
@@ -16,6 +16,15 @@ export interface Options {
16
16
  request?: RequestInit;
17
17
  }
18
18
 
19
+ export type CreateContactNoteResponse = {
20
+ note: {
21
+ id: string;
22
+ content: string;
23
+ createdAt: string;
24
+ updatedAt: string;
25
+ };
26
+ };
27
+
19
28
  export default class CreateContactNote {
20
29
  public static SCHEMA = z.object({
21
30
  content: z.string(),
@@ -24,8 +33,9 @@ export default class CreateContactNote {
24
33
  constructor(protected _transport: FetchTransport) {}
25
34
 
26
35
  public async send({ id, body, request = {} }: Options) {
27
- return this._transport
28
- .send("v1/contacts/" + encodeURIComponent(id) + "/notes", {
36
+ return this._transport.send<CreateContactNoteResponse>(
37
+ "v1/contacts/" + encodeURIComponent(id) + "/notes",
38
+ {
29
39
  ...request,
30
40
  method: "POST",
31
41
  headers: {
@@ -33,24 +43,7 @@ export default class CreateContactNote {
33
43
  "Content-Type": "application/json",
34
44
  },
35
45
  body: JSON.stringify(CreateContactNote.SCHEMA.parse(body)),
36
- })
37
- .then((response) => new CreateContactNoteResponse(response));
38
- }
39
- }
40
-
41
- export type CreateContactNoteResponsePayload = {
42
- note: {
43
- id: string;
44
- content: string;
45
- createdAt: string;
46
- updatedAt: string;
47
- };
48
- };
49
-
50
- export class CreateContactNoteResponse {
51
- constructor(public response: Response) {}
52
-
53
- public async result(): Promise<CreateContactNoteResponsePayload> {
54
- return this.response.json();
46
+ },
47
+ );
55
48
  }
56
49
  }