@great-detail/support-sdk 0.2.8 → 0.2.10
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-KG7KNOPC.js +1 -0
- package/dist/{chunk-IQESWTED.js → chunk-ZYSG2PTQ.js} +1 -1
- package/dist/cli/index.cjs +1 -1
- package/dist/cli/index.d.cts +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/{index-DsZ1QEUj.d.cts → index-BMsEq65I.d.cts} +178 -13
- package/dist/{index-DsZ1QEUj.d.ts → index-BMsEq65I.d.ts} +178 -13
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +20 -3
- package/dist/index.d.ts +20 -3
- package/dist/index.js +1 -1
- package/package.json +1 -2
- package/src/Action/index.ts +10 -0
- package/src/Boilerplate/CreateBoilerplate.ts +59 -0
- package/src/Boilerplate/GetBoilerplate.ts +47 -0
- package/src/Boilerplate/ListBoilerplates.ts +46 -0
- package/src/Boilerplate/UpdateBoilerplate.ts +59 -0
- package/src/Boilerplate/index.ts +13 -0
- package/src/Channel/index.ts +10 -0
- package/src/Client/index.ts +13 -0
- package/src/Contact/index.ts +14 -0
- package/src/Conversation/index.ts +13 -0
- package/src/Label/index.ts +14 -0
- package/src/Message/index.ts +11 -0
- package/src/Model/index.ts +15 -0
- package/src/Note/index.ts +15 -0
- package/src/Source/index.ts +11 -0
- package/src/Subscription/CreateContactSubscription.ts +62 -0
- package/src/Subscription/index.ts +10 -0
- package/src/index.ts +11 -47
- package/dist/chunk-UWNMFEJS.js +0 -1
|
@@ -28,21 +28,21 @@ interface RequestFilterable {
|
|
|
28
28
|
* @see https://greatdetail.com
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
interface Options$
|
|
31
|
+
interface Options$B {
|
|
32
32
|
requestFilterables: RequestFilterable[];
|
|
33
33
|
}
|
|
34
34
|
interface Transport {
|
|
35
35
|
getURL(url: string): string;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
interface InputOptions extends Options$
|
|
38
|
+
interface InputOptions extends Options$B {
|
|
39
39
|
baseURL: string;
|
|
40
40
|
}
|
|
41
|
-
interface Options$
|
|
41
|
+
interface Options$A extends Options$B {
|
|
42
42
|
baseURL: string;
|
|
43
43
|
}
|
|
44
44
|
declare class FetchTransport implements Transport {
|
|
45
|
-
options: Options$
|
|
45
|
+
options: Options$A;
|
|
46
46
|
constructor({ baseURL, ...options }: InputOptions);
|
|
47
47
|
getURL(url: string): string;
|
|
48
48
|
getRequest(url: string, request: RequestInit): Request;
|
|
@@ -58,13 +58,13 @@ declare class FetchTransport implements Transport {
|
|
|
58
58
|
* @see https://greatdetail.com
|
|
59
59
|
*/
|
|
60
60
|
|
|
61
|
-
interface Options$
|
|
61
|
+
interface Options$z {
|
|
62
62
|
request?: RequestInit;
|
|
63
63
|
}
|
|
64
64
|
declare class ListActions {
|
|
65
65
|
protected _transport: FetchTransport;
|
|
66
66
|
constructor(_transport: FetchTransport);
|
|
67
|
-
send({ request }?: Options$
|
|
67
|
+
send({ request }?: Options$z): Promise<ListActionsResponse>;
|
|
68
68
|
}
|
|
69
69
|
type ListActionsResponsePayload = {
|
|
70
70
|
actions: {
|
|
@@ -97,6 +97,165 @@ declare class ListActionsResponse {
|
|
|
97
97
|
|
|
98
98
|
type Authentication = RequestFilterable;
|
|
99
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Great Detail Support System.
|
|
102
|
+
*
|
|
103
|
+
* @copyright 2024 Great Detail Ltd
|
|
104
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
105
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
106
|
+
* @see https://greatdetail.com
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
interface Options$y {
|
|
110
|
+
body: z.infer<typeof CreateBoilerplate.SCHEMA>;
|
|
111
|
+
request?: RequestInit;
|
|
112
|
+
}
|
|
113
|
+
declare class CreateBoilerplate {
|
|
114
|
+
protected _transport: FetchTransport;
|
|
115
|
+
static SCHEMA: z.ZodObject<{
|
|
116
|
+
title: z.ZodString;
|
|
117
|
+
content: z.ZodString;
|
|
118
|
+
account: z.ZodString;
|
|
119
|
+
}, "strip", z.ZodTypeAny, {
|
|
120
|
+
title: string;
|
|
121
|
+
content: string;
|
|
122
|
+
account: string;
|
|
123
|
+
}, {
|
|
124
|
+
title: string;
|
|
125
|
+
content: string;
|
|
126
|
+
account: string;
|
|
127
|
+
}>;
|
|
128
|
+
constructor(_transport: FetchTransport);
|
|
129
|
+
send({ body, request }: Options$y): Promise<CreateBoilerplateResponse>;
|
|
130
|
+
}
|
|
131
|
+
type CreateBoilerplateResponsePayload = {
|
|
132
|
+
boilerplate: {
|
|
133
|
+
id: string;
|
|
134
|
+
title: string;
|
|
135
|
+
content: string;
|
|
136
|
+
account: string;
|
|
137
|
+
createdAt: string;
|
|
138
|
+
updatedAt: string;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
declare class CreateBoilerplateResponse {
|
|
142
|
+
response: Response;
|
|
143
|
+
constructor(response: Response);
|
|
144
|
+
result(): Promise<CreateBoilerplateResponsePayload>;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Great Detail Support System.
|
|
149
|
+
*
|
|
150
|
+
* @copyright 2024 Great Detail Ltd
|
|
151
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
152
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
153
|
+
* @see https://greatdetail.com
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
interface Options$x {
|
|
157
|
+
id: string;
|
|
158
|
+
request?: RequestInit;
|
|
159
|
+
}
|
|
160
|
+
declare class GetBoilerplate {
|
|
161
|
+
protected _transport: FetchTransport;
|
|
162
|
+
constructor(_transport: FetchTransport);
|
|
163
|
+
send({ id, request }: Options$x): Promise<GetBoilerplateResponse>;
|
|
164
|
+
}
|
|
165
|
+
type GetBoilerplateResponsePayload = {
|
|
166
|
+
boilerplate: {
|
|
167
|
+
id: string;
|
|
168
|
+
title: string;
|
|
169
|
+
content: string;
|
|
170
|
+
account: string;
|
|
171
|
+
createdAt: string;
|
|
172
|
+
updatedAt: string;
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
declare class GetBoilerplateResponse {
|
|
176
|
+
response: Response;
|
|
177
|
+
constructor(response: Response);
|
|
178
|
+
result(): Promise<GetBoilerplateResponsePayload>;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Great Detail Support System.
|
|
183
|
+
*
|
|
184
|
+
* @copyright 2024 Great Detail Ltd
|
|
185
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
186
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
187
|
+
* @see https://greatdetail.com
|
|
188
|
+
*/
|
|
189
|
+
|
|
190
|
+
interface Options$w {
|
|
191
|
+
request?: RequestInit;
|
|
192
|
+
}
|
|
193
|
+
declare class ListBoilerplates {
|
|
194
|
+
protected _transport: FetchTransport;
|
|
195
|
+
constructor(_transport: FetchTransport);
|
|
196
|
+
send({ request }?: Options$w): Promise<ListBoilerplatesResponse>;
|
|
197
|
+
}
|
|
198
|
+
type ListBoilerplatesResponsePayload = {
|
|
199
|
+
boilerplates: {
|
|
200
|
+
id: string;
|
|
201
|
+
title: string;
|
|
202
|
+
content: string;
|
|
203
|
+
account: string;
|
|
204
|
+
createdAt: string;
|
|
205
|
+
updatedAt: string;
|
|
206
|
+
}[];
|
|
207
|
+
};
|
|
208
|
+
declare class ListBoilerplatesResponse {
|
|
209
|
+
response: Response;
|
|
210
|
+
constructor(response: Response);
|
|
211
|
+
result(): Promise<ListBoilerplatesResponsePayload>;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Great Detail Support System.
|
|
216
|
+
*
|
|
217
|
+
* @copyright 2024 Great Detail Ltd
|
|
218
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
219
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
220
|
+
* @see https://greatdetail.com
|
|
221
|
+
*/
|
|
222
|
+
|
|
223
|
+
interface Options$v {
|
|
224
|
+
id: string;
|
|
225
|
+
body: z.infer<typeof UpdateBoilerplate.SCHEMA>;
|
|
226
|
+
request?: RequestInit;
|
|
227
|
+
}
|
|
228
|
+
declare class UpdateBoilerplate {
|
|
229
|
+
protected _transport: FetchTransport;
|
|
230
|
+
static SCHEMA: z.ZodObject<{
|
|
231
|
+
title: z.ZodOptional<z.ZodString>;
|
|
232
|
+
content: z.ZodOptional<z.ZodString>;
|
|
233
|
+
}, "strip", z.ZodTypeAny, {
|
|
234
|
+
title?: string | undefined;
|
|
235
|
+
content?: string | undefined;
|
|
236
|
+
}, {
|
|
237
|
+
title?: string | undefined;
|
|
238
|
+
content?: string | undefined;
|
|
239
|
+
}>;
|
|
240
|
+
constructor(_transport: FetchTransport);
|
|
241
|
+
send({ id, body, request }: Options$v): Promise<UpdateBoilerplateResponse>;
|
|
242
|
+
}
|
|
243
|
+
type UpdateBoilerplateResponsePayload = {
|
|
244
|
+
boilerplate: {
|
|
245
|
+
id: string;
|
|
246
|
+
title: string;
|
|
247
|
+
content: string;
|
|
248
|
+
account: string;
|
|
249
|
+
createdAt: string;
|
|
250
|
+
updatedAt: string;
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
declare class UpdateBoilerplateResponse {
|
|
254
|
+
response: Response;
|
|
255
|
+
constructor(response: Response);
|
|
256
|
+
result(): Promise<UpdateBoilerplateResponsePayload>;
|
|
257
|
+
}
|
|
258
|
+
|
|
100
259
|
/**
|
|
101
260
|
* Great Detail Support System.
|
|
102
261
|
*
|
|
@@ -191,13 +350,13 @@ declare class CreateContact {
|
|
|
191
350
|
emailAddress: z.ZodOptional<z.ZodString>;
|
|
192
351
|
telephoneNumber: z.ZodOptional<z.ZodString>;
|
|
193
352
|
}, "strip", z.ZodTypeAny, {
|
|
194
|
-
name: string;
|
|
195
353
|
account: string;
|
|
354
|
+
name: string;
|
|
196
355
|
emailAddress?: string | undefined;
|
|
197
356
|
telephoneNumber?: string | undefined;
|
|
198
357
|
}, {
|
|
199
|
-
name: string;
|
|
200
358
|
account: string;
|
|
359
|
+
name: string;
|
|
201
360
|
emailAddress?: string | undefined;
|
|
202
361
|
telephoneNumber?: string | undefined;
|
|
203
362
|
}>;
|
|
@@ -541,12 +700,12 @@ declare class CreateLabel {
|
|
|
541
700
|
description: z.ZodOptional<z.ZodString>;
|
|
542
701
|
account: z.ZodString;
|
|
543
702
|
}, "strip", z.ZodTypeAny, {
|
|
544
|
-
account: string;
|
|
545
703
|
title: string;
|
|
704
|
+
account: string;
|
|
546
705
|
description?: string | undefined;
|
|
547
706
|
}, {
|
|
548
|
-
account: string;
|
|
549
707
|
title: string;
|
|
708
|
+
account: string;
|
|
550
709
|
description?: string | undefined;
|
|
551
710
|
}>;
|
|
552
711
|
constructor(_transport: FetchTransport);
|
|
@@ -914,11 +1073,11 @@ declare class CreateResponseModel {
|
|
|
914
1073
|
role: z.ZodEnum<["user", "assistant"]>;
|
|
915
1074
|
content: z.ZodNullable<z.ZodString>;
|
|
916
1075
|
}, "strip", z.ZodTypeAny, {
|
|
917
|
-
role: "user" | "assistant";
|
|
918
1076
|
content: string | null;
|
|
919
|
-
}, {
|
|
920
1077
|
role: "user" | "assistant";
|
|
1078
|
+
}, {
|
|
921
1079
|
content: string | null;
|
|
1080
|
+
role: "user" | "assistant";
|
|
922
1081
|
}>, "many">;
|
|
923
1082
|
constructor(_transport: FetchTransport);
|
|
924
1083
|
send({ id, body, request }: Options$9): Promise<CreateResponseModelResponse>;
|
|
@@ -1239,6 +1398,12 @@ declare class Client {
|
|
|
1239
1398
|
get action(): {
|
|
1240
1399
|
list: ListActions;
|
|
1241
1400
|
};
|
|
1401
|
+
get boilerplate(): {
|
|
1402
|
+
get: GetBoilerplate;
|
|
1403
|
+
list: ListBoilerplates;
|
|
1404
|
+
create: CreateBoilerplate;
|
|
1405
|
+
update: UpdateBoilerplate;
|
|
1406
|
+
};
|
|
1242
1407
|
get channel(): {
|
|
1243
1408
|
list: ListChannels;
|
|
1244
1409
|
};
|
|
@@ -1303,4 +1468,4 @@ declare class Client {
|
|
|
1303
1468
|
};
|
|
1304
1469
|
}
|
|
1305
1470
|
|
|
1306
|
-
export { type Authentication as A, type
|
|
1471
|
+
export { type Authentication as A, type ListContactNotesResponsePayload as B, Client as C, type DeleteLabelResponsePayload as D, type ListConversationNotesResponsePayload as E, type UpdateNoteResponsePayload as F, type GetBoilerplateResponsePayload as G, type GetSourceResponsePayload as H, type ListSourcesResponsePayload as I, type ListActionsResponsePayload as L, type Options as O, type RequestFilterable as R, type UpdateBoilerplateResponsePayload as U, type Options$B as a, type CreateBoilerplateResponsePayload as b, type ListBoilerplatesResponsePayload as c, type ListChannelsResponsePayload as d, type CreateContactResponsePayload as e, type GetContactResponsePayload as f, type ListContactsResponsePayload as g, type ListLabelContactsResponsePayload as h, type UpdateContactResponsePayload as i, type GetConversationResponsePayload as j, type ListConversationsResponsePayload as k, type ListLabelConversationsResponsePayload as l, type UpdateConversationResponsePayload as m, type CreateLabelResponsePayload as n, type GetLabelResponsePayload as o, type ListLabelsResponsePayload as p, type UpdateLabelResponsePayload as q, type ListConversationMessagesResponsePayload as r, type ListMessagesResponsePayload as s, type GetModelResponsePayload as t, type ListModelsResponsePayload as u, type CreateCorrectionResponsePayload as v, type CreateResponseResponsePayload as w, type CreateContactNoteResponsePayload as x, type CreateConversationNoteResponsePayload as y, type GetNoteResponsePayload as z };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Xt=Object.create;var tt=Object.defineProperty;var Qt=Object.getOwnPropertyDescriptor;var Zt=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty;var Ht=(e,t)=>{for(var r in t)tt(e,r,{get:t[r],enumerable:!0})},Mt=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Zt(t))!ee.call(e,o)&&o!==r&&tt(e,o,{get:()=>t[o],enumerable:!(s=Qt(t,o))||s.enumerable});return e};var Gt=(e,t,r)=>(r=e!=null?Xt(te(e)):{},Mt(t||!e||!e.__esModule?tt(r,"default",{value:e,enumerable:!0}):r,e)),re=e=>Mt(tt({},"__esModule",{value:!0}),e);var se={};Ht(se,{Client:()=>m,DEFAULT_SUPPORT_BASE_URL:()=>et,Error:()=>jt,KeyAuthentication:()=>X,PublicAuthentication:()=>Z,TokenAuthentication:()=>Q,default:()=>m});module.exports=re(se);var et="https://api.support.greatdetail.com",Dt={"X-Powered-By":"GDSupport/JavaScript"},zt="api-key";var h=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"}).then(r=>new st(r))}},st=class{constructor(t){this.response=t}async result(){return this.response.json()}};var g=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"}).then(r=>new ot(r))}},ot=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Vt="SUPPORT_ACCESS_TOKEN",Bt="SUPPORT_API_KEY",kt="SUPPORT_KEY_NAME",Jt="SUPPORT_BASE_URL";var f=class{constructor(t){this._transport=t}getRelativeURL({id:t,vcf:r={}}){let s=r.variant??"vcard",o=r.format??(r.variant==="vcard"?"vcf":"json");return"v1/contacts/"+encodeURIComponent(t)+"/vcf?variant="+encodeURIComponent(s)+"&format="+encodeURIComponent(o)}getURL(t){return this._transport.getURL(this.getRelativeURL(t))}};var l=require("zod"),y=class e{constructor(t){this._transport=t}static SCHEMA=l.z.object({name:l.z.string(),account:l.z.string(),emailAddress:l.z.string().email().optional(),telephoneNumber:l.z.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 nt(s))}},nt=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 it(s))}},it=class{constructor(t){this.response=t}async result(){return this.response.json()}};var R=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"}).then(r=>new at(r))}},at=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:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...r,method:"GET"}).then(s=>new pt(s))}},pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=require("zod"),C=class e{constructor(t){this._transport=t}static SCHEMA=A.z.object({name:A.z.string().optional(),emailAddress:A.z.string().email().optional(),telephoneNumber:A.z.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(o=>new ct(o))}},ct=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:r={}}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new dt(s))}},dt=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 ut(r))}},ut=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=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 lt(s))}},lt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var mt=require("zod"),E=class e{constructor(t){this._transport=t}static SCHEMA=mt.z.object({hasEnded:mt.z.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(o=>new ht(o))}},ht=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=require("zod"),v=class e{constructor(t){this._transport=t}static SCHEMA=S.z.object({title:S.z.string(),description:S.z.string().optional(),account:S.z.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 gt(s))}},gt=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:r={}}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...r,method:"DELETE"}).then(s=>new ft(s))}},ft=class{constructor(t){this.response=t}async result(){return this.response.json()}};var w=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 yt(s))}},yt=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/labels",{...t,method:"GET"}).then(r=>new bt(r))}},bt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var rt=require("zod"),U=class e{constructor(t){this._transport=t}static SCHEMA=rt.z.object({title:rt.z.string().optional(),description:rt.z.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(o=>new Rt(o))}},Rt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var L=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 xt(s))}},xt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var I=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/messages",{...t,method:"GET"}).then(r=>new At(r))}},At=class{constructor(t){this.response=t}async result(){return this.response.json()}};var q=require("zod"),N=class e{constructor(t){this._transport=t}static SCHEMA=q.z.object({input:q.z.string().max(65536),original:q.z.string().max(65536),correction:q.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(o=>new Ct(o))}},Ct=class{constructor(t){this.response=t}async result(){return this.response.json()}};var j=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 Pt(s))}},Pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var H=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"}).then(r=>new Tt(r))}},Tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var M=require("zod"),G=class e{constructor(t){this._transport=t}static SCHEMA=M.z.array(M.z.object({role:M.z.enum(["user","assistant"]),content:M.z.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(o=>new _t(o))}},_t=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Et=require("zod"),D=class e{constructor(t){this._transport=t}static SCHEMA=Et.z.object({content:Et.z.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(o=>new St(o))}},St=class{constructor(t){this.response=t}async result(){return this.response.json()}};var vt=require("zod"),z=class e{constructor(t){this._transport=t}static SCHEMA=vt.z.object({content:vt.z.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(o=>new Ot(o))}},Ot=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/notes/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new wt(s))}},wt=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)+"/notes",{...r,method:"GET"}).then(s=>new Ft(s))}},Ft=class{constructor(t){this.response=t}async result(){return this.response.json()}};var k=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 Ut(s))}},Ut=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Lt=require("zod"),J=class e{constructor(t){this._transport=t}static SCHEMA=Lt.z.object({content:Lt.z.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(o=>new It(o))}},It=class{constructor(t){this.response=t}async result(){return this.response.json()}};var K=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Dt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var Y=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 qt(s))}},qt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var $=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"}).then(r=>new Nt(r))}},Nt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Kt=Gt(require("is-network-error"),1),Yt=Gt(require("ky"),1);var n=class extends Error{};var i=class extends n{};var p=class extends i{static unauthenticated(){return new this("An unauthenticated request occurred")}};var c=class extends i{static forbidden(){return new this("A forbidden request occurred")}};var a=class extends n{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 d=class extends n{};var u=class extends n{static badRequest(){return new this("Bad request")}};var W=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 o=s.getHeaders();for(let[$t,Wt]of Object.entries(o))r.headers.set($t,Wt)}return new Request(this.getURL(t),r)}async send(t,r){return await(0,Yt.default)(this.getRequest(t,r)).then(s=>{if(!s.ok){let o=s.status;switch(console.error(JSON.stringify(s)),o){case 400:throw u.badRequest();case 401:throw p.unauthenticated();case 403:throw c.forbidden();case 404:throw a.notFound(t);case 405:throw a.forbiddenMethod(t,r.method??"GET")}}return s}).catch(s=>{throw(0,Kt.default)(s)?new d("A network error occurred",{cause:s}):s})}};var m=class e{static DEFAULT_BASE_URL=et;_transport;constructor(t,{baseURL:r,...s}={}){this._transport=new W({requestFilterables:[new K,t],...s,baseURL:r?.toString()??e.getBaseURL()})}static getBaseURL(){return process.env[Jt]??this.DEFAULT_BASE_URL}get action(){return{list:new h(this._transport)}}get channel(){return{list:new g(this._transport)}}get contact(){return{get:new b(this._transport),list:new R(this._transport),update:new C(this._transport),create:new y(this._transport),vcf:{get:new f(this._transport)},note:{list:new B(this._transport),create:new D(this._transport)}}}get conversation(){return{get:new P(this._transport),list:new T(this._transport),update:new E(this._transport),message:{list:new L(this._transport)},note:{list:new k(this._transport),create:new z(this._transport)}}}get label(){return{create:new v(this._transport),get:new w(this._transport),list:new F(this._transport),update:new U(this._transport),delete:new O(this._transport),contact:{list:new x(this._transport)},conversation:{list:new _(this._transport)}}}get message(){return{list:new I(this._transport)}}get model(){return{get:new j(this._transport),list:new H(this._transport),response:{create:new G(this._transport)},correction:{create:new N(this._transport)}}}get note(){return{get:new V(this._transport),update:new J(this._transport)}}get source(){return{get:new Y(this._transport),list:new $(this._transport)}}};var jt={};Ht(jt,{AuthError:()=>i,AuthenticationError:()=>p,AuthorizationError:()=>c,LogicError:()=>a,NetworkError:()=>d,SupportError:()=>n,ValidationError:()=>u});var X=class e{static DEFAULT_NAME=zt;name;#t;constructor({name:t=process.env[kt]??e.DEFAULT_NAME,key:r=process.env[Bt]}={}){if(!r)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=r}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var Q=class{#t;constructor({token:t=process.env[Vt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var Z=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,Error,KeyAuthentication,PublicAuthentication,TokenAuthentication});
|
|
1
|
+
"use strict";var ae=Object.create;var ot=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var ue=Object.getPrototypeOf,de=Object.prototype.hasOwnProperty;var Yt=(e,t)=>{for(var r in t)ot(e,r,{get:t[r],enumerable:!0})},$t=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ce(t))!de.call(e,n)&&n!==r&&ot(e,n,{get:()=>t[n],enumerable:!(s=pe(t,n))||s.enumerable});return e};var Wt=(e,t,r)=>(r=e!=null?ae(ue(e)):{},$t(t||!e||!e.__esModule?ot(r,"default",{value:e,enumerable:!0}):r,e)),le=e=>$t(ot({},"__esModule",{value:!0}),e);var me={};Yt(me,{Client:()=>m,DEFAULT_SUPPORT_BASE_URL:()=>it,Error:()=>Kt,KeyAuthentication:()=>rt,PublicAuthentication:()=>nt,TokenAuthentication:()=>st,default:()=>m});module.exports=le(me);var it="https://api.support.greatdetail.com",Xt={"X-Powered-By":"GDSupport/JavaScript"},Qt="api-key";var g=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/actions",{...t,method:"GET"}).then(r=>new ct(r))}},ct=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=require("zod"),f=class e{constructor(t){this._transport=t}static SCHEMA=h.z.object({title:h.z.string(),content:h.z.string(),account:h.z.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 ut(s))}},ut=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/boilerplates/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new dt(s))}},dt=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/boilerplates",{...t,method:"GET"}).then(r=>new lt(r))}},lt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var at=require("zod"),x=class e{constructor(t){this._transport=t}static SCHEMA=at.z.object({title:at.z.string().optional(),content:at.z.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 mt(n))}},mt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var R=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/channels",{...t,method:"GET"}).then(r=>new gt(r))}},gt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Zt="SUPPORT_ACCESS_TOKEN",te="SUPPORT_API_KEY",ee="SUPPORT_KEY_NAME",re="SUPPORT_BASE_URL";var A=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))}};var l=require("zod"),T=class e{constructor(t){this._transport=t}static SCHEMA=l.z.object({name:l.z.string(),account:l.z.string(),emailAddress:l.z.string().email().optional(),telephoneNumber:l.z.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 ht(s))}},ht=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=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 ft(s))}},ft=class{constructor(t){this.response=t}async result(){return this.response.json()}};var C=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/contacts",{...t,method:"GET"}).then(r=>new bt(r))}},bt=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)+"/contacts",{...r,method:"GET"}).then(s=>new yt(s))}},yt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var P=require("zod"),O=class e{constructor(t){this._transport=t}static SCHEMA=P.z.object({name:P.z.string().optional(),emailAddress:P.z.string().email().optional(),telephoneNumber:P.z.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 xt(n))}},xt=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/conversations/"+encodeURIComponent(t),{...r,method:"GET"}).then(s=>new Rt(s))}},Rt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var w=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/conversations",{...t,method:"GET"}).then(r=>new At(r))}},At=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/labels/"+encodeURIComponent(t)+"/conversations",{...r,method:"GET"}).then(s=>new Tt(s))}},Tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _t=require("zod"),F=class e{constructor(t){this._transport=t}static SCHEMA=_t.z.object({hasEnded:_t.z.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 Ct(n))}},Ct=class{constructor(t){this.response=t}async result(){return this.response.json()}};var U=require("zod"),I=class e{constructor(t){this._transport=t}static SCHEMA=U.z.object({title:U.z.string(),description:U.z.string().optional(),account:U.z.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 Et(s))}},Et=class{constructor(t){this.response=t}async result(){return this.response.json()}};var q=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 Pt(s))}},Pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var j=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 Ot(s))}},Ot=class{constructor(t){this.response=t}async result(){return this.response.json()}};var H=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/labels",{...t,method:"GET"}).then(r=>new St(r))}},St=class{constructor(t){this.response=t}async result(){return this.response.json()}};var pt=require("zod"),L=class e{constructor(t){this._transport=t}static SCHEMA=pt.z.object({title:pt.z.string().optional(),description:pt.z.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 wt(n))}},wt=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/conversations/"+encodeURIComponent(t)+"/messages",{...r,method:"GET"}).then(s=>new vt(s))}},vt=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/messages",{...t,method:"GET"}).then(r=>new Ft(r))}},Ft=class{constructor(t){this.response=t}async result(){return this.response.json()}};var D=require("zod"),G=class e{constructor(t){this._transport=t}static SCHEMA=D.z.object({input:D.z.string().max(65536),original:D.z.string().max(65536),correction:D.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 Ut(n))}},Ut=class{constructor(t){this.response=t}async result(){return this.response.json()}};var z=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 It(s))}},It=class{constructor(t){this.response=t}async result(){return this.response.json()}};var B=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/models",{...t,method:"GET"}).then(r=>new qt(r))}},qt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var V=require("zod"),J=class e{constructor(t){this._transport=t}static SCHEMA=V.z.array(V.z.object({role:V.z.enum(["user","assistant"]),content:V.z.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 jt(n))}},jt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Ht=require("zod"),k=class e{constructor(t){this._transport=t}static SCHEMA=Ht.z.object({content:Ht.z.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 Lt(n))}},Lt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Nt=require("zod"),K=class e{constructor(t){this._transport=t}static SCHEMA=Nt.z.object({content:Nt.z.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 Mt(n))}},Mt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Y=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 Dt(s))}},Dt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var $=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 Gt(s))}},Gt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var W=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 zt(s))}},zt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Bt=require("zod"),X=class e{constructor(t){this._transport=t}static SCHEMA=Bt.z.object({content:Bt.z.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 Vt(n))}},Vt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Q=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Xt;async filter(){return{headers:this.getHeaders()}}getHeaders(){return this._standardHeaders}};var Z=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 tt=class{constructor(t){this._transport=t}async send({request:t={}}={}){return this._transport.send("v1/sources",{...t,method:"GET"}).then(r=>new kt(r))}},kt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var se=Wt(require("is-network-error"),1),ne=Wt(require("ky"),1);var o=class extends Error{};var i=class extends o{};var p=class extends i{static unauthenticated(){return new this("An unauthenticated request occurred")}};var c=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 u=class extends o{};var d=class extends o{static badRequest(){return new this("Bad request")}};var et=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[oe,ie]of Object.entries(n))r.headers.set(oe,ie)}return new Request(this.getURL(t),r)}async send(t,r){return await(0,ne.default)(this.getRequest(t,r)).then(s=>{if(!s.ok){let n=s.status;switch(console.error(JSON.stringify(s)),n){case 400:throw d.badRequest();case 401:throw p.unauthenticated();case 403:throw c.forbidden();case 404:throw a.notFound(t);case 405:throw a.forbiddenMethod(t,r.method??"GET")}}return s}).catch(s=>{throw(0,se.default)(s)?new u("A network error occurred",{cause:s}):s})}};var m=class e{static DEFAULT_BASE_URL=it;_transport;constructor(t,{baseURL:r,...s}={}){this._transport=new et({requestFilterables:[new Q,t],...s,baseURL:r?.toString()??e.getBaseURL()})}static getBaseURL(){return process.env[re]??this.DEFAULT_BASE_URL}get action(){return{list:new g(this._transport)}}get boilerplate(){return{get:new b(this._transport),list:new y(this._transport),create:new f(this._transport),update:new x(this._transport)}}get channel(){return{list:new R(this._transport)}}get contact(){return{get:new _(this._transport),list:new C(this._transport),update:new O(this._transport),create:new T(this._transport),vcf:{get:new A(this._transport)},note:{list:new $(this._transport),create:new k(this._transport)}}}get conversation(){return{get:new S(this._transport),list:new w(this._transport),update:new F(this._transport),message:{list:new N(this._transport)},note:{list:new W(this._transport),create:new K(this._transport)}}}get label(){return{create:new I(this._transport),get:new j(this._transport),list:new H(this._transport),update:new L(this._transport),delete:new q(this._transport),contact:{list:new E(this._transport)},conversation:{list:new v(this._transport)}}}get message(){return{list:new M(this._transport)}}get model(){return{get:new z(this._transport),list:new B(this._transport),response:{create:new J(this._transport)},correction:{create:new G(this._transport)}}}get note(){return{get:new Y(this._transport),update:new X(this._transport)}}get source(){return{get:new Z(this._transport),list:new tt(this._transport)}}};var Kt={};Yt(Kt,{AuthError:()=>i,AuthenticationError:()=>p,AuthorizationError:()=>c,LogicError:()=>a,NetworkError:()=>u,SupportError:()=>o,ValidationError:()=>d});var rt=class e{static DEFAULT_NAME=Qt;name;#t;constructor({name:t=process.env[ee]??e.DEFAULT_NAME,key:r=process.env[te]}={}){if(!r)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=r}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var st=class{#t;constructor({token:t=process.env[Zt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};var nt=class{async filter(){return{headers:this.getHeaders()}}getHeaders(){return{}}};0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,Error,KeyAuthentication,PublicAuthentication,TokenAuthentication});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Authentication } from './index-
|
|
2
|
-
export { C as Client,
|
|
1
|
+
import { A as Authentication } from './index-BMsEq65I.cjs';
|
|
2
|
+
export { C as Client, b as CreateBoilerplateResponsePayload, x as CreateContactNoteResponsePayload, e as CreateContactResponsePayload, y as CreateConversationNoteResponsePayload, v as CreateCorrectionResponsePayload, n as CreateLabelResponsePayload, w as CreateResponseResponsePayload, D as DeleteLabelResponsePayload, G as GetBoilerplateResponsePayload, f as GetContactResponsePayload, j as GetConversationResponsePayload, o as GetLabelResponsePayload, t as GetModelResponsePayload, z as GetNoteResponsePayload, H as GetSourceResponsePayload, L as ListActionsResponsePayload, c as ListBoilerplatesResponsePayload, d as ListChannelsResponsePayload, B as ListContactNotesResponsePayload, g as ListContactsResponsePayload, r as ListConversationMessagesResponsePayload, E as ListConversationNotesResponsePayload, k as ListConversationsResponsePayload, h as ListLabelContactsResponsePayload, l as ListLabelConversationsResponsePayload, p as ListLabelsResponsePayload, s as ListMessagesResponsePayload, u as ListModelsResponsePayload, I as ListSourcesResponsePayload, O as Options, R as RequestFilterable, a as TransportOptions, U as UpdateBoilerplateResponsePayload, i as UpdateContactResponsePayload, m as UpdateConversationResponsePayload, q as UpdateLabelResponsePayload, F as UpdateNoteResponsePayload, C as default } from './index-BMsEq65I.cjs';
|
|
3
3
|
import 'ky';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
@@ -212,4 +212,21 @@ declare class PublicAuthentication implements Authentication {
|
|
|
212
212
|
getHeaders(): {};
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
|
|
215
|
+
/**
|
|
216
|
+
* Great Detail Support System.
|
|
217
|
+
*
|
|
218
|
+
* @copyright 2024 Great Detail Ltd
|
|
219
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
220
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
221
|
+
* @see https://greatdetail.com
|
|
222
|
+
*/
|
|
223
|
+
|
|
224
|
+
type CreateContactSubscriptionResponsePayload = {
|
|
225
|
+
subscription: {
|
|
226
|
+
id: string;
|
|
227
|
+
createdAt: string;
|
|
228
|
+
updatedAt: string;
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
export { type CreateContactSubscriptionResponsePayload, DEFAULT_SUPPORT_BASE_URL, index as Error, KeyAuthentication, PublicAuthentication, TokenAuthentication };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Authentication } from './index-
|
|
2
|
-
export { C as Client,
|
|
1
|
+
import { A as Authentication } from './index-BMsEq65I.js';
|
|
2
|
+
export { C as Client, b as CreateBoilerplateResponsePayload, x as CreateContactNoteResponsePayload, e as CreateContactResponsePayload, y as CreateConversationNoteResponsePayload, v as CreateCorrectionResponsePayload, n as CreateLabelResponsePayload, w as CreateResponseResponsePayload, D as DeleteLabelResponsePayload, G as GetBoilerplateResponsePayload, f as GetContactResponsePayload, j as GetConversationResponsePayload, o as GetLabelResponsePayload, t as GetModelResponsePayload, z as GetNoteResponsePayload, H as GetSourceResponsePayload, L as ListActionsResponsePayload, c as ListBoilerplatesResponsePayload, d as ListChannelsResponsePayload, B as ListContactNotesResponsePayload, g as ListContactsResponsePayload, r as ListConversationMessagesResponsePayload, E as ListConversationNotesResponsePayload, k as ListConversationsResponsePayload, h as ListLabelContactsResponsePayload, l as ListLabelConversationsResponsePayload, p as ListLabelsResponsePayload, s as ListMessagesResponsePayload, u as ListModelsResponsePayload, I as ListSourcesResponsePayload, O as Options, R as RequestFilterable, a as TransportOptions, U as UpdateBoilerplateResponsePayload, i as UpdateContactResponsePayload, m as UpdateConversationResponsePayload, q as UpdateLabelResponsePayload, F as UpdateNoteResponsePayload, C as default } from './index-BMsEq65I.js';
|
|
3
3
|
import 'ky';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
@@ -212,4 +212,21 @@ declare class PublicAuthentication implements Authentication {
|
|
|
212
212
|
getHeaders(): {};
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
|
|
215
|
+
/**
|
|
216
|
+
* Great Detail Support System.
|
|
217
|
+
*
|
|
218
|
+
* @copyright 2024 Great Detail Ltd
|
|
219
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
220
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
221
|
+
* @see https://greatdetail.com
|
|
222
|
+
*/
|
|
223
|
+
|
|
224
|
+
type CreateContactSubscriptionResponsePayload = {
|
|
225
|
+
subscription: {
|
|
226
|
+
id: string;
|
|
227
|
+
createdAt: string;
|
|
228
|
+
updatedAt: string;
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
export { type CreateContactSubscriptionResponsePayload, DEFAULT_SUPPORT_BASE_URL, index as Error, KeyAuthentication, PublicAuthentication, TokenAuthentication };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as d,b as g,c as s,d as n,e as a,f as p,g as f,h as m,i as u,j as c,k as l,l as x,m as A,n as h,o as _}from"./chunk-KG7KNOPC.js";var E={};d(E,{AuthError:()=>m,AuthenticationError:()=>u,AuthorizationError:()=>c,LogicError:()=>l,NetworkError:()=>x,SupportError:()=>f,ValidationError:()=>A});var r=class o{static DEFAULT_NAME=s;name;#t;constructor({name:t=process.env[p]??o.DEFAULT_NAME,key:i=process.env[a]}={}){if(!i)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=i}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}};var e=class{#t;constructor({token:t=process.env[n]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async filter(){return{headers:this.getHeaders()}}getHeaders(){return{Authorization:`Bearer ${this.#t}`}}};export{h as Client,g as DEFAULT_SUPPORT_BASE_URL,E as Error,r as KeyAuthentication,_ as PublicAuthentication,e as TokenAuthentication,h as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@great-detail/support-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "JavaScript SDK for the Great Detail Support System",
|
|
6
6
|
"author": "Great Detail Ltd <info@greatdetail.com>",
|
|
@@ -61,7 +61,6 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"commander": "^12.1.0",
|
|
64
|
-
"cross-fetch": "^4.0.0",
|
|
65
64
|
"is-network-error": "^1.1.0",
|
|
66
65
|
"ky": "^1.7.2",
|
|
67
66
|
"ora": "^8.0.1",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Great Detail Support System.
|
|
3
|
+
*
|
|
4
|
+
* @copyright 2024 Great Detail Ltd
|
|
5
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
6
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
7
|
+
* @see https://greatdetail.com
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export { type ListActionsResponsePayload } from "./ListActions.js";
|
|
@@ -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
|
+
body: z.infer<typeof CreateBoilerplate.SCHEMA>;
|
|
15
|
+
request?: RequestInit;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default class CreateBoilerplate {
|
|
19
|
+
public static SCHEMA = z.object({
|
|
20
|
+
title: z.string(),
|
|
21
|
+
content: z.string(),
|
|
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/boilerplates", {
|
|
30
|
+
...request,
|
|
31
|
+
method: "POST",
|
|
32
|
+
headers: {
|
|
33
|
+
...request.headers,
|
|
34
|
+
"Content-Type": "application/json",
|
|
35
|
+
},
|
|
36
|
+
body: JSON.stringify(CreateBoilerplate.SCHEMA.parse(body)),
|
|
37
|
+
})
|
|
38
|
+
.then((response) => new CreateBoilerplateResponse(response));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type CreateBoilerplateResponsePayload = {
|
|
43
|
+
boilerplate: {
|
|
44
|
+
id: string;
|
|
45
|
+
title: string;
|
|
46
|
+
content: string;
|
|
47
|
+
account: string;
|
|
48
|
+
createdAt: string;
|
|
49
|
+
updatedAt: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export class CreateBoilerplateResponse {
|
|
54
|
+
constructor(public response: Response) {}
|
|
55
|
+
|
|
56
|
+
public async result(): Promise<CreateBoilerplateResponsePayload> {
|
|
57
|
+
return this.response.json();
|
|
58
|
+
}
|
|
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 GetBoilerplate {
|
|
18
|
+
constructor(protected _transport: FetchTransport) {}
|
|
19
|
+
|
|
20
|
+
public async send({ id, request = {} }: Options) {
|
|
21
|
+
return this._transport
|
|
22
|
+
.send("v1/boilerplates/" + encodeURIComponent(id), {
|
|
23
|
+
...request,
|
|
24
|
+
method: "GET",
|
|
25
|
+
})
|
|
26
|
+
.then((response) => new GetBoilerplateResponse(response));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type GetBoilerplateResponsePayload = {
|
|
31
|
+
boilerplate: {
|
|
32
|
+
id: string;
|
|
33
|
+
title: string;
|
|
34
|
+
content: string;
|
|
35
|
+
account: string;
|
|
36
|
+
createdAt: string;
|
|
37
|
+
updatedAt: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export class GetBoilerplateResponse {
|
|
42
|
+
constructor(public response: Response) {}
|
|
43
|
+
|
|
44
|
+
public async result(): Promise<GetBoilerplateResponsePayload> {
|
|
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 ListBoilerplates {
|
|
17
|
+
constructor(protected _transport: FetchTransport) {}
|
|
18
|
+
|
|
19
|
+
public async send({ request = {} }: Options = {}) {
|
|
20
|
+
return this._transport
|
|
21
|
+
.send("v1/boilerplates", {
|
|
22
|
+
...request,
|
|
23
|
+
method: "GET",
|
|
24
|
+
})
|
|
25
|
+
.then((response) => new ListBoilerplatesResponse(response));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type ListBoilerplatesResponsePayload = {
|
|
30
|
+
boilerplates: {
|
|
31
|
+
id: string;
|
|
32
|
+
title: string;
|
|
33
|
+
content: string;
|
|
34
|
+
account: string;
|
|
35
|
+
createdAt: string;
|
|
36
|
+
updatedAt: string;
|
|
37
|
+
}[];
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export class ListBoilerplatesResponse {
|
|
41
|
+
constructor(public response: Response) {}
|
|
42
|
+
|
|
43
|
+
public async result(): Promise<ListBoilerplatesResponsePayload> {
|
|
44
|
+
return this.response.json();
|
|
45
|
+
}
|
|
46
|
+
}
|