@great-detail/support-sdk 0.2.10 → 0.3.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.
@@ -45,6 +45,7 @@ export type UpdateBoilerplateResponsePayload = {
45
45
  title: string;
46
46
  content: string;
47
47
  account: string;
48
+ boilerplateCategory: string;
48
49
  createdAt: string;
49
50
  updatedAt: string;
50
51
  };
@@ -7,7 +7,8 @@
7
7
  * @see https://greatdetail.com
8
8
  */
9
9
 
10
- export { type CreateBoilerplateResponsePayload } from "./CreateBoilerplate.js";
10
+ export { type CreateBoilerplateCategoryBoilerplateResponsePayload } from "./CreateBoilerplateCategoryBoilerplate.js";
11
+ export { type ListBoilerplateCategoryBoilerplatesResponsePayload } from "./ListBoilerplateCategoryBoilerplates.js";
11
12
  export { type GetBoilerplateResponsePayload } from "./GetBoilerplate.js";
12
13
  export { type ListBoilerplatesResponsePayload } from "./ListBoilerplates.js";
13
14
  export { type UpdateBoilerplateResponsePayload } from "./UpdateBoilerplate.js";
@@ -11,14 +11,14 @@ import { z } from "zod";
11
11
  import FetchTransport from "../Transport/FetchTransport.js";
12
12
 
13
13
  export interface Options {
14
- body: z.infer<typeof CreateBoilerplate.SCHEMA>;
14
+ body: z.infer<typeof CreateBoilerplateCategory.SCHEMA>;
15
15
  request?: RequestInit;
16
16
  }
17
17
 
18
- export default class CreateBoilerplate {
18
+ export default class CreateBoilerplateCategory {
19
19
  public static SCHEMA = z.object({
20
20
  title: z.string(),
21
- content: z.string(),
21
+ description: z.string().optional(),
22
22
  account: z.string(),
23
23
  });
24
24
 
@@ -26,34 +26,34 @@ export default class CreateBoilerplate {
26
26
 
27
27
  public async send({ body, request = {} }: Options) {
28
28
  return this._transport
29
- .send("v1/boilerplates", {
29
+ .send("v1/boilerplate-categories", {
30
30
  ...request,
31
31
  method: "POST",
32
32
  headers: {
33
33
  ...request.headers,
34
34
  "Content-Type": "application/json",
35
35
  },
36
- body: JSON.stringify(CreateBoilerplate.SCHEMA.parse(body)),
36
+ body: JSON.stringify(CreateBoilerplateCategory.SCHEMA.parse(body)),
37
37
  })
38
- .then((response) => new CreateBoilerplateResponse(response));
38
+ .then((response) => new CreateBoilerplateCategoryResponse(response));
39
39
  }
40
40
  }
41
41
 
42
- export type CreateBoilerplateResponsePayload = {
43
- boilerplate: {
42
+ export type CreateBoilerplateCategoryResponsePayload = {
43
+ boilerplateCategory: {
44
44
  id: string;
45
45
  title: string;
46
- content: string;
46
+ description?: string;
47
47
  account: string;
48
48
  createdAt: string;
49
49
  updatedAt: string;
50
50
  };
51
51
  };
52
52
 
53
- export class CreateBoilerplateResponse {
53
+ export class CreateBoilerplateCategoryResponse {
54
54
  constructor(public response: Response) {}
55
55
 
56
- public async result(): Promise<CreateBoilerplateResponsePayload> {
56
+ public async result(): Promise<CreateBoilerplateCategoryResponsePayload> {
57
57
  return this.response.json();
58
58
  }
59
59
  }
@@ -0,0 +1,47 @@
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 FetchTransport from "../Transport/FetchTransport.js";
11
+
12
+ export interface Options {
13
+ id: string;
14
+ request?: RequestInit;
15
+ }
16
+
17
+ export default class GetBoilerplateCategory {
18
+ constructor(protected _transport: FetchTransport) {}
19
+
20
+ public async send({ id, request = {} }: Options) {
21
+ return this._transport
22
+ .send("v1/boilerplate-categories/" + encodeURIComponent(id), {
23
+ ...request,
24
+ method: "GET",
25
+ })
26
+ .then((response) => new GetBoilerplateCategoryResponse(response));
27
+ }
28
+ }
29
+
30
+ export type GetBoilerplateCategoryResponsePayload = {
31
+ boilerplateCategory: {
32
+ id: string;
33
+ title: string;
34
+ description?: string;
35
+ account: string;
36
+ createdAt: string;
37
+ updatedAt: string;
38
+ };
39
+ };
40
+
41
+ export class GetBoilerplateCategoryResponse {
42
+ constructor(public response: Response) {}
43
+
44
+ public async result(): Promise<GetBoilerplateCategoryResponsePayload> {
45
+ return this.response.json();
46
+ }
47
+ }
@@ -0,0 +1,46 @@
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 FetchTransport from "../Transport/FetchTransport.js";
11
+
12
+ export interface Options {
13
+ request?: RequestInit;
14
+ }
15
+
16
+ export default class ListBoilerplateCategories {
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 = {
30
+ boilerplateCategories: {
31
+ id: string;
32
+ title: string;
33
+ description?: string;
34
+ account: string;
35
+ createdAt: string;
36
+ updatedAt: string;
37
+ }[];
38
+ };
39
+
40
+ export class ListBoilerplateCategoriesResponse {
41
+ constructor(public response: Response) {}
42
+
43
+ public async result(): Promise<ListBoilerplateCategoriesResponsePayload> {
44
+ return this.response.json();
45
+ }
46
+ }
@@ -0,0 +1,59 @@
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
+ id: string;
15
+ body: z.infer<typeof UpdateBoilerplateCategory.SCHEMA>;
16
+ request?: RequestInit;
17
+ }
18
+
19
+ export default class UpdateBoilerplateCategory {
20
+ public static SCHEMA = z.object({
21
+ title: z.string().optional(),
22
+ description: z.string().optional(),
23
+ });
24
+
25
+ constructor(protected _transport: FetchTransport) {}
26
+
27
+ public async send({ id, body, request = {} }: Options) {
28
+ return this._transport
29
+ .send("v1/boilerplate-categories/" + encodeURIComponent(id), {
30
+ ...request,
31
+ method: "PATCH",
32
+ headers: {
33
+ ...request.headers,
34
+ "Content-Type": "application/json",
35
+ },
36
+ body: JSON.stringify(UpdateBoilerplateCategory.SCHEMA.parse(body)),
37
+ })
38
+ .then((response) => new UpdateBoilerplateCategoryResponse(response));
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();
58
+ }
59
+ }
@@ -0,0 +1,13 @@
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 { type CreateBoilerplateCategoryResponsePayload } from "./CreateBoilerplateCategory.js";
11
+ export { type GetBoilerplateCategoryResponsePayload } from "./GetBoilerplateCategory.js";
12
+ export { type ListBoilerplateCategoriesResponsePayload } from "./ListBoilerplateCategories.js";
13
+ export { type UpdateBoilerplateCategoryResponsePayload } from "./UpdateBoilerplateCategory.js";
@@ -9,10 +9,15 @@
9
9
 
10
10
  import ListActions from "../Action/ListActions.js";
11
11
  import Authentication from "../Authentication/index.js";
12
- import CreateBoilerplate from "../Boilerplate/CreateBoilerplate.js";
12
+ import CreateBoilerplateCategoryBoilerplate from "../Boilerplate/CreateBoilerplateCategoryBoilerplate.js";
13
13
  import GetBoilerplate from "../Boilerplate/GetBoilerplate.js";
14
+ import ListBoilerplateCategoryBoilerplates from "../Boilerplate/ListBoilerplateCategoryBoilerplates.js";
14
15
  import ListBoilerplates from "../Boilerplate/ListBoilerplates.js";
15
16
  import UpdateBoilerplate from "../Boilerplate/UpdateBoilerplate.js";
17
+ import CreateBoilerplateCategory from "../BoilerplateCategory/CreateBoilerplateCategory.js";
18
+ import GetBoilerplateCategory from "../BoilerplateCategory/GetBoilerplateCategory.js";
19
+ import ListBoilerplateCategories from "../BoilerplateCategory/ListBoilerplateCategories.js";
20
+ import UpdateBoilerplateCategory from "../BoilerplateCategory/UpdateBoilerplateCategory.js";
16
21
  import ListChannels from "../Channel/ListChannels.js";
17
22
  import { BASE_URL_ENV_VAR } from "../constants/environment.js";
18
23
  import { DEFAULT_SUPPORT_BASE_URL } from "../constants/index.js";
@@ -82,11 +87,23 @@ export default class Client {
82
87
  return {
83
88
  get: new GetBoilerplate(this._transport),
84
89
  list: new ListBoilerplates(this._transport),
85
- create: new CreateBoilerplate(this._transport),
86
90
  update: new UpdateBoilerplate(this._transport),
87
91
  };
88
92
  }
89
93
 
94
+ public get boilerplateCategory() {
95
+ return {
96
+ get: new GetBoilerplateCategory(this._transport),
97
+ list: new ListBoilerplateCategories(this._transport),
98
+ create: new CreateBoilerplateCategory(this._transport),
99
+ update: new UpdateBoilerplateCategory(this._transport),
100
+ boilerplate: {
101
+ list: new ListBoilerplateCategoryBoilerplates(this._transport),
102
+ create: new CreateBoilerplateCategoryBoilerplate(this._transport),
103
+ },
104
+ };
105
+ }
106
+
90
107
  public get channel() {
91
108
  return {
92
109
  list: new ListChannels(this._transport),
package/src/index.ts CHANGED
@@ -26,6 +26,7 @@ export { default as PublicAuthentication } from "./Authentication/PublicAuthenti
26
26
 
27
27
  export * from "./Action/index.js";
28
28
  export * from "./Boilerplate/index.js";
29
+ export * from "./BoilerplateCategory/index.js";
29
30
  export * from "./Channel/index.js";
30
31
  export * from "./Contact/index.js";
31
32
  export * from "./Conversation/index.js";
@@ -1 +0,0 @@
1
- var Yt=Object.defineProperty;var Xt=(e,t)=>{for(var r in t)Yt(e,r,{get:t[r],enumerable:!0})};var Mt="https://api.support.greatdetail.com",Gt={"X-Powered-By":"GDSupport/JavaScript"},Zt="api-key";var p=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"}).then(r=>new et(r))}},et=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as W}from"zod";var c=class e{constructor(t){this._transport=t}static SCHEMA=W.object({title:W.string(),content:W.string(),account:W.string()});async send({body:t,request:r={}}){return this._transport.send("v1/boilerplates",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(s=>new rt(s))}},rt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var d=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new st(s))}},st=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/boilerplates",{...t,method:"GET"}).then(r=>new nt(r))}},nt=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as ot}from"zod";var l=class e{constructor(t){this._transport=t}static SCHEMA=ot.object({title:ot.string().optional(),content:ot.string().optional()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/boilerplates/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(n=>new it(n))}},it=class{constructor(t){this.response=t}async result(){return this.response.json()}};var m=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"}).then(r=>new at(r))}},at=class{constructor(t){this.response=t}async result(){return this.response.json()}};var ce="SUPPORT_ACCESS_TOKEN",de="SUPPORT_API_KEY",ue="SUPPORT_KEY_NAME",Dt="SUPPORT_BASE_URL";var g=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:r={}}){let s=r.variant??"vcard",n=r.format??(r.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(s)+"&format="+encodeURIComponent(n)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};import{z as h}from"zod";var f=class e{constructor(t){this._transport=t}static SCHEMA=h.object({name:h.string(),account:h.string(),emailAddress:h.string().email().optional(),telephoneNumber:h.string().optional()});async send({body:t,request:r={}}){return this._transport.send("v1/contacts",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(s=>new pt(s))}},pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new ct(s))}},ct=class{constructor(t){this.response=t}async result(){return this.response.json()}};var y=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"}).then(r=>new dt(r))}},dt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var R=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...r,method:"GET"}).then(s=>new ut(s))}},ut=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as X}from"zod";var x=class e{constructor(t){this._transport=t}static SCHEMA=X.object({name:X.string().optional(),emailAddress:X.string().email().optional(),telephoneNumber:X.string().optional()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(n=>new lt(n))}},lt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new mt(s))}},mt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var T=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"}).then(r=>new gt(r))}},gt=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:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET"}).then(s=>new ht(s))}},ht=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as zt}from"zod";var _=class e{constructor(t){this._transport=t}static SCHEMA=zt.object({hasEnded:zt.boolean()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(n=>new ft(n))}},ft=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as Q}from"zod";var P=class e{constructor(t){this._transport=t}static SCHEMA=Q.object({title:Q.string(),description:Q.string().optional(),account:Q.string()});async send({body:t,request:r={}}){return this._transport.send("v1/labels",{...r,method:"POST",headers:{...r.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))}).then(s=>new bt(s))}},bt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"DELETE"}).then(s=>new yt(s))}},yt=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:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new Rt(s))}},Rt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var O=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"}).then(r=>new xt(r))}},xt=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as At}from"zod";var w=class e{constructor(t){this._transport=t}static SCHEMA=At.object({title:At.string().optional(),description:At.string().optional()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(n=>new Tt(n))}},Tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var v=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET"}).then(s=>new Ct(s))}},Ct=class{constructor(t){this.response=t}async result(){return this.response.json()}};var F=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"}).then(r=>new _t(r))}},_t=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as Z}from"zod";var q=class e{constructor(t){this._transport=t}static SCHEMA=Z.object({input:Z.string().max(65536),original:Z.string().max(65536),correction:Z.string().max(65536)});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(n=>new Pt(n))}},Pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var I=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new St(s))}},St=class{constructor(t){this.response=t}async result(){return this.response.json()}};var U=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"}).then(r=>new Et(r))}},Et=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as tt}from"zod";var j=class e{constructor(t){this._transport=t}static SCHEMA=tt.array(tt.object({role:tt.enum(["user","assistant"]),content:tt.string().max(65536).nullable()})).min(1);async send({id:t,body:r,request:s={}}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(n=>new Ot(n))}},Ot=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as Bt}from"zod";var H=class e{constructor(t){this._transport=t}static SCHEMA=Bt.object({content:Bt.string()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(n=>new wt(n))}},wt=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as Jt}from"zod";var L=class e{constructor(t){this._transport=t}static SCHEMA=Jt.object({content:Jt.string()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(n=>new vt(n))}},vt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var N=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new Ft(s))}},Ft=class{constructor(t){this.response=t}async result(){return this.response.json()}};var M=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/contacts/"+encodeURIComponent(t)+"/notes",{...r,method:"GET"}).then(s=>new qt(s))}},qt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var G=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/notes",{...r,method:"GET"}).then(s=>new It(s))}},It=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as Vt}from"zod";var D=class e{constructor(t){this._transport=t}static SCHEMA=Vt.object({content:Vt.string().optional()});async send({id:t,body:r,request:s={}}){return this._transport.send("v1/notes/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(r))}).then(n=>new Ut(n))}},Ut=class{constructor(t){this.response=t}async result(){return this.response.json()}};var z=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Gt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var B=class{constructor(t){this._transport=t}async send({id:t,request:r={}}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new jt(s))}},jt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var J=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"}).then(r=>new Ht(r))}},Ht=class{constructor(t){this.response=t}async result(){return this.response.json()}};import $t from"is-network-error";import Wt from"ky";var o=class extends Error{};var i=class extends o{};var V=class extends i{static unauthenticated(){return new this("An unauthenticated request occurred")}};var k=class extends i{static forbidden(){return new this("A forbidden request occurred")}};var a=class extends o{static notFound(t){return new this(`Record not found for request: ${t}`)}static forbiddenMethod(t,r){return new this(`Forbidden method for request: ${t} ${r}`)}};var K=class extends o{};var Y=class extends o{static badRequest(){return new this("Bad request")}};var $=class{options;constructor({baseURL:t,...r}){this.options={...r,baseURL:t}}getURL(t){return new URL(t,this.options.baseURL).toString()}getRequest(t,r){r.headers=new Headers(r.headers);for(let s of this.options.requestFilterables){let n=s.getHeaders();for(let[kt,Kt]of Object.entries(n))r.headers.set(kt,Kt)}return new Request(this.getURL(t),r)}async send(t,r){return await Wt(this.getRequest(t,r)).then(s=>{if(!s.ok){let n=s.status;switch(console.error(JSON.stringify(s)),n){case 400:throw Y.badRequest();case 401:throw V.unauthenticated();case 403:throw k.forbidden();case 404:throw a.notFound(t);case 405:throw a.forbiddenMethod(t,r.method??"GET")}}return s}).catch(s=>{throw $t(s)?new K("A network error occurred",{cause:s}):s})}};var Lt=class e{static DEFAULT_BASE_URL=Mt;_transport;constructor(t,{baseURL:r,...s}={}){this._transport=new $({requestFilterables:[new z,t],...s,baseURL:r?.toString()??e.getBaseURL()})}static getBaseURL(){return process.env[Dt]??this.DEFAULT_BASE_URL}get action(){return{list:new p(this._transport)}}get boilerplate(){return{get:new d(this._transport),list:new u(this._transport),create:new c(this._transport),update:new l(this._transport)}}get channel(){return{list:new m(this._transport)}}get contact(){return{get:new b(this._transport),list:new y(this._transport),update:new x(this._transport),create:new f(this._transport),vcf:{get:new g(this._transport)},note:{list:new M(this._transport),create:new H(this._transport)}}}get conversation(){return{get:new A(this._transport),list:new T(this._transport),update:new _(this._transport),message:{list:new v(this._transport)},note:{list:new G(this._transport),create:new L(this._transport)}}}get label(){return{create:new P(this._transport),get:new E(this._transport),list:new O(this._transport),update:new w(this._transport),delete:new S(this._transport),contact:{list:new R(this._transport)},conversation:{list:new C(this._transport)}}}get message(){return{list:new F(this._transport)}}get model(){return{get:new I(this._transport),list:new U(this._transport),response:{create:new j(this._transport)},correction:{create:new q(this._transport)}}}get note(){return{get:new N(this._transport),update:new D(this._transport)}}get source(){return{get:new B(this._transport),list:new J(this._transport)}}};var Nt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};export{Xt as a,Mt as b,Zt as c,ce as d,de as e,ue as f,o as g,i as h,V as i,k as j,a as k,K as l,Y as m,Lt as n,Nt as o};