@great-detail/support-sdk 0.1.3 → 0.1.5
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-2LKRKCHH.js +1 -0
- package/dist/{chunk-XHFS4EBE.js → chunk-PTKKI5PQ.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-DqEBKPNI.d.cts → index-Dm8jdpkD.d.cts} +31 -9
- package/dist/{index-DqEBKPNI.d.ts → index-Dm8jdpkD.d.ts} +31 -9
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/Client/index.ts +4 -0
- package/src/Contact/ContactVCF/GetContactVCF.ts +24 -0
- package/src/Contact/ListLabelContacts.ts +1 -1
- package/src/Transport/index.ts +5 -4
- package/dist/chunk-5MVQFIMQ.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var ut="https://api.support.greatdetail.com",lt={"X-Powered-By":"GDSupport/JavaScript"},gt="api-key",ht="SUPPORT_ACCESS_TOKEN",bt="SUPPORT_API_KEY",yt="SUPPORT_KEY_NAME";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 M(n))}},M=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 D(n))}},D=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as a}from"zod";var c=class e{constructor(t){this._transport=t}static SCHEMA=a.object({name:a.string(),account:a.string(),emailAddress:a.string().email().optional(),telephoneNumber:a.string().optional()});async send({body:t,request:s={},...n}){return this._transport.send("v1/contacts",{...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 d=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 z(r))}},z=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/contacts",{...t,method:"GET"},s).then(n=>new F(n))}},F=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:s={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...s,method:"GET"},n).then(r=>new B(r))}},B=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as L}from"zod";var m=class e{constructor(t){this._transport=t}static SCHEMA=L.object({name:L.string().optional(),emailAddress:L.string().email().optional(),telephoneNumber:L.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 J(o))}},J=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:s={},...n}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new K(r))}},K=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/conversations",{...t,method:"GET"},s).then(n=>new V(n))}},V=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:s={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...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 mt}from"zod";var y=class e{constructor(t){this._transport=t}static SCHEMA=mt.object({hasEnded:mt.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 k(o))}},k=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as j}from"zod";var f=class e{constructor(t){this._transport=t}static SCHEMA=j.object({title:j.string(),description:j.string().optional(),account:j.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 W(r))}},W=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:s={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"DELETE"},n).then(r=>new X(r))}},X=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),{...s,method:"GET"},n).then(r=>new Q(r))}},Q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=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()}};import{z as $}from"zod";var O=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 A=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 _=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/messages",{...t,method:"GET"},s).then(n=>new st(n))}},st=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as H}from"zod";var T=class e{constructor(t){this._transport=t}static SCHEMA=H.object({input:H.string().max(65536),original:H.string().max(65536),correction:H.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 nt(o))}},nt=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/models/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new rt(r))}},rt=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/models",{...t,method:"GET"},s).then(n=>new ot(n))}},ot=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as N}from"zod";var E=class e{constructor(t){this._transport=t}static SCHEMA=N.array(N.object({role:N.enum(["user","assistant"]),content:N.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 it(o))}},it=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:s={},...n}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new pt(r))}},pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var w=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/sources",{...t,method:"GET"},s).then(n=>new at(n))}},at=class{constructor(t){this.response=t}async result(){return this.response.json()}};var U=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}getURL(t){return new URL(t,this.options.baseURL)}async send(t,s,{fetch:n=fetch}={}){return await n(new Request(this.getURL(t),await this._filterRequest(s)))}};var q=class{constructor(t){this._transport=t}async send({id:t}){return this._transport.getURL("v1/contacts/"+encodeURIComponent(t)+"/vcf")}};var I=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=lt;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var ct=class e{static DEFAULT_BASE_URL=ut;_transport;constructor(t,{baseURL:s,...n}={}){this._transport=new U({requestFilterables:[new I,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 d(this._transport),list:new u(this._transport),update:new m(this._transport),create:new c(this._transport),vcf:{getURL:new q(this._transport)}}}get conversation(){return{get:new g(this._transport),list:new h(this._transport),update:new y(this._transport),message:{list:new A(this._transport)}}}get label(){return{create:new f(this._transport),get:new x(this._transport),list:new S(this._transport),update:new O(this._transport),delete:new R(this._transport),contact:{list:new l(this._transport)},conversation:{list:new b(this._transport)}}}get message(){return{list:new _(this._transport)}}get model(){return{get:new C(this._transport),list:new P(this._transport),response:{create:new E(this._transport)},correction:{create:new T(this._transport)}}}get source(){return{get:new v(this._transport),list:new w(this._transport)}}};var dt=class{async filter(t){return t}};export{ut as a,gt as b,ht as c,bt as d,yt as e,ct as f,dt as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as y,g as F}from"./chunk-
|
|
1
|
+
import{f as y,g as F}from"./chunk-2LKRKCHH.js";import{Command as A}from"commander";import{Command as b}from"commander";import{oraPromise as I}from"ora";function m({client:n,ora:s}){let o=new b("actions").description("Actions");return o.addCommand(new b("list").description("List actions").action(async()=>{let t=await I(()=>n.action.list.send(),{...s,text:"Finding actions"});console.log(await t.result())})),o}import{Command as v}from"commander";import{oraPromise as S}from"ora";function r({client:n,ora:s}){let o=new v("channels").description("Channels");return o.addCommand(new v("list").description("List channels").action(async()=>{let t=await S(()=>n.channel.list.send(),{...s,text:"Finding channels"});console.log(await t.result())})),o}import{Command as d}from"commander";import{oraPromise as L}from"ora";function c({client:n,ora:s}){let o=new d("contacts").description("Contacts");return o.addCommand(new d("get").description("Find contact").argument("<contact>","Contact ID").action(async t=>{let e=await L(()=>n.contact.get.send({id:t}),{...s,text:"Finding contact"});console.log(await e.result())})),o.addCommand(new d("list").description("List contacts").action(async()=>{let t=await L(()=>n.contact.list.send(),{...s,text:"Finding contacts"});console.log(await t.result())})),o}import{Command as p}from"commander";import{oraPromise as P}from"ora";function l({client:n,ora:s}){let o=new p("conversations").description("Conversations");return o.addCommand(new p("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async t=>{let e=await P(()=>n.conversation.get.send({id:t}),{...s,text:"Finding conversation"});console.log(await e.result())})),o.addCommand(new p("list").description("List conversations").action(async()=>{let t=await P(()=>n.conversation.list.send(),{...s,text:"Finding conversations"});console.log(await t.result())})),o}import{Command as a}from"commander";import{oraPromise as u}from"ora";function f({client:n,ora:s}){let o=new a("labels").description("Labels");return o.addCommand(new a("get").description("Find label").argument("<label>","Label ID").action(async t=>{let e=await u(()=>n.label.get.send({id:t}),{...s,text:"Finding label"});console.log(await e.result())})),o.addCommand(new a("list").description("List labels").action(async()=>{let t=await u(()=>n.label.list.send(),{...s,text:"Finding labels"});console.log(await t.result())})),o.addCommand(new a("conversations").description("Find label conversations").argument("<label>","Label ID").action(async t=>{let e=await u(()=>n.label.conversation.list.send({id:t}),{...s,text:"Finding conversations"});console.log(await e.result())})),o}import{Command as h}from"commander";import{oraPromise as M}from"ora";function C({client:n,ora:s}){let o=new h("messages").description("Messages");return o.addCommand(new h("list").description("List messages").action(async()=>{let t=await M(()=>n.message.list.send(),{...s,text:"Finding messages"});console.log(await t.result())})),o}import{Command as g}from"commander";import{oraPromise as j}from"ora";function w({client:n,ora:s}){let o=new g("models").description("Models");return o.addCommand(new g("get").description("Find model").argument("<model>","Model ID").action(async t=>{let e=await j(()=>n.model.get.send({id:t}),{...s,text:"Finding model"});console.log(await e.result())})),o.addCommand(new g("list").description("List models").action(async()=>{let t=await j(()=>n.model.list.send(),{...s,text:"Finding models"});console.log(await t.result())})),o}import{Command as O}from"commander";import{oraPromise as D}from"ora";function x({client:n,ora:s}){let o=new O("sources").description("Sources");return o.addCommand(new O("get").description("Find source").argument("<source>","Source ID").action(async t=>{let e=await D(()=>n.source.get.send({id:t}),{...s,text:"Finding source"});console.log(await e.result())})),o.addCommand(new O("list").description("List sources").action(async()=>{let t=await D(()=>n.source.list.send(),{...s,text:"Finding sources"});console.log(await t.result())})),o}var i={ora:{spinner:"simpleDotsScrolling"},client:new y(new F)},G=new A("gds").description("Great Detail Support System").addCommand(m(i)).addCommand(r(i)).addCommand(c(i)).addCommand(l(i)).addCommand(f(i)).addCommand(C(i)).addCommand(w(i)).addCommand(x(i)),go=G;export{go as a};
|
package/dist/cli/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Y=Object.defineProperty;var Nt=Object.getOwnPropertyDescriptor;var Gt=Object.getOwnPropertyNames;var zt=Object.prototype.hasOwnProperty;var Bt=(s,t)=>{for(var e in t)Y(s,e,{get:t[e],enumerable:!0})},Jt=(s,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Gt(t))!zt.call(s,o)&&o!==e&&Y(s,o,{get:()=>t[o],enumerable:!(n=Nt(t,o))||n.enumerable});return s};var Kt=s=>Jt(Y({},"__esModule",{value:!0}),s);var kt={};Bt(kt,{default:()=>Yt});module.exports=Kt(kt);var Mt=require("commander");var p=class{async filter(t){return t}};var c=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/actions",{...t,method:"GET"},e).then(n=>new k(n))}},k=class{constructor(t){this.response=t}async result(){return this.response.json()}};var d=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/channels",{...t,method:"GET"},e).then(n=>new W(n))}},W=class{constructor(t){this.response=t}async result(){return this.response.json()}};var jt="https://api.support.greatdetail.com",Ut={"X-Powered-By":"GDSupport/JavaScript"};var a=require("zod"),l=class s{constructor(t){this._transport=t}static SCHEMA=a.z.object({name:a.z.string(),account:a.z.string(),emailAddress:a.z.string().email().optional(),telephoneNumber:a.z.string().optional()});async send({body:t,request:e={},...n}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(t))},n).then(o=>new X(o))}},X=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._transport=t}async send({id:t,request:e={},...n}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new Q(o))}},Q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var m=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/contacts",{...t,method:"GET"},e).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({id:t,request:e={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"},n).then(o=>new $(o))}},$=class{constructor(t){this.response=t}async result(){return this.response.json()}};var f=require("zod"),y=class s{constructor(t){this._transport=t}static SCHEMA=f.z.object({name:f.z.string().optional(),emailAddress:f.z.string().email().optional(),telephoneNumber:f.z.string().optional()});async send({id:t,body:e,request:n={},...o}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(e))},o).then(r=>new tt(r))}},tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=class{constructor(t){this._transport=t}async send({id:t,request:e={},...n}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new et(o))}},et=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/conversations",{...t,method:"GET"},e).then(n=>new st(n))}},st=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:e={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"},n).then(o=>new nt(o))}},nt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var ot=require("zod"),O=class s{constructor(t){this._transport=t}static SCHEMA=ot.z.object({hasEnded:ot.z.boolean()});async send({id:t,body:e,request:n={},...o}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(e))},o).then(r=>new rt(r))}},rt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var C=require("zod"),S=class s{constructor(t){this._transport=t}static SCHEMA=C.z.object({title:C.z.string(),description:C.z.string().optional(),account:C.z.string()});async send({body:t,request:e={},...n}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(t))},n).then(o=>new it(o))}},it=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:e={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"},n).then(o=>new at(o))}},at=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:e={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new pt(o))}},pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/labels",{...t,method:"GET"},e).then(n=>new ct(n))}},ct=class{constructor(t){this.response=t}async result(){return this.response.json()}};var G=require("zod"),P=class s{constructor(t){this._transport=t}static SCHEMA=G.z.object({title:G.z.string().optional(),description:G.z.string().optional()});async send({id:t,body:e,request:n={},...o}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(e))},o).then(r=>new dt(r))}},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:e={},...n}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"},n).then(o=>new lt(o))}},lt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var T=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/messages",{...t,method:"GET"},e).then(n=>new ut(n))}},ut=class{constructor(t){this.response=t}async result(){return this.response.json()}};var v=require("zod"),E=class s{constructor(t){this._transport=t}static SCHEMA=v.z.object({input:v.z.string().max(65536),original:v.z.string().max(65536),correction:v.z.string().max(65536)});async send({id:t,body:e,request:n={},...o}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(e))},o).then(r=>new mt(r))}},mt=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:e={},...n}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new gt(o))}},gt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var q=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/models",{...t,method:"GET"},e).then(n=>new ft(n))}},ft=class{constructor(t){this.response=t}async result(){return this.response.json()}};var L=require("zod"),j=class s{constructor(t){this._transport=t}static SCHEMA=L.z.array(L.z.object({role:L.z.enum(["user","assistant"]),content:L.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:n={},...o}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(e))},o).then(r=>new yt(r))}},yt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var U=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Ut;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var D=class{constructor(t){this._transport=t}async send({id:t,request:e={},...n}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new ht(o))}},ht=class{constructor(t){this.response=t}async result(){return this.response.json()}};var F=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/sources",{...t,method:"GET"},e).then(n=>new bt(n))}},bt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var H=class{options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t}}async _filterRequest(t){for(let e of this.options.requestFilterables)t=await e.filter(t);return t}async send(t,e,{fetch:n=fetch}={}){return await n(new Request(new URL(t,this.options.baseURL),await this._filterRequest(e)))}};var M=class s{static DEFAULT_BASE_URL=jt;_transport;constructor(t,{baseURL:e,...n}={}){this._transport=new H({requestFilterables:[new U,t],...n,baseURL:e?.toString()??s.getBaseURL()})}static getBaseURL(){return process.env.SUPPORT_BASE_URL??this.DEFAULT_BASE_URL}get action(){return{list:new c(this._transport)}}get channel(){return{list:new d(this._transport)}}get contact(){return{get:new u(this._transport),list:new m(this._transport),update:new y(this._transport),create:new l(this._transport)}}get conversation(){return{get:new h(this._transport),list:new b(this._transport),update:new O(this._transport),message:{list:new _(this._transport)}}}get label(){return{create:new S(this._transport),get:new w(this._transport),list:new A(this._transport),update:new P(this._transport),delete:new R(this._transport),contact:{list:new g(this._transport)},conversation:{list:new x(this._transport)}}}get message(){return{list:new T(this._transport)}}get model(){return{get:new I(this._transport),list:new q(this._transport),response:{create:new j(this._transport)},correction:{create:new E(this._transport)}}}get source(){return{get:new D(this._transport),list:new F(this._transport)}}};var xt=require("commander"),Dt=require("ora");function Ot({client:s,ora:t}){let e=new xt.Command("actions").description("Actions");return e.addCommand(new xt.Command("list").description("List actions").action(async()=>{let n=await(0,Dt.oraPromise)(()=>s.action.list.send(),{...t,text:"Finding actions"});console.log(await n.result())})),e}var Ct=require("commander"),Ft=require("ora");function St({client:s,ora:t}){let e=new Ct.Command("channels").description("Channels");return e.addCommand(new Ct.Command("list").description("List channels").action(async()=>{let n=await(0,Ft.oraPromise)(()=>s.channel.list.send(),{...t,text:"Finding channels"});console.log(await n.result())})),e}var z=require("commander"),Rt=require("ora");function wt({client:s,ora:t}){let e=new z.Command("contacts").description("Contacts");return e.addCommand(new z.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let o=await(0,Rt.oraPromise)(()=>s.contact.get.send({id:n}),{...t,text:"Finding contact"});console.log(await o.result())})),e.addCommand(new z.Command("list").description("List contacts").action(async()=>{let n=await(0,Rt.oraPromise)(()=>s.contact.list.send(),{...t,text:"Finding contacts"});console.log(await n.result())})),e}var B=require("commander"),At=require("ora");function Pt({client:s,ora:t}){let e=new B.Command("conversations").description("Conversations");return e.addCommand(new B.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let o=await(0,At.oraPromise)(()=>s.conversation.get.send({id:n}),{...t,text:"Finding conversation"});console.log(await o.result())})),e.addCommand(new B.Command("list").description("List conversations").action(async()=>{let n=await(0,At.oraPromise)(()=>s.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await n.result())})),e}var N=require("commander"),J=require("ora");function _t({client:s,ora:t}){let e=new N.Command("labels").description("Labels");return e.addCommand(new N.Command("get").description("Find label").argument("<label>","Label ID").action(async n=>{let o=await(0,J.oraPromise)(()=>s.label.get.send({id:n}),{...t,text:"Finding label"});console.log(await o.result())})),e.addCommand(new N.Command("list").description("List labels").action(async()=>{let n=await(0,J.oraPromise)(()=>s.label.list.send(),{...t,text:"Finding labels"});console.log(await n.result())})),e.addCommand(new N.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let o=await(0,J.oraPromise)(()=>s.label.conversation.list.send({id:n}),{...t,text:"Finding conversations"});console.log(await o.result())})),e}var Tt=require("commander"),Ht=require("ora");function vt({client:s,ora:t}){let e=new Tt.Command("messages").description("Messages");return e.addCommand(new Tt.Command("list").description("List messages").action(async()=>{let n=await(0,Ht.oraPromise)(()=>s.message.list.send(),{...t,text:"Finding messages"});console.log(await n.result())})),e}var K=require("commander"),Et=require("ora");function It({client:s,ora:t}){let e=new K.Command("models").description("Models");return e.addCommand(new K.Command("get").description("Find model").argument("<model>","Model ID").action(async n=>{let o=await(0,Et.oraPromise)(()=>s.model.get.send({id:n}),{...t,text:"Finding model"});console.log(await o.result())})),e.addCommand(new K.Command("list").description("List models").action(async()=>{let n=await(0,Et.oraPromise)(()=>s.model.list.send(),{...t,text:"Finding models"});console.log(await n.result())})),e}var V=require("commander"),qt=require("ora");function Lt({client:s,ora:t}){let e=new V.Command("sources").description("Sources");return e.addCommand(new V.Command("get").description("Find source").argument("<source>","Source ID").action(async n=>{let o=await(0,qt.oraPromise)(()=>s.source.get.send({id:n}),{...t,text:"Finding source"});console.log(await o.result())})),e.addCommand(new V.Command("list").description("List sources").action(async()=>{let n=await(0,qt.oraPromise)(()=>s.source.list.send(),{...t,text:"Finding sources"});console.log(await n.result())})),e}var i={ora:{spinner:"simpleDotsScrolling"},client:new M(new p)},Vt=new Mt.Command("gds").description("Great Detail Support System").addCommand(Ot(i)).addCommand(St(i)).addCommand(wt(i)).addCommand(Pt(i)).addCommand(_t(i)).addCommand(vt(i)).addCommand(It(i)).addCommand(Lt(i)),Yt=Vt;
|
|
1
|
+
"use strict";var k=Object.defineProperty;var Gt=Object.getOwnPropertyDescriptor;var zt=Object.getOwnPropertyNames;var Bt=Object.prototype.hasOwnProperty;var Jt=(s,t)=>{for(var e in t)k(s,e,{get:t[e],enumerable:!0})},Kt=(s,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of zt(t))!Bt.call(s,o)&&o!==e&&k(s,o,{get:()=>t[o],enumerable:!(n=Gt(t,o))||n.enumerable});return s};var Vt=s=>Kt(k({},"__esModule",{value:!0}),s);var Wt={};Jt(Wt,{default:()=>kt});module.exports=Vt(Wt);var Nt=require("commander");var p=class{async filter(t){return t}};var c=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/actions",{...t,method:"GET"},e).then(n=>new W(n))}},W=class{constructor(t){this.response=t}async result(){return this.response.json()}};var d=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/channels",{...t,method:"GET"},e).then(n=>new X(n))}},X=class{constructor(t){this.response=t}async result(){return this.response.json()}};var jt="https://api.support.greatdetail.com",Dt={"X-Powered-By":"GDSupport/JavaScript"};var l=class{constructor(t){this._transport=t}async send({id:t}){return this._transport.getURL("v1/contacts/"+encodeURIComponent(t)+"/vcf")}};var a=require("zod"),u=class s{constructor(t){this._transport=t}static SCHEMA=a.z.object({name:a.z.string(),account:a.z.string(),emailAddress:a.z.string().email().optional(),telephoneNumber:a.z.string().optional()});async send({body:t,request:e={},...n}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(t))},n).then(o=>new Q(o))}},Q=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:e={},...n}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new Z(o))}},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={},...e}={}){return this._transport.send("v1/contacts",{...t,method:"GET"},e).then(n=>new $(n))}},$=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:e={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"},n).then(o=>new tt(o))}},tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var y=require("zod"),h=class s{constructor(t){this._transport=t}static SCHEMA=y.z.object({name:y.z.string().optional(),emailAddress:y.z.string().email().optional(),telephoneNumber:y.z.string().optional()});async send({id:t,body:e,request:n={},...o}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(e))},o).then(r=>new et(r))}},et=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:e={},...n}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new st(o))}},st=class{constructor(t){this.response=t}async result(){return this.response.json()}};var x=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/conversations",{...t,method:"GET"},e).then(n=>new nt(n))}},nt=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:e={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"},n).then(o=>new ot(o))}},ot=class{constructor(t){this.response=t}async result(){return this.response.json()}};var rt=require("zod"),C=class s{constructor(t){this._transport=t}static SCHEMA=rt.z.object({hasEnded:rt.z.boolean()});async send({id:t,body:e,request:n={},...o}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(e))},o).then(r=>new it(r))}},it=class{constructor(t){this.response=t}async result(){return this.response.json()}};var R=require("zod"),S=class s{constructor(t){this._transport=t}static SCHEMA=R.z.object({title:R.z.string(),description:R.z.string().optional(),account:R.z.string()});async send({body:t,request:e={},...n}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(t))},n).then(o=>new at(o))}},at=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:e={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"},n).then(o=>new pt(o))}},pt=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:e={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new ct(o))}},ct=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/labels",{...t,method:"GET"},e).then(n=>new dt(n))}},dt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var z=require("zod"),T=class s{constructor(t){this._transport=t}static SCHEMA=z.z.object({title:z.z.string().optional(),description:z.z.string().optional()});async send({id:t,body:e,request:n={},...o}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...n,method:"PATCH",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(e))},o).then(r=>new lt(r))}},lt=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:e={},...n}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"},n).then(o=>new ut(o))}},ut=class{constructor(t){this.response=t}async result(){return this.response.json()}};var v=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/messages",{...t,method:"GET"},e).then(n=>new mt(n))}},mt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var E=require("zod"),I=class s{constructor(t){this._transport=t}static SCHEMA=E.z.object({input:E.z.string().max(65536),original:E.z.string().max(65536),correction:E.z.string().max(65536)});async send({id:t,body:e,request:n={},...o}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(e))},o).then(r=>new gt(r))}},gt=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:e={},...n}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new ft(o))}},ft=class{constructor(t){this.response=t}async result(){return this.response.json()}};var U=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/models",{...t,method:"GET"},e).then(n=>new yt(n))}},yt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var q=require("zod"),j=class s{constructor(t){this._transport=t}static SCHEMA=q.z.array(q.z.object({role:q.z.enum(["user","assistant"]),content:q.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:n={},...o}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...n,method:"POST",headers:{...n.headers,"Content-Type":"application/json"},body:JSON.stringify(s.SCHEMA.parse(e))},o).then(r=>new ht(r))}},ht=class{constructor(t){this.response=t}async result(){return this.response.json()}};var D=class s{constructor(t=s.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=Dt;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var F=class{constructor(t){this._transport=t}async send({id:t,request:e={},...n}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"},n).then(o=>new bt(o))}},bt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var H=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/sources",{...t,method:"GET"},e).then(n=>new xt(n))}},xt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var M=class{options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t}}async _filterRequest(t){for(let e of this.options.requestFilterables)t=await e.filter(t);return t}getURL(t){return new URL(t,this.options.baseURL)}async send(t,e,{fetch:n=fetch}={}){return await n(new Request(this.getURL(t),await this._filterRequest(e)))}};var N=class s{static DEFAULT_BASE_URL=jt;_transport;constructor(t,{baseURL:e,...n}={}){this._transport=new M({requestFilterables:[new D,t],...n,baseURL:e?.toString()??s.getBaseURL()})}static getBaseURL(){return process.env.SUPPORT_BASE_URL??this.DEFAULT_BASE_URL}get action(){return{list:new c(this._transport)}}get channel(){return{list:new d(this._transport)}}get contact(){return{get:new m(this._transport),list:new g(this._transport),update:new h(this._transport),create:new u(this._transport),vcf:{getURL:new l(this._transport)}}}get conversation(){return{get:new b(this._transport),list:new x(this._transport),update:new C(this._transport),message:{list:new P(this._transport)}}}get label(){return{create:new S(this._transport),get:new A(this._transport),list:new _(this._transport),update:new T(this._transport),delete:new w(this._transport),contact:{list:new f(this._transport)},conversation:{list:new O(this._transport)}}}get message(){return{list:new v(this._transport)}}get model(){return{get:new L(this._transport),list:new U(this._transport),response:{create:new j(this._transport)},correction:{create:new I(this._transport)}}}get source(){return{get:new F(this._transport),list:new H(this._transport)}}};var Ot=require("commander"),Ft=require("ora");function Ct({client:s,ora:t}){let e=new Ot.Command("actions").description("Actions");return e.addCommand(new Ot.Command("list").description("List actions").action(async()=>{let n=await(0,Ft.oraPromise)(()=>s.action.list.send(),{...t,text:"Finding actions"});console.log(await n.result())})),e}var Rt=require("commander"),Ht=require("ora");function St({client:s,ora:t}){let e=new Rt.Command("channels").description("Channels");return e.addCommand(new Rt.Command("list").description("List channels").action(async()=>{let n=await(0,Ht.oraPromise)(()=>s.channel.list.send(),{...t,text:"Finding channels"});console.log(await n.result())})),e}var B=require("commander"),wt=require("ora");function At({client:s,ora:t}){let e=new B.Command("contacts").description("Contacts");return e.addCommand(new B.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async n=>{let o=await(0,wt.oraPromise)(()=>s.contact.get.send({id:n}),{...t,text:"Finding contact"});console.log(await o.result())})),e.addCommand(new B.Command("list").description("List contacts").action(async()=>{let n=await(0,wt.oraPromise)(()=>s.contact.list.send(),{...t,text:"Finding contacts"});console.log(await n.result())})),e}var J=require("commander"),_t=require("ora");function Tt({client:s,ora:t}){let e=new J.Command("conversations").description("Conversations");return e.addCommand(new J.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async n=>{let o=await(0,_t.oraPromise)(()=>s.conversation.get.send({id:n}),{...t,text:"Finding conversation"});console.log(await o.result())})),e.addCommand(new J.Command("list").description("List conversations").action(async()=>{let n=await(0,_t.oraPromise)(()=>s.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await n.result())})),e}var G=require("commander"),K=require("ora");function Pt({client:s,ora:t}){let e=new G.Command("labels").description("Labels");return e.addCommand(new G.Command("get").description("Find label").argument("<label>","Label ID").action(async n=>{let o=await(0,K.oraPromise)(()=>s.label.get.send({id:n}),{...t,text:"Finding label"});console.log(await o.result())})),e.addCommand(new G.Command("list").description("List labels").action(async()=>{let n=await(0,K.oraPromise)(()=>s.label.list.send(),{...t,text:"Finding labels"});console.log(await n.result())})),e.addCommand(new G.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async n=>{let o=await(0,K.oraPromise)(()=>s.label.conversation.list.send({id:n}),{...t,text:"Finding conversations"});console.log(await o.result())})),e}var vt=require("commander"),Mt=require("ora");function Et({client:s,ora:t}){let e=new vt.Command("messages").description("Messages");return e.addCommand(new vt.Command("list").description("List messages").action(async()=>{let n=await(0,Mt.oraPromise)(()=>s.message.list.send(),{...t,text:"Finding messages"});console.log(await n.result())})),e}var V=require("commander"),It=require("ora");function Lt({client:s,ora:t}){let e=new V.Command("models").description("Models");return e.addCommand(new V.Command("get").description("Find model").argument("<model>","Model ID").action(async n=>{let o=await(0,It.oraPromise)(()=>s.model.get.send({id:n}),{...t,text:"Finding model"});console.log(await o.result())})),e.addCommand(new V.Command("list").description("List models").action(async()=>{let n=await(0,It.oraPromise)(()=>s.model.list.send(),{...t,text:"Finding models"});console.log(await n.result())})),e}var Y=require("commander"),Ut=require("ora");function qt({client:s,ora:t}){let e=new Y.Command("sources").description("Sources");return e.addCommand(new Y.Command("get").description("Find source").argument("<source>","Source ID").action(async n=>{let o=await(0,Ut.oraPromise)(()=>s.source.get.send({id:n}),{...t,text:"Finding source"});console.log(await o.result())})),e.addCommand(new Y.Command("list").description("List sources").action(async()=>{let n=await(0,Ut.oraPromise)(()=>s.source.list.send(),{...t,text:"Finding sources"});console.log(await n.result())})),e}var i={ora:{spinner:"simpleDotsScrolling"},client:new N(new p)},Yt=new Nt.Command("gds").description("Great Detail Support System").addCommand(Ct(i)).addCommand(St(i)).addCommand(At(i)).addCommand(Tt(i)).addCommand(Pt(i)).addCommand(Et(i)).addCommand(Lt(i)).addCommand(qt(i)),kt=Yt;
|
package/dist/cli/index.d.cts
CHANGED
package/dist/cli/index.d.ts
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-PTKKI5PQ.js";import"../chunk-2LKRKCHH.js";export{a as default};
|
package/dist/cli.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var Ht=require("commander");var p=class{async filter(t){return t}};var c=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/actions",{...t,method:"GET"},e).then(s=>new Y(s))}},Y=class{constructor(t){this.response=t}async result(){return this.response.json()}};var d=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/channels",{...t,method:"GET"},e).then(s=>new k(s))}},k=class{constructor(t){this.response=t}async result(){return this.response.json()}};var Lt="https://api.support.greatdetail.com",jt={"X-Powered-By":"GDSupport/JavaScript"};var a=require("zod"),l=class n{constructor(t){this._transport=t}static SCHEMA=a.z.object({name:a.z.string(),account:a.z.string(),emailAddress:a.z.string().email().optional(),telephoneNumber:a.z.string().optional()});async send({body:t,request:e={},...s}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))},s).then(o=>new W(o))}},W=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=class{constructor(t){this._transport=t}async send({id:t,request:e={},...s}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new X(o))}},X=class{constructor(t){this.response=t}async result(){return this.response.json()}};var m=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/contacts",{...t,method:"GET"},e).then(s=>new Q(s))}},Q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var g=class{constructor(t){this._transport=t}async({id:t,request:e={},...s}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"},s).then(o=>new Z(o))}},Z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var f=require("zod"),y=class n{constructor(t){this._transport=t}static SCHEMA=f.z.object({name:f.z.string().optional(),emailAddress:f.z.string().email().optional(),telephoneNumber:f.z.string().optional()});async send({id:t,body:e,request:s={},...o}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},o).then(r=>new $(r))}},$=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=class{constructor(t){this._transport=t}async send({id:t,request:e={},...s}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new tt(o))}},tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/conversations",{...t,method:"GET"},e).then(s=>new et(s))}},et=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:e={},...s}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"},s).then(o=>new st(o))}},st=class{constructor(t){this.response=t}async result(){return this.response.json()}};var nt=require("zod"),O=class n{constructor(t){this._transport=t}static SCHEMA=nt.z.object({hasEnded:nt.z.boolean()});async send({id:t,body:e,request:s={},...o}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},o).then(r=>new ot(r))}},ot=class{constructor(t){this.response=t}async result(){return this.response.json()}};var C=require("zod"),S=class n{constructor(t){this._transport=t}static SCHEMA=C.z.object({title:C.z.string(),description:C.z.string().optional(),account:C.z.string()});async send({body:t,request:e={},...s}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))},s).then(o=>new rt(o))}},rt=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:e={},...s}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"},s).then(o=>new it(o))}},it=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:e={},...s}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new at(o))}},at=class{constructor(t){this.response=t}async result(){return this.response.json()}};var w=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/labels",{...t,method:"GET"},e).then(s=>new pt(s))}},pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var G=require("zod"),P=class n{constructor(t){this._transport=t}static SCHEMA=G.z.object({title:G.z.string().optional(),description:G.z.string().optional()});async send({id:t,body:e,request:s={},...o}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},o).then(r=>new ct(r))}},ct=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=class{constructor(t){this._transport=t}async send({id:t,request:e={},...s}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"},s).then(o=>new dt(o))}},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={},...e}={}){return this._transport.send("v1/messages",{...t,method:"GET"},e).then(s=>new lt(s))}},lt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var v=require("zod"),E=class n{constructor(t){this._transport=t}static SCHEMA=v.z.object({input:v.z.string().max(65536),original:v.z.string().max(65536),correction:v.z.string().max(65536)});async send({id:t,body:e,request:s={},...o}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},o).then(r=>new ut(r))}},ut=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:e={},...s}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new mt(o))}},mt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var q=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/models",{...t,method:"GET"},e).then(s=>new gt(s))}},gt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var L=require("zod"),j=class n{constructor(t){this._transport=t}static SCHEMA=L.z.array(L.z.object({role:L.z.enum(["user","assistant"]),content:L.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:s={},...o}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},o).then(r=>new ft(r))}},ft=class{constructor(t){this.response=t}async result(){return this.response.json()}};var U=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=jt;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var D=class{constructor(t){this._transport=t}async send({id:t,request:e={},...s}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new yt(o))}},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={},...e}={}){return this._transport.send("v1/sources",{...t,method:"GET"},e).then(s=>new ht(s))}},ht=class{constructor(t){this.response=t}async result(){return this.response.json()}};var H=class{options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t}}async _filterRequest(t){for(let e of this.options.requestFilterables)t=await e.filter(t);return t}async send(t,e,{fetch:s=fetch}={}){return await s(new Request(new URL(t,this.options.baseURL),await this._filterRequest(e)))}};var M=class n{static DEFAULT_BASE_URL=Lt;_transport;constructor(t,{baseURL:e,...s}={}){this._transport=new H({requestFilterables:[new U,t],...s,baseURL:e?.toString()??n.getBaseURL()})}static getBaseURL(){return process.env.SUPPORT_BASE_URL??this.DEFAULT_BASE_URL}get action(){return{list:new c(this._transport)}}get channel(){return{list:new d(this._transport)}}get contact(){return{get:new u(this._transport),list:new m(this._transport),update:new y(this._transport),create:new l(this._transport)}}get conversation(){return{get:new h(this._transport),list:new b(this._transport),update:new O(this._transport),message:{list:new _(this._transport)}}}get label(){return{create:new S(this._transport),get:new A(this._transport),list:new w(this._transport),update:new P(this._transport),delete:new R(this._transport),contact:{list:new g(this._transport)},conversation:{list:new x(this._transport)}}}get message(){return{list:new T(this._transport)}}get model(){return{get:new I(this._transport),list:new q(this._transport),response:{create:new j(this._transport)},correction:{create:new E(this._transport)}}}get source(){return{get:new D(this._transport),list:new F(this._transport)}}};var bt=require("commander"),Ut=require("ora");function xt({client:n,ora:t}){let e=new bt.Command("actions").description("Actions");return e.addCommand(new bt.Command("list").description("List actions").action(async()=>{let s=await(0,Ut.oraPromise)(()=>n.action.list.send(),{...t,text:"Finding actions"});console.log(await s.result())})),e}var Ot=require("commander"),Dt=require("ora");function Ct({client:n,ora:t}){let e=new Ot.Command("channels").description("Channels");return e.addCommand(new Ot.Command("list").description("List channels").action(async()=>{let s=await(0,Dt.oraPromise)(()=>n.channel.list.send(),{...t,text:"Finding channels"});console.log(await s.result())})),e}var z=require("commander"),St=require("ora");function Rt({client:n,ora:t}){let e=new z.Command("contacts").description("Contacts");return e.addCommand(new z.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async s=>{let o=await(0,St.oraPromise)(()=>n.contact.get.send({id:s}),{...t,text:"Finding contact"});console.log(await o.result())})),e.addCommand(new z.Command("list").description("List contacts").action(async()=>{let s=await(0,St.oraPromise)(()=>n.contact.list.send(),{...t,text:"Finding contacts"});console.log(await s.result())})),e}var B=require("commander"),At=require("ora");function wt({client:n,ora:t}){let e=new B.Command("conversations").description("Conversations");return e.addCommand(new B.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async s=>{let o=await(0,At.oraPromise)(()=>n.conversation.get.send({id:s}),{...t,text:"Finding conversation"});console.log(await o.result())})),e.addCommand(new B.Command("list").description("List conversations").action(async()=>{let s=await(0,At.oraPromise)(()=>n.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await s.result())})),e}var N=require("commander"),J=require("ora");function Pt({client:n,ora:t}){let e=new N.Command("labels").description("Labels");return e.addCommand(new N.Command("get").description("Find label").argument("<label>","Label ID").action(async s=>{let o=await(0,J.oraPromise)(()=>n.label.get.send({id:s}),{...t,text:"Finding label"});console.log(await o.result())})),e.addCommand(new N.Command("list").description("List labels").action(async()=>{let s=await(0,J.oraPromise)(()=>n.label.list.send(),{...t,text:"Finding labels"});console.log(await s.result())})),e.addCommand(new N.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async s=>{let o=await(0,J.oraPromise)(()=>n.label.conversation.list.send({id:s}),{...t,text:"Finding conversations"});console.log(await o.result())})),e}var _t=require("commander"),Ft=require("ora");function Tt({client:n,ora:t}){let e=new _t.Command("messages").description("Messages");return e.addCommand(new _t.Command("list").description("List messages").action(async()=>{let s=await(0,Ft.oraPromise)(()=>n.message.list.send(),{...t,text:"Finding messages"});console.log(await s.result())})),e}var K=require("commander"),vt=require("ora");function Et({client:n,ora:t}){let e=new K.Command("models").description("Models");return e.addCommand(new K.Command("get").description("Find model").argument("<model>","Model ID").action(async s=>{let o=await(0,vt.oraPromise)(()=>n.model.get.send({id:s}),{...t,text:"Finding model"});console.log(await o.result())})),e.addCommand(new K.Command("list").description("List models").action(async()=>{let s=await(0,vt.oraPromise)(()=>n.model.list.send(),{...t,text:"Finding models"});console.log(await s.result())})),e}var V=require("commander"),It=require("ora");function qt({client:n,ora:t}){let e=new V.Command("sources").description("Sources");return e.addCommand(new V.Command("get").description("Find source").argument("<source>","Source ID").action(async s=>{let o=await(0,It.oraPromise)(()=>n.source.get.send({id:s}),{...t,text:"Finding source"});console.log(await o.result())})),e.addCommand(new V.Command("list").description("List sources").action(async()=>{let s=await(0,It.oraPromise)(()=>n.source.list.send(),{...t,text:"Finding sources"});console.log(await s.result())})),e}var i={ora:{spinner:"simpleDotsScrolling"},client:new M(new p)},Nt=new Ht.Command("gds").description("Great Detail Support System").addCommand(xt(i)).addCommand(Ct(i)).addCommand(Rt(i)).addCommand(wt(i)).addCommand(Pt(i)).addCommand(Tt(i)).addCommand(Et(i)).addCommand(qt(i)),Mt=Nt;Mt.parseAsync(process.argv);
|
|
2
|
+
"use strict";var Mt=require("commander");var p=class{async filter(t){return t}};var c=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/actions",{...t,method:"GET"},e).then(s=>new k(s))}},k=class{constructor(t){this.response=t}async result(){return this.response.json()}};var d=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/channels",{...t,method:"GET"},e).then(s=>new W(s))}},W=class{constructor(t){this.response=t}async result(){return this.response.json()}};var qt="https://api.support.greatdetail.com",jt={"X-Powered-By":"GDSupport/JavaScript"};var l=class{constructor(t){this._transport=t}async send({id:t}){return this._transport.getURL("v1/contacts/"+encodeURIComponent(t)+"/vcf")}};var a=require("zod"),u=class n{constructor(t){this._transport=t}static SCHEMA=a.z.object({name:a.z.string(),account:a.z.string(),emailAddress:a.z.string().email().optional(),telephoneNumber:a.z.string().optional()});async send({body:t,request:e={},...s}){return this._transport.send("v1/contacts",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))},s).then(o=>new X(o))}},X=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:e={},...s}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new Q(o))}},Q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var g=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/contacts",{...t,method:"GET"},e).then(s=>new Z(s))}},Z=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:e={},...s}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...e,method:"GET"},s).then(o=>new $(o))}},$=class{constructor(t){this.response=t}async result(){return this.response.json()}};var y=require("zod"),h=class n{constructor(t){this._transport=t}static SCHEMA=y.z.object({name:y.z.string().optional(),emailAddress:y.z.string().email().optional(),telephoneNumber:y.z.string().optional()});async send({id:t,body:e,request:s={},...o}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},o).then(r=>new tt(r))}},tt=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:e={},...s}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new et(o))}},et=class{constructor(t){this.response=t}async result(){return this.response.json()}};var x=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/conversations",{...t,method:"GET"},e).then(s=>new st(s))}},st=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:e={},...s}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...e,method:"GET"},s).then(o=>new nt(o))}},nt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var ot=require("zod"),C=class n{constructor(t){this._transport=t}static SCHEMA=ot.z.object({hasEnded:ot.z.boolean()});async send({id:t,body:e,request:s={},...o}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},o).then(r=>new rt(r))}},rt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var R=require("zod"),S=class n{constructor(t){this._transport=t}static SCHEMA=R.z.object({title:R.z.string(),description:R.z.string().optional(),account:R.z.string()});async send({body:t,request:e={},...s}){return this._transport.send("v1/labels",{...e,method:"POST",headers:{...e.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(t))},s).then(o=>new it(o))}},it=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:e={},...s}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"DELETE"},s).then(o=>new at(o))}},at=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:e={},...s}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new pt(o))}},pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/labels",{...t,method:"GET"},e).then(s=>new ct(s))}},ct=class{constructor(t){this.response=t}async result(){return this.response.json()}};var z=require("zod"),T=class n{constructor(t){this._transport=t}static SCHEMA=z.z.object({title:z.z.string().optional(),description:z.z.string().optional()});async send({id:t,body:e,request:s={},...o}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"PATCH",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},o).then(r=>new dt(r))}},dt=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:e={},...s}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...e,method:"GET"},s).then(o=>new lt(o))}},lt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var v=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/messages",{...t,method:"GET"},e).then(s=>new ut(s))}},ut=class{constructor(t){this.response=t}async result(){return this.response.json()}};var E=require("zod"),I=class n{constructor(t){this._transport=t}static SCHEMA=E.z.object({input:E.z.string().max(65536),original:E.z.string().max(65536),correction:E.z.string().max(65536)});async send({id:t,body:e,request:s={},...o}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/correction",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},o).then(r=>new mt(r))}},mt=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:e={},...s}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new gt(o))}},gt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var U=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/models",{...t,method:"GET"},e).then(s=>new ft(s))}},ft=class{constructor(t){this.response=t}async result(){return this.response.json()}};var q=require("zod"),j=class n{constructor(t){this._transport=t}static SCHEMA=q.z.array(q.z.object({role:q.z.enum(["user","assistant"]),content:q.z.string().max(65536).nullable()})).min(1);async send({id:t,body:e,request:s={},...o}){return this._transport.send("v1/models/"+encodeURIComponent(t)+"/response",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(n.SCHEMA.parse(e))},o).then(r=>new yt(r))}},yt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var D=class n{constructor(t=n.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=jt;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var F=class{constructor(t){this._transport=t}async send({id:t,request:e={},...s}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...e,method:"GET"},s).then(o=>new ht(o))}},ht=class{constructor(t){this.response=t}async result(){return this.response.json()}};var H=class{constructor(t){this._transport=t}async send({request:t={},...e}={}){return this._transport.send("v1/sources",{...t,method:"GET"},e).then(s=>new bt(s))}},bt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var M=class{options;constructor({baseURL:t,...e}){this.options={...e,baseURL:t}}async _filterRequest(t){for(let e of this.options.requestFilterables)t=await e.filter(t);return t}getURL(t){return new URL(t,this.options.baseURL)}async send(t,e,{fetch:s=fetch}={}){return await s(new Request(this.getURL(t),await this._filterRequest(e)))}};var N=class n{static DEFAULT_BASE_URL=qt;_transport;constructor(t,{baseURL:e,...s}={}){this._transport=new M({requestFilterables:[new D,t],...s,baseURL:e?.toString()??n.getBaseURL()})}static getBaseURL(){return process.env.SUPPORT_BASE_URL??this.DEFAULT_BASE_URL}get action(){return{list:new c(this._transport)}}get channel(){return{list:new d(this._transport)}}get contact(){return{get:new m(this._transport),list:new g(this._transport),update:new h(this._transport),create:new u(this._transport),vcf:{getURL:new l(this._transport)}}}get conversation(){return{get:new b(this._transport),list:new x(this._transport),update:new C(this._transport),message:{list:new P(this._transport)}}}get label(){return{create:new S(this._transport),get:new A(this._transport),list:new _(this._transport),update:new T(this._transport),delete:new w(this._transport),contact:{list:new f(this._transport)},conversation:{list:new O(this._transport)}}}get message(){return{list:new v(this._transport)}}get model(){return{get:new L(this._transport),list:new U(this._transport),response:{create:new j(this._transport)},correction:{create:new I(this._transport)}}}get source(){return{get:new F(this._transport),list:new H(this._transport)}}};var xt=require("commander"),Dt=require("ora");function Ot({client:n,ora:t}){let e=new xt.Command("actions").description("Actions");return e.addCommand(new xt.Command("list").description("List actions").action(async()=>{let s=await(0,Dt.oraPromise)(()=>n.action.list.send(),{...t,text:"Finding actions"});console.log(await s.result())})),e}var Ct=require("commander"),Ft=require("ora");function Rt({client:n,ora:t}){let e=new Ct.Command("channels").description("Channels");return e.addCommand(new Ct.Command("list").description("List channels").action(async()=>{let s=await(0,Ft.oraPromise)(()=>n.channel.list.send(),{...t,text:"Finding channels"});console.log(await s.result())})),e}var B=require("commander"),St=require("ora");function wt({client:n,ora:t}){let e=new B.Command("contacts").description("Contacts");return e.addCommand(new B.Command("get").description("Find contact").argument("<contact>","Contact ID").action(async s=>{let o=await(0,St.oraPromise)(()=>n.contact.get.send({id:s}),{...t,text:"Finding contact"});console.log(await o.result())})),e.addCommand(new B.Command("list").description("List contacts").action(async()=>{let s=await(0,St.oraPromise)(()=>n.contact.list.send(),{...t,text:"Finding contacts"});console.log(await s.result())})),e}var J=require("commander"),At=require("ora");function _t({client:n,ora:t}){let e=new J.Command("conversations").description("Conversations");return e.addCommand(new J.Command("get").description("Find conversation").argument("<conversation>","Conversation ID").action(async s=>{let o=await(0,At.oraPromise)(()=>n.conversation.get.send({id:s}),{...t,text:"Finding conversation"});console.log(await o.result())})),e.addCommand(new J.Command("list").description("List conversations").action(async()=>{let s=await(0,At.oraPromise)(()=>n.conversation.list.send(),{...t,text:"Finding conversations"});console.log(await s.result())})),e}var G=require("commander"),K=require("ora");function Tt({client:n,ora:t}){let e=new G.Command("labels").description("Labels");return e.addCommand(new G.Command("get").description("Find label").argument("<label>","Label ID").action(async s=>{let o=await(0,K.oraPromise)(()=>n.label.get.send({id:s}),{...t,text:"Finding label"});console.log(await o.result())})),e.addCommand(new G.Command("list").description("List labels").action(async()=>{let s=await(0,K.oraPromise)(()=>n.label.list.send(),{...t,text:"Finding labels"});console.log(await s.result())})),e.addCommand(new G.Command("conversations").description("Find label conversations").argument("<label>","Label ID").action(async s=>{let o=await(0,K.oraPromise)(()=>n.label.conversation.list.send({id:s}),{...t,text:"Finding conversations"});console.log(await o.result())})),e}var Pt=require("commander"),Ht=require("ora");function vt({client:n,ora:t}){let e=new Pt.Command("messages").description("Messages");return e.addCommand(new Pt.Command("list").description("List messages").action(async()=>{let s=await(0,Ht.oraPromise)(()=>n.message.list.send(),{...t,text:"Finding messages"});console.log(await s.result())})),e}var V=require("commander"),Et=require("ora");function It({client:n,ora:t}){let e=new V.Command("models").description("Models");return e.addCommand(new V.Command("get").description("Find model").argument("<model>","Model ID").action(async s=>{let o=await(0,Et.oraPromise)(()=>n.model.get.send({id:s}),{...t,text:"Finding model"});console.log(await o.result())})),e.addCommand(new V.Command("list").description("List models").action(async()=>{let s=await(0,Et.oraPromise)(()=>n.model.list.send(),{...t,text:"Finding models"});console.log(await s.result())})),e}var Y=require("commander"),Lt=require("ora");function Ut({client:n,ora:t}){let e=new Y.Command("sources").description("Sources");return e.addCommand(new Y.Command("get").description("Find source").argument("<source>","Source ID").action(async s=>{let o=await(0,Lt.oraPromise)(()=>n.source.get.send({id:s}),{...t,text:"Finding source"});console.log(await o.result())})),e.addCommand(new Y.Command("list").description("List sources").action(async()=>{let s=await(0,Lt.oraPromise)(()=>n.source.list.send(),{...t,text:"Finding sources"});console.log(await s.result())})),e}var i={ora:{spinner:"simpleDotsScrolling"},client:new N(new p)},Gt=new Mt.Command("gds").description("Great Detail Support System").addCommand(Ot(i)).addCommand(Rt(i)).addCommand(wt(i)).addCommand(_t(i)).addCommand(Tt(i)).addCommand(vt(i)).addCommand(It(i)).addCommand(Ut(i)),Nt=Gt;Nt.parseAsync(process.argv);
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as r}from"./chunk-
|
|
2
|
+
import{a as r}from"./chunk-PTKKI5PQ.js";import"./chunk-2LKRKCHH.js";r.parseAsync(process.argv);
|
|
@@ -21,7 +21,7 @@ interface RequestFilterable {
|
|
|
21
21
|
* @see https://greatdetail.com
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
interface Options$
|
|
24
|
+
interface Options$q {
|
|
25
25
|
requestFilterables: RequestFilterable[];
|
|
26
26
|
baseURL: string;
|
|
27
27
|
}
|
|
@@ -36,9 +36,10 @@ interface SendOptions {
|
|
|
36
36
|
fetch?: typeof fetch;
|
|
37
37
|
}
|
|
38
38
|
declare class Transport {
|
|
39
|
-
options: Options$
|
|
40
|
-
constructor({ baseURL, ...options }: Options$
|
|
39
|
+
options: Options$q;
|
|
40
|
+
constructor({ baseURL, ...options }: Options$q);
|
|
41
41
|
protected _filterRequest(request: RequestInit): Promise<RequestInit>;
|
|
42
|
+
getURL(url: string | URL): URL;
|
|
42
43
|
send(url: string | URL, request: RequestInit, { fetch: fetchAlternative }?: SendOptions): Promise<Response>;
|
|
43
44
|
}
|
|
44
45
|
|
|
@@ -51,13 +52,13 @@ declare class Transport {
|
|
|
51
52
|
* @see https://greatdetail.com
|
|
52
53
|
*/
|
|
53
54
|
|
|
54
|
-
interface Options$
|
|
55
|
+
interface Options$p extends SendOptions {
|
|
55
56
|
request?: RequestInit;
|
|
56
57
|
}
|
|
57
58
|
declare class ListActions {
|
|
58
59
|
protected _transport: Transport;
|
|
59
60
|
constructor(_transport: Transport);
|
|
60
|
-
send({ request, ...options }?: Options$
|
|
61
|
+
send({ request, ...options }?: Options$p): Promise<ListActionsResponse>;
|
|
61
62
|
}
|
|
62
63
|
type ListActionsResponsePayload = {
|
|
63
64
|
actions: {
|
|
@@ -99,13 +100,13 @@ type Authentication = RequestFilterable;
|
|
|
99
100
|
* @see https://greatdetail.com
|
|
100
101
|
*/
|
|
101
102
|
|
|
102
|
-
interface Options$
|
|
103
|
+
interface Options$o extends SendOptions {
|
|
103
104
|
request?: RequestInit;
|
|
104
105
|
}
|
|
105
106
|
declare class ListChannels {
|
|
106
107
|
protected _transport: Transport;
|
|
107
108
|
constructor(_transport: Transport);
|
|
108
|
-
send({ request, ...options }?: Options$
|
|
109
|
+
send({ request, ...options }?: Options$o): Promise<ListChannelsResponse>;
|
|
109
110
|
}
|
|
110
111
|
type ListChannelsResponsePayload = {
|
|
111
112
|
channels: ({
|
|
@@ -137,6 +138,24 @@ declare class ListChannelsResponse {
|
|
|
137
138
|
result(): Promise<ListChannelsResponsePayload>;
|
|
138
139
|
}
|
|
139
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Great Detail Support System.
|
|
143
|
+
*
|
|
144
|
+
* @copyright 2024 Great Detail Ltd
|
|
145
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
146
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
147
|
+
* @see https://greatdetail.com
|
|
148
|
+
*/
|
|
149
|
+
|
|
150
|
+
interface Options$n {
|
|
151
|
+
id: string;
|
|
152
|
+
}
|
|
153
|
+
declare class GetContactVCFURL {
|
|
154
|
+
protected _transport: Transport;
|
|
155
|
+
constructor(_transport: Transport);
|
|
156
|
+
send({ id }: Options$n): Promise<URL>;
|
|
157
|
+
}
|
|
158
|
+
|
|
140
159
|
/**
|
|
141
160
|
* Great Detail Support System.
|
|
142
161
|
*
|
|
@@ -273,7 +292,7 @@ interface Options$j extends SendOptions {
|
|
|
273
292
|
declare class ListLabelContacts {
|
|
274
293
|
protected _transport: Transport;
|
|
275
294
|
constructor(_transport: Transport);
|
|
276
|
-
|
|
295
|
+
send({ id, request, ...options }: Options$j): Promise<ListLabelContactsResponse>;
|
|
277
296
|
}
|
|
278
297
|
type ListLabelContactsResponsePayload = {
|
|
279
298
|
contacts: {
|
|
@@ -998,6 +1017,9 @@ declare class Client {
|
|
|
998
1017
|
list: ListContacts;
|
|
999
1018
|
update: UpdateContact;
|
|
1000
1019
|
create: CreateContact;
|
|
1020
|
+
vcf: {
|
|
1021
|
+
getURL: GetContactVCFURL;
|
|
1022
|
+
};
|
|
1001
1023
|
};
|
|
1002
1024
|
get conversation(): {
|
|
1003
1025
|
get: GetConversation;
|
|
@@ -1039,4 +1061,4 @@ declare class Client {
|
|
|
1039
1061
|
};
|
|
1040
1062
|
}
|
|
1041
1063
|
|
|
1042
|
-
export { type Authentication as A, Client as C, type DeleteLabelResponsePayload as D, type GetContactResponsePayload as G, type ListActionsResponsePayload as L, type Options as O, type RequestFilterable as R, type SendOptions as S, type UpdateContactResponsePayload as U, type Options$
|
|
1064
|
+
export { type Authentication as A, Client as C, type DeleteLabelResponsePayload as D, type GetContactResponsePayload as G, type ListActionsResponsePayload as L, type Options as O, type RequestFilterable as R, type SendOptions as S, type UpdateContactResponsePayload as U, type Options$q as a, type ListChannelsResponsePayload as b, type ListContactsResponsePayload as c, type ListLabelContactsResponsePayload as d, type CreateContactResponsePayload as e, type GetConversationResponsePayload as f, type ListConversationsResponsePayload as g, type ListLabelConversationsResponsePayload as h, type UpdateConversationResponsePayload as i, type CreateLabelResponsePayload as j, type GetLabelResponsePayload as k, type ListLabelsResponsePayload as l, type UpdateLabelResponsePayload as m, type ListConversationMessagesResponsePayload as n, type ListMessagesResponsePayload as o, type GetModelResponsePayload as p, type ListModelsResponsePayload as q, type CreateCorrectionResponsePayload as r, type CreateResponseResponsePayload as s, type GetSourceResponsePayload as t, type ListSourcesResponsePayload as u };
|
|
@@ -21,7 +21,7 @@ interface RequestFilterable {
|
|
|
21
21
|
* @see https://greatdetail.com
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
interface Options$
|
|
24
|
+
interface Options$q {
|
|
25
25
|
requestFilterables: RequestFilterable[];
|
|
26
26
|
baseURL: string;
|
|
27
27
|
}
|
|
@@ -36,9 +36,10 @@ interface SendOptions {
|
|
|
36
36
|
fetch?: typeof fetch;
|
|
37
37
|
}
|
|
38
38
|
declare class Transport {
|
|
39
|
-
options: Options$
|
|
40
|
-
constructor({ baseURL, ...options }: Options$
|
|
39
|
+
options: Options$q;
|
|
40
|
+
constructor({ baseURL, ...options }: Options$q);
|
|
41
41
|
protected _filterRequest(request: RequestInit): Promise<RequestInit>;
|
|
42
|
+
getURL(url: string | URL): URL;
|
|
42
43
|
send(url: string | URL, request: RequestInit, { fetch: fetchAlternative }?: SendOptions): Promise<Response>;
|
|
43
44
|
}
|
|
44
45
|
|
|
@@ -51,13 +52,13 @@ declare class Transport {
|
|
|
51
52
|
* @see https://greatdetail.com
|
|
52
53
|
*/
|
|
53
54
|
|
|
54
|
-
interface Options$
|
|
55
|
+
interface Options$p extends SendOptions {
|
|
55
56
|
request?: RequestInit;
|
|
56
57
|
}
|
|
57
58
|
declare class ListActions {
|
|
58
59
|
protected _transport: Transport;
|
|
59
60
|
constructor(_transport: Transport);
|
|
60
|
-
send({ request, ...options }?: Options$
|
|
61
|
+
send({ request, ...options }?: Options$p): Promise<ListActionsResponse>;
|
|
61
62
|
}
|
|
62
63
|
type ListActionsResponsePayload = {
|
|
63
64
|
actions: {
|
|
@@ -99,13 +100,13 @@ type Authentication = RequestFilterable;
|
|
|
99
100
|
* @see https://greatdetail.com
|
|
100
101
|
*/
|
|
101
102
|
|
|
102
|
-
interface Options$
|
|
103
|
+
interface Options$o extends SendOptions {
|
|
103
104
|
request?: RequestInit;
|
|
104
105
|
}
|
|
105
106
|
declare class ListChannels {
|
|
106
107
|
protected _transport: Transport;
|
|
107
108
|
constructor(_transport: Transport);
|
|
108
|
-
send({ request, ...options }?: Options$
|
|
109
|
+
send({ request, ...options }?: Options$o): Promise<ListChannelsResponse>;
|
|
109
110
|
}
|
|
110
111
|
type ListChannelsResponsePayload = {
|
|
111
112
|
channels: ({
|
|
@@ -137,6 +138,24 @@ declare class ListChannelsResponse {
|
|
|
137
138
|
result(): Promise<ListChannelsResponsePayload>;
|
|
138
139
|
}
|
|
139
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Great Detail Support System.
|
|
143
|
+
*
|
|
144
|
+
* @copyright 2024 Great Detail Ltd
|
|
145
|
+
* @author Great Detail Ltd <info@greatdetail.com>
|
|
146
|
+
* @author Dom Webber <dom.webber@greatdetail.com>
|
|
147
|
+
* @see https://greatdetail.com
|
|
148
|
+
*/
|
|
149
|
+
|
|
150
|
+
interface Options$n {
|
|
151
|
+
id: string;
|
|
152
|
+
}
|
|
153
|
+
declare class GetContactVCFURL {
|
|
154
|
+
protected _transport: Transport;
|
|
155
|
+
constructor(_transport: Transport);
|
|
156
|
+
send({ id }: Options$n): Promise<URL>;
|
|
157
|
+
}
|
|
158
|
+
|
|
140
159
|
/**
|
|
141
160
|
* Great Detail Support System.
|
|
142
161
|
*
|
|
@@ -273,7 +292,7 @@ interface Options$j extends SendOptions {
|
|
|
273
292
|
declare class ListLabelContacts {
|
|
274
293
|
protected _transport: Transport;
|
|
275
294
|
constructor(_transport: Transport);
|
|
276
|
-
|
|
295
|
+
send({ id, request, ...options }: Options$j): Promise<ListLabelContactsResponse>;
|
|
277
296
|
}
|
|
278
297
|
type ListLabelContactsResponsePayload = {
|
|
279
298
|
contacts: {
|
|
@@ -998,6 +1017,9 @@ declare class Client {
|
|
|
998
1017
|
list: ListContacts;
|
|
999
1018
|
update: UpdateContact;
|
|
1000
1019
|
create: CreateContact;
|
|
1020
|
+
vcf: {
|
|
1021
|
+
getURL: GetContactVCFURL;
|
|
1022
|
+
};
|
|
1001
1023
|
};
|
|
1002
1024
|
get conversation(): {
|
|
1003
1025
|
get: GetConversation;
|
|
@@ -1039,4 +1061,4 @@ declare class Client {
|
|
|
1039
1061
|
};
|
|
1040
1062
|
}
|
|
1041
1063
|
|
|
1042
|
-
export { type Authentication as A, Client as C, type DeleteLabelResponsePayload as D, type GetContactResponsePayload as G, type ListActionsResponsePayload as L, type Options as O, type RequestFilterable as R, type SendOptions as S, type UpdateContactResponsePayload as U, type Options$
|
|
1064
|
+
export { type Authentication as A, Client as C, type DeleteLabelResponsePayload as D, type GetContactResponsePayload as G, type ListActionsResponsePayload as L, type Options as O, type RequestFilterable as R, type SendOptions as S, type UpdateContactResponsePayload as U, type Options$q as a, type ListChannelsResponsePayload as b, type ListContactsResponsePayload as c, type ListLabelContactsResponsePayload as d, type CreateContactResponsePayload as e, type GetConversationResponsePayload as f, type ListConversationsResponsePayload as g, type ListLabelConversationsResponsePayload as h, type UpdateConversationResponsePayload as i, type CreateLabelResponsePayload as j, type GetLabelResponsePayload as k, type ListLabelsResponsePayload as l, type UpdateLabelResponsePayload as m, type ListConversationMessagesResponsePayload as n, type ListMessagesResponsePayload as o, type GetModelResponsePayload as p, type ListModelsResponsePayload as q, type CreateCorrectionResponsePayload as r, type CreateResponseResponsePayload as s, type GetSourceResponsePayload as t, type ListSourcesResponsePayload as u };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var K=Object.defineProperty;var Rt=Object.getOwnPropertyDescriptor;var At=Object.getOwnPropertyNames;var St=Object.prototype.hasOwnProperty;var Ot=(e,t)=>{for(var s in t)K(e,s,{get:t[s],enumerable:!0})},Pt=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of At(t))!St.call(e,r)&&r!==s&&K(e,r,{get:()=>t[r],enumerable:!(n=Rt(t,r))||n.enumerable});return e};var Ct=e=>Pt(K({},"__esModule",{value:!0}),e);var _t={};Ot(_t,{Client:()=>p,DEFAULT_SUPPORT_BASE_URL:()=>F,KeyAuthentication:()=>D,PublicAuthentication:()=>G,TokenAuthentication:()=>H,default:()=>p});module.exports=Ct(_t);var F="https://api.support.greatdetail.com",yt={"X-Powered-By":"GDSupport/JavaScript"},ft="api-key",ht="SUPPORT_ACCESS_TOKEN",bt="SUPPORT_API_KEY",xt="SUPPORT_KEY_NAME";var a=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/actions",{...t,method:"GET"},s).then(n=>new V(n))}},V=class{constructor(t){this.response=t}async result(){return this.response.json()}};var c=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/channels",{...t,method:"GET"},s).then(n=>new B(n))}},B=class{constructor(t){this.response=t}async result(){return this.response.json()}};var i=require("zod"),d=class e{constructor(t){this._transport=t}static SCHEMA=i.z.object({name:i.z.string(),account:i.z.string(),emailAddress:i.z.string().email().optional(),telephoneNumber:i.z.string().optional()});async send({body:t,request:s={},...n}){return this._transport.send("v1/contacts",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))},n).then(r=>new J(r))}},J=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:s={},...n}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new k(r))}},k=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/contacts",{...t,method:"GET"},s).then(n=>new Y(n))}},Y=class{constructor(t){this.response=t}async result(){return this.response.json()}};var m=class{constructor(t){this._transport=t}async({id:t,request:s={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...s,method:"GET"},n).then(r=>new $(r))}},$=class{constructor(t){this.response=t}async result(){return this.response.json()}};var g=require("zod"),y=class e{constructor(t){this._transport=t}static SCHEMA=g.z.object({name:g.z.string().optional(),emailAddress:g.z.string().email().optional(),telephoneNumber:g.z.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 W(o))}},W=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/conversations/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new X(r))}},X=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/conversations",{...t,method:"GET"},s).then(n=>new Q(n))}},Q=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:s={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...s,method:"GET"},n).then(r=>new Z(r))}},Z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var tt=require("zod"),x=class e{constructor(t){this._transport=t}static SCHEMA=tt.z.object({hasEnded:tt.z.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 et(o))}},et=class{constructor(t){this.response=t}async result(){return this.response.json()}};var R=require("zod"),A=class e{constructor(t){this._transport=t}static SCHEMA=R.z.object({title:R.z.string(),description:R.z.string().optional(),account:R.z.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 st(r))}},st=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:s={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"DELETE"},n).then(r=>new nt(r))}},nt=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 rt(r))}},rt=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/labels",{...t,method:"GET"},s).then(n=>new ot(n))}},ot=class{constructor(t){this.response=t}async result(){return this.response.json()}};var z=require("zod"),C=class e{constructor(t){this._transport=t}static SCHEMA=z.z.object({title:z.z.string().optional(),description:z.z.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 it(o))}},it=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=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 pt(r))}},pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var T=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/messages",{...t,method:"GET"},s).then(n=>new at(n))}},at=class{constructor(t){this.response=t}async result(){return this.response.json()}};var E=require("zod"),v=class e{constructor(t){this._transport=t}static SCHEMA=E.z.object({input:E.z.string().max(65536),original:E.z.string().max(65536),correction:E.z.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 ct(o))}},ct=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:s={},...n}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new dt(r))}},dt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var L=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/models",{...t,method:"GET"},s).then(n=>new lt(n))}},lt=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.array(U.z.object({role:U.z.enum(["user","assistant"]),content:U.z.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 ut(o))}},ut=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=yt;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var j=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 mt(r))}},mt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var N=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/sources",{...t,method:"GET"},s).then(n=>new gt(n))}},gt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var M=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 p=class e{static DEFAULT_BASE_URL=F;_transport;constructor(t,{baseURL:s,...n}={}){this._transport=new M({requestFilterables:[new q,t],...n,baseURL:s?.toString()??e.getBaseURL()})}static getBaseURL(){return process.env.SUPPORT_BASE_URL??this.DEFAULT_BASE_URL}get action(){return{list:new a(this._transport)}}get channel(){return{list:new c(this._transport)}}get contact(){return{get:new l(this._transport),list:new u(this._transport),update:new y(this._transport),create:new d(this._transport)}}get conversation(){return{get:new f(this._transport),list:new h(this._transport),update:new x(this._transport),message:{list:new _(this._transport)}}}get label(){return{create:new A(this._transport),get:new O(this._transport),list:new P(this._transport),update:new C(this._transport),delete:new S(this._transport),contact:{list:new m(this._transport)},conversation:{list:new b(this._transport)}}}get message(){return{list:new T(this._transport)}}get model(){return{get:new w(this._transport),list:new L(this._transport),response:{create:new I(this._transport)},correction:{create:new v(this._transport)}}}get source(){return{get:new j(this._transport),list:new N(this._transport)}}};var D=class e{static DEFAULT_NAME=ft;name;#t;constructor({name:t=process.env[xt]??e.DEFAULT_NAME,key:s=process.env[bt]}={}){if(!s)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=s}async filter(t){return{...t,headers:{...t.headers,Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}}};var H=class{#t;constructor({token:t=process.env[ht]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async filter(t){return{...t,headers:{...t.headers,Authorization:`Bearer ${this.#t}`}}}};var G=class{async filter(t){return t}};0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,KeyAuthentication,PublicAuthentication,TokenAuthentication});
|
|
1
|
+
"use strict";var V=Object.defineProperty;var At=Object.getOwnPropertyDescriptor;var St=Object.getOwnPropertyNames;var Ot=Object.prototype.hasOwnProperty;var Pt=(e,t)=>{for(var s in t)V(e,s,{get:t[s],enumerable:!0})},_t=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of St(t))!Ot.call(e,r)&&r!==s&&V(e,r,{get:()=>t[r],enumerable:!(n=At(t,r))||n.enumerable});return e};var Ct=e=>_t(V({},"__esModule",{value:!0}),e);var Tt={};Pt(Tt,{Client:()=>p,DEFAULT_SUPPORT_BASE_URL:()=>z,KeyAuthentication:()=>H,PublicAuthentication:()=>F,TokenAuthentication:()=>G,default:()=>p});module.exports=Ct(Tt);var z="https://api.support.greatdetail.com",ft={"X-Powered-By":"GDSupport/JavaScript"},ht="api-key",bt="SUPPORT_ACCESS_TOKEN",Rt="SUPPORT_API_KEY",xt="SUPPORT_KEY_NAME";var a=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/actions",{...t,method:"GET"},s).then(n=>new B(n))}},B=class{constructor(t){this.response=t}async result(){return this.response.json()}};var c=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/channels",{...t,method:"GET"},s).then(n=>new J(n))}},J=class{constructor(t){this.response=t}async result(){return this.response.json()}};var d=class{constructor(t){this._transport=t}async send({id:t}){return this._transport.getURL("v1/contacts/"+encodeURIComponent(t)+"/vcf")}};var i=require("zod"),l=class e{constructor(t){this._transport=t}static SCHEMA=i.z.object({name:i.z.string(),account:i.z.string(),emailAddress:i.z.string().email().optional(),telephoneNumber:i.z.string().optional()});async send({body:t,request:s={},...n}){return this._transport.send("v1/contacts",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))},n).then(r=>new k(r))}},k=class{constructor(t){this.response=t}async result(){return this.response.json()}};var u=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()}};var m=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/contacts",{...t,method:"GET"},s).then(n=>new $(n))}},$=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:s={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...s,method:"GET"},n).then(r=>new W(r))}},W=class{constructor(t){this.response=t}async result(){return this.response.json()}};var y=require("zod"),f=class e{constructor(t){this._transport=t}static SCHEMA=y.z.object({name:y.z.string().optional(),emailAddress:y.z.string().email().optional(),telephoneNumber:y.z.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 X(o))}},X=class{constructor(t){this.response=t}async result(){return this.response.json()}};var h=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 Q(r))}},Q=class{constructor(t){this.response=t}async result(){return this.response.json()}};var b=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/conversations",{...t,method:"GET"},s).then(n=>new Z(n))}},Z=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:s={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...s,method:"GET"},n).then(r=>new tt(r))}},tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var et=require("zod"),x=class e{constructor(t){this._transport=t}static SCHEMA=et.z.object({hasEnded:et.z.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 st(o))}},st=class{constructor(t){this.response=t}async result(){return this.response.json()}};var A=require("zod"),S=class e{constructor(t){this._transport=t}static SCHEMA=A.z.object({title:A.z.string(),description:A.z.string().optional(),account:A.z.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 nt(r))}},nt=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:"DELETE"},n).then(r=>new rt(r))}},rt=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/labels/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new ot(r))}},ot=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/labels",{...t,method:"GET"},s).then(n=>new it(n))}},it=class{constructor(t){this.response=t}async result(){return this.response.json()}};var K=require("zod"),C=class e{constructor(t){this._transport=t}static SCHEMA=K.z.object({title:K.z.string().optional(),description:K.z.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 pt(o))}},pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var T=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 at(r))}},at=class{constructor(t){this.response=t}async result(){return this.response.json()}};var E=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/messages",{...t,method:"GET"},s).then(n=>new ct(n))}},ct=class{constructor(t){this.response=t}async result(){return this.response.json()}};var v=require("zod"),w=class e{constructor(t){this._transport=t}static SCHEMA=v.z.object({input:v.z.string().max(65536),original:v.z.string().max(65536),correction:v.z.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 dt(o))}},dt=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:s={},...n}){return this._transport.send("v1/models/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new lt(r))}},lt=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/models",{...t,method:"GET"},s).then(n=>new ut(n))}},ut=class{constructor(t){this.response=t}async result(){return this.response.json()}};var I=require("zod"),q=class e{constructor(t){this._transport=t}static SCHEMA=I.z.array(I.z.object({role:I.z.enum(["user","assistant"]),content:I.z.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 mt(o))}},mt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var j=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ft;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var N=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 gt(r))}},gt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var M=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/sources",{...t,method:"GET"},s).then(n=>new yt(n))}},yt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var D=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}getURL(t){return new URL(t,this.options.baseURL)}async send(t,s,{fetch:n=fetch}={}){return await n(new Request(this.getURL(t),await this._filterRequest(s)))}};var p=class e{static DEFAULT_BASE_URL=z;_transport;constructor(t,{baseURL:s,...n}={}){this._transport=new D({requestFilterables:[new j,t],...n,baseURL:s?.toString()??e.getBaseURL()})}static getBaseURL(){return process.env.SUPPORT_BASE_URL??this.DEFAULT_BASE_URL}get action(){return{list:new a(this._transport)}}get channel(){return{list:new c(this._transport)}}get contact(){return{get:new u(this._transport),list:new m(this._transport),update:new f(this._transport),create:new l(this._transport),vcf:{getURL:new d(this._transport)}}}get conversation(){return{get:new h(this._transport),list:new b(this._transport),update:new x(this._transport),message:{list:new T(this._transport)}}}get label(){return{create:new S(this._transport),get:new P(this._transport),list:new _(this._transport),update:new C(this._transport),delete:new O(this._transport),contact:{list:new g(this._transport)},conversation:{list:new R(this._transport)}}}get message(){return{list:new E(this._transport)}}get model(){return{get:new L(this._transport),list:new U(this._transport),response:{create:new q(this._transport)},correction:{create:new w(this._transport)}}}get source(){return{get:new N(this._transport),list:new M(this._transport)}}};var H=class e{static DEFAULT_NAME=ht;name;#t;constructor({name:t=process.env[xt]??e.DEFAULT_NAME,key:s=process.env[Rt]}={}){if(!s)throw new Error("API Key option must be specified when using Key Authentication");this.name=t,this.#t=s}async filter(t){return{...t,headers:{...t.headers,Authorization:`Basic ${btoa(this.name+":"+this.#t)}`}}}};var G=class{#t;constructor({token:t=process.env[bt]}={}){if(!t)throw new Error("Access Token option must be specified when using Token Authentication");this.#t=t}async filter(t){return{...t,headers:{...t.headers,Authorization:`Bearer ${this.#t}`}}}};var F=class{async filter(t){return t}};0&&(module.exports={Client,DEFAULT_SUPPORT_BASE_URL,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, e as CreateContactResponsePayload, r as CreateCorrectionResponsePayload, j as CreateLabelResponsePayload, s as CreateResponseResponsePayload, D as DeleteLabelResponsePayload, G as GetContactResponsePayload, f as GetConversationResponsePayload, k as GetLabelResponsePayload, p as GetModelResponsePayload, t as GetSourceResponsePayload, L as ListActionsResponsePayload, b as ListChannelsResponsePayload, c as ListContactsResponsePayload, n as ListConversationMessagesResponsePayload, g as ListConversationsResponsePayload, d as ListLabelContactsResponsePayload, h as ListLabelConversationsResponsePayload, l as ListLabelsResponsePayload, o as ListMessagesResponsePayload, q as ListModelsResponsePayload, u as ListSourcesResponsePayload, O as Options, R as RequestFilterable, a as TransportOptions, S as TransportSendOptions, U as UpdateContactResponsePayload, i as UpdateConversationResponsePayload, m as UpdateLabelResponsePayload, C as default } from './index-
|
|
1
|
+
import { A as Authentication } from './index-Dm8jdpkD.cjs';
|
|
2
|
+
export { C as Client, e as CreateContactResponsePayload, r as CreateCorrectionResponsePayload, j as CreateLabelResponsePayload, s as CreateResponseResponsePayload, D as DeleteLabelResponsePayload, G as GetContactResponsePayload, f as GetConversationResponsePayload, k as GetLabelResponsePayload, p as GetModelResponsePayload, t as GetSourceResponsePayload, L as ListActionsResponsePayload, b as ListChannelsResponsePayload, c as ListContactsResponsePayload, n as ListConversationMessagesResponsePayload, g as ListConversationsResponsePayload, d as ListLabelContactsResponsePayload, h as ListLabelConversationsResponsePayload, l as ListLabelsResponsePayload, o as ListMessagesResponsePayload, q as ListModelsResponsePayload, u as ListSourcesResponsePayload, O as Options, R as RequestFilterable, a as TransportOptions, S as TransportSendOptions, U as UpdateContactResponsePayload, i as UpdateConversationResponsePayload, m as UpdateLabelResponsePayload, C as default } from './index-Dm8jdpkD.cjs';
|
|
3
3
|
import 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Authentication } from './index-
|
|
2
|
-
export { C as Client, e as CreateContactResponsePayload, r as CreateCorrectionResponsePayload, j as CreateLabelResponsePayload, s as CreateResponseResponsePayload, D as DeleteLabelResponsePayload, G as GetContactResponsePayload, f as GetConversationResponsePayload, k as GetLabelResponsePayload, p as GetModelResponsePayload, t as GetSourceResponsePayload, L as ListActionsResponsePayload, b as ListChannelsResponsePayload, c as ListContactsResponsePayload, n as ListConversationMessagesResponsePayload, g as ListConversationsResponsePayload, d as ListLabelContactsResponsePayload, h as ListLabelConversationsResponsePayload, l as ListLabelsResponsePayload, o as ListMessagesResponsePayload, q as ListModelsResponsePayload, u as ListSourcesResponsePayload, O as Options, R as RequestFilterable, a as TransportOptions, S as TransportSendOptions, U as UpdateContactResponsePayload, i as UpdateConversationResponsePayload, m as UpdateLabelResponsePayload, C as default } from './index-
|
|
1
|
+
import { A as Authentication } from './index-Dm8jdpkD.js';
|
|
2
|
+
export { C as Client, e as CreateContactResponsePayload, r as CreateCorrectionResponsePayload, j as CreateLabelResponsePayload, s as CreateResponseResponsePayload, D as DeleteLabelResponsePayload, G as GetContactResponsePayload, f as GetConversationResponsePayload, k as GetLabelResponsePayload, p as GetModelResponsePayload, t as GetSourceResponsePayload, L as ListActionsResponsePayload, b as ListChannelsResponsePayload, c as ListContactsResponsePayload, n as ListConversationMessagesResponsePayload, g as ListConversationsResponsePayload, d as ListLabelContactsResponsePayload, h as ListLabelConversationsResponsePayload, l as ListLabelsResponsePayload, o as ListMessagesResponsePayload, q as ListModelsResponsePayload, u as ListSourcesResponsePayload, O as Options, R as RequestFilterable, a as TransportOptions, S as TransportSendOptions, U as UpdateContactResponsePayload, i as UpdateConversationResponsePayload, m as UpdateLabelResponsePayload, C as default } from './index-Dm8jdpkD.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as y,b as a,c as p,d as n,e as i,f as l,g as f}from"./chunk-
|
|
1
|
+
import{a as y,b as a,c as p,d as n,e as i,f as l,g as f}from"./chunk-2LKRKCHH.js";var t=class s{static DEFAULT_NAME=a;name;#e;constructor({name:e=process.env[i]??s.DEFAULT_NAME,key:r=process.env[n]}={}){if(!r)throw new Error("API Key option must be specified when using Key Authentication");this.name=e,this.#e=r}async filter(e){return{...e,headers:{...e.headers,Authorization:`Basic ${btoa(this.name+":"+this.#e)}`}}}};var o=class{#e;constructor({token:e=process.env[p]}={}){if(!e)throw new Error("Access Token option must be specified when using Token Authentication");this.#e=e}async filter(e){return{...e,headers:{...e.headers,Authorization:`Bearer ${this.#e}`}}}};export{l as Client,y as DEFAULT_SUPPORT_BASE_URL,t as KeyAuthentication,f as PublicAuthentication,o as TokenAuthentication,l as default};
|
package/package.json
CHANGED
package/src/Client/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ import ListActions from "../Action/ListActions.js";
|
|
|
11
11
|
import Authentication from "../Authentication/index.js";
|
|
12
12
|
import ListChannels from "../Channel/ListChannels.js";
|
|
13
13
|
import { DEFAULT_SUPPORT_BASE_URL } from "../constants/index.js";
|
|
14
|
+
import GetContactVCFURL from "../Contact/ContactVCF/GetContactVCF.js";
|
|
14
15
|
import CreateContact from "../Contact/CreateContact.js";
|
|
15
16
|
import GetContact from "../Contact/GetContact.js";
|
|
16
17
|
import ListContacts from "../Contact/ListContacts.js";
|
|
@@ -78,6 +79,9 @@ export default class Client {
|
|
|
78
79
|
list: new ListContacts(this._transport),
|
|
79
80
|
update: new UpdateContact(this._transport),
|
|
80
81
|
create: new CreateContact(this._transport),
|
|
82
|
+
vcf: {
|
|
83
|
+
getURL: new GetContactVCFURL(this._transport),
|
|
84
|
+
},
|
|
81
85
|
};
|
|
82
86
|
}
|
|
83
87
|
|
|
@@ -0,0 +1,24 @@
|
|
|
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 Transport from "../../Transport/index.js";
|
|
11
|
+
|
|
12
|
+
export interface Options {
|
|
13
|
+
id: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default class GetContactVCFURL {
|
|
17
|
+
constructor(protected _transport: Transport) {}
|
|
18
|
+
|
|
19
|
+
public async send({ id }: Options) {
|
|
20
|
+
return this._transport.getURL(
|
|
21
|
+
"v1/contacts/" + encodeURIComponent(id) + "/vcf",
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -17,7 +17,7 @@ export interface Options extends SendOptions {
|
|
|
17
17
|
export default class ListLabelContacts {
|
|
18
18
|
constructor(protected _transport: Transport) {}
|
|
19
19
|
|
|
20
|
-
public async({ id, request = {}, ...options }: Options) {
|
|
20
|
+
public async send({ id, request = {}, ...options }: Options) {
|
|
21
21
|
return this._transport
|
|
22
22
|
.send(
|
|
23
23
|
"v1/labels/" + encodeURIComponent(id) + "/contacts",
|
package/src/Transport/index.ts
CHANGED
|
@@ -43,6 +43,10 @@ export default class Transport {
|
|
|
43
43
|
return request;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
public getURL(url: string | URL): URL {
|
|
47
|
+
return new URL(url, this.options.baseURL);
|
|
48
|
+
}
|
|
49
|
+
|
|
46
50
|
public async send(
|
|
47
51
|
url: string | URL,
|
|
48
52
|
request: RequestInit,
|
|
@@ -50,10 +54,7 @@ export default class Transport {
|
|
|
50
54
|
) {
|
|
51
55
|
// See: https://github.com/node-fetch/node-fetch/issues/481#issuecomment-592491825
|
|
52
56
|
return await fetchAlternative(
|
|
53
|
-
new Request(
|
|
54
|
-
new URL(url, this.options.baseURL),
|
|
55
|
-
await this._filterRequest(request),
|
|
56
|
-
),
|
|
57
|
+
new Request(this.getURL(url), await this._filterRequest(request)),
|
|
57
58
|
);
|
|
58
59
|
}
|
|
59
60
|
}
|
package/dist/chunk-5MVQFIMQ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var dt="https://api.support.greatdetail.com",ut={"X-Powered-By":"GDSupport/JavaScript"},mt="api-key",gt="SUPPORT_ACCESS_TOKEN",ht="SUPPORT_API_KEY",bt="SUPPORT_KEY_NAME";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 N(n))}},N=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 M(n))}},M=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as a}from"zod";var c=class e{constructor(t){this._transport=t}static SCHEMA=a.object({name:a.string(),account:a.string(),emailAddress:a.string().email().optional(),telephoneNumber:a.string().optional()});async send({body:t,request:s={},...n}){return this._transport.send("v1/contacts",{...s,method:"POST",headers:{...s.headers,"Content-Type":"application/json"},body:JSON.stringify(e.SCHEMA.parse(t))},n).then(r=>new D(r))}},D=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:s={},...n}){return this._transport.send("v1/contacts/"+encodeURIComponent(t),{...s,method:"GET"},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/contacts",{...t,method:"GET"},s).then(n=>new z(n))}},z=class{constructor(t){this.response=t}async result(){return this.response.json()}};var l=class{constructor(t){this._transport=t}async({id:t,request:s={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/contacts",{...s,method:"GET"},n).then(r=>new F(r))}},F=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as U}from"zod";var m=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 B(o))}},B=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:s={},...n}){return this._transport.send("v1/conversations/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new J(r))}},J=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/conversations",{...t,method:"GET"},s).then(n=>new K(n))}},K=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:s={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t)+"/conversations",{...s,method:"GET"},n).then(r=>new V(r))}},V=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as lt}from"zod";var y=class e{constructor(t){this._transport=t}static SCHEMA=lt.object({hasEnded:lt.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 Y(o))}},Y=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as L}from"zod";var f=class e{constructor(t){this._transport=t}static SCHEMA=L.object({title:L.string(),description:L.string().optional(),account:L.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 k(r))}},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),{...s,method:"DELETE"},n).then(r=>new W(r))}},W=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:s={},...n}){return this._transport.send("v1/labels/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new X(r))}},X=class{constructor(t){this.response=t}async result(){return this.response.json()}};var S=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/labels",{...t,method:"GET"},s).then(n=>new Q(n))}},Q=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as Z}from"zod";var O=class e{constructor(t){this._transport=t}static SCHEMA=Z.object({title:Z.string().optional(),description:Z.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 $(o))}},$=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:s={},...n}){return this._transport.send("v1/conversations/"+encodeURIComponent(t)+"/messages",{...s,method:"GET"},n).then(r=>new tt(r))}},tt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var _=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/messages",{...t,method:"GET"},s).then(n=>new et(n))}},et=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as j}from"zod";var T=class e{constructor(t){this._transport=t}static SCHEMA=j.object({input:j.string().max(65536),original:j.string().max(65536),correction:j.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 st(o))}},st=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/models/"+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 P=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/models",{...t,method:"GET"},s).then(n=>new rt(n))}},rt=class{constructor(t){this.response=t}async result(){return this.response.json()}};import{z as H}from"zod";var E=class e{constructor(t){this._transport=t}static SCHEMA=H.array(H.object({role:H.enum(["user","assistant"]),content:H.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 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:s={},...n}){return this._transport.send("v1/sources/"+encodeURIComponent(t),{...s,method:"GET"},n).then(r=>new it(r))}},it=class{constructor(t){this.response=t}async result(){return this.response.json()}};var w=class{constructor(t){this._transport=t}async send({request:t={},...s}={}){return this._transport.send("v1/sources",{...t,method:"GET"},s).then(n=>new pt(n))}},pt=class{constructor(t){this.response=t}async result(){return this.response.json()}};var q=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 I=class e{constructor(t=e.STANDARD_HEADERS){this._standardHeaders=t}static STANDARD_HEADERS=ut;async filter(t){return{...t,headers:{...t.headers,...this._standardHeaders}}}};var at=class e{static DEFAULT_BASE_URL=dt;_transport;constructor(t,{baseURL:s,...n}={}){this._transport=new q({requestFilterables:[new I,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 d(this._transport),list:new u(this._transport),update:new m(this._transport),create:new c(this._transport)}}get conversation(){return{get:new g(this._transport),list:new h(this._transport),update:new y(this._transport),message:{list:new A(this._transport)}}}get label(){return{create:new f(this._transport),get:new R(this._transport),list:new S(this._transport),update:new O(this._transport),delete:new x(this._transport),contact:{list:new l(this._transport)},conversation:{list:new b(this._transport)}}}get message(){return{list:new _(this._transport)}}get model(){return{get:new C(this._transport),list:new P(this._transport),response:{create:new E(this._transport)},correction:{create:new T(this._transport)}}}get source(){return{get:new v(this._transport),list:new w(this._transport)}}};var ct=class{async filter(t){return t}};export{dt as a,mt as b,gt as c,ht as d,bt as e,at as f,ct as g};
|