@great-detail/support-sdk 0.3.3 → 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.
- package/dist/chunk-2WFTGNNI.js +1 -0
- package/dist/chunk-ILW336CI.js +1 -0
- 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-yIZZNsRM.d.cts → index-Dp-x4kXq.d.cts} +268 -826
- package/dist/{index-yIZZNsRM.d.ts → index-Dp-x4kXq.d.ts} +268 -826
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +15 -12
- package/dist/index.d.ts +15 -12
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/Action/ListActions.ts +8 -18
- package/src/Action/index.ts +1 -1
- package/src/Boilerplate/CreateBoilerplateCategoryBoilerplate.ts +24 -37
- package/src/Boilerplate/GetBoilerplate.ts +11 -18
- package/src/Boilerplate/ListBoilerplateCategoryBoilerplates.ts +8 -20
- package/src/Boilerplate/ListBoilerplates.ts +8 -18
- package/src/Boilerplate/UpdateBoilerplate.ts +17 -24
- package/src/Boilerplate/index.ts +5 -5
- package/src/BoilerplateCategory/CreateBoilerplateCategory.ts +16 -23
- package/src/BoilerplateCategory/GetBoilerplateCategory.ts +11 -18
- package/src/BoilerplateCategory/ListBoilerplateCategories.ts +11 -18
- package/src/BoilerplateCategory/UpdateBoilerplateCategory.ts +16 -23
- package/src/BoilerplateCategory/index.ts +4 -4
- package/src/Channel/ListChannels.ts +8 -18
- package/src/Channel/index.ts +1 -1
- package/src/Client/index.ts +1 -0
- package/src/Contact/CreateContact.ts +20 -30
- package/src/Contact/GetContact.ts +11 -18
- package/src/Contact/ListContacts.ts +8 -18
- package/src/Contact/ListLabelContacts.ts +11 -18
- package/src/Contact/UpdateContact.ts +17 -24
- package/src/Contact/index.ts +5 -5
- package/src/Conversation/CreateConversation.ts +58 -0
- package/src/Conversation/GetConversation.ts +11 -18
- package/src/Conversation/ListContactConversations.ts +11 -18
- package/src/Conversation/ListConversations.ts +8 -18
- package/src/Conversation/ListLabelConversations.ts +11 -18
- package/src/Conversation/UpdateConversation.ts +22 -29
- package/src/Conversation/index.ts +6 -5
- package/src/Label/CreateLabel.ts +19 -29
- package/src/Label/DeleteLabel.ts +7 -14
- package/src/Label/GetLabel.ts +11 -18
- package/src/Label/ListLabels.ts +8 -18
- package/src/Label/UpdateLabel.ts +16 -23
- package/src/Label/index.ts +5 -5
- package/src/Message/ListConversationMessages.ts +11 -18
- package/src/Message/ListMessages.ts +8 -18
- package/src/Message/index.ts +2 -2
- package/src/Model/Correction/CreateCorrectionModel.ts +7 -14
- package/src/Model/GetModel.ts +11 -18
- package/src/Model/ListModels.ts +8 -18
- package/src/Model/Response/CreateResponseModel.ts +13 -20
- package/src/Model/index.ts +4 -4
- package/src/Note/CreateContactNote.ts +14 -21
- package/src/Note/CreateConversationNote.ts +14 -21
- package/src/Note/GetNote.ts +11 -18
- package/src/Note/ListContactNotes.ts +11 -18
- package/src/Note/ListConversationNotes.ts +11 -18
- package/src/Note/UpdateNote.ts +14 -21
- package/src/Note/index.ts +6 -6
- package/src/Source/GetSource.ts +11 -18
- package/src/Source/ListSources.ts +8 -18
- package/src/Source/index.ts +2 -2
- package/src/Subscription/CreateContactSubscription.ts +13 -20
- package/src/Subscription/index.ts +1 -1
- package/src/Transport/FetchTransport.ts +50 -46
- package/src/cli/actions.ts +1 -1
- package/src/cli/channels.ts +1 -1
- package/src/cli/contacts.ts +2 -2
- package/src/cli/conversations.ts +2 -2
- package/src/cli/labels.ts +3 -3
- package/src/cli/messages.ts +1 -1
- package/src/cli/models.ts +2 -2
- package/src/cli/sources.ts +2 -2
- package/dist/chunk-BVAU2D3F.js +0 -1
- package/dist/chunk-TF4VTYVZ.js +0 -1
|
@@ -13,20 +13,7 @@ export interface Options {
|
|
|
13
13
|
request?: RequestInit;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export
|
|
17
|
-
constructor(protected _transport: FetchTransport) {}
|
|
18
|
-
|
|
19
|
-
public async send({ request = {} }: Options = {}) {
|
|
20
|
-
return this._transport
|
|
21
|
-
.send("v1/boilerplate-categories", {
|
|
22
|
-
...request,
|
|
23
|
-
method: "GET",
|
|
24
|
-
})
|
|
25
|
-
.then((response) => new ListBoilerplateCategoriesResponse(response));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export type ListBoilerplateCategoriesResponsePayload = {
|
|
16
|
+
export type ListBoilerplateCategoriesResponse = {
|
|
30
17
|
boilerplateCategories: {
|
|
31
18
|
id: string;
|
|
32
19
|
title: string;
|
|
@@ -37,10 +24,16 @@ export type ListBoilerplateCategoriesResponsePayload = {
|
|
|
37
24
|
}[];
|
|
38
25
|
};
|
|
39
26
|
|
|
40
|
-
export class
|
|
41
|
-
constructor(
|
|
27
|
+
export default class ListBoilerplateCategories {
|
|
28
|
+
constructor(protected _transport: FetchTransport) {}
|
|
42
29
|
|
|
43
|
-
public async
|
|
44
|
-
return this.
|
|
30
|
+
public async send({ request = {} }: Options = {}) {
|
|
31
|
+
return this._transport.send<ListBoilerplateCategoriesResponse>(
|
|
32
|
+
"v1/boilerplate-categories",
|
|
33
|
+
{
|
|
34
|
+
...request,
|
|
35
|
+
method: "GET",
|
|
36
|
+
},
|
|
37
|
+
);
|
|
45
38
|
}
|
|
46
39
|
}
|
|
@@ -16,6 +16,17 @@ export interface Options {
|
|
|
16
16
|
request?: RequestInit;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
export type UpdateBoilerplateCategoryResponse = {
|
|
20
|
+
boilerplateCategory: {
|
|
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 UpdateBoilerplateCategory {
|
|
20
31
|
public static SCHEMA = z.object({
|
|
21
32
|
title: z.string().optional(),
|
|
@@ -25,8 +36,9 @@ export default class UpdateBoilerplateCategory {
|
|
|
25
36
|
constructor(protected _transport: FetchTransport) {}
|
|
26
37
|
|
|
27
38
|
public async send({ id, body, request = {} }: Options) {
|
|
28
|
-
return this._transport
|
|
29
|
-
|
|
39
|
+
return this._transport.send<UpdateBoilerplateCategoryResponse>(
|
|
40
|
+
"v1/boilerplate-categories/" + encodeURIComponent(id),
|
|
41
|
+
{
|
|
30
42
|
...request,
|
|
31
43
|
method: "PATCH",
|
|
32
44
|
headers: {
|
|
@@ -34,26 +46,7 @@ export default class UpdateBoilerplateCategory {
|
|
|
34
46
|
"Content-Type": "application/json",
|
|
35
47
|
},
|
|
36
48
|
body: JSON.stringify(UpdateBoilerplateCategory.SCHEMA.parse(body)),
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export type UpdateBoilerplateCategoryResponsePayload = {
|
|
43
|
-
boilerplateCategory: {
|
|
44
|
-
id: string;
|
|
45
|
-
title: string;
|
|
46
|
-
description?: string;
|
|
47
|
-
account: string;
|
|
48
|
-
createdAt: string;
|
|
49
|
-
updatedAt: string;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export class UpdateBoilerplateCategoryResponse {
|
|
54
|
-
constructor(public response: Response) {}
|
|
55
|
-
|
|
56
|
-
public async result(): Promise<UpdateBoilerplateCategoryResponsePayload> {
|
|
57
|
-
return this.response.json();
|
|
49
|
+
},
|
|
50
|
+
);
|
|
58
51
|
}
|
|
59
52
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @see https://greatdetail.com
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
export { type
|
|
11
|
-
export { type
|
|
12
|
-
export { type
|
|
13
|
-
export { type
|
|
10
|
+
export { type CreateBoilerplateCategoryResponse } from "./CreateBoilerplateCategory.js";
|
|
11
|
+
export { type GetBoilerplateCategoryResponse } from "./GetBoilerplateCategory.js";
|
|
12
|
+
export { type ListBoilerplateCategoriesResponse } from "./ListBoilerplateCategories.js";
|
|
13
|
+
export { type UpdateBoilerplateCategoryResponse } from "./UpdateBoilerplateCategory.js";
|
|
@@ -13,20 +13,7 @@ export interface Options {
|
|
|
13
13
|
request?: RequestInit;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export
|
|
17
|
-
constructor(protected _transport: FetchTransport) {}
|
|
18
|
-
|
|
19
|
-
public async send({ request = {} }: Options = {}) {
|
|
20
|
-
return this._transport
|
|
21
|
-
.send("v1/channels", {
|
|
22
|
-
...request,
|
|
23
|
-
method: "GET",
|
|
24
|
-
})
|
|
25
|
-
.then((response) => new ListChannelsResponse(response));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export type ListChannelsResponsePayload = {
|
|
16
|
+
export type ListChannelsResponse = {
|
|
30
17
|
channels: ({
|
|
31
18
|
id: string;
|
|
32
19
|
name?: string;
|
|
@@ -54,10 +41,13 @@ export type ListChannelsResponsePayload = {
|
|
|
54
41
|
))[];
|
|
55
42
|
};
|
|
56
43
|
|
|
57
|
-
export class
|
|
58
|
-
constructor(
|
|
44
|
+
export default class ListChannels {
|
|
45
|
+
constructor(protected _transport: FetchTransport) {}
|
|
59
46
|
|
|
60
|
-
public async
|
|
61
|
-
return this.
|
|
47
|
+
public async send({ request = {} }: Options = {}) {
|
|
48
|
+
return this._transport.send<ListChannelsResponse>("v1/channels", {
|
|
49
|
+
...request,
|
|
50
|
+
method: "GET",
|
|
51
|
+
});
|
|
62
52
|
}
|
|
63
53
|
}
|
package/src/Channel/index.ts
CHANGED
package/src/Client/index.ts
CHANGED
|
@@ -135,6 +135,7 @@ export default class Client {
|
|
|
135
135
|
get: new GetConversation(this._transport),
|
|
136
136
|
list: new ListConversations(this._transport),
|
|
137
137
|
update: new UpdateConversation(this._transport),
|
|
138
|
+
create: new CreateConversationNote(this._transport),
|
|
138
139
|
message: {
|
|
139
140
|
list: new ListConversationMessages(this._transport),
|
|
140
141
|
},
|
|
@@ -15,32 +15,7 @@ export interface Options {
|
|
|
15
15
|
request?: RequestInit;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export
|
|
19
|
-
public static SCHEMA = z.object({
|
|
20
|
-
name: z.string(),
|
|
21
|
-
account: z.string(),
|
|
22
|
-
emailAddress: z.string().email().optional(),
|
|
23
|
-
telephoneNumber: z.string().optional(),
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
constructor(protected _transport: FetchTransport) {}
|
|
27
|
-
|
|
28
|
-
public async send({ body, request = {} }: Options) {
|
|
29
|
-
return this._transport
|
|
30
|
-
.send("v1/contacts", {
|
|
31
|
-
...request,
|
|
32
|
-
method: "POST",
|
|
33
|
-
headers: {
|
|
34
|
-
...request.headers,
|
|
35
|
-
"Content-Type": "application/json",
|
|
36
|
-
},
|
|
37
|
-
body: JSON.stringify(CreateContact.SCHEMA.parse(body)),
|
|
38
|
-
})
|
|
39
|
-
.then((response) => new CreateContactResponse(response));
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export type CreateContactResponsePayload = {
|
|
18
|
+
export type CreateContactResponse = {
|
|
44
19
|
contact: {
|
|
45
20
|
id: string;
|
|
46
21
|
name?: string;
|
|
@@ -52,10 +27,25 @@ export type CreateContactResponsePayload = {
|
|
|
52
27
|
};
|
|
53
28
|
};
|
|
54
29
|
|
|
55
|
-
export class
|
|
56
|
-
|
|
30
|
+
export default class CreateContact {
|
|
31
|
+
public static SCHEMA = z.object({
|
|
32
|
+
name: z.string(),
|
|
33
|
+
account: z.string(),
|
|
34
|
+
emailAddress: z.string().email().optional(),
|
|
35
|
+
telephoneNumber: z.string().optional(),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
constructor(protected _transport: FetchTransport) {}
|
|
57
39
|
|
|
58
|
-
public async
|
|
59
|
-
return this.
|
|
40
|
+
public async send({ body, request = {} }: Options) {
|
|
41
|
+
return this._transport.send<CreateContactResponse>("v1/contacts", {
|
|
42
|
+
...request,
|
|
43
|
+
method: "POST",
|
|
44
|
+
headers: {
|
|
45
|
+
...request.headers,
|
|
46
|
+
"Content-Type": "application/json",
|
|
47
|
+
},
|
|
48
|
+
body: JSON.stringify(CreateContact.SCHEMA.parse(body)),
|
|
49
|
+
});
|
|
60
50
|
}
|
|
61
51
|
}
|
|
@@ -14,20 +14,7 @@ export interface Options {
|
|
|
14
14
|
request?: RequestInit;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export
|
|
18
|
-
constructor(protected _transport: FetchTransport) {}
|
|
19
|
-
|
|
20
|
-
public async send({ id, request = {} }: Options) {
|
|
21
|
-
return this._transport
|
|
22
|
-
.send("v1/contacts/" + encodeURIComponent(id), {
|
|
23
|
-
...request,
|
|
24
|
-
method: "GET",
|
|
25
|
-
})
|
|
26
|
-
.then((response) => new GetContactResponse(response));
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export type GetContactResponsePayload = {
|
|
17
|
+
export type GetContactResponse = {
|
|
31
18
|
contact: {
|
|
32
19
|
id: string;
|
|
33
20
|
name?: string;
|
|
@@ -39,10 +26,16 @@ export type GetContactResponsePayload = {
|
|
|
39
26
|
};
|
|
40
27
|
};
|
|
41
28
|
|
|
42
|
-
export class
|
|
43
|
-
constructor(
|
|
29
|
+
export default class GetContact {
|
|
30
|
+
constructor(protected _transport: FetchTransport) {}
|
|
44
31
|
|
|
45
|
-
public async
|
|
46
|
-
return this.
|
|
32
|
+
public async send({ id, request = {} }: Options) {
|
|
33
|
+
return this._transport.send<GetContactResponse>(
|
|
34
|
+
"v1/contacts/" + encodeURIComponent(id),
|
|
35
|
+
{
|
|
36
|
+
...request,
|
|
37
|
+
method: "GET",
|
|
38
|
+
},
|
|
39
|
+
);
|
|
47
40
|
}
|
|
48
41
|
}
|
|
@@ -13,20 +13,7 @@ export interface Options {
|
|
|
13
13
|
request?: RequestInit;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export
|
|
17
|
-
constructor(protected _transport: FetchTransport) {}
|
|
18
|
-
|
|
19
|
-
public async send({ request = {} }: Options = {}) {
|
|
20
|
-
return this._transport
|
|
21
|
-
.send("v1/contacts", {
|
|
22
|
-
...request,
|
|
23
|
-
method: "GET",
|
|
24
|
-
})
|
|
25
|
-
.then((response) => new ListContactsResponse(response));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export type ListContactsResponsePayload = {
|
|
16
|
+
export type ListContactsResponse = {
|
|
30
17
|
contacts: {
|
|
31
18
|
id: string;
|
|
32
19
|
name?: string;
|
|
@@ -38,10 +25,13 @@ export type ListContactsResponsePayload = {
|
|
|
38
25
|
}[];
|
|
39
26
|
};
|
|
40
27
|
|
|
41
|
-
export class
|
|
42
|
-
constructor(
|
|
28
|
+
export default class ListContacts {
|
|
29
|
+
constructor(protected _transport: FetchTransport) {}
|
|
43
30
|
|
|
44
|
-
public async
|
|
45
|
-
return this.
|
|
31
|
+
public async send({ request = {} }: Options = {}) {
|
|
32
|
+
return this._transport.send<ListContactsResponse>("v1/contacts", {
|
|
33
|
+
...request,
|
|
34
|
+
method: "GET",
|
|
35
|
+
});
|
|
46
36
|
}
|
|
47
37
|
}
|
|
@@ -14,20 +14,7 @@ export interface Options {
|
|
|
14
14
|
request?: RequestInit;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export
|
|
18
|
-
constructor(protected _transport: FetchTransport) {}
|
|
19
|
-
|
|
20
|
-
public async send({ id, request = {} }: Options) {
|
|
21
|
-
return this._transport
|
|
22
|
-
.send("v1/labels/" + encodeURIComponent(id) + "/contacts", {
|
|
23
|
-
...request,
|
|
24
|
-
method: "GET",
|
|
25
|
-
})
|
|
26
|
-
.then((response) => new ListLabelContactsResponse(response));
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export type ListLabelContactsResponsePayload = {
|
|
17
|
+
export type ListLabelContactsResponse = {
|
|
31
18
|
contacts: {
|
|
32
19
|
id: string;
|
|
33
20
|
name?: string;
|
|
@@ -39,10 +26,16 @@ export type ListLabelContactsResponsePayload = {
|
|
|
39
26
|
}[];
|
|
40
27
|
};
|
|
41
28
|
|
|
42
|
-
export class
|
|
43
|
-
constructor(
|
|
29
|
+
export default class ListLabelContacts {
|
|
30
|
+
constructor(protected _transport: FetchTransport) {}
|
|
44
31
|
|
|
45
|
-
public async
|
|
46
|
-
return this.
|
|
32
|
+
public async send({ id, request = {} }: Options) {
|
|
33
|
+
return this._transport.send<ListLabelContactsResponse>(
|
|
34
|
+
"v1/labels/" + encodeURIComponent(id) + "/contacts",
|
|
35
|
+
{
|
|
36
|
+
...request,
|
|
37
|
+
method: "GET",
|
|
38
|
+
},
|
|
39
|
+
);
|
|
47
40
|
}
|
|
48
41
|
}
|
|
@@ -16,6 +16,18 @@ export interface Options {
|
|
|
16
16
|
request?: RequestInit;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
export type UpdateContactResponse = {
|
|
20
|
+
contact: {
|
|
21
|
+
id: string;
|
|
22
|
+
name?: string;
|
|
23
|
+
emailAddress?: string;
|
|
24
|
+
telephoneNumber?: string;
|
|
25
|
+
account: string;
|
|
26
|
+
createdAt: string;
|
|
27
|
+
updatedAt?: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
19
31
|
export default class UpdateContact {
|
|
20
32
|
public static SCHEMA = z.object({
|
|
21
33
|
name: z.string().optional(),
|
|
@@ -26,8 +38,9 @@ export default class UpdateContact {
|
|
|
26
38
|
constructor(protected _transport: FetchTransport) {}
|
|
27
39
|
|
|
28
40
|
public async send({ id, body, request = {} }: Options) {
|
|
29
|
-
return this._transport
|
|
30
|
-
|
|
41
|
+
return this._transport.send<UpdateContactResponse>(
|
|
42
|
+
"v1/contacts/" + encodeURIComponent(id),
|
|
43
|
+
{
|
|
31
44
|
...request,
|
|
32
45
|
method: "PATCH",
|
|
33
46
|
headers: {
|
|
@@ -35,27 +48,7 @@ export default class UpdateContact {
|
|
|
35
48
|
"Content-Type": "application/json",
|
|
36
49
|
},
|
|
37
50
|
body: JSON.stringify(UpdateContact.SCHEMA.parse(body)),
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export type UpdateContactResponsePayload = {
|
|
44
|
-
contact: {
|
|
45
|
-
id: string;
|
|
46
|
-
name?: string;
|
|
47
|
-
emailAddress?: string;
|
|
48
|
-
telephoneNumber?: string;
|
|
49
|
-
account: string;
|
|
50
|
-
createdAt: string;
|
|
51
|
-
updatedAt?: string;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export class UpdateContactResponse {
|
|
56
|
-
constructor(public response: Response) {}
|
|
57
|
-
|
|
58
|
-
public async result(): Promise<UpdateContactResponsePayload> {
|
|
59
|
-
return this.response.json();
|
|
51
|
+
},
|
|
52
|
+
);
|
|
60
53
|
}
|
|
61
54
|
}
|
package/src/Contact/index.ts
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* @see https://greatdetail.com
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
export { type
|
|
11
|
-
export { type
|
|
12
|
-
export { type
|
|
13
|
-
export { type
|
|
14
|
-
export { type
|
|
10
|
+
export { type CreateContactResponse } from "./CreateContact.js";
|
|
11
|
+
export { type GetContactResponse } from "./GetContact.js";
|
|
12
|
+
export { type ListContactsResponse } from "./ListContacts.js";
|
|
13
|
+
export { type ListLabelContactsResponse } from "./ListLabelContacts.js";
|
|
14
|
+
export { type UpdateContactResponse } from "./UpdateContact.js";
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
body: z.infer<typeof CreateConversation.SCHEMA>;
|
|
15
|
+
request?: RequestInit;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type CreateConversationResponse = {
|
|
19
|
+
conversation: {
|
|
20
|
+
id: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
hasEnded: boolean;
|
|
23
|
+
conversationStatus:
|
|
24
|
+
| "AwaitingContactConversationStatus"
|
|
25
|
+
| "AwaitingAgentConversationStatus"
|
|
26
|
+
| "ResolvedConversationStatus"
|
|
27
|
+
| "ClosedConversationStatus";
|
|
28
|
+
accountChannel: string;
|
|
29
|
+
createdAt: string;
|
|
30
|
+
updatedAt: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default class CreateConversation {
|
|
35
|
+
public static SCHEMA = z.object({
|
|
36
|
+
name: z.string().optional(),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
constructor(protected _transport: FetchTransport) {}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Not Yet Implemented
|
|
43
|
+
*/
|
|
44
|
+
public async send({ body, request = {} }: Options) {
|
|
45
|
+
return this._transport.send<CreateConversationResponse>(
|
|
46
|
+
"v1/conversations",
|
|
47
|
+
{
|
|
48
|
+
...request,
|
|
49
|
+
method: "POST",
|
|
50
|
+
headers: {
|
|
51
|
+
...request.headers,
|
|
52
|
+
"Content-Type": "application/json",
|
|
53
|
+
},
|
|
54
|
+
body: JSON.stringify(CreateConversation.SCHEMA.parse(body)),
|
|
55
|
+
},
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -14,20 +14,7 @@ export interface Options {
|
|
|
14
14
|
request?: RequestInit;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export
|
|
18
|
-
constructor(protected _transport: FetchTransport) {}
|
|
19
|
-
|
|
20
|
-
public async send({ id, request = {} }: Options) {
|
|
21
|
-
return this._transport
|
|
22
|
-
.send("v1/conversations/" + encodeURIComponent(id), {
|
|
23
|
-
...request,
|
|
24
|
-
method: "GET",
|
|
25
|
-
})
|
|
26
|
-
.then((response) => new GetConversationResponse(response));
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export type GetConversationResponsePayload = {
|
|
17
|
+
export type GetConversationResponse = {
|
|
31
18
|
conversation: {
|
|
32
19
|
id: string;
|
|
33
20
|
name?: string;
|
|
@@ -43,10 +30,16 @@ export type GetConversationResponsePayload = {
|
|
|
43
30
|
};
|
|
44
31
|
};
|
|
45
32
|
|
|
46
|
-
export class
|
|
47
|
-
constructor(
|
|
33
|
+
export default class GetConversation {
|
|
34
|
+
constructor(protected _transport: FetchTransport) {}
|
|
48
35
|
|
|
49
|
-
public async
|
|
50
|
-
return this.
|
|
36
|
+
public async send({ id, request = {} }: Options) {
|
|
37
|
+
return this._transport.send<GetConversationResponse>(
|
|
38
|
+
"v1/conversations/" + encodeURIComponent(id),
|
|
39
|
+
{
|
|
40
|
+
...request,
|
|
41
|
+
method: "GET",
|
|
42
|
+
},
|
|
43
|
+
);
|
|
51
44
|
}
|
|
52
45
|
}
|
|
@@ -14,20 +14,7 @@ export interface Options {
|
|
|
14
14
|
request?: RequestInit;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export
|
|
18
|
-
constructor(protected _transport: FetchTransport) {}
|
|
19
|
-
|
|
20
|
-
public async send({ id, request = {} }: Options) {
|
|
21
|
-
return this._transport
|
|
22
|
-
.send("v1/contacts/" + encodeURIComponent(id) + "/conversations", {
|
|
23
|
-
...request,
|
|
24
|
-
method: "GET",
|
|
25
|
-
})
|
|
26
|
-
.then((response) => new ListContactConversationsResponse(response));
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export type ListContactConversationsResponsePayload = {
|
|
17
|
+
export type ListContactConversationsResponse = {
|
|
31
18
|
conversations: {
|
|
32
19
|
id: string;
|
|
33
20
|
name?: string;
|
|
@@ -43,10 +30,16 @@ export type ListContactConversationsResponsePayload = {
|
|
|
43
30
|
}[];
|
|
44
31
|
};
|
|
45
32
|
|
|
46
|
-
export class
|
|
47
|
-
constructor(
|
|
33
|
+
export default class ListContactConversations {
|
|
34
|
+
constructor(protected _transport: FetchTransport) {}
|
|
48
35
|
|
|
49
|
-
public async
|
|
50
|
-
return this.
|
|
36
|
+
public async send({ id, request = {} }: Options) {
|
|
37
|
+
return this._transport.send<ListContactConversationsResponse>(
|
|
38
|
+
"v1/contacts/" + encodeURIComponent(id) + "/conversations",
|
|
39
|
+
{
|
|
40
|
+
...request,
|
|
41
|
+
method: "GET",
|
|
42
|
+
},
|
|
43
|
+
);
|
|
51
44
|
}
|
|
52
45
|
}
|
|
@@ -13,20 +13,7 @@ export interface Options {
|
|
|
13
13
|
request?: RequestInit;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export
|
|
17
|
-
constructor(protected _transport: FetchTransport) {}
|
|
18
|
-
|
|
19
|
-
public async send({ request = {} }: Options = {}) {
|
|
20
|
-
return this._transport
|
|
21
|
-
.send("v1/conversations", {
|
|
22
|
-
...request,
|
|
23
|
-
method: "GET",
|
|
24
|
-
})
|
|
25
|
-
.then((response) => new ListConversationsResponse(response));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export type ListConversationsResponsePayload = {
|
|
16
|
+
export type ListConversationsResponse = {
|
|
30
17
|
conversations: {
|
|
31
18
|
id: string;
|
|
32
19
|
name?: string;
|
|
@@ -42,10 +29,13 @@ export type ListConversationsResponsePayload = {
|
|
|
42
29
|
}[];
|
|
43
30
|
};
|
|
44
31
|
|
|
45
|
-
export class
|
|
46
|
-
constructor(
|
|
32
|
+
export default class ListConversations {
|
|
33
|
+
constructor(protected _transport: FetchTransport) {}
|
|
47
34
|
|
|
48
|
-
public async
|
|
49
|
-
return this.
|
|
35
|
+
public async send({ request = {} }: Options = {}) {
|
|
36
|
+
return this._transport.send<ListConversationsResponse>("v1/conversations", {
|
|
37
|
+
...request,
|
|
38
|
+
method: "GET",
|
|
39
|
+
});
|
|
50
40
|
}
|
|
51
41
|
}
|
|
@@ -14,20 +14,7 @@ export interface Options {
|
|
|
14
14
|
request?: RequestInit;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export
|
|
18
|
-
constructor(protected _transport: FetchTransport) {}
|
|
19
|
-
|
|
20
|
-
public async send({ id, request = {} }: Options) {
|
|
21
|
-
return this._transport
|
|
22
|
-
.send("v1/labels/" + encodeURIComponent(id) + "/conversations", {
|
|
23
|
-
...request,
|
|
24
|
-
method: "GET",
|
|
25
|
-
})
|
|
26
|
-
.then((response) => new ListLabelConversationsResponse(response));
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export type ListLabelConversationsResponsePayload = {
|
|
17
|
+
export type ListLabelConversationsResponse = {
|
|
31
18
|
conversations: {
|
|
32
19
|
id: string;
|
|
33
20
|
name?: string;
|
|
@@ -43,10 +30,16 @@ export type ListLabelConversationsResponsePayload = {
|
|
|
43
30
|
}[];
|
|
44
31
|
};
|
|
45
32
|
|
|
46
|
-
export class
|
|
47
|
-
constructor(
|
|
33
|
+
export default class ListLabelConversations {
|
|
34
|
+
constructor(protected _transport: FetchTransport) {}
|
|
48
35
|
|
|
49
|
-
public async
|
|
50
|
-
return this.
|
|
36
|
+
public async send({ id, request = {} }: Options) {
|
|
37
|
+
return this._transport.send<ListLabelConversationsResponse>(
|
|
38
|
+
"v1/labels/" + encodeURIComponent(id) + "/conversations",
|
|
39
|
+
{
|
|
40
|
+
...request,
|
|
41
|
+
method: "GET",
|
|
42
|
+
},
|
|
43
|
+
);
|
|
51
44
|
}
|
|
52
45
|
}
|