@great-detail/support-sdk 0.1.0 → 0.1.2

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.
@@ -11,6 +11,7 @@ import ListActionsRequest from "../Action/ListActions.js";
11
11
  import Authentication from "../Authentication/index.js";
12
12
  import ListChannelsRequest from "../Channel/ListChannels.js";
13
13
  import { DEFAULT_SUPPORT_BASE_URL } from "../constants/index.js";
14
+ import CreateContactRequest from "../Contact/CreateContact.js";
14
15
  import GetContactRequest from "../Contact/GetContact.js";
15
16
  import ListContactsRequest from "../Contact/ListContacts.js";
16
17
  import UpdateContactRequest from "../Contact/UpdateContact.js";
@@ -34,20 +35,20 @@ import GetSourceRequest from "../Source/GetSource.js";
34
35
  import ListSourcesRequest from "../Source/ListSources.js";
35
36
  import Transport from "../Transport/index.js";
36
37
 
37
- export interface ClientOptions {
38
+ export interface Options {
38
39
  baseURL?: string | URL;
39
40
  }
40
41
 
41
42
  export default class Client {
42
43
  public static DEFAULT_BASE_URL = DEFAULT_SUPPORT_BASE_URL;
43
44
 
44
- public transport: Transport;
45
+ public _transport: Transport;
45
46
 
46
47
  constructor(
47
48
  authentication: Authentication,
48
- { baseURL, ...options }: ClientOptions = {},
49
+ { baseURL, ...options }: Options = {},
49
50
  ) {
50
- this.transport = new Transport({
51
+ this._transport = new Transport({
51
52
  requestFilterables: [new RequestStandardHeaders(), authentication],
52
53
  ...options,
53
54
  baseURL: baseURL?.toString() ?? Client.getBaseURL(),
@@ -60,71 +61,72 @@ export default class Client {
60
61
 
61
62
  public get action() {
62
63
  return {
63
- list: new ListActionsRequest(this.transport),
64
+ list: new ListActionsRequest(this._transport),
64
65
  };
65
66
  }
66
67
 
67
68
  public get channel() {
68
69
  return {
69
- list: new ListChannelsRequest(this.transport),
70
+ list: new ListChannelsRequest(this._transport),
70
71
  };
71
72
  }
72
73
 
73
74
  public get contact() {
74
75
  return {
75
- get: new GetContactRequest(this.transport),
76
- list: new ListContactsRequest(this.transport),
77
- update: new UpdateContactRequest(this.transport),
76
+ get: new GetContactRequest(this._transport),
77
+ list: new ListContactsRequest(this._transport),
78
+ update: new UpdateContactRequest(this._transport),
79
+ create: new CreateContactRequest(this._transport),
78
80
  };
79
81
  }
80
82
 
81
83
  public get conversation() {
82
84
  return {
83
- get: new GetConversationRequest(this.transport),
84
- list: new ListConversationsRequest(this.transport),
85
- update: new UpdateConversationRequest(this.transport),
85
+ get: new GetConversationRequest(this._transport),
86
+ list: new ListConversationsRequest(this._transport),
87
+ update: new UpdateConversationRequest(this._transport),
86
88
  message: {
87
- list: new ListConversationMessages(this.transport),
89
+ list: new ListConversationMessages(this._transport),
88
90
  },
89
91
  };
90
92
  }
91
93
 
92
94
  public get label() {
93
95
  return {
94
- create: new CreateLabelRequest(this.transport),
95
- get: new GetLabelRequest(this.transport),
96
- list: new ListLabelsRequest(this.transport),
97
- update: new UpdateLabelRequest(this.transport),
98
- delete: new DeleteLabelRequest(this.transport),
96
+ create: new CreateLabelRequest(this._transport),
97
+ get: new GetLabelRequest(this._transport),
98
+ list: new ListLabelsRequest(this._transport),
99
+ update: new UpdateLabelRequest(this._transport),
100
+ delete: new DeleteLabelRequest(this._transport),
99
101
  conversation: {
100
- list: new ListLabelConversations(this.transport),
102
+ list: new ListLabelConversations(this._transport),
101
103
  },
102
104
  };
103
105
  }
104
106
 
105
107
  public get message() {
106
108
  return {
107
- list: new ListMessagesRequest(this.transport),
109
+ list: new ListMessagesRequest(this._transport),
108
110
  };
109
111
  }
110
112
 
111
113
  public get model() {
112
114
  return {
113
- get: new GetModelRequest(this.transport),
114
- list: new ListModelsRequest(this.transport),
115
+ get: new GetModelRequest(this._transport),
116
+ list: new ListModelsRequest(this._transport),
115
117
  response: {
116
- create: new CreateResponseModelRequest(this.transport),
118
+ create: new CreateResponseModelRequest(this._transport),
117
119
  },
118
120
  correction: {
119
- create: new CreateCorrectionModelRequest(this.transport),
121
+ create: new CreateCorrectionModelRequest(this._transport),
120
122
  },
121
123
  };
122
124
  }
123
125
 
124
126
  public get source() {
125
127
  return {
126
- get: new GetSourceRequest(this.transport),
127
- list: new ListSourcesRequest(this.transport),
128
+ get: new GetSourceRequest(this._transport),
129
+ list: new ListSourcesRequest(this._transport),
128
130
  };
129
131
  }
130
132
  }
@@ -0,0 +1,65 @@
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 Transport, { SendOptions } from "../Transport/index.js";
12
+
13
+ export interface Options extends SendOptions {
14
+ body: z.infer<typeof CreateContactRequest.SCHEMA>;
15
+ request?: RequestInit;
16
+ }
17
+
18
+ export default class CreateContactRequest {
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: Transport) {}
27
+
28
+ public async send({ body, request = {}, ...options }: Options) {
29
+ return this._transport
30
+ .send(
31
+ "v1/contacts",
32
+ {
33
+ ...request,
34
+ method: "POST",
35
+ headers: {
36
+ ...request.headers,
37
+ "Content-Type": "application/json",
38
+ },
39
+ body: JSON.stringify(CreateContactRequest.SCHEMA.parse(body)),
40
+ },
41
+ options,
42
+ )
43
+ .then((response) => new CreateContactResponse(response));
44
+ }
45
+ }
46
+
47
+ export type CreateContactResponsePayload = {
48
+ contact: {
49
+ id: string;
50
+ name?: string;
51
+ emailAddress?: string;
52
+ telephoneNumber?: string;
53
+ account: string;
54
+ createdAt: string;
55
+ updatedAt?: string;
56
+ };
57
+ };
58
+
59
+ export class CreateContactResponse {
60
+ constructor(public response: Response) {}
61
+
62
+ public async result(): Promise<CreateContactResponsePayload> {
63
+ return this.response.json();
64
+ }
65
+ }
@@ -7,7 +7,7 @@
7
7
  * @see https://greatdetail.com
8
8
  */
9
9
 
10
- import Client, { SendOptions } from "../Transport/index.js";
10
+ import Transport, { SendOptions } from "../Transport/index.js";
11
11
 
12
12
  export interface Options extends SendOptions {
13
13
  id: string;
@@ -15,7 +15,7 @@ export interface Options extends SendOptions {
15
15
  }
16
16
 
17
17
  export default class GetContactRequest {
18
- constructor(protected _transport: Client) {}
18
+ constructor(protected _transport: Transport) {}
19
19
 
20
20
  public async send({ id, request = {}, ...options }: Options) {
21
21
  return this._transport
@@ -7,14 +7,14 @@
7
7
  * @see https://greatdetail.com
8
8
  */
9
9
 
10
- import Client, { SendOptions } from "../Transport/index.js";
10
+ import Transport, { SendOptions } from "../Transport/index.js";
11
11
 
12
12
  export interface Options extends SendOptions {
13
13
  request?: RequestInit;
14
14
  }
15
15
 
16
16
  export default class ListContactsRequest {
17
- constructor(protected _transport: Client) {}
17
+ constructor(protected _transport: Transport) {}
18
18
 
19
19
  public async send({ request = {}, ...options }: Options = {}) {
20
20
  return this._transport
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  import { z } from "zod";
11
- import Client, { SendOptions } from "../Transport/index.js";
11
+ import Transport, { SendOptions } from "../Transport/index.js";
12
12
 
13
13
  export interface Options extends SendOptions {
14
14
  id: string;
@@ -23,7 +23,7 @@ export default class UpdateContactRequest {
23
23
  telephoneNumber: z.string().optional(),
24
24
  });
25
25
 
26
- constructor(protected _transport: Client) {}
26
+ constructor(protected _transport: Transport) {}
27
27
 
28
28
  public async send({ id, body, request = {}, ...options }: Options) {
29
29
  return this._transport
@@ -7,7 +7,7 @@
7
7
  * @see https://greatdetail.com
8
8
  */
9
9
 
10
- import Client, { SendOptions } from "../Transport/index.js";
10
+ import Transport, { SendOptions } from "../Transport/index.js";
11
11
 
12
12
  export interface Options extends SendOptions {
13
13
  id: string;
@@ -15,7 +15,7 @@ export interface Options extends SendOptions {
15
15
  }
16
16
 
17
17
  export default class GetConversationRequest {
18
- constructor(protected _transport: Client) {}
18
+ constructor(protected _transport: Transport) {}
19
19
 
20
20
  public async send({ id, request = {}, ...options }: Options) {
21
21
  return this._transport
@@ -7,14 +7,14 @@
7
7
  * @see https://greatdetail.com
8
8
  */
9
9
 
10
- import Client, { SendOptions } from "../Transport/index.js";
10
+ import Transport, { SendOptions } from "../Transport/index.js";
11
11
 
12
12
  export interface Options extends SendOptions {
13
13
  request?: RequestInit;
14
14
  }
15
15
 
16
16
  export default class ListConversationsRequest {
17
- constructor(protected _transport: Client) {}
17
+ constructor(protected _transport: Transport) {}
18
18
 
19
19
  public async send({ request = {}, ...options }: Options = {}) {
20
20
  return this._transport
@@ -7,7 +7,7 @@
7
7
  * @see https://greatdetail.com
8
8
  */
9
9
 
10
- import Client, { SendOptions } from "../Transport/index.js";
10
+ import Transport, { SendOptions } from "../Transport/index.js";
11
11
 
12
12
  export interface Options extends SendOptions {
13
13
  id: string;
@@ -15,7 +15,7 @@ export interface Options extends SendOptions {
15
15
  }
16
16
 
17
17
  export default class ListLabelConversations {
18
- constructor(protected _transport: Client) {}
18
+ constructor(protected _transport: Transport) {}
19
19
 
20
20
  public async send({ id, request = {}, ...options }: Options) {
21
21
  return this._transport
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  import { z } from "zod";
11
- import Client, { SendOptions } from "../Transport/index.js";
11
+ import Transport, { SendOptions } from "../Transport/index.js";
12
12
 
13
13
  export interface Options extends SendOptions {
14
14
  id: string;
@@ -21,7 +21,7 @@ export default class UpdateConversationRequest {
21
21
  hasEnded: z.boolean(),
22
22
  });
23
23
 
24
- constructor(protected _transport: Client) {}
24
+ constructor(protected _transport: Transport) {}
25
25
 
26
26
  public async send({ id, body, request = {}, ...options }: Options) {
27
27
  return this._transport
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  import { z } from "zod";
11
- import Client, { SendOptions } from "../Transport/index.js";
11
+ import Transport, { SendOptions } from "../Transport/index.js";
12
12
 
13
13
  export interface Options extends SendOptions {
14
14
  body: z.infer<typeof CreateLabelRequest.SCHEMA>;
@@ -22,7 +22,7 @@ export default class CreateLabelRequest {
22
22
  account: z.string(),
23
23
  });
24
24
 
25
- constructor(protected _transport: Client) {}
25
+ constructor(protected _transport: Transport) {}
26
26
 
27
27
  public async send({ body, request = {}, ...options }: Options) {
28
28
  return this._transport
@@ -7,7 +7,7 @@
7
7
  * @see https://greatdetail.com
8
8
  */
9
9
 
10
- import Client, { SendOptions } from "../Transport/index.js";
10
+ import Transport, { SendOptions } from "../Transport/index.js";
11
11
 
12
12
  export interface Options extends SendOptions {
13
13
  id: string;
@@ -15,7 +15,7 @@ export interface Options extends SendOptions {
15
15
  }
16
16
 
17
17
  export default class DeleteLabelRequest {
18
- constructor(protected _transport: Client) {}
18
+ constructor(protected _transport: Transport) {}
19
19
 
20
20
  public async send({ id, request = {}, ...options }: Options) {
21
21
  return this._transport
@@ -7,7 +7,7 @@
7
7
  * @see https://greatdetail.com
8
8
  */
9
9
 
10
- import Client, { SendOptions } from "../Transport/index.js";
10
+ import Transport, { SendOptions } from "../Transport/index.js";
11
11
 
12
12
  export interface Options extends SendOptions {
13
13
  id: string;
@@ -15,7 +15,7 @@ export interface Options extends SendOptions {
15
15
  }
16
16
 
17
17
  export default class GetLabelRequest {
18
- constructor(protected _transport: Client) {}
18
+ constructor(protected _transport: Transport) {}
19
19
 
20
20
  public async send({ id, request = {}, ...options }: Options) {
21
21
  return this._transport
@@ -43,7 +43,7 @@ export default class UpdateLabelRequest {
43
43
  }
44
44
  }
45
45
 
46
- export type CreateLabelResponsePayload = {
46
+ export type UpdateLabelResponsePayload = {
47
47
  label: {
48
48
  id: string;
49
49
  title: string;
@@ -57,7 +57,7 @@ export type CreateLabelResponsePayload = {
57
57
  export class UpdateLabelResponse {
58
58
  constructor(public response: Response) {}
59
59
 
60
- public async result(): Promise<CreateLabelResponsePayload> {
60
+ public async result(): Promise<UpdateLabelResponsePayload> {
61
61
  return this.response.json();
62
62
  }
63
63
  }
@@ -9,7 +9,7 @@
9
9
 
10
10
  import RequestFilterable from "../Request/RequestFilterable.js";
11
11
 
12
- export interface TransportOptions {
12
+ export interface Options {
13
13
  requestFilterables: RequestFilterable[];
14
14
  baseURL: string;
15
15
  }
@@ -26,9 +26,9 @@ export interface SendOptions {
26
26
  }
27
27
 
28
28
  export default class Transport {
29
- public options: TransportOptions;
29
+ public options: Options;
30
30
 
31
- constructor({ baseURL, ...options }: TransportOptions) {
31
+ constructor({ baseURL, ...options }: Options) {
32
32
  this.options = {
33
33
  ...options,
34
34
  baseURL,
package/src/index.ts CHANGED
@@ -8,20 +8,57 @@
8
8
  */
9
9
 
10
10
  export { DEFAULT_SUPPORT_BASE_URL } from "./constants/index.js";
11
+
12
+ // Client
13
+ export { default, default as Client, type Options } from "./Client/index.js";
14
+
15
+ // Transport & Filtering
16
+ export { type default as RequestFilterable } from "./Request/RequestFilterable.js";
17
+ export {
18
+ type Options as TransportOptions,
19
+ type SendOptions as TransportSendOptions,
20
+ } from "./Transport/index.js";
21
+
22
+ // Authentication
11
23
  export { default as KeyAuthentication } from "./Authentication/KeyAuthentication.js";
12
24
  export { default as TokenAuthentication } from "./Authentication/TokenAuthentication.js";
13
25
  export { default as PublicAuthentication } from "./Authentication/PublicAuthentication.js";
14
- export { type default as RequestFilterable } from "./Request/RequestFilterable.js";
15
- export { default, default as Client } from "./Client/index.js";
26
+
27
+ // Actions
16
28
  export { type ListActionsResponsePayload } from "./Action/ListActions.js";
29
+
30
+ // Channels
17
31
  export { type ListChannelsResponsePayload } from "./Channel/ListChannels.js";
32
+
33
+ // Contacts
34
+ export { type GetContactResponsePayload } from "./Contact/GetContact.js";
18
35
  export { type ListContactsResponsePayload } from "./Contact/ListContacts.js";
19
- export { type ListConversationsResponsePayload } from "./Conversation/ListConversations.js";
36
+ export { type UpdateContactResponsePayload } from "./Contact/UpdateContact.js";
37
+ export { type CreateContactResponsePayload } from "./Contact/CreateContact.js";
38
+
39
+ // Conversations
20
40
  export { type GetConversationResponsePayload } from "./Conversation/GetConversation.js";
41
+ export { type ListConversationsResponsePayload } from "./Conversation/ListConversations.js";
42
+ export { type ListLabelConversationsResponsePayload } from "./Conversation/ListLabelConversations.js";
43
+ export { type UpdateConversationResponsePayload } from "./Conversation/UpdateConversation.js";
44
+
45
+ // Labels
21
46
  export { type CreateLabelResponsePayload } from "./Label/CreateLabel.js";
47
+ export { type DeleteLabelResponsePayload } from "./Label/DeleteLabel.js";
48
+ export { type GetLabelResponsePayload } from "./Label/GetLabel.js";
22
49
  export { type ListLabelsResponsePayload } from "./Label/ListLabels.js";
50
+ export { type UpdateLabelResponsePayload } from "./Label/UpdateLabel.js";
51
+
52
+ // Messages
53
+ export { type ListConversationMessagesResponsePayload } from "./Message/ListConversationMessages.js";
23
54
  export { type ListMessagesResponsePayload } from "./Message/ListMessages.js";
55
+
56
+ // Models
57
+ export { type GetModelResponsePayload } from "./Model/GetModel.js";
24
58
  export { type ListModelsResponsePayload } from "./Model/ListModels.js";
25
59
  export { type CreateCorrectionResponsePayload } from "./Model/Correction/CreateCorrectionModel.js";
26
60
  export { type CreateResponseResponsePayload } from "./Model/Response/CreateResponseModel.js";
61
+
62
+ // Sources
63
+ export { type GetSourceResponsePayload } from "./Source/GetSource.js";
27
64
  export { type ListSourcesResponsePayload } from "./Source/ListSources.js";
@@ -1 +0,0 @@
1
- var ot="https://api.support.greatdetail.com",it={"X-Powered-By":"GDSupport/JavaScript"},at="api-key",ct="SUPPORT_ACCESS_TOKEN",dt="SUPPORT_API_KEY",lt="SUPPORT_KEY_NAME";var L=class{async filter(t){return t}};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 j(n))}},j=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 H(n))}},H=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/contacts",{...t,method:"GET"},s).then(n=>new D(n))}},D=class{constructor(t){this.response=t}async result(){return this.response.json()}};var c=class{constructor(t){this._transport=t}async send({id:t,request:s={},...n}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new M(r))}},M=class{constructor(t){this.response=t}async result(){return this.response.json()}};var d=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/conversations",{...t,method:"GET"},s).then(n=>new N(n))}},N=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as w}from"zod";var l=class e{constructor(t){this._transport=t}static SCHEMA=w.object({title:w.string(),description:w.string().optional(),account:w.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 G(r))}},G=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/labels",{...t,method:"GET"},s).then(n=>new z(n))}},z=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/messages",{...t,method:"GET"},s).then(n=>new F(n))}},F=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as q}from"zod";var m=class e{constructor(t){this._transport=t}static SCHEMA=q.object({input:q.string().max(65536),original:q.string().max(65536),correction:q.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 B(o))}},B=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/models",{...t,method:"GET"},s).then(n=>new J(n))}},J=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as I}from"zod";var b=class e{constructor(t){this._transport=t}static SCHEMA=I.array(I.object({role:I.enum(["user","assistant"]),content:I.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 K(o))}},K=class{constructor(t){this.response=t}async result(){return this.response.json()}};var y=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/sources",{...t,method:"GET"},s).then(n=>new V(n))}},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/contacts/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new Y(r))}},Y=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as U}from"zod";var R=class e{constructor(t){this._transport=t}static SCHEMA=U.object({name:U.string().optional(),emailAddress:U.string().email().optional(),telephoneNumber:U.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 k(o))}},k=class{constructor(t){this.response=t}async result(){return this.response.json()}};var x=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 W(r))}},W=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as pt}from"zod";var S=class e{constructor(t){this._transport=t}static SCHEMA=pt.object({hasEnded:pt.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 X(o))}},X=class{constructor(t){this.response=t}async result(){return this.response.json()}};var C=class{constructor(t){this._transport=t}async send({id:t,request:s={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"DELETE"},n).then(r=>new Q(r))}},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/labels/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new Z(r))}},Z=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as $}from"zod";var A=class e{constructor(t){this._transport=t}static SCHEMA=$.object({title:$.string().optional(),description:$.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 tt(o))}},tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var P=class{constructor(t){this._transport=t}async send({id:t,request:s={},...n}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET"},n).then(r=>new et(r))}},et=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/models/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new st(r))}},st=class{constructor(t){this.response=t}async result(){return this.response.json()}};var T=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=it;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var _=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 nt(r))}},nt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var v=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 rt=class e{static DEFAULT_BASE_URL=ot;transport;constructor(t,{baseURL:s,...n}={}){this.transport=new v({requestFilterables:[new T,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 f(this.transport),list:new a(this.transport),update:new R(this.transport)}}get conversation(){return{get:new c(this.transport),list:new d(this.transport),update:new S(this.transport),message:{list:new P(this.transport)}}}get label(){return{create:new l(this.transport),get:new O(this.transport),list:new u(this.transport),update:new A(this.transport),delete:new C(this.transport),conversation:{list:new x(this.transport)}}}get message(){return{list:new g(this.transport)}}get model(){return{get:new E(this.transport),list:new h(this.transport),response:{create:new b(this.transport)},correction:{create:new m(this.transport)}}}get source(){return{get:new _(this.transport),list:new y(this.transport)}}};export{ot as a,at as b,ct as c,dt as d,lt as e,L as f,rt as g};