@great-detail/support-sdk 0.41.0 → 0.41.1

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/index.d.ts CHANGED
@@ -9603,7 +9603,7 @@ declare class ModelMCPServerAPI {
9603
9603
  * @see https://greatdetail.com
9604
9604
  */
9605
9605
 
9606
- type NotesFields = "note.content" | "note.account" | "note.conversation" | "note.contact" | "note.createdAt" | "note.updatedAt";
9606
+ type NotesFields = "note.content" | "note.account" | "note.createdByUser" | "note.conversation" | "note.contact" | "note.createdAt" | "note.updatedAt";
9607
9607
  type NoteID = `nte${string}` | (string & NonNullable<unknown>);
9608
9608
  type Note<K extends NotesFields = NotesFields> = FieldsPick<components["schemas"]["Note"], "note.", K, "id">;
9609
9609
 
@@ -10560,7 +10560,7 @@ type ConversationSettingsID = string;
10560
10560
  type ConversationSettings = components["schemas"]["ConversationSettings"];
10561
10561
 
10562
10562
  /** SDK Version */
10563
- declare const SDK_VERSION = "0.41.0";
10563
+ declare const SDK_VERSION = "0.41.1";
10564
10564
  /** API Version */
10565
10565
  declare const API_VERSION = "0.31.0";
10566
10566
 
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import Pe,{HTTPError}from'ky';import {z as z$1}from'zod';import*as Rp from'lexical';var le=Object.defineProperty;var ve=Object.getOwnPropertyDescriptor;var Ie=Object.getOwnPropertyNames;var Oe=Object.prototype.hasOwnProperty;var xe=(s,e)=>{for(var t in e)le(s,t,{get:e[t],enumerable:true});},me=(s,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ie(e))!Oe.call(s,r)&&r!==t&&le(s,r,{get:()=>e[r],enumerable:!(o=ve(e,r))||o.enumerable});return s},ue=(s,e,t)=>(me(s,e,"default"),t);var ae="https://api.support.greatdetail.com",de={"x-powered-by":"GDS/JavaScript"},he="_gds_session";var d=class{constructor(e){this._transport=e;}list({filter:e,fields:t,pagination:o,request:r={}}={}){return this._transport.prepare("v1/accounts",{...r,method:"GET",searchParams:this._transport.query.build({pagination:o,fields:t,filter:e})})}get(e,{fields:t,request:o={}}={}){return this._transport.prepare(`v1/accounts/${encodeURIComponent(e)}`,{...o,method:"GET",searchParams:this._transport.query.build({fields:t})})}update(e,{body:t,request:o={}}){return this._transport.prepare(`v1/accounts/${encodeURIComponent(e)}`,{...o,method:"PATCH",json:t})}create({body:e,request:t={}}){return this._transport.prepare("v1/accounts",{...t,method:"POST",json:e})}delete(e,{request:t={}}={}){return this._transport.prepare(`v1/accounts/${encodeURIComponent(e)}`,{...t,method:"DELETE"})}};var h=class{constructor(e){this._transport=e;}get(e,t,{fields:o,request:r={}}={}){return this._transport.prepare("v1/accounts/"+encodeURIComponent(e)+"/access-tokens/"+encodeURIComponent(t),{...r,method:"GET",searchParams:this._transport.query.build({fields:o})})}list(e,{filter:t,fields:o,pagination:r,request:n={}}={}){return this._transport.prepare("v1/accounts/"+encodeURIComponent(e)+"/access-tokens",{...n,method:"GET",searchParams:this._transport.query.build({pagination:r,filter:t,fields:o})})}delete(e,t,{body:o,request:r={}}={}){return this._transport.prepare("v1/accounts/"+encodeURIComponent(e)+"/access-tokens/"+encodeURIComponent(t),{...r,method:"DELETE",json:o})}create(e,{body:t={},request:o={}}={}){return this._transport.prepare("v1/accounts/"+encodeURIComponent(e)+"/access-tokens",{...o,method:"POST",json:t})}};var C=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare("v1/conversation-sections/accounts/"+encodeURIComponent(e),{...t,method:"GET"})}list({request:e={}}={}){return this._transport.prepare("v1/conversation-sections/accounts",{...e,method:"GET"})}create({body:e,request:t={}}){return this._transport.prepare("v1/conversation-sections/accounts",{...t,method:"POST",json:e})}update(e,{body:t,request:o={}}){return this._transport.prepare("v1/conversation-sections/accounts/"+encodeURIComponent(e),{...o,method:"PATCH",json:t})}delete(e,{request:t={}}={}){return this._transport.prepare("v1/conversation-sections/accounts/"+encodeURIComponent(e),{...t,method:"DELETE"})}};var f=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare("v1/accounts/"+encodeURIComponent(e)+"/conversation-settings",{...t,method:"GET"})}update(e,{body:t,request:o={}}){return this._transport.prepare("v1/accounts/"+encodeURIComponent(e)+"/conversation-settings",{...o,method:"PATCH",json:t})}};var T=class{constructor(e){this._transport=e;}get(e,{fields:t,include:o,request:r={}}={}){return this._transport.prepare(`v1/memberships/accounts/${encodeURIComponent(e)}`,{...r,method:"GET",searchParams:this._transport.query.build({fields:t,include:o})})}list({filter:e,fields:t,pagination:o,include:r,request:n={}}={}){return this._transport.prepare("v1/memberships/accounts",{...n,method:"GET",searchParams:this._transport.query.build({pagination:o,filter:e,fields:t,include:r})})}create({body:e,request:t={}}){return this._transport.prepare("v1/memberships/accounts",{...t,method:"POST",json:e})}delete(e,{request:t={}}={}){return this._transport.prepare(`v1/memberships/accounts/${encodeURIComponent(e)}`,{...t,method:"DELETE"})}};var E=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare("v1/notifications/events/account/"+encodeURIComponent(e),{...t,method:"GET"})}list({filter:e,pagination:t,request:o={}}={}){return this._transport.prepare("v1/notifications/events/account",{...o,method:"GET",searchParams:this._transport.query.build({pagination:t,filter:e})})}update(e,{body:t,request:o={}}){return this._transport.prepare("v1/notifications/events/account/"+encodeURIComponent(e),{...o,method:"PATCH",json:{...t,readAt:t.readAt instanceof Date&&typeof t.readAt.getMonth=="function"?t.readAt.toISOString():t.readAt}})}};var A=class{constructor(e){this._transport=e;}get(e,{fields:t,request:o={}}={}){return this._transport.prepare(`v1/actions/${encodeURIComponent(e)}`,{...o,method:"GET",searchParams:this._transport.query.build({fields:t})})}list({filter:e,fields:t,sort:o,request:r={}}={}){return this._transport.prepare("v1/actions",{...r,method:"GET",searchParams:this._transport.query.build({sort:o,filter:e,fields:t})})}update(e,{body:t,fields:o,request:r={}}){return this._transport.prepare(`v1/actions/${encodeURIComponent(e)}`,{...r,method:"PATCH",searchParams:this._transport.query.build({fields:o}),json:t})}};var Ce="SUPPORT_SESSION_COOKIE",fe="SUPPORT_SESSION_TOKEN",Te="SUPPORT_ACCESS_TOKEN",Ee="SUPPORT_KEY_NAME",Ae="SUPPORT_KEY_PASSWORD",ie="SUPPORT_SIGNING_KEY",Se="SUPPORT_BASE_URL";var l=class{name;#e;constructor({name:e=process.env[Ee],password:t=process.env[Ae]}={}){if(!e)throw new Error("Name option must be specified when using Basic Authentication");if(!t)throw new Error("Password option must be specified when using Basic Authentication");this.name=e,this.#e=t;}getHeaders(){let e=typeof this.name=="function"?this.name():this.name,t=typeof this.#e=="function"?this.#e():this.#e;return {authorization:`Basic ${btoa(e+":"+t)}`}}};var S=class{#e;constructor({token:e=process.env[Te]}={}){if(!e)throw new Error("Access Token option must be specified when using Token Authentication");this.#e=e;}getHeaders(){return {authorization:`Bearer ${typeof this.#e=="function"?this.#e():this.#e}`}}};var g=class{getHeaders(){return {}}};var R=class{method;name;#e;constructor({method:e="header",name:t=process.env[Ce]??he,token:o=process.env[fe]}={}){if(!t)throw new Error("Session Token Cookie Name option must be specified when using Session Authentication");if(!o)throw new Error("Token option must be specified when using Session Authentication");this.method=e,this.name=t,this.#e=o;}getHeaders(){let e=typeof this.name=="function"?this.name():this.name,t=typeof this.#e=="function"?this.#e():this.#e;return this.method==="header"?{authorization:`Bearer ${t}`}:{cookie:`${e}=${encodeURIComponent(t)}`}}};var _=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare("v1/boilerplates/categories/"+encodeURIComponent(e),{...t,method:"GET"})}list({filter:e,pagination:t,include:o,request:r={}}={}){return this._transport.prepare("v1/boilerplates/categories",{...r,method:"GET",searchParams:this._transport.query.build({include:o,pagination:t,filter:e})})}create({body:e,request:t={}}){return this._transport.prepare("v1/boilerplates/categories",{...t,method:"POST",json:e})}update(e,{body:t,request:o={}}){return this._transport.prepare(`v1/boilerplates/categories/${encodeURIComponent(e)}`,{...o,method:"PATCH",json:t})}delete(e,{request:t={}}={}){return this._transport.prepare(`v1/boilerplates/categories/${encodeURIComponent(e)}`,{...t,method:"DELETE"})}};var b=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare("v1/boilerplates/contents/"+encodeURIComponent(e),{...t,method:"GET"})}list({filter:e,pagination:t,request:o={}}={}){return this._transport.prepare("v1/boilerplates/contents",{...o,method:"GET",searchParams:this._transport.query.build({pagination:t,filter:e})})}create({body:e,request:t={}}){return this._transport.prepare("v1/boilerplates/contents",{...t,method:"POST",json:e})}update(e,{body:t,request:o={}}){return this._transport.prepare(`v1/boilerplates/contents/${encodeURIComponent(e)}`,{...o,method:"PATCH",json:t})}delete(e,{request:t={}}={}){return this._transport.prepare(`v1/boilerplates/contents/${encodeURIComponent(e)}`,{...t,method:"DELETE"})}};var v=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare("v1/channels/"+encodeURIComponent(e),{...t,method:"GET"})}list({filter:e,pagination:t,request:o={}}={}){return this._transport.prepare("v1/channels",{...o,method:"GET",searchParams:this._transport.query.build({pagination:t,filter:e})})}update(e,{body:t,request:o={}}){return this._transport.prepare("v1/channels/"+encodeURIComponent(e),{...o,method:"PATCH",json:t})}create({body:e,request:t={}}){return this._transport.prepare("v1/channels",{...t,method:"POST",json:e})}delete(e,{request:t={}}={}){return this._transport.prepare("v1/channels/"+encodeURIComponent(e),{...t,method:"DELETE"})}sendgridChannelSync(e,{body:t,request:o={}}){return this._transport.prepare("v1/channels/"+encodeURIComponent(e)+"/sendgrid/sync",{...o,method:"POST",json:t})}};var I=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare("v1/conversation-sections/channels/"+encodeURIComponent(e),{...t,method:"GET"})}list({filter:e,request:t={}}={}){return this._transport.prepare("v1/conversation-sections/channels",{...t,method:"GET",searchParams:this._transport.query.build({filter:e})})}create({body:e,request:t={}}){return this._transport.prepare("v1/conversation-sections/channels",{...t,method:"POST",json:e})}update(e,{body:t,request:o={}}){return this._transport.prepare("v1/conversation-sections/channels/"+encodeURIComponent(e),{...o,method:"PATCH",json:t})}delete(e,{request:t={}}={}){return this._transport.prepare("v1/conversation-sections/channels/"+encodeURIComponent(e),{...t,method:"DELETE"})}};var O=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare("v1/channels/"+encodeURIComponent(e)+"/conversation-settings",{...t,method:"GET"})}update(e,{body:t,request:o={}}){return this._transport.prepare("v1/channels/"+encodeURIComponent(e)+"/conversation-settings",{...o,method:"PATCH",json:t})}};var x=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare(`v1/composition/sections/${encodeURIComponent(e)}`,{...t,method:"GET"})}list({filter:e,pagination:t,request:o={}}={}){return this._transport.prepare("v1/composition/sections",{...o,method:"GET",searchParams:this._transport.query.build({pagination:t,filter:e})})}create({body:e,request:t={}}){return this._transport.prepare("v1/composition/sections",{...t,method:"POST",json:e})}update(e,{body:t,request:o={}}){return this._transport.prepare(`v1/composition/sections/${encodeURIComponent(e)}`,{...o,method:"PATCH",json:t})}delete(e,{request:t={}}={}){return this._transport.prepare(`v1/composition/sections/${encodeURIComponent(e)}`,{...t,method:"DELETE"})}};var P=class{constructor(e){this._transport=e;}get(e,{include:t,request:o={}}={}){return this._transport.prepare(`v1/contacts/${encodeURIComponent(e)}`,{...o,method:"GET",searchParams:this._transport.query.build({include:t})})}getRelativeVCFURL(e,{vcf:t={}}={}){let o=t.variant??"vcard",r=t.format??(o==="vcard"?"vcf":"json");return "v1/contacts/"+encodeURIComponent(e)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(r)}getVCFURL(e,t={}){return this._transport.getURL(this.getRelativeVCFURL(e,t))}getVCF(e,t={}){return this._transport.prepare(this.getVCFURL(e,t),{method:"GET"})}list({pagination:e,filter:t,sort:o,request:r={}}={}){return this._transport.prepare("v1/contacts",{...r,method:"GET",searchParams:this._transport.query.build({pagination:e,sort:o,filter:t})})}create({body:e,request:t={}}){return this._transport.prepare("v1/contacts",{...t,method:"POST",json:e})}update(e,{body:t,request:o={}}){return this._transport.prepare(`v1/contacts/${encodeURIComponent(e)}`,{...o,method:"PATCH",json:t})}delete(e,{request:t={}}={}){return this._transport.prepare(`v1/contacts/${encodeURIComponent(e)}`,{...t,method:"DELETE"})}merge(e,t,{request:o={}}={}){return this._transport.prepare(`v1/contacts/${encodeURIComponent(e)}/merge`,{...o,method:"POST",json:{contact:t}})}};var M=class{constructor(e){this._transport=e;}create(e,{body:t,request:o={}}){return this._transport.prepare(`v1/contacts/${encodeURIComponent(e)}/labels`,{...o,method:"POST",json:t})}delete(e,t,{request:o={}}={}){return this._transport.prepare(`v1/contacts/${encodeURIComponent(e)}/labels/${encodeURIComponent(t)}`,{...o,method:"DELETE"})}};var y=class{constructor(e){this._transport=e;}get(e,{include:t,fields:o,request:r={}}={}){return this._transport.prepare(`v1/conversations/${encodeURIComponent(e)}`,{...r,method:"GET",searchParams:this._transport.query.build({include:t,fields:o})})}list({filter:e,sort:t,pagination:o,include:r,fields:n,request:a={}}={}){return this._transport.prepare("v1/conversations",{...a,method:"GET",searchParams:this._transport.query.build({sort:t,pagination:o,filter:e,include:r,fields:n})})}create({body:e,request:t={}}){return this._transport.prepare("v1/conversations",{...t,method:"POST",json:e})}update(e,{body:t,request:o={}}){return this._transport.prepare(`v1/conversations/${encodeURIComponent(e)}`,{...o,method:"PATCH",json:t})}delete(e,{request:t={}}={}){return this._transport.prepare(`v1/conversations/${encodeURIComponent(e)}`,{...t,method:"DELETE"})}triggerResponse(e,{request:t={}}={}){return this._transport.prepare(`v1/conversations/${encodeURIComponent(e)}/response`,{...t,method:"POST"})}};var D=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare(`v1/conversation/${encodeURIComponent(e)}/context`,{...t,method:"GET"})}update(e,{body:t,request:o={}}){return this._transport.prepare(`v1/conversation/${encodeURIComponent(e)}/context`,{...o,method:"PATCH",json:t})}};var L=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare("v1/feedback/conversation/"+encodeURIComponent(e),{...t,method:"GET"})}list({pagination:e,filter:t,request:o={}}={}){return this._transport.prepare("v1/feedback/conversation",{...o,method:"GET",searchParams:this._transport.query.build({filter:t,pagination:e})})}create({body:e,request:t={}}){return this._transport.prepare("v1/feedback/conversation",{...t,method:"POST",json:e})}delete(e,{request:t={}}={}){return this._transport.prepare("v1/feedback/conversation/"+encodeURIComponent(e),{...t,method:"DELETE"})}};var U=class{constructor(e){this._transport=e;}create(e,{body:t,request:o={}}){return this._transport.prepare(`v1/conversations/${encodeURIComponent(e)}/labels`,{...o,method:"POST",json:t})}delete(e,t,{request:o={}}={}){return this._transport.prepare(`v1/conversations/${encodeURIComponent(e)}/labels/${encodeURIComponent(t)}`,{...o,method:"DELETE"})}};var N=class{constructor(e){this._transport=e;}get(e,{request:t={},...o}={}){return this._transport.prepare("v1/escalations/"+encodeURIComponent(e),{...t,method:"GET",searchParams:this._transport.query.build(o)})}list({request:e={},...t}={}){return this._transport.prepare("v1/escalations",{...e,method:"GET",searchParams:this._transport.query.build(t)})}create({body:e,request:t={},...o}){return this._transport.prepare("v1/escalations",{...t,method:"POST",searchParams:this._transport.query.build(o),json:e})}delete(e,{request:t={}}={}){return this._transport.prepare(`v1/escalations/${encodeURIComponent(e)}`,{...t,method:"DELETE"})}};var F=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare("v1/imports/"+encodeURIComponent(e),{...t,method:"GET"})}list({pagination:e,filter:t,request:o={}}={}){return this._transport.prepare("v1/imports",{...o,method:"GET",searchParams:this._transport.query.build({filter:t,pagination:e})})}create({body:e,request:t={}}){return this._transport.prepare("v1/imports",{...t,method:"POST",json:e})}delete(e,{body:t,request:o={}}){return this._transport.prepare("v1/imports/"+encodeURIComponent(e),{...o,method:"DELETE",json:t})}};var G=class{constructor(e){this._transport=e;}get(e,{include:t,request:o={}}={}){return this._transport.prepare("v1/integrations/whatsapp/accounts/"+encodeURIComponent(e),{timeout:72e3,...o,method:"GET",searchParams:this._transport.query.build({include:t})})}list({request:e={}}={}){return this._transport.prepare("v1/integrations/whatsapp/accounts",{timeout:72e3,...e,method:"GET"})}};var k=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare("v1/integrations/whatsapp/phone-numbers/"+encodeURIComponent(e)+"/business-profile",{timeout:72e3,...t,method:"GET"})}update(e,{body:t,request:o={}}){return this._transport.prepare("v1/integrations/whatsapp/phone-numbers/"+encodeURIComponent(e)+"/business-profile",{timeout:72e3,...o,method:"PATCH",json:t})}};var W=class{constructor(e){this._transport=e;}get(e,{include:t,request:o={}}={}){return this._transport.prepare("v1/integrations/whatsapp/phone-numbers/"+encodeURIComponent(e),{timeout:72e3,...o,method:"GET",searchParams:this._transport.query.build({include:t})})}list({whatsappAccount:e,channel:t,request:o={}}={}){return this._transport.prepare("v1/integrations/whatsapp/phone-numbers",{timeout:72e3,...o,method:"GET",searchParams:this._transport.query.build({filter:{whatsappAccount:e,channel:t}})})}update(e,{body:t,request:o={}}){return this._transport.prepare("v1/integrations/whatsapp/phone-numbers/"+encodeURIComponent(e),{timeout:72e3,...o,method:"PATCH",json:t})}};var K=class{constructor(e){this._transport=e;}get list(){return this.listByAccount}get get(){return this.getByAccount}get delete(){return this.deleteByAccount}create(e,{body:t,request:o={}}){return this._transport.prepare(`v1/integrations/whatsapp/accounts/${e}/templates`,{timeout:72e3,...o,method:"POST",json:t})}listByAccount(e,{search:t,status:o,quality:r,category:n,language:a,request:p={}}={}){return this._transport.prepare(`v1/integrations/whatsapp/accounts/${e}/templates`,{timeout:72e3,...p,method:"GET",searchParams:this._transport.query.build({filter:{search:t,status:o,quality:r,category:n,language:a}})})}getByAccount(e,t,{request:o={}}={}){return this._transport.prepare(`v1/integrations/whatsapp/accounts/${e}/templates/${t}`,{timeout:72e3,...o,method:"GET"})}deleteByAccount(e,t,{request:o={}}={}){return this._transport.prepare(`v1/integrations/whatsapp/accounts/${e}/templates/${t}`,{timeout:72e3,...o,method:"DELETE"})}};var w=class{constructor(e){this._transport=e;}get(e,{fields:t,request:o={}}={}){return this._transport.prepare("v1/labels/"+encodeURIComponent(e),{...o,method:"GET",searchParams:this._transport.query.build({fields:t})})}list({filter:e,fields:t,pagination:o,include:r,request:n={}}={}){return this._transport.prepare("v1/labels",{...n,method:"GET",searchParams:this._transport.query.build({pagination:o,filter:e,fields:t,include:r})})}create({body:e,request:t={}}){return this._transport.prepare("v1/labels",{...t,method:"POST",json:e})}update(e,{body:t,request:o={}}){return this._transport.prepare("v1/labels/"+encodeURIComponent(e),{...o,method:"PATCH",json:t})}delete(e,{request:t={}}={}){return this._transport.prepare("v1/labels/"+encodeURIComponent(e),{...t,method:"DELETE"})}};var B=class{constructor(e){this._transport=e;}get(e,{fields:t,include:o,request:r={}}={}){return this._transport.prepare(`v1/messages/${encodeURIComponent(e)}`,{...r,method:"GET",searchParams:this._transport.query.build({fields:t,include:o})})}list({filter:e,fields:t,pagination:o,include:r,request:n={}}={}){return this._transport.prepare("v1/messages",{...n,method:"GET",searchParams:this._transport.query.build({pagination:o,include:r,filter:e,fields:t})})}create({body:e,request:t={}}){return this._transport.prepare("v1/messages",{...t,method:"POST",json:e})}update(e,{fields:t,body:o,request:r={}}){return this._transport.prepare(`v1/messages/${encodeURIComponent(e)}`,{...r,method:"PATCH",json:o,searchParams:this._transport.query.build({fields:t})})}delete(e,{request:t={}}={}){return this._transport.prepare(`v1/messages/${encodeURIComponent(e)}`,{...t,method:"DELETE"})}};var q=class{constructor(e){this._transport=e;}create(e,{body:t,request:o={}}){return this._transport.prepare(`v1/messages/${encodeURIComponent(e)}/labels`,{...o,method:"POST",json:t})}delete(e,t,{request:o={}}={}){return this._transport.prepare(`v1/messages/${encodeURIComponent(e)}/labels/${encodeURIComponent(t)}`,{...o,method:"DELETE"})}};var H=class{constructor(e){this._transport=e;}getVersion({request:e={}}={}){return this._transport.prepare("v1/metadata/version",{...e,method:"GET"})}};var j=class{constructor(e){this._transport=e;}get(e,{request:t={},...o}={}){return this._transport.prepare("v1/models/configs/"+encodeURIComponent(e),{...t,method:"GET",searchParams:this._transport.query.build(o)})}list({request:e={},...t}={}){return this._transport.prepare("v1/models/configs",{...e,method:"GET",searchParams:this._transport.query.build(t)})}create({request:e={},body:t,...o}){return this._transport.prepare("v1/models/configs",{...e,method:"POST",searchParams:this._transport.query.build(o),json:t})}update(e,{request:t={},body:o,...r}){return this._transport.prepare("v1/models/configs/"+encodeURIComponent(e),{...t,method:"PATCH",searchParams:this._transport.query.build(r),json:o})}delete(e,{request:t={},...o}={}){return this._transport.prepare("v1/models/configs/"+encodeURIComponent(e),{...t,method:"DELETE",searchParams:this._transport.query.build(o)})}};var V=class{constructor(e){this._transport=e;}get(e,{fields:t,request:o={}}={}){return this._transport.prepare("v1/models/interfaces/"+encodeURIComponent(e),{...o,method:"GET",searchParams:this._transport.query.build({fields:t})})}list({fields:e,request:t={}}={}){return this._transport.prepare("v1/models/interfaces",{...t,method:"GET",searchParams:this._transport.query.build({fields:e})})}};var $=class{constructor(e){this._transport=e;}get(e,{fields:t,request:o={}}={}){return this._transport.prepare("v1/models/mcp/servers/"+encodeURIComponent(e),{...o,method:"GET",searchParams:this._transport.query.build({fields:t})})}list({pagination:e,fields:t,filter:o,request:r={}}={}){return this._transport.prepare("v1/models/mcp/servers",{...r,method:"GET",searchParams:this._transport.query.build({filter:o,fields:t,pagination:e})})}create({body:e,fields:t,request:o={}}){return this._transport.prepare("v1/models/mcp/servers",{...o,method:"POST",json:e,searchParams:this._transport.query.build({fields:t})})}update(e,{body:t,request:o={}}){return this._transport.prepare("v1/models/mcp/servers/"+encodeURIComponent(e),{...o,method:"PATCH",json:t})}delete(e,{request:t={}}={}){return this._transport.prepare("v1/models/mcp/servers/"+encodeURIComponent(e),{...t,method:"DELETE"})}};var Y=class{constructor(e){this._transport=e;}get(e,{fields:t,include:o,request:r={}}={}){return this._transport.prepare("v1/notes/"+encodeURIComponent(e),{...r,method:"GET",searchParams:this._transport.query.build({fields:t,include:o})})}list({filter:e,fields:t,include:o,pagination:r,request:n={}}={}){return this._transport.prepare("v1/notes",{...n,method:"GET",searchParams:this._transport.query.build({filter:e,fields:t,include:o,pagination:r})})}create({body:e,request:t={}}){return this._transport.prepare("v1/notes",{...t,method:"POST",json:e})}update(e,{body:t,request:o={}}){return this._transport.prepare("v1/notes/"+encodeURIComponent(e),{...o,method:"PATCH",json:t})}delete(e,{request:t={}}={}){return this._transport.prepare(`v1/notes/${encodeURIComponent(e)}`,{...t,method:"DELETE"})}};var z=class{constructor(e){this._transport=e;}get(e,{fields:t,include:o,request:r={}}={}){return this._transport.prepare(`v1/representatives/${encodeURIComponent(e)}`,{...r,method:"GET",searchParams:this._transport.query.build({fields:t,include:o})})}list({filter:e,fields:t,include:o,pagination:r,request:n={}}={}){return this._transport.prepare("v1/representatives",{...n,method:"GET",searchParams:this._transport.query.build({filter:e,fields:t,include:o,pagination:r})})}create({fields:e,body:t,request:o={}}){return this._transport.prepare("v1/representatives",{...o,method:"POST",searchParams:this._transport.query.build({fields:e}),json:t})}delete(e,{request:t={}}={}){return this._transport.prepare(`v1/representatives/${encodeURIComponent(e)}`,{...t,method:"DELETE"})}};var Q=class{constructor(e){this._transport=e;}get(e,{fields:t,request:o={}}={}){return this._transport.prepare(`v1/auth/sessions/${encodeURIComponent(e)}`,{...o,method:"GET",searchParams:this._transport.query.build({fields:t})})}create({body:e,request:t={}}){return this._transport.prepare("v1/auth/sessions",{...t,method:"POST",json:e})}};var X=class{constructor(e){this._transport=e;}get(e,{fields:t,request:o={}}={}){return this._transport.prepare("v1/sources/"+encodeURIComponent(e),{...o,method:"GET",searchParams:this._transport.query.build({fields:t})})}list({filter:e,fields:t,request:o={}}={}){return this._transport.prepare("v1/sources",{...o,method:"GET",searchParams:this._transport.query.build({filter:e,fields:t})})}};var J=class{constructor(e){this._transport=e;}getMessageFrequency({filter:e,request:t={}}={}){return this._transport.prepare("v1/statistics/message-frequency",{...t,method:"GET",searchParams:this._transport.query.build({filter:e})})}getChannelMessageFrequency(e,{request:t={}}={}){return this.getMessageFrequency({filter:{channel:e},request:t})}getModelUsage({request:e={}}={}){return this._transport.prepare("v1/statistics/model-usage",{...e,method:"GET"})}};var Z=class extends Error{constructor(t,o,{requestID:r,title:n,body:a,...p}){super(`GDS(ERR): [${t.status}] ${o.method}:${t.url}${n||a?" - ":""}${[n,a].join(" - ")}`,p);this.response=t;this.request=o;this.title=n,this.requestID=r;}title;requestID};function u(s){return typeof s=="function"&&(s=s()),typeof s.toString=="function"?s.toString():typeof s=="string"?s:String(s)}var ee=class s{static _filterSpecialColumns=["filter"];static build({sort:e,pagination:t,filter:o,include:r,fields:n,custom:a}){return [...this.string("filter",o?.filter),...Object.entries(o??{}).flatMap(([p,i])=>s._filterSpecialColumns.includes(p)?[]:this.arrayableDelimitedString(`filter[${p}]`,i)),...this.arrayableDelimitedString("fields",n),...this.arrayableDelimitedString("include",r),...this.arrayableDelimitedString("sort",e?Object.entries(e).map(([p,i])=>{if(i!==void 0)return (i==="desc"?"-":"")+u(p)}).filter(p=>p!==void 0):void 0),...this.paginationCursor(t),...this.string("page[size]",t?.size),...Object.entries(a??{}).flatMap(([p,i])=>this.arrayableString(p,i))]}static null(e){return [[e,"null"]]}static string(e,t){return t===void 0?[]:t===null?this.null(e):[[e,u(t)]]}static arrayableString(e,t,o){if(t===void 0)return [];if(t===null)return this.null(e);let r=Array.isArray(t)?t:[t];if(o!==void 0&&r.length<=0)return [[e,o]];let n=[];for(let a of r)n.push(...this.string(e,a));return n}static arrayableDelimitedString(e,t,o,r=","){if(t===void 0)return [];if(t===null)return this.null(e);let n=this.arrayableString(e,t,o);return [[e,n.map(([,a])=>a).join(r)]]}static paginationCursor({before:e,after:t,preferred:o="after"}={}){let r=[];if(e===void 0&&t===void 0)return r;let n=e?{direction:"before",value:u(e)}:void 0,a=t?{direction:"after",value:u(t)}:void 0,p=o==="after"?a||n:n||a;return p&&r.push([`page[${p.direction}]`,p.value]),r}};var te=class{client;options;query=ee;constructor({baseURL:e,authentication:t,lang:o,...r}){this.options={authentication:t,baseURL:e,lang:o},this.client=Pe.create({prefixUrl:this.options.baseURL,headers:de,timeout:12e3,retry:{jitter:true},...r.request});}getURL(e){return new URL(e,this.options.baseURL).toString()}_generateClientRequestId(){let e="";if(globalThis.crypto&&typeof globalThis.crypto.getRandomValues=="function"){let r=new Uint8Array(21);return globalThis.crypto.getRandomValues(r),e+Array.from(r,n=>n.toString(16).padStart(2,"0")).join("")}if(globalThis.crypto&&typeof globalThis.crypto.randomUUID=="function")return e+globalThis.crypto.randomUUID();let t=Date.now().toString(36),o=Math.random().toString(36).slice(2);return `${e}${t}-${o}`}prepare(e,t){let o=typeof e=="string"?{url:e,...t}:e,r=this._generateClientRequestId(),n=o.authentication??this.options.authentication,a=this.client.extend({headers:{...n.getHeaders(),"x-request-id":r,"correlation-id":r,"accept-language":this.options.lang}}),p=async()=>a(o.url,o).catch(async i=>{if(console.error("FetchTransport Error:",i),i instanceof HTTPError){let ce=await i.response.json();throw new Z(i.response,i.request,{requestID:i.response.headers.get("request-id")??r,cause:i,title:ce?.error?.title,body:ce?.error?.detail})}throw i});return {request:o,response:async()=>p(),json:async()=>await p().then(i=>i.json()),requestID:async()=>(await p()).headers.get("request-id")??r}}};var oe=class{constructor(e){this._transport=e;}get(e,{include:t,fields:o,request:r={}}={}){return this._transport.prepare("v1/uploads/"+encodeURIComponent(e),{...r,method:"GET",searchParams:this._transport.query.build({include:t,fields:o})})}list({filter:e,include:t,fields:o,pagination:r,request:n={}}={}){return this._transport.prepare("v1/uploads",{...n,method:"GET",searchParams:this._transport.query.build({filter:e,include:t,fields:o,pagination:r})})}create({files:e,include:t,request:o={}}){let r=new FormData;for(let n of e)r.append("file",n);return this._transport.prepare("v1/uploads",{...o,method:"POST",searchParams:this._transport.query.build({include:t}),body:r})}delete(e,{request:t={}}={}){return this._transport.prepare("v1/uploads/"+encodeURIComponent(e),{...t,method:"DELETE"})}};var re=class{constructor(e){this._transport=e;}list({filter:e,fields:t,pagination:o,request:r={}}={}){return this._transport.prepare("v1/users",{...r,method:"GET",searchParams:this._transport.query.build({pagination:o,fields:t,filter:e})})}get(e,{fields:t,request:o={}}={}){return this._transport.prepare(`v1/users/${encodeURIComponent(e)}`,{...o,method:"GET",searchParams:this._transport.query.build({fields:t})})}update(e,{body:t,request:o={}}){return this._transport.prepare(`v1/users/${encodeURIComponent(e)}`,{...o,method:"PATCH",json:t})}create({body:e,request:t={}}){return this._transport.prepare("v1/users",{...t,method:"POST",json:e})}delete(e,{request:t={}}={}){return this._transport.prepare(`v1/users/${encodeURIComponent(e)}`,{...t,method:"DELETE"})}};var ge=z$1.object({event:z$1.object({id:z$1.string(),type:z$1.string(),payload:z$1.record(z$1.string(),z$1.string()),createdAt:z$1.iso.datetime()})}),Re=z$1.object({data:z$1.union([ge.transform(s=>[s]),z$1.array(ge)])});var se=class{constructor(e){this._transport=e;}async event({key:e=process.env[ie],maxSignatures:t=3,request:o}){let r=o.headers["gds-signature"];if(e!==false){if(e===void 0)throw new Error("Missing webhook signing key in process.env."+ie);if(!r)throw new Error("Missing signature header");if(!this._verifySignature(e,o.body,Array.isArray(r)?r.slice(0,t):[r]))throw new Error("Untrusted signature")}return Re.parse(o.body)}async _verifySignature(e,t,o){let r=await crypto.subtle.importKey("raw",new TextEncoder().encode(e),{name:"HMAC",hash:"SHA-256"},false,["sign","verify"]);for(let n of o)if(await crypto.subtle.verify("HMAC",r,new TextEncoder().encode(atob(n)),new TextEncoder().encode(JSON.stringify(t))))return true;return false}};var ne=class{constructor(e){this._transport=e;}get(e,{fields:t,request:o={}}={}){return this._transport.prepare("v1/webhooks/subscriptions/"+encodeURIComponent(e),{...o,method:"GET",searchParams:this._transport.query.build({fields:t})})}list({pagination:e,fields:t,filter:o,request:r={}}={}){return this._transport.prepare("v1/webhooks/subscriptions",{...r,method:"GET",searchParams:this._transport.query.build({filter:o,fields:t,pagination:e})})}test(e,{request:t={}}={}){return this._transport.prepare("v1/webhooks/subscriptions/"+encodeURIComponent(e)+"/test",{...t,method:"POST"})}create({body:e,request:t={}}){return this._transport.prepare("v1/webhooks/subscriptions",{...t,method:"POST",json:e})}delete(e,{request:t={}}={}){return this._transport.prepare("v1/webhooks/subscriptions/"+encodeURIComponent(e),{...t,method:"DELETE"})}};var pe=class s{static DEFAULT_BASE_URL=ae;static PublicAuthentication=g;static BasicAuthentication=l;static BearerAuthentication=S;static SessionAuthentication=R;_transport;account;accountAccessToken;accountConversationSection;accountConversationSettings;accountMembership;accountNotificationEvent;action;boilerplateCategory;boilerplateContent;channel;channelConversationSection;channelConversationSettings;compositionSection;contact;contactLabel;conversation;conversationContext;conversationFeedback;conversationLabel;escalation;label;import;integration;message;messageLabel;metadata;modelConfig;modelInterface;modelMCPServer;note;representative;session;source;statistics;user;upload;webhook;webhookSubscription;constructor(e=new l,{baseURL:t,...o}={}){this._transport=new te({authentication:e,...o,baseURL:t?.toString()??s.getBaseURL()}),this.account=new d(this._transport),this.accountAccessToken=new h(this._transport),this.accountConversationSection=new C(this._transport),this.accountConversationSettings=new f(this._transport),this.accountMembership=new T(this._transport),this.accountNotificationEvent=new E(this._transport),this.action=new A(this._transport),this.boilerplateCategory=new _(this._transport),this.boilerplateContent=new b(this._transport),this.channel=new v(this._transport),this.channelConversationSection=new I(this._transport),this.channelConversationSettings=new O(this._transport),this.compositionSection=new x(this._transport),this.contact=new P(this._transport),this.contactLabel=new M(this._transport),this.conversation=new y(this._transport),this.conversationContext=new D(this._transport),this.conversationFeedback=new L(this._transport),this.conversationLabel=new U(this._transport),this.escalation=new N(this._transport),this.label=new w(this._transport),this.import=new F(this._transport),this.integration={whatsapp:{account:new G(this._transport),phoneNumber:new W(this._transport),businessProfile:new k(this._transport),template:new K(this._transport)}},this.message=new B(this._transport),this.messageLabel=new q(this._transport),this.metadata=new H(this._transport),this.modelConfig=new j(this._transport),this.modelInterface=new V(this._transport),this.modelMCPServer=new $(this._transport),this.note=new Y(this._transport),this.representative=new z(this._transport),this.session=new Q(this._transport),this.source=new X(this._transport),this.statistics=new J(this._transport),this.user=new re(this._transport),this.upload=new oe(this._transport),this.webhook=new se(this._transport),this.webhookSubscription=new ne(this._transport);}static getBaseURL(){return process.env[Se]??this.DEFAULT_BASE_URL}$request(e,t){return this._transport.prepare(e,t)}};var _e={};xe(_e,{SupportError:()=>Z});var cr=["POTENTIAL","ACTIVE","DISABLED"];var jr=["TOOL","MCP"],Vr=["POTENTIAL","ACTIVE","COMPLETED","FAILED"];var ds=["ACTIVE","POTENTIAL"];var ws=["CONSUMER","REPRESENTATIVE","ASSISTANT"],Bs=["ACTIVE","BANNED"];var ye=["OPEN","AWAITING_CONTACT","AWAITING_AGENT"],De=["RESOLVED","CLOSED"],Zs=[...ye,...De],en=["HIGH","MEDIUM","LOW"];var bn=["FRESHDESK"],vn=["POTENTIAL","ACTIVE","COMPLETED","FAILED"];new TextEncoder;var Le=["af","sq","ar","ar_EG","ar_AE","ar_LB","ar_MA","ar_QA","az","be_BY","bn","bn_IN","bg","ca","zh_CN","zh_HK","zh_TW","hr","cs","da","prs_AF","nl","nl_BE","en","en_GB","en_US","en_AE","en_AU","en_CA","en_GH","en_IE","en_IN","en_JM","en_MY","en_NZ","en_QA","en_SG","en_UG","en_ZA","et","fil","fi","fr","fr_BE","fr_CA","fr_CH","fr_CI","fr_MA","ka","de","de_AT","de_CH","el","gu","ha","he","hi","hu","id","ga","it","ja","kn","kk","rw_RW","ko","ky_KG","lo","lv","lt","mk","ms","ml","mr","nb","ps_AF","fa","pl","pt_BR","pt_PT","pa","ro","ru","sr","si_LK","sk","sl","es","es_AR","es_CL","es_CO","es_CR","es_DO","es_EC","es_HN","es_MX","es_PA","es_PE","es_ES","es_UY","sw","sv","ta","te","th","th","tr","uk","ur","uz","vi","zu"],Ue=["PENDING","APPROVED","REJECTED","IN_APPEAL","PAUSED","PENDING_DELETION","DELETED","DISABLED","LIMIT_EXCEEDED"],Ne=["GREEN","YELLOW","RED","UNKNOWN"];var Fe=["POSITIONAL","NAMED"];var Ge=["AUTHENTICATION","MARKETING","UTILITY"],ke=["ORDER_DETAILS","ORDER_STATUS"],We=["E_COMMERCE","FINANCIAL_SERVICES"],Ke=["ACCOUNT_UPDATES","CUSTOMER_FEEDBACK","EVENT_REMINDER","FIXED_TEMPLATE_PRICE_TEST","IDENTITY_VERIFICATION","ORDER_MANAGEMENT","PAYMENTS"],we=["ACCOUNT_CREATION_CONFIRMATION","PAYMENT_DUE_REMINDER","FEEDBACK_SURVEY","PAYMENT_ACTION_REQUIRED","SHIPMENT_CONFIRMATION","PAYMENT_OVERDUE","DELIVERY_UPDATE","PAYMENT_CONFIRMATION","ORDER_DELAY","FRAUD_ALERT","DELIVERY_FAILED","AUTO_PAY_REMINDER","DELIVERY_CONFIRMATION","PAYMENT_SCHEDULED","ORDER_PICK_UP","PAYMENT_REJECT_FAIL","ORDER_ACTION_NEEDED","STATEMENT_AVAILABLE","ORDER_CONFIRMATION","LOW_BALANCE_WARNING","ORDER_OR_TRANSACTION_CANCEL","RECEIPT_ATTACHMENT","RETURN_CONFIRMATION","STATEMENT_ATTACHMENT","TRANSACTION_ALERT"],Be=10,be=["QUICK_REPLY","COPY_CODE","URL","PHONE_NUMBER","OTP","MPM","SPM","CATALOG","FLOW","VOICE_CALL","APP"];[...be];var qe=(s=>(s.Audio="audio",s.Contacts="contacts",s.Document="document",s.Image="image",s.Interactive="interactive",s.Location="location",s.Reaction="sticker",s.Sticker="sticker",s.System="system",s.Button="button",s.Order="order",s.Template="template",s.Text="text",s.Video="video",s))(qe||{});var c={};ue(c,Rp);var _p=["TEXT","MEDIA","RICHTEXT","EMAIL","WHATSAPP_TEMPLATE"],bp=["POTENTIAL","SENDING","SENT","RECEIVED","FAILED"],vp=["VISIBLE","PRIVATE"],Ip=["READ","RECEIVED","SENT"];var Jp=["ACTIVE","DISABLED"],Zp=["HTTP_STREAM","HTTP_SSE"];var ba=["POPULAR","SPONSORED","NEW"];var ri="0.41.0",si="0.31.0";var export_LEXICAL_IS_ALL_FORMATTING=c.IS_ALL_FORMATTING;var export_LEXICAL_IS_BOLD=c.IS_BOLD;var export_LEXICAL_IS_CODE=c.IS_CODE;var export_LEXICAL_IS_HIGHLIGHT=c.IS_HIGHLIGHT;var export_LEXICAL_IS_ITALIC=c.IS_ITALIC;var export_LEXICAL_IS_STRIKETHROUGH=c.IS_STRIKETHROUGH;var export_LEXICAL_IS_SUBSCRIPT=c.IS_SUBSCRIPT;var export_LEXICAL_IS_SUPERSCRIPT=c.IS_SUPERSCRIPT;var export_LEXICAL_IS_UNDERLINE=c.IS_UNDERLINE;
1
+ import Pe,{HTTPError}from'ky';import {z as z$1}from'zod';import*as Rp from'lexical';var le=Object.defineProperty;var ve=Object.getOwnPropertyDescriptor;var Ie=Object.getOwnPropertyNames;var Oe=Object.prototype.hasOwnProperty;var xe=(s,e)=>{for(var t in e)le(s,t,{get:e[t],enumerable:true});},me=(s,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ie(e))!Oe.call(s,r)&&r!==t&&le(s,r,{get:()=>e[r],enumerable:!(o=ve(e,r))||o.enumerable});return s},ue=(s,e,t)=>(me(s,e,"default"),t);var ae="https://api.support.greatdetail.com",de={"x-powered-by":"GDS/JavaScript"},he="_gds_session";var d=class{constructor(e){this._transport=e;}list({filter:e,fields:t,pagination:o,request:r={}}={}){return this._transport.prepare("v1/accounts",{...r,method:"GET",searchParams:this._transport.query.build({pagination:o,fields:t,filter:e})})}get(e,{fields:t,request:o={}}={}){return this._transport.prepare(`v1/accounts/${encodeURIComponent(e)}`,{...o,method:"GET",searchParams:this._transport.query.build({fields:t})})}update(e,{body:t,request:o={}}){return this._transport.prepare(`v1/accounts/${encodeURIComponent(e)}`,{...o,method:"PATCH",json:t})}create({body:e,request:t={}}){return this._transport.prepare("v1/accounts",{...t,method:"POST",json:e})}delete(e,{request:t={}}={}){return this._transport.prepare(`v1/accounts/${encodeURIComponent(e)}`,{...t,method:"DELETE"})}};var h=class{constructor(e){this._transport=e;}get(e,t,{fields:o,request:r={}}={}){return this._transport.prepare("v1/accounts/"+encodeURIComponent(e)+"/access-tokens/"+encodeURIComponent(t),{...r,method:"GET",searchParams:this._transport.query.build({fields:o})})}list(e,{filter:t,fields:o,pagination:r,request:n={}}={}){return this._transport.prepare("v1/accounts/"+encodeURIComponent(e)+"/access-tokens",{...n,method:"GET",searchParams:this._transport.query.build({pagination:r,filter:t,fields:o})})}delete(e,t,{body:o,request:r={}}={}){return this._transport.prepare("v1/accounts/"+encodeURIComponent(e)+"/access-tokens/"+encodeURIComponent(t),{...r,method:"DELETE",json:o})}create(e,{body:t={},request:o={}}={}){return this._transport.prepare("v1/accounts/"+encodeURIComponent(e)+"/access-tokens",{...o,method:"POST",json:t})}};var C=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare("v1/conversation-sections/accounts/"+encodeURIComponent(e),{...t,method:"GET"})}list({request:e={}}={}){return this._transport.prepare("v1/conversation-sections/accounts",{...e,method:"GET"})}create({body:e,request:t={}}){return this._transport.prepare("v1/conversation-sections/accounts",{...t,method:"POST",json:e})}update(e,{body:t,request:o={}}){return this._transport.prepare("v1/conversation-sections/accounts/"+encodeURIComponent(e),{...o,method:"PATCH",json:t})}delete(e,{request:t={}}={}){return this._transport.prepare("v1/conversation-sections/accounts/"+encodeURIComponent(e),{...t,method:"DELETE"})}};var f=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare("v1/accounts/"+encodeURIComponent(e)+"/conversation-settings",{...t,method:"GET"})}update(e,{body:t,request:o={}}){return this._transport.prepare("v1/accounts/"+encodeURIComponent(e)+"/conversation-settings",{...o,method:"PATCH",json:t})}};var T=class{constructor(e){this._transport=e;}get(e,{fields:t,include:o,request:r={}}={}){return this._transport.prepare(`v1/memberships/accounts/${encodeURIComponent(e)}`,{...r,method:"GET",searchParams:this._transport.query.build({fields:t,include:o})})}list({filter:e,fields:t,pagination:o,include:r,request:n={}}={}){return this._transport.prepare("v1/memberships/accounts",{...n,method:"GET",searchParams:this._transport.query.build({pagination:o,filter:e,fields:t,include:r})})}create({body:e,request:t={}}){return this._transport.prepare("v1/memberships/accounts",{...t,method:"POST",json:e})}delete(e,{request:t={}}={}){return this._transport.prepare(`v1/memberships/accounts/${encodeURIComponent(e)}`,{...t,method:"DELETE"})}};var E=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare("v1/notifications/events/account/"+encodeURIComponent(e),{...t,method:"GET"})}list({filter:e,pagination:t,request:o={}}={}){return this._transport.prepare("v1/notifications/events/account",{...o,method:"GET",searchParams:this._transport.query.build({pagination:t,filter:e})})}update(e,{body:t,request:o={}}){return this._transport.prepare("v1/notifications/events/account/"+encodeURIComponent(e),{...o,method:"PATCH",json:{...t,readAt:t.readAt instanceof Date&&typeof t.readAt.getMonth=="function"?t.readAt.toISOString():t.readAt}})}};var A=class{constructor(e){this._transport=e;}get(e,{fields:t,request:o={}}={}){return this._transport.prepare(`v1/actions/${encodeURIComponent(e)}`,{...o,method:"GET",searchParams:this._transport.query.build({fields:t})})}list({filter:e,fields:t,sort:o,request:r={}}={}){return this._transport.prepare("v1/actions",{...r,method:"GET",searchParams:this._transport.query.build({sort:o,filter:e,fields:t})})}update(e,{body:t,fields:o,request:r={}}){return this._transport.prepare(`v1/actions/${encodeURIComponent(e)}`,{...r,method:"PATCH",searchParams:this._transport.query.build({fields:o}),json:t})}};var Ce="SUPPORT_SESSION_COOKIE",fe="SUPPORT_SESSION_TOKEN",Te="SUPPORT_ACCESS_TOKEN",Ee="SUPPORT_KEY_NAME",Ae="SUPPORT_KEY_PASSWORD",ie="SUPPORT_SIGNING_KEY",Se="SUPPORT_BASE_URL";var l=class{name;#e;constructor({name:e=process.env[Ee],password:t=process.env[Ae]}={}){if(!e)throw new Error("Name option must be specified when using Basic Authentication");if(!t)throw new Error("Password option must be specified when using Basic Authentication");this.name=e,this.#e=t;}getHeaders(){let e=typeof this.name=="function"?this.name():this.name,t=typeof this.#e=="function"?this.#e():this.#e;return {authorization:`Basic ${btoa(e+":"+t)}`}}};var S=class{#e;constructor({token:e=process.env[Te]}={}){if(!e)throw new Error("Access Token option must be specified when using Token Authentication");this.#e=e;}getHeaders(){return {authorization:`Bearer ${typeof this.#e=="function"?this.#e():this.#e}`}}};var g=class{getHeaders(){return {}}};var R=class{method;name;#e;constructor({method:e="header",name:t=process.env[Ce]??he,token:o=process.env[fe]}={}){if(!t)throw new Error("Session Token Cookie Name option must be specified when using Session Authentication");if(!o)throw new Error("Token option must be specified when using Session Authentication");this.method=e,this.name=t,this.#e=o;}getHeaders(){let e=typeof this.name=="function"?this.name():this.name,t=typeof this.#e=="function"?this.#e():this.#e;return this.method==="header"?{authorization:`Bearer ${t}`}:{cookie:`${e}=${encodeURIComponent(t)}`}}};var _=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare("v1/boilerplates/categories/"+encodeURIComponent(e),{...t,method:"GET"})}list({filter:e,pagination:t,include:o,request:r={}}={}){return this._transport.prepare("v1/boilerplates/categories",{...r,method:"GET",searchParams:this._transport.query.build({include:o,pagination:t,filter:e})})}create({body:e,request:t={}}){return this._transport.prepare("v1/boilerplates/categories",{...t,method:"POST",json:e})}update(e,{body:t,request:o={}}){return this._transport.prepare(`v1/boilerplates/categories/${encodeURIComponent(e)}`,{...o,method:"PATCH",json:t})}delete(e,{request:t={}}={}){return this._transport.prepare(`v1/boilerplates/categories/${encodeURIComponent(e)}`,{...t,method:"DELETE"})}};var b=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare("v1/boilerplates/contents/"+encodeURIComponent(e),{...t,method:"GET"})}list({filter:e,pagination:t,request:o={}}={}){return this._transport.prepare("v1/boilerplates/contents",{...o,method:"GET",searchParams:this._transport.query.build({pagination:t,filter:e})})}create({body:e,request:t={}}){return this._transport.prepare("v1/boilerplates/contents",{...t,method:"POST",json:e})}update(e,{body:t,request:o={}}){return this._transport.prepare(`v1/boilerplates/contents/${encodeURIComponent(e)}`,{...o,method:"PATCH",json:t})}delete(e,{request:t={}}={}){return this._transport.prepare(`v1/boilerplates/contents/${encodeURIComponent(e)}`,{...t,method:"DELETE"})}};var v=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare("v1/channels/"+encodeURIComponent(e),{...t,method:"GET"})}list({filter:e,pagination:t,request:o={}}={}){return this._transport.prepare("v1/channels",{...o,method:"GET",searchParams:this._transport.query.build({pagination:t,filter:e})})}update(e,{body:t,request:o={}}){return this._transport.prepare("v1/channels/"+encodeURIComponent(e),{...o,method:"PATCH",json:t})}create({body:e,request:t={}}){return this._transport.prepare("v1/channels",{...t,method:"POST",json:e})}delete(e,{request:t={}}={}){return this._transport.prepare("v1/channels/"+encodeURIComponent(e),{...t,method:"DELETE"})}sendgridChannelSync(e,{body:t,request:o={}}){return this._transport.prepare("v1/channels/"+encodeURIComponent(e)+"/sendgrid/sync",{...o,method:"POST",json:t})}};var I=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare("v1/conversation-sections/channels/"+encodeURIComponent(e),{...t,method:"GET"})}list({filter:e,request:t={}}={}){return this._transport.prepare("v1/conversation-sections/channels",{...t,method:"GET",searchParams:this._transport.query.build({filter:e})})}create({body:e,request:t={}}){return this._transport.prepare("v1/conversation-sections/channels",{...t,method:"POST",json:e})}update(e,{body:t,request:o={}}){return this._transport.prepare("v1/conversation-sections/channels/"+encodeURIComponent(e),{...o,method:"PATCH",json:t})}delete(e,{request:t={}}={}){return this._transport.prepare("v1/conversation-sections/channels/"+encodeURIComponent(e),{...t,method:"DELETE"})}};var O=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare("v1/channels/"+encodeURIComponent(e)+"/conversation-settings",{...t,method:"GET"})}update(e,{body:t,request:o={}}){return this._transport.prepare("v1/channels/"+encodeURIComponent(e)+"/conversation-settings",{...o,method:"PATCH",json:t})}};var x=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare(`v1/composition/sections/${encodeURIComponent(e)}`,{...t,method:"GET"})}list({filter:e,pagination:t,request:o={}}={}){return this._transport.prepare("v1/composition/sections",{...o,method:"GET",searchParams:this._transport.query.build({pagination:t,filter:e})})}create({body:e,request:t={}}){return this._transport.prepare("v1/composition/sections",{...t,method:"POST",json:e})}update(e,{body:t,request:o={}}){return this._transport.prepare(`v1/composition/sections/${encodeURIComponent(e)}`,{...o,method:"PATCH",json:t})}delete(e,{request:t={}}={}){return this._transport.prepare(`v1/composition/sections/${encodeURIComponent(e)}`,{...t,method:"DELETE"})}};var P=class{constructor(e){this._transport=e;}get(e,{include:t,request:o={}}={}){return this._transport.prepare(`v1/contacts/${encodeURIComponent(e)}`,{...o,method:"GET",searchParams:this._transport.query.build({include:t})})}getRelativeVCFURL(e,{vcf:t={}}={}){let o=t.variant??"vcard",r=t.format??(o==="vcard"?"vcf":"json");return "v1/contacts/"+encodeURIComponent(e)+"/vcf?variant="+encodeURIComponent(o)+"&format="+encodeURIComponent(r)}getVCFURL(e,t={}){return this._transport.getURL(this.getRelativeVCFURL(e,t))}getVCF(e,t={}){return this._transport.prepare(this.getVCFURL(e,t),{method:"GET"})}list({pagination:e,filter:t,sort:o,request:r={}}={}){return this._transport.prepare("v1/contacts",{...r,method:"GET",searchParams:this._transport.query.build({pagination:e,sort:o,filter:t})})}create({body:e,request:t={}}){return this._transport.prepare("v1/contacts",{...t,method:"POST",json:e})}update(e,{body:t,request:o={}}){return this._transport.prepare(`v1/contacts/${encodeURIComponent(e)}`,{...o,method:"PATCH",json:t})}delete(e,{request:t={}}={}){return this._transport.prepare(`v1/contacts/${encodeURIComponent(e)}`,{...t,method:"DELETE"})}merge(e,t,{request:o={}}={}){return this._transport.prepare(`v1/contacts/${encodeURIComponent(e)}/merge`,{...o,method:"POST",json:{contact:t}})}};var M=class{constructor(e){this._transport=e;}create(e,{body:t,request:o={}}){return this._transport.prepare(`v1/contacts/${encodeURIComponent(e)}/labels`,{...o,method:"POST",json:t})}delete(e,t,{request:o={}}={}){return this._transport.prepare(`v1/contacts/${encodeURIComponent(e)}/labels/${encodeURIComponent(t)}`,{...o,method:"DELETE"})}};var y=class{constructor(e){this._transport=e;}get(e,{include:t,fields:o,request:r={}}={}){return this._transport.prepare(`v1/conversations/${encodeURIComponent(e)}`,{...r,method:"GET",searchParams:this._transport.query.build({include:t,fields:o})})}list({filter:e,sort:t,pagination:o,include:r,fields:n,request:a={}}={}){return this._transport.prepare("v1/conversations",{...a,method:"GET",searchParams:this._transport.query.build({sort:t,pagination:o,filter:e,include:r,fields:n})})}create({body:e,request:t={}}){return this._transport.prepare("v1/conversations",{...t,method:"POST",json:e})}update(e,{body:t,request:o={}}){return this._transport.prepare(`v1/conversations/${encodeURIComponent(e)}`,{...o,method:"PATCH",json:t})}delete(e,{request:t={}}={}){return this._transport.prepare(`v1/conversations/${encodeURIComponent(e)}`,{...t,method:"DELETE"})}triggerResponse(e,{request:t={}}={}){return this._transport.prepare(`v1/conversations/${encodeURIComponent(e)}/response`,{...t,method:"POST"})}};var D=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare(`v1/conversation/${encodeURIComponent(e)}/context`,{...t,method:"GET"})}update(e,{body:t,request:o={}}){return this._transport.prepare(`v1/conversation/${encodeURIComponent(e)}/context`,{...o,method:"PATCH",json:t})}};var L=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare("v1/feedback/conversation/"+encodeURIComponent(e),{...t,method:"GET"})}list({pagination:e,filter:t,request:o={}}={}){return this._transport.prepare("v1/feedback/conversation",{...o,method:"GET",searchParams:this._transport.query.build({filter:t,pagination:e})})}create({body:e,request:t={}}){return this._transport.prepare("v1/feedback/conversation",{...t,method:"POST",json:e})}delete(e,{request:t={}}={}){return this._transport.prepare("v1/feedback/conversation/"+encodeURIComponent(e),{...t,method:"DELETE"})}};var U=class{constructor(e){this._transport=e;}create(e,{body:t,request:o={}}){return this._transport.prepare(`v1/conversations/${encodeURIComponent(e)}/labels`,{...o,method:"POST",json:t})}delete(e,t,{request:o={}}={}){return this._transport.prepare(`v1/conversations/${encodeURIComponent(e)}/labels/${encodeURIComponent(t)}`,{...o,method:"DELETE"})}};var N=class{constructor(e){this._transport=e;}get(e,{request:t={},...o}={}){return this._transport.prepare("v1/escalations/"+encodeURIComponent(e),{...t,method:"GET",searchParams:this._transport.query.build(o)})}list({request:e={},...t}={}){return this._transport.prepare("v1/escalations",{...e,method:"GET",searchParams:this._transport.query.build(t)})}create({body:e,request:t={},...o}){return this._transport.prepare("v1/escalations",{...t,method:"POST",searchParams:this._transport.query.build(o),json:e})}delete(e,{request:t={}}={}){return this._transport.prepare(`v1/escalations/${encodeURIComponent(e)}`,{...t,method:"DELETE"})}};var F=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare("v1/imports/"+encodeURIComponent(e),{...t,method:"GET"})}list({pagination:e,filter:t,request:o={}}={}){return this._transport.prepare("v1/imports",{...o,method:"GET",searchParams:this._transport.query.build({filter:t,pagination:e})})}create({body:e,request:t={}}){return this._transport.prepare("v1/imports",{...t,method:"POST",json:e})}delete(e,{body:t,request:o={}}){return this._transport.prepare("v1/imports/"+encodeURIComponent(e),{...o,method:"DELETE",json:t})}};var G=class{constructor(e){this._transport=e;}get(e,{include:t,request:o={}}={}){return this._transport.prepare("v1/integrations/whatsapp/accounts/"+encodeURIComponent(e),{timeout:72e3,...o,method:"GET",searchParams:this._transport.query.build({include:t})})}list({request:e={}}={}){return this._transport.prepare("v1/integrations/whatsapp/accounts",{timeout:72e3,...e,method:"GET"})}};var k=class{constructor(e){this._transport=e;}get(e,{request:t={}}={}){return this._transport.prepare("v1/integrations/whatsapp/phone-numbers/"+encodeURIComponent(e)+"/business-profile",{timeout:72e3,...t,method:"GET"})}update(e,{body:t,request:o={}}){return this._transport.prepare("v1/integrations/whatsapp/phone-numbers/"+encodeURIComponent(e)+"/business-profile",{timeout:72e3,...o,method:"PATCH",json:t})}};var W=class{constructor(e){this._transport=e;}get(e,{include:t,request:o={}}={}){return this._transport.prepare("v1/integrations/whatsapp/phone-numbers/"+encodeURIComponent(e),{timeout:72e3,...o,method:"GET",searchParams:this._transport.query.build({include:t})})}list({whatsappAccount:e,channel:t,request:o={}}={}){return this._transport.prepare("v1/integrations/whatsapp/phone-numbers",{timeout:72e3,...o,method:"GET",searchParams:this._transport.query.build({filter:{whatsappAccount:e,channel:t}})})}update(e,{body:t,request:o={}}){return this._transport.prepare("v1/integrations/whatsapp/phone-numbers/"+encodeURIComponent(e),{timeout:72e3,...o,method:"PATCH",json:t})}};var K=class{constructor(e){this._transport=e;}get list(){return this.listByAccount}get get(){return this.getByAccount}get delete(){return this.deleteByAccount}create(e,{body:t,request:o={}}){return this._transport.prepare(`v1/integrations/whatsapp/accounts/${e}/templates`,{timeout:72e3,...o,method:"POST",json:t})}listByAccount(e,{search:t,status:o,quality:r,category:n,language:a,request:p={}}={}){return this._transport.prepare(`v1/integrations/whatsapp/accounts/${e}/templates`,{timeout:72e3,...p,method:"GET",searchParams:this._transport.query.build({filter:{search:t,status:o,quality:r,category:n,language:a}})})}getByAccount(e,t,{request:o={}}={}){return this._transport.prepare(`v1/integrations/whatsapp/accounts/${e}/templates/${t}`,{timeout:72e3,...o,method:"GET"})}deleteByAccount(e,t,{request:o={}}={}){return this._transport.prepare(`v1/integrations/whatsapp/accounts/${e}/templates/${t}`,{timeout:72e3,...o,method:"DELETE"})}};var w=class{constructor(e){this._transport=e;}get(e,{fields:t,request:o={}}={}){return this._transport.prepare("v1/labels/"+encodeURIComponent(e),{...o,method:"GET",searchParams:this._transport.query.build({fields:t})})}list({filter:e,fields:t,pagination:o,include:r,request:n={}}={}){return this._transport.prepare("v1/labels",{...n,method:"GET",searchParams:this._transport.query.build({pagination:o,filter:e,fields:t,include:r})})}create({body:e,request:t={}}){return this._transport.prepare("v1/labels",{...t,method:"POST",json:e})}update(e,{body:t,request:o={}}){return this._transport.prepare("v1/labels/"+encodeURIComponent(e),{...o,method:"PATCH",json:t})}delete(e,{request:t={}}={}){return this._transport.prepare("v1/labels/"+encodeURIComponent(e),{...t,method:"DELETE"})}};var B=class{constructor(e){this._transport=e;}get(e,{fields:t,include:o,request:r={}}={}){return this._transport.prepare(`v1/messages/${encodeURIComponent(e)}`,{...r,method:"GET",searchParams:this._transport.query.build({fields:t,include:o})})}list({filter:e,fields:t,pagination:o,include:r,request:n={}}={}){return this._transport.prepare("v1/messages",{...n,method:"GET",searchParams:this._transport.query.build({pagination:o,include:r,filter:e,fields:t})})}create({body:e,request:t={}}){return this._transport.prepare("v1/messages",{...t,method:"POST",json:e})}update(e,{fields:t,body:o,request:r={}}){return this._transport.prepare(`v1/messages/${encodeURIComponent(e)}`,{...r,method:"PATCH",json:o,searchParams:this._transport.query.build({fields:t})})}delete(e,{request:t={}}={}){return this._transport.prepare(`v1/messages/${encodeURIComponent(e)}`,{...t,method:"DELETE"})}};var q=class{constructor(e){this._transport=e;}create(e,{body:t,request:o={}}){return this._transport.prepare(`v1/messages/${encodeURIComponent(e)}/labels`,{...o,method:"POST",json:t})}delete(e,t,{request:o={}}={}){return this._transport.prepare(`v1/messages/${encodeURIComponent(e)}/labels/${encodeURIComponent(t)}`,{...o,method:"DELETE"})}};var H=class{constructor(e){this._transport=e;}getVersion({request:e={}}={}){return this._transport.prepare("v1/metadata/version",{...e,method:"GET"})}};var j=class{constructor(e){this._transport=e;}get(e,{request:t={},...o}={}){return this._transport.prepare("v1/models/configs/"+encodeURIComponent(e),{...t,method:"GET",searchParams:this._transport.query.build(o)})}list({request:e={},...t}={}){return this._transport.prepare("v1/models/configs",{...e,method:"GET",searchParams:this._transport.query.build(t)})}create({request:e={},body:t,...o}){return this._transport.prepare("v1/models/configs",{...e,method:"POST",searchParams:this._transport.query.build(o),json:t})}update(e,{request:t={},body:o,...r}){return this._transport.prepare("v1/models/configs/"+encodeURIComponent(e),{...t,method:"PATCH",searchParams:this._transport.query.build(r),json:o})}delete(e,{request:t={},...o}={}){return this._transport.prepare("v1/models/configs/"+encodeURIComponent(e),{...t,method:"DELETE",searchParams:this._transport.query.build(o)})}};var V=class{constructor(e){this._transport=e;}get(e,{fields:t,request:o={}}={}){return this._transport.prepare("v1/models/interfaces/"+encodeURIComponent(e),{...o,method:"GET",searchParams:this._transport.query.build({fields:t})})}list({fields:e,request:t={}}={}){return this._transport.prepare("v1/models/interfaces",{...t,method:"GET",searchParams:this._transport.query.build({fields:e})})}};var $=class{constructor(e){this._transport=e;}get(e,{fields:t,request:o={}}={}){return this._transport.prepare("v1/models/mcp/servers/"+encodeURIComponent(e),{...o,method:"GET",searchParams:this._transport.query.build({fields:t})})}list({pagination:e,fields:t,filter:o,request:r={}}={}){return this._transport.prepare("v1/models/mcp/servers",{...r,method:"GET",searchParams:this._transport.query.build({filter:o,fields:t,pagination:e})})}create({body:e,fields:t,request:o={}}){return this._transport.prepare("v1/models/mcp/servers",{...o,method:"POST",json:e,searchParams:this._transport.query.build({fields:t})})}update(e,{body:t,request:o={}}){return this._transport.prepare("v1/models/mcp/servers/"+encodeURIComponent(e),{...o,method:"PATCH",json:t})}delete(e,{request:t={}}={}){return this._transport.prepare("v1/models/mcp/servers/"+encodeURIComponent(e),{...t,method:"DELETE"})}};var Y=class{constructor(e){this._transport=e;}get(e,{fields:t,include:o,request:r={}}={}){return this._transport.prepare("v1/notes/"+encodeURIComponent(e),{...r,method:"GET",searchParams:this._transport.query.build({fields:t,include:o})})}list({filter:e,fields:t,include:o,pagination:r,request:n={}}={}){return this._transport.prepare("v1/notes",{...n,method:"GET",searchParams:this._transport.query.build({filter:e,fields:t,include:o,pagination:r})})}create({body:e,request:t={}}){return this._transport.prepare("v1/notes",{...t,method:"POST",json:e})}update(e,{body:t,request:o={}}){return this._transport.prepare("v1/notes/"+encodeURIComponent(e),{...o,method:"PATCH",json:t})}delete(e,{request:t={}}={}){return this._transport.prepare(`v1/notes/${encodeURIComponent(e)}`,{...t,method:"DELETE"})}};var z=class{constructor(e){this._transport=e;}get(e,{fields:t,include:o,request:r={}}={}){return this._transport.prepare(`v1/representatives/${encodeURIComponent(e)}`,{...r,method:"GET",searchParams:this._transport.query.build({fields:t,include:o})})}list({filter:e,fields:t,include:o,pagination:r,request:n={}}={}){return this._transport.prepare("v1/representatives",{...n,method:"GET",searchParams:this._transport.query.build({filter:e,fields:t,include:o,pagination:r})})}create({fields:e,body:t,request:o={}}){return this._transport.prepare("v1/representatives",{...o,method:"POST",searchParams:this._transport.query.build({fields:e}),json:t})}delete(e,{request:t={}}={}){return this._transport.prepare(`v1/representatives/${encodeURIComponent(e)}`,{...t,method:"DELETE"})}};var Q=class{constructor(e){this._transport=e;}get(e,{fields:t,request:o={}}={}){return this._transport.prepare(`v1/auth/sessions/${encodeURIComponent(e)}`,{...o,method:"GET",searchParams:this._transport.query.build({fields:t})})}create({body:e,request:t={}}){return this._transport.prepare("v1/auth/sessions",{...t,method:"POST",json:e})}};var X=class{constructor(e){this._transport=e;}get(e,{fields:t,request:o={}}={}){return this._transport.prepare("v1/sources/"+encodeURIComponent(e),{...o,method:"GET",searchParams:this._transport.query.build({fields:t})})}list({filter:e,fields:t,request:o={}}={}){return this._transport.prepare("v1/sources",{...o,method:"GET",searchParams:this._transport.query.build({filter:e,fields:t})})}};var J=class{constructor(e){this._transport=e;}getMessageFrequency({filter:e,request:t={}}={}){return this._transport.prepare("v1/statistics/message-frequency",{...t,method:"GET",searchParams:this._transport.query.build({filter:e})})}getChannelMessageFrequency(e,{request:t={}}={}){return this.getMessageFrequency({filter:{channel:e},request:t})}getModelUsage({request:e={}}={}){return this._transport.prepare("v1/statistics/model-usage",{...e,method:"GET"})}};var Z=class extends Error{constructor(t,o,{requestID:r,title:n,body:a,...p}){super(`GDS(ERR): [${t.status}] ${o.method}:${t.url}${n||a?" - ":""}${[n,a].join(" - ")}`,p);this.response=t;this.request=o;this.title=n,this.requestID=r;}title;requestID};function u(s){return typeof s=="function"&&(s=s()),typeof s.toString=="function"?s.toString():typeof s=="string"?s:String(s)}var ee=class s{static _filterSpecialColumns=["filter"];static build({sort:e,pagination:t,filter:o,include:r,fields:n,custom:a}){return [...this.string("filter",o?.filter),...Object.entries(o??{}).flatMap(([p,i])=>s._filterSpecialColumns.includes(p)?[]:this.arrayableDelimitedString(`filter[${p}]`,i)),...this.arrayableDelimitedString("fields",n),...this.arrayableDelimitedString("include",r),...this.arrayableDelimitedString("sort",e?Object.entries(e).map(([p,i])=>{if(i!==void 0)return (i==="desc"?"-":"")+u(p)}).filter(p=>p!==void 0):void 0),...this.paginationCursor(t),...this.string("page[size]",t?.size),...Object.entries(a??{}).flatMap(([p,i])=>this.arrayableString(p,i))]}static null(e){return [[e,"null"]]}static string(e,t){return t===void 0?[]:t===null?this.null(e):[[e,u(t)]]}static arrayableString(e,t,o){if(t===void 0)return [];if(t===null)return this.null(e);let r=Array.isArray(t)?t:[t];if(o!==void 0&&r.length<=0)return [[e,o]];let n=[];for(let a of r)n.push(...this.string(e,a));return n}static arrayableDelimitedString(e,t,o,r=","){if(t===void 0)return [];if(t===null)return this.null(e);let n=this.arrayableString(e,t,o);return [[e,n.map(([,a])=>a).join(r)]]}static paginationCursor({before:e,after:t,preferred:o="after"}={}){let r=[];if(e===void 0&&t===void 0)return r;let n=e?{direction:"before",value:u(e)}:void 0,a=t?{direction:"after",value:u(t)}:void 0,p=o==="after"?a||n:n||a;return p&&r.push([`page[${p.direction}]`,p.value]),r}};var te=class{client;options;query=ee;constructor({baseURL:e,authentication:t,lang:o,...r}){this.options={authentication:t,baseURL:e,lang:o},this.client=Pe.create({prefixUrl:this.options.baseURL,headers:de,timeout:12e3,retry:{jitter:true},...r.request});}getURL(e){return new URL(e,this.options.baseURL).toString()}_generateClientRequestId(){let e="";if(globalThis.crypto&&typeof globalThis.crypto.getRandomValues=="function"){let r=new Uint8Array(21);return globalThis.crypto.getRandomValues(r),e+Array.from(r,n=>n.toString(16).padStart(2,"0")).join("")}if(globalThis.crypto&&typeof globalThis.crypto.randomUUID=="function")return e+globalThis.crypto.randomUUID();let t=Date.now().toString(36),o=Math.random().toString(36).slice(2);return `${e}${t}-${o}`}prepare(e,t){let o=typeof e=="string"?{url:e,...t}:e,r=this._generateClientRequestId(),n=o.authentication??this.options.authentication,a=this.client.extend({headers:{...n.getHeaders(),"x-request-id":r,"correlation-id":r,"accept-language":this.options.lang}}),p=async()=>a(o.url,o).catch(async i=>{if(console.error("FetchTransport Error:",i),i instanceof HTTPError){let ce=await i.response.json();throw new Z(i.response,i.request,{requestID:i.response.headers.get("request-id")??r,cause:i,title:ce?.error?.title,body:ce?.error?.detail})}throw i});return {request:o,response:async()=>p(),json:async()=>await p().then(i=>i.json()),requestID:async()=>(await p()).headers.get("request-id")??r}}};var oe=class{constructor(e){this._transport=e;}get(e,{include:t,fields:o,request:r={}}={}){return this._transport.prepare("v1/uploads/"+encodeURIComponent(e),{...r,method:"GET",searchParams:this._transport.query.build({include:t,fields:o})})}list({filter:e,include:t,fields:o,pagination:r,request:n={}}={}){return this._transport.prepare("v1/uploads",{...n,method:"GET",searchParams:this._transport.query.build({filter:e,include:t,fields:o,pagination:r})})}create({files:e,include:t,request:o={}}){let r=new FormData;for(let n of e)r.append("file",n);return this._transport.prepare("v1/uploads",{...o,method:"POST",searchParams:this._transport.query.build({include:t}),body:r})}delete(e,{request:t={}}={}){return this._transport.prepare("v1/uploads/"+encodeURIComponent(e),{...t,method:"DELETE"})}};var re=class{constructor(e){this._transport=e;}list({filter:e,fields:t,pagination:o,request:r={}}={}){return this._transport.prepare("v1/users",{...r,method:"GET",searchParams:this._transport.query.build({pagination:o,fields:t,filter:e})})}get(e,{fields:t,request:o={}}={}){return this._transport.prepare(`v1/users/${encodeURIComponent(e)}`,{...o,method:"GET",searchParams:this._transport.query.build({fields:t})})}update(e,{body:t,request:o={}}){return this._transport.prepare(`v1/users/${encodeURIComponent(e)}`,{...o,method:"PATCH",json:t})}create({body:e,request:t={}}){return this._transport.prepare("v1/users",{...t,method:"POST",json:e})}delete(e,{request:t={}}={}){return this._transport.prepare(`v1/users/${encodeURIComponent(e)}`,{...t,method:"DELETE"})}};var ge=z$1.object({event:z$1.object({id:z$1.string(),type:z$1.string(),payload:z$1.record(z$1.string(),z$1.string()),createdAt:z$1.iso.datetime()})}),Re=z$1.object({data:z$1.union([ge.transform(s=>[s]),z$1.array(ge)])});var se=class{constructor(e){this._transport=e;}async event({key:e=process.env[ie],maxSignatures:t=3,request:o}){let r=o.headers["gds-signature"];if(e!==false){if(e===void 0)throw new Error("Missing webhook signing key in process.env."+ie);if(!r)throw new Error("Missing signature header");if(!this._verifySignature(e,o.body,Array.isArray(r)?r.slice(0,t):[r]))throw new Error("Untrusted signature")}return Re.parse(o.body)}async _verifySignature(e,t,o){let r=await crypto.subtle.importKey("raw",new TextEncoder().encode(e),{name:"HMAC",hash:"SHA-256"},false,["sign","verify"]);for(let n of o)if(await crypto.subtle.verify("HMAC",r,new TextEncoder().encode(atob(n)),new TextEncoder().encode(JSON.stringify(t))))return true;return false}};var ne=class{constructor(e){this._transport=e;}get(e,{fields:t,request:o={}}={}){return this._transport.prepare("v1/webhooks/subscriptions/"+encodeURIComponent(e),{...o,method:"GET",searchParams:this._transport.query.build({fields:t})})}list({pagination:e,fields:t,filter:o,request:r={}}={}){return this._transport.prepare("v1/webhooks/subscriptions",{...r,method:"GET",searchParams:this._transport.query.build({filter:o,fields:t,pagination:e})})}test(e,{request:t={}}={}){return this._transport.prepare("v1/webhooks/subscriptions/"+encodeURIComponent(e)+"/test",{...t,method:"POST"})}create({body:e,request:t={}}){return this._transport.prepare("v1/webhooks/subscriptions",{...t,method:"POST",json:e})}delete(e,{request:t={}}={}){return this._transport.prepare("v1/webhooks/subscriptions/"+encodeURIComponent(e),{...t,method:"DELETE"})}};var pe=class s{static DEFAULT_BASE_URL=ae;static PublicAuthentication=g;static BasicAuthentication=l;static BearerAuthentication=S;static SessionAuthentication=R;_transport;account;accountAccessToken;accountConversationSection;accountConversationSettings;accountMembership;accountNotificationEvent;action;boilerplateCategory;boilerplateContent;channel;channelConversationSection;channelConversationSettings;compositionSection;contact;contactLabel;conversation;conversationContext;conversationFeedback;conversationLabel;escalation;label;import;integration;message;messageLabel;metadata;modelConfig;modelInterface;modelMCPServer;note;representative;session;source;statistics;user;upload;webhook;webhookSubscription;constructor(e=new l,{baseURL:t,...o}={}){this._transport=new te({authentication:e,...o,baseURL:t?.toString()??s.getBaseURL()}),this.account=new d(this._transport),this.accountAccessToken=new h(this._transport),this.accountConversationSection=new C(this._transport),this.accountConversationSettings=new f(this._transport),this.accountMembership=new T(this._transport),this.accountNotificationEvent=new E(this._transport),this.action=new A(this._transport),this.boilerplateCategory=new _(this._transport),this.boilerplateContent=new b(this._transport),this.channel=new v(this._transport),this.channelConversationSection=new I(this._transport),this.channelConversationSettings=new O(this._transport),this.compositionSection=new x(this._transport),this.contact=new P(this._transport),this.contactLabel=new M(this._transport),this.conversation=new y(this._transport),this.conversationContext=new D(this._transport),this.conversationFeedback=new L(this._transport),this.conversationLabel=new U(this._transport),this.escalation=new N(this._transport),this.label=new w(this._transport),this.import=new F(this._transport),this.integration={whatsapp:{account:new G(this._transport),phoneNumber:new W(this._transport),businessProfile:new k(this._transport),template:new K(this._transport)}},this.message=new B(this._transport),this.messageLabel=new q(this._transport),this.metadata=new H(this._transport),this.modelConfig=new j(this._transport),this.modelInterface=new V(this._transport),this.modelMCPServer=new $(this._transport),this.note=new Y(this._transport),this.representative=new z(this._transport),this.session=new Q(this._transport),this.source=new X(this._transport),this.statistics=new J(this._transport),this.user=new re(this._transport),this.upload=new oe(this._transport),this.webhook=new se(this._transport),this.webhookSubscription=new ne(this._transport);}static getBaseURL(){return process.env[Se]??this.DEFAULT_BASE_URL}$request(e,t){return this._transport.prepare(e,t)}};var _e={};xe(_e,{SupportError:()=>Z});var cr=["POTENTIAL","ACTIVE","DISABLED"];var jr=["TOOL","MCP"],Vr=["POTENTIAL","ACTIVE","COMPLETED","FAILED"];var ds=["ACTIVE","POTENTIAL"];var ws=["CONSUMER","REPRESENTATIVE","ASSISTANT"],Bs=["ACTIVE","BANNED"];var ye=["OPEN","AWAITING_CONTACT","AWAITING_AGENT"],De=["RESOLVED","CLOSED"],Zs=[...ye,...De],en=["HIGH","MEDIUM","LOW"];var bn=["FRESHDESK"],vn=["POTENTIAL","ACTIVE","COMPLETED","FAILED"];new TextEncoder;var Le=["af","sq","ar","ar_EG","ar_AE","ar_LB","ar_MA","ar_QA","az","be_BY","bn","bn_IN","bg","ca","zh_CN","zh_HK","zh_TW","hr","cs","da","prs_AF","nl","nl_BE","en","en_GB","en_US","en_AE","en_AU","en_CA","en_GH","en_IE","en_IN","en_JM","en_MY","en_NZ","en_QA","en_SG","en_UG","en_ZA","et","fil","fi","fr","fr_BE","fr_CA","fr_CH","fr_CI","fr_MA","ka","de","de_AT","de_CH","el","gu","ha","he","hi","hu","id","ga","it","ja","kn","kk","rw_RW","ko","ky_KG","lo","lv","lt","mk","ms","ml","mr","nb","ps_AF","fa","pl","pt_BR","pt_PT","pa","ro","ru","sr","si_LK","sk","sl","es","es_AR","es_CL","es_CO","es_CR","es_DO","es_EC","es_HN","es_MX","es_PA","es_PE","es_ES","es_UY","sw","sv","ta","te","th","th","tr","uk","ur","uz","vi","zu"],Ue=["PENDING","APPROVED","REJECTED","IN_APPEAL","PAUSED","PENDING_DELETION","DELETED","DISABLED","LIMIT_EXCEEDED"],Ne=["GREEN","YELLOW","RED","UNKNOWN"];var Fe=["POSITIONAL","NAMED"];var Ge=["AUTHENTICATION","MARKETING","UTILITY"],ke=["ORDER_DETAILS","ORDER_STATUS"],We=["E_COMMERCE","FINANCIAL_SERVICES"],Ke=["ACCOUNT_UPDATES","CUSTOMER_FEEDBACK","EVENT_REMINDER","FIXED_TEMPLATE_PRICE_TEST","IDENTITY_VERIFICATION","ORDER_MANAGEMENT","PAYMENTS"],we=["ACCOUNT_CREATION_CONFIRMATION","PAYMENT_DUE_REMINDER","FEEDBACK_SURVEY","PAYMENT_ACTION_REQUIRED","SHIPMENT_CONFIRMATION","PAYMENT_OVERDUE","DELIVERY_UPDATE","PAYMENT_CONFIRMATION","ORDER_DELAY","FRAUD_ALERT","DELIVERY_FAILED","AUTO_PAY_REMINDER","DELIVERY_CONFIRMATION","PAYMENT_SCHEDULED","ORDER_PICK_UP","PAYMENT_REJECT_FAIL","ORDER_ACTION_NEEDED","STATEMENT_AVAILABLE","ORDER_CONFIRMATION","LOW_BALANCE_WARNING","ORDER_OR_TRANSACTION_CANCEL","RECEIPT_ATTACHMENT","RETURN_CONFIRMATION","STATEMENT_ATTACHMENT","TRANSACTION_ALERT"],Be=10,be=["QUICK_REPLY","COPY_CODE","URL","PHONE_NUMBER","OTP","MPM","SPM","CATALOG","FLOW","VOICE_CALL","APP"];[...be];var qe=(s=>(s.Audio="audio",s.Contacts="contacts",s.Document="document",s.Image="image",s.Interactive="interactive",s.Location="location",s.Reaction="sticker",s.Sticker="sticker",s.System="system",s.Button="button",s.Order="order",s.Template="template",s.Text="text",s.Video="video",s))(qe||{});var c={};ue(c,Rp);var _p=["TEXT","MEDIA","RICHTEXT","EMAIL","WHATSAPP_TEMPLATE"],bp=["POTENTIAL","SENDING","SENT","RECEIVED","FAILED"],vp=["VISIBLE","PRIVATE"],Ip=["READ","RECEIVED","SENT"];var Jp=["ACTIVE","DISABLED"],Zp=["HTTP_STREAM","HTTP_SSE"];var ba=["POPULAR","SPONSORED","NEW"];var ri="0.41.1",si="0.31.0";var export_LEXICAL_IS_ALL_FORMATTING=c.IS_ALL_FORMATTING;var export_LEXICAL_IS_BOLD=c.IS_BOLD;var export_LEXICAL_IS_CODE=c.IS_CODE;var export_LEXICAL_IS_HIGHLIGHT=c.IS_HIGHLIGHT;var export_LEXICAL_IS_ITALIC=c.IS_ITALIC;var export_LEXICAL_IS_STRIKETHROUGH=c.IS_STRIKETHROUGH;var export_LEXICAL_IS_SUBSCRIPT=c.IS_SUBSCRIPT;var export_LEXICAL_IS_SUPERSCRIPT=c.IS_SUPERSCRIPT;var export_LEXICAL_IS_UNDERLINE=c.IS_UNDERLINE;
2
2
  export{cr as ACCOUNT_STATUSES,Vr as ACTION_STATUSES,jr as ACTION_TYPES,ye as ACTIVE_CONVERSATION_STATUSES,si as API_VERSION,ds as CHANNEL_STATUSES,De as CONCLUDED_CONVERSATION_STATUSES,Bs as CONTACT_STATUSES,ws as CONTACT_TYPES,en as CONVERSATION_PRIORITIES,Zs as CONVERSATION_STATUSES,pe as Client,ae as DEFAULT_SUPPORT_BASE_URL,_e as Error,vn as IMPORT_STATUSES,bn as IMPORT_TYPES,export_LEXICAL_IS_ALL_FORMATTING as LEXICAL_IS_ALL_FORMATTING,export_LEXICAL_IS_BOLD as LEXICAL_IS_BOLD,export_LEXICAL_IS_CODE as LEXICAL_IS_CODE,export_LEXICAL_IS_HIGHLIGHT as LEXICAL_IS_HIGHLIGHT,export_LEXICAL_IS_ITALIC as LEXICAL_IS_ITALIC,export_LEXICAL_IS_STRIKETHROUGH as LEXICAL_IS_STRIKETHROUGH,export_LEXICAL_IS_SUBSCRIPT as LEXICAL_IS_SUBSCRIPT,export_LEXICAL_IS_SUPERSCRIPT as LEXICAL_IS_SUPERSCRIPT,export_LEXICAL_IS_UNDERLINE as LEXICAL_IS_UNDERLINE,Ip as MESSAGE_EVENT_TYPES,bp as MESSAGE_STATUSES,_p as MESSAGE_TYPES,vp as MESSAGE_VISIBILITIES,Jp as MODEL_MCP_SERVER_STATUSES,Zp as MODEL_MCP_SERVER_TYPES,ri as SDK_VERSION,ba as SOURCE_ADORNMENTS,Z as SupportError,Fe as WHATSAPP_PARAMETER_FORMATS,be as WHATSAPP_TEMPLATE_BUTTON_TYPES,Ge as WHATSAPP_TEMPLATE_CATEGORIES,We as WHATSAPP_TEMPLATE_INDUSTRIES,Le as WHATSAPP_TEMPLATE_LANGUAGES,Be as WHATSAPP_TEMPLATE_MAX_BUTTONS,Ne as WHATSAPP_TEMPLATE_QUALITY_SCORES,Ue as WHATSAPP_TEMPLATE_STATUSES,ke as WHATSAPP_TEMPLATE_SUBCATEGORIES,Ke as WHATSAPP_TEMPLATE_TOPICS,we as WHATSAPP_TEMPLATE_USECASES,pe as default,Re as eventWebhookSchema};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@great-detail/support-sdk",
3
- "version": "0.41.0",
3
+ "version": "0.41.1",
4
4
  "type": "module",
5
5
  "description": "JavaScript SDK for the Great Detail Support System",
6
6
  "author": "Great Detail Ltd <info@greatdetail.com>",