UNPKG

node-zendesk

Version:

A trusted Zendesk API client library for Node.js and the browser, lovingly maintained for over 10 years.

1 lines 69.2 kB
"use strict";var n=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var Qe=n((na,Ve)=>{"use strict";var w=class{fatal(e){console.error(e)}error(e){console.error(e)}warn(e){console.warn(e)}info(e){console.info(e)}debug(e){console.log(e)}trace(e){console.trace(e)}},v=class extends w{};Ve.exports=v});var p=n((ia,Ke)=>{var Vr={core:"core",helpcenter:"helpcenter",services:"services",voice:"voice"},Qr={core:".zendesk.com/api/v2",helpcenter:".zendesk.com/api/v2/help_center",services:".zendesk.com/api/services/jira",voice:".zendesk.com/api/v2/channels/voice"};Ke.exports={ApiTypes:Vr,Endpoints:Qr}});var C=n(Xe=>{var x=class{constructor(){this.listeners=new Map}addEventListener(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}removeEventListener(e,t){if(this.listeners.has(e)){let r=this.listeners.get(e),a=r.indexOf(t);a!==-1&&r.splice(a,1)}}dispatchEvent(e){if(this.listeners.has(e.type)){let t=this.listeners.get(e.type);for(let r of t)r(e)}}};Xe.CustomEventTarget=x});var Ye=n(Ze=>{var j=class{constructor(e){this.options=e}createAuthorizationHeader(){return this.isOAuth()?this.createOAuthHeader():this.createBasicAuthHeader()}isOAuth(){return this.options.get("useOAuth")===!0||this.options.get("oauth")===!0}createOAuthHeader(){let e=this.options.get("token");if(!e)throw new Error("OAuth is enabled, but token is missing.");return`Bearer ${e}`}createBasicAuthHeader(){let e=this.options.get("username"),t=this.getPasswordOrToken();if(!e||!t)throw new Error("Missing credentials for Basic Authentication.");return`Basic ${this.encodeCredentials(`${e}${t}`)}`}getPasswordOrToken(){let e=this.options.get("password");return e?`:${e}`:`/token:${this.options.get("token")}`}encodeCredentials(e){return require("node:buffer").Buffer.from(e).toString("base64")}};Ze.AuthorizationHandler=j});var tt=n(et=>{var P=class{constructor(){this.SUPPORTED_ENDPOINTS=new Set(["views","users","triggers/active","triggers","tickets_audits","tickets","tickets/incremental/.*","incremental/tickets/.*","ticket_metrics","ticket/.+/audits","tags","suspended_tickets","skips","satisfaction_ratings","requests/.+/comments","recipient_addresses","organizations/.+/subscriptions","organizations/.+/tickets","organizations/.+/users","organizations","oauth/tokens","oauth/global_clients","oauth/clients","macros","groups/assignable","groups/.+/memberships","groups","group_memberships","deleted_tickets","automations","activities","help_center/.+/articles","help_center/.+/articles/.+/comments","help_center/.+/articles/.+/labels","help_center/.+/articles/.+/subscriptions","help_center/.+/articles/.+/votes","help_center/.+/categories/.+/articles","help_center/.+/categories/.+/sections","help_center/.+/sections","help_center/.+/sections/.+/subscriptions","help_center/.+/sections/.+/articles","help_center/articles/.+/translations","help_center/articles/labels","help_center/categories/.+/translations","help_center/incremental/articles","help_center/sections/.+/translations","help_center/user_segments","help_center/user_segments/.+/topics","help_center/user_segments/applicable","help_center/users/.+/comments","help_center/users/.+/subscriptions","help_center/users/.+/user_segments","help_center/users/.+/votes","help_center/users/.+/articles","community/topics","community/posts/.+/comments","community/posts/.+/comments/.+/votes","community/posts/.+/subscriptions","community/posts/.+/votes","community/topics/.+/subscriptions","community/users/.+/posts","community/users/.+/comments"]),this.SUPPORTED_REGEXES=new Set,this._initSupportedRegexes()}_initSupportedRegexes(){for(let e of this.SUPPORTED_ENDPOINTS){let t=new RegExp(`^${e.replaceAll("/","\\/").replaceAll(/{.+}/g,".+")}$`);this.SUPPORTED_REGEXES.add(t)}}supportsCursorPagination(e){for(let t of this.SUPPORTED_REGEXES)if(t.test(e))return!0;return!1}};et.EndpointChecker=P});var st=n((ua,Kr)=>{Kr.exports={name:"node-zendesk",version:"6.0.1",type:"commonjs",description:"A trusted Zendesk API client library for Node.js and the browser, lovingly maintained for over 10 years.",keywords:["zendesk","API","api-client","api-wrapper","browser-library","buddha","chat-api","customer-service","customer-support","helpdesk","knowledge-base","node-library","rest-api","sdk","support-api","support-ticket","supportdesk","ticket-management","ticketing","zendesk-api","zendesk-client","zendesk-integration","zendesk-platform","zendesk-sdk"],homepage:"https://github.com/blakmatrix/node-zendesk",repository:{type:"git",url:"git://github.com/blakmatrix/node-zendesk.git"},main:"./dist/index.js",types:"./dist/types/index.d.ts",exports:{".":{import:{types:"./dist/types/index.d.ts",default:"./dist/index.js"},require:{types:"./dist/types/index.d.ts",default:"./dist/index.js"}},"./clients/*":{import:{types:"./dist/types/clients/*.d.ts",default:"./dist/clients/*.js"},require:{types:"./dist/types/clients/*.d.ts",default:"./dist/clients/*.js"}},"./clients/*/*":{import:{types:"./dist/types/clients/*/*.d.ts",default:"./dist/clients/*/*.js"},require:{types:"./dist/types/clients/*/*.d.ts",default:"./dist/clients/*/*.js"}},"./clients/*/*/*":{import:{types:"./dist/types/clients/*/*/*.d.ts",default:"./dist/clients/*/*/*.js"},require:{types:"./dist/types/clients/*/*/*.d.ts",default:"./dist/clients/*/*/*.js"}}},files:["dist"],scripts:{"clean:dist":"npx rimraf ./dist",esbuild:"npx esbuild ./src/index.js --bundle --outdir=dist --platform=node --target=node18 --minify --packages=external --format=cjs","build:types":"npx -p typescript tsc ./src/**/**/*.js --declaration --allowJs --emitDeclarationOnly --outDir dist/types",build:"npm run clean:dist && npm run build:types && npm run esbuild",prepublishOnly:"npm run build",postpublish:"npm run clean:dist",test:"vitest run","test:coverage":"vitest run --coverage",lint:"xo","lint:fix":"xo --fix","docs:code":"npx typedoc --out ./docs/code --plugin typedoc-plugin-markdown 'dist/**/*.ts'","docs:dev":"vitepress dev docs","docs:build":"vitepress build docs","docs:preview":"vitepress preview docs","docs:deploy-github-pages":"npm run build && npm run docs:code && npm run docs:build",release:"git push origin --follow-tags"},author:"Farrin Reid <blakmatrix@gmail.com>",contributors:["Adil H <didil@noreply.users.github.com>","Amal Khezami <khezamian@noreply.users.github.com>","Anastasi Bakolias <spasiu@noreply.users.github.com>","Azharuddin <gs-akhan@noreply.users.github.com>","Bas <basdewachter@noreply.users.github.com>","Blair Anderson <blairanderson@noreply.users.github.com>","Brian Hartvigsen <tresni@noreply.users.github.com>","Carl-Fredrik Her\xF6 <carlfredrikhero@noreply.users.github.com>","Colin Loretz <colinloretz@noreply.users.github.com>","David Kapell <dkapell@noreply.users.github.com>","Eike Bernhardt <teefax@noreply.users.github.com>","Eike Thienemann-Dehde <edehde@noreply.users.github.com>","Eric Davis <iconecd@noreply.users.github.com>","Eriks Reks <erikzrekz@noreply.users.github.com>","Fred Souza <fmsouza@noreply.users.github.com>","genius-fx <genius-fx@noreply.users.github.com>","genius-fx <gitter-badger@noreply.users.github.com>","Heriberto Madrigal <magic-madrigal@noreply.users.github.com>","Iconecd <iconecd@noreply.users.github.com>","Ignigena <Ignigena@noreply.users.github.com>","James Greene <JamesMGreene@noreply.users.github.com>","Jeff Zabel <jzabel@noreply.users.github.com>","Marcelo Luiz Onhate <onhate@noreply.users.github.com>","Mathias Anderss\xE9n <Okar@noreply.users.github.com>","matthewschmidt <matthewschmidt.users.github.com>","Nie Xiaochen <nnabuuu@noreply.users.github.com>","Oleksandr Pidlisnyi <unreadableusername@noreply.users.github.com>","oleksiy-turchanikov <oleksiy-turchanikov@noreply.users.github.com>","Roman Onufryk <onufryk@noreply.users.github.com>","Shuan Wang <swang@noreply.users.github.com>","Stuart McGrigor <stueynz@noreply.users.github.com>","Wade Grandoni <wadegrandoni@noreply.users.github.com>"],license:"MIT",funding:[{type:"individual",url:"https://github.com/blakmatrix/node-zendesk?sponsor=1"}],bugs:{url:"https://github.com/blakmatrix/node-zendesk/issues"},engines:{node:">= 18"},dependencies:{"cross-fetch":"^4.0.0"},devDependencies:{"@vitest/coverage-v8":"^2.1.6",dotenv:"^16.4.5","eslint-plugin-jsdoc":"^50.6.0",nock:"^13.5.6",typedoc:"^0.26.11","typedoc-plugin-markdown":"^4.2.10",vitepress:"^1.5.0","vitepress-sidebar":"^1.29.0",vitest:"^2.1.6","vue-github-button":"^3.1.3",xo:"^0.59.3"}}});var I=n((la,nt)=>{var Xr={400:"Bad Request",401:"Not Authorized",403:"Forbidden",404:"Item not found",405:"Method not Allowed",409:"Conflict",422:"Unprocessable Entity",429:"Too Many Requests",500:"Internal Server Error",503:"Service Unavailable"};function rt(s){return s.reduce((e,t)=>e.concat(Array.isArray(t)?rt(t):t),[])}function Zr(s,e,t){let r=new Map,a=(c,u,l)=>c.filter(y=>y[u]===l),o=(c,u,l)=>c.find(y=>y[u]===l)||null,h=c=>{for(let{field:u,name:l,dataset:y,all:m,dataKey:_,array:A}of t)if(Object.hasOwn(c,u)){let d=r.get(y)||e[y];if(r.set(y,d),d){let b=_||"id";c[l]=m?d:A?a(d,b,c[u]):o(d,b,c[u])}}};if(Array.isArray(s))for(let c of s)h(c);else h(s);return s}function Yr(s,e,t){let r=d=>typeof d=="object"&&!Array.isArray(d),a=(d,...b)=>{let g=new URLSearchParams(d);for(let Gr of b){let Hr=new URLSearchParams(Gr);for(let[Wr,Jr]of Hr.entries())g.set(Wr,Jr)}return g.toString()},o=s.options.get("endpointUri"),h=s.sideLoad?.length>0?`include=${s.sideLoad.join(",")}`:"",c=f(s.options.get("query")||{}),u=[],l="";if(Array.isArray(t)){let d=t.pop();r(d)?l=f(d):typeof d=="string"&&d.startsWith("?")?l=d.slice(1):d!==void 0&&d!==""&&t.push(d),u=t}else if(typeof t=="string"){if(t.includes(o))return t;u=[t]}let y="";e==="GET"&&s.endpointChecker.supportsCursorPagination(u.join("/"))&&(y=f({page:{size:100}})),l=a(l,y,h,c);let m=u.filter(Boolean).join("/"),_=s.useDotJson===!1?"":".json",A=`${o}/${m}${_}`;return l?`${A}?${l}`:A}var f=(s,e="")=>s===null||typeof s!="object"?`${encodeURIComponent(e)}=${encodeURIComponent(s)}`:Array.isArray(s)?`${encodeURIComponent(e)}=${encodeURIComponent(s.join(","))}`:Object.entries(s).map(([t,r])=>{let a=e?`${e}[${t}]`:t;return f(r,a)}).join("&");function k(s,e,t=null){let r=new Error(s);return r.statusCode=e,r.result=t,r}function en(s,e){if(!e)return k("Zendesk returned an empty result",204);if(s.status===204&&(s.statusText??"No Content")==="No Content")return k("No Content",s.status);let t;try{t=s.status}catch(o){return{exception:o,code:t,result:e}}if(s.headers.get("retry-after"))return k("Zendesk rate limits 200 requests per minute",429,e);let a=Xr[t];if(a)throw k(`Zendesk Error (${t}): ${a}`,t,e);return e}function tn(s,e){if(!s)return"";if(e.jsonAPINames){let t=e.jsonAPINames.find(r=>Object.hasOwn(s,r));if(t)return s[t]}return s}function sn(s,e){let t=tn(s,e);return e.sideLoadMap&&(t=Zr(t,s,e.sideLoadMap)),t}function rn(){let{version:s}=st();return`node-zendesk/${s} (node/${require("node:process").versions.node})`}nt.exports={flatten:rt,assembleUrl:Yr,checkRequestResponse:en,processResponseBody:sn,generateUserAgent:rn}});var ot=n(at=>{"use strict";var{fetch:nn}=require("cross-fetch"),{AuthorizationHandler:an}=Ye(),{CustomEventTarget:on}=C(),{EndpointChecker:cn}=tt(),{assembleUrl:it,generateUserAgent:un}=I(),ln={transportFn(s,e){return nn(s,e)},responseAdapter(s){return{json:()=>s.json(),status:s.status,headers:{get:e=>s.headers.get(e)},statusText:s.statusText}}},z=class{constructor(e,t=[],r=!0){this.options=e,this.sideLoad=t,this.useDotJson=r,this.authHandler=new an(this.options),this.eventTarget=new on,this.endpointChecker=new cn;let a=this.options.transportConfig??ln;this.transportFn=a.transportFn,this.responseAdapter=a.responseAdapter,this.userAgent=this.options.get("userAgent")??un()}emit(e,t){let r={type:e,detail:t};this.eventTarget.dispatchEvent(r)}on(e,t){this.eventTarget.addEventListener(e,t)}async request(e,t,r=null){let a=this.prepareOptionsForRequest(e,t,r);return this.sendRequest(a)}async upload(e,t){let r="POST",a=t instanceof require("node:stream").Stream,o=t instanceof FormData,h=this.getHeadersForRequest();o&&(h["Content-Type"]="multipart/form-data"),a&&(h["Content-Type"]="application/binary");let c=a||o,u={...this.options,headers:h,uri:it(this,r,e),method:r,body:c?t:require("node:fs").createReadStream(t)};return this.sendRequest(u)}obfuscateToken(e){return e.token?{...e,token:e.token.slice(0,5)+"**********"}:{...e}}async sendRequest(e){this.emit("debug::request",this.obfuscateToken(e));let t=await this.transportFn(e.uri,e),r=this.responseAdapter(t);this.emit("debug::response",r);let a={};return r.status!==204&&r.headers.get("content-type")?.includes("application/json")&&(a=await r.json()),this.emit("debug::result",a),{response:r,result:a}}prepareOptionsForRequest(e="GET",t,r,a=!1){let o=it(this,e,t),h=a?r:this.getBodyForRequest(e,r),c=this.getHeadersForRequest();return r instanceof FormData&&(c["Content-Type"]="multipart/form-data"),a&&(c["Content-Type"]="application/binary"),{...this.options,headers:c,uri:o,method:e,body:h}}getHeadersForRequest(){let e={Authorization:this.authHandler.createAuthorizationHeader(),"Content-Type":"application/json",Accept:"application/json","User-Agent":this.userAgent,...this.options.get("customHeaders")},t=this.options.get("asUser");return t&&(e["X-On-Behalf-Of"]=t),e}getBodyForRequest(e,t){if(e!=="GET")return t?this.getJSONBody(t):void 0}getJSONBody(e){if(!e)return"{}";try{return JSON.stringify(e)}catch(t){throw new Error(`Failed to stringify the request body: ${t.message}`)}}setSideLoad(e){this.sideLoad=e}};at.Transporter=z});var ut=n((pa,ct)=>{ct.exports=hn;function hn(...s){let[e,t,r={}]=s.length>1?s:[null,...s],a=c(r),o=[],h;function c(l){return typeof l=="number"?l:typeof l=="string"?Number(l):Math.ceil((l.window||1)/(l.limit||1)*1e3)}function u(){return o.length===0&&clearInterval(h),o.shift()?t.apply(e,o.shift()):null}return function(...l){return o.push(l),h||=setInterval(u,a),{position:o.length,queuedAt:Date.now(),timeUntilCall:o.length*a}}}});var i=n(ht=>{"use strict";var{ApiTypes:pn,Endpoints:dn}=p(),{CustomEventTarget:yn}=C(),{Transporter:gn}=ot(),mn=ut(),{flatten:_n,checkRequestResponse:T,processResponseBody:lt}=I(),S=class{constructor(e,t){this.options=this._buildOptions(e,t),this.sideLoad=[],this.jsonAPINames=[],this.useDotJson=!0,this.eventTarget=new yn}get transporter(){return this._transporter?this._transporter:(this._transporter=new gn(this.options,this.sideLoad,this.useDotJson),this._transporter.on("debug::request",e=>{this.emit("debug::request",e.detail)}),this._transporter.on("debug::response",e=>{this.emit("debug::response",e.detail)}),this._transporter.on("debug::result",e=>{this.emit("debug::result",e.detail)}),this._transporter)}emit(e,t){let r={type:e,detail:t};this.eventTarget.dispatchEvent(r)}on(e,t){this.eventTarget.addEventListener(e,t)}_buildOptions(e,t=pn.core){let r=e.endpointUri??this._getEndpointUri(e.subdomain,t),a={...e,endpointUri:r};return{...a,get:o=>a[o]}}_getEndpointUri(e,t){let r=dn[t];return`https://${e}${r}`}setSideLoad(e){this.sideLoad=e,this.transporter.setSideLoad(e)}async get(e){return this.request("GET",e)}async patch(...e){let t=e.pop(),r=Array.isArray(e[0])?e[0]:e;return this.request("PATCH",r,t)}async put(e,t){return this.request("PUT",e,t)}async post(e,t){return this.request("POST",e,t)}async delete(...e){let t=Array.isArray(e[0])?e[0]:e;return this.request("DELETE",t)}async getAll(e){return this.requestAll("GET",e)}async _rawRequest(e,t,...r){let a=typeof r.at(-1)=="object"&&!Array.isArray(r.at(-1))&&r.pop();return this.transporter.request(e,t,a)}async request(e,t,...r){try{let{response:a,result:o}=await this._rawRequest(e,t,...r),h=lt(T(a,o),this);return{response:a,result:h}}catch(a){if(this.options.throwOriginalException)throw a;let{message:o,result:{error:{title:h="",message:c=""}={}}={}}=a,u=`Request processing failed: ${o}`;throw(h.length>0||c.length>0)&&(u+=` - ${h}${h.length>0&&c.length>0?": ":""}${c}`),new Error(u)}}async requestAll(e,t,...r){let a=[],o=this.options.get("throttle"),h=this._rawRequest;o&&(h=mn(this,this._rawRequest,o));let c=({result:l,response:y})=>{let m=T(y,l),_=g=>g&&g.links&&g.links.next,A=g=>g&&g.next_page,d=g=>_(g)?g.links.next:A(g)?g.next_page:null,b=lt(m,this);return a.push(b),d(m)},u=async l=>{let y=l.includes("incremental"),m=await h.call(this,e,l,...r),_=c(m);if(_&&(!y||m.response&&m.response.count>=1e3))return u(_)};return await u(t),_n(a)}async requestUpload(e,t){let{response:r,result:a}=await this.transporter.upload(e,t);return T(r,a)}};ht.Client=S});var dt=n(pt=>{var{Client:An}=i(),{ApiTypes:bn}=p(),B=class extends An{constructor(e){super(e,bn.helpcenter),this.jsonAPINames=["accesspplicies","accesspolicy"]}async show(e){return this.get(["sections",e,"access_policy"])}async update(e,t){return this.put(["sections",e,"access_policy"],t)}};pt.AccessPolicies=B});var gt=n(yt=>{var{Client:kn}=i(),{ApiTypes:fn}=p(),N=class extends kn{constructor(e){super(e,fn.helpcenter),this.jsonAPINames=["articleattachments","articleattachment"]}async list(e){return this.get(["articles",e,"attachments"])}async listInline(e){return this.get(["articles",e,"attachments","inline"])}async listBlock(e){return this.get(["articles",e,"attachments","block"])}async show(e){return this.get(["articles","attachments",e])}async create(){return new Error("not implemented")}async createUnassociated(){return new Error("not implemented")}async delete(e){return super.delete(["articles","attachments",e])}};yt.ArticleAttachments=N});var _t=n(mt=>{var{Client:qn}=i(),{ApiTypes:wn}=p(),O=class extends qn{constructor(e){super(e,wn.helpcenter),this.jsonAPINames=["articlecomments","articlecomment"],this.sideLoadMap=[{field:"author_id",name:"user",dataset:"users"}]}async listByUser(e){return this.getAll(["users",e,"comments"])}async listByArticle(e){return this.getAll(["articles",e,"comments"])}async show(e,t){return this.get(["articles",e,"comments",t])}async create(e,t){return this.post(["articles",e,"comments"],t)}async update(e,t,r){return this.put(["articles",e,"comments",t],r)}async delete(e,t){return super.delete(["articles",e,"comments",t])}};mt.ArticleComments=O});var bt=n(At=>{var{Client:vn}=i(),{ApiTypes:xn}=p(),E=class extends vn{constructor(e){super(e,xn.helpcenter),this.jsonAPINames=["articlelabels","articlelabel"]}async list(){return this.get(["articles","labels"])}async listByArticle(e){return this.get(["articles",e,"labels"])}async show(e){return this.get(["articles","labels",e])}async create(e,t){return this.post(["articles",e,"labels"],t)}async delete(e,t){return super.delete(["articles",e,"labels",t])}};At.ArticleLabels=E});var ft=n(kt=>{var{Client:Cn}=i(),{ApiTypes:jn}=p(),U=class extends Cn{constructor(e){super(e,jn.helpcenter),this.jsonAPINames=["articles","article"],this.sideLoadMap=[{field:"author_id",name:"user",dataset:"users"},{field:"section_id",name:"section",dataset:"sections"},{field:"category_id",name:"category",dataset:"categories"}]}async list(){return this.getAll(["articles"])}async listByLocale(e){return this.getAll([e,"articles"])}async listBySection(e){return this.getAll(["sections",e,"articles"])}async listBySectionByLocale(e,t){return this.getAll([e,"sections",t,"articles"])}async listByCategory(e){return this.getAll(["categories",e,"articles"])}async listByCategoryByLocale(e,t){return this.getAll([e,"categories",t,"articles"])}async listByUser(e){return this.getAll(["users",e,"articles"])}async listSinceStartTime(e){return this.getAll(["incremental","articles",{start_time:e}])}async listByLabelNames(e){return this.getAll(["articles",{label_names:e.toString()}])}async show(e){return this.get(["articles",e])}async showWithLocale(e,t){return this.get([e,"articles",t])}async create(e,t){return this.post(["sections",e,"articles"],t)}async createWithLocale(e,t,r){return this.post([e,"sections",t,"articles"],r)}async update(e,t){return this.put(["articles",e],t)}async updateWithLocale(e,t,r){return this.put([e,"articles",t],r)}async associateAttachmentsInBulk(e,t){return this.post(["articles",e,"bulk_attachments"],t)}async delete(e){return super.delete(["articles",e])}};kt.Articles=U});var wt=n(qt=>{var{Client:Pn}=i(),{ApiTypes:In}=p(),M=class extends Pn{constructor(e){super(e,In.helpcenter),this.jsonAPINames=["categories","category"]}async list(){return this.getAll(["categories"])}async listWithLocale(e){return this.getAll([e,"categories"])}async show(e){return this.get(["categories",e])}async create(e){return this.post(["categories"],e)}async update(e,t){return this.put(["categories",e],t)}async updateWithLocale(e,t,r){return this.put([e,"categories",t],r)}async updateSourceLocale(e,t){return this.put(["categories",e,"source_locale"],t)}async delete(e){return super.delete(["categories",e])}};qt.Categories=M});var xt=n(vt=>{var{Client:zn}=i(),{ApiTypes:Tn}=p(),L=class extends zn{constructor(e){super(e,Tn.helpcenter),this.jsonAPINames=["search","search"]}async searchArticles(e){let t=typeof e=="object"?e:{query:e};return this.get(["articles","search",t])}async searchArticlesInLocale(e,t){let r={query:e,locale:t};return this.get(["articles","search",r])}async searchArticlesByLabels(e){let t=typeof e=="object"?e:{label_names:e};return this.get(["articles",t])}async searchQuestions(e){let t=typeof e=="object"?e:{query:e};return this.get(["questions","search",t])}};vt.Search=L});var jt=n(Ct=>{var{Client:Sn}=i(),{ApiTypes:Bn}=p(),R=class extends Sn{constructor(e){super(e,Bn.helpcenter),this.jsonAPINames=["sections","section"],this.sideLoadMap=[{field:"category_id",name:"category",dataset:"categories"}]}async list(){return this.getAll(["sections"])}async listByCategory(e){return this.getAll(["categories",e,"sections"])}async listWithLocale(e){return this.getAll([e,"sections"])}async listByCategoryByLocale(e,t){return this.getAll([e,"categories",t,"sections"])}async show(e){return this.get(["sections",e])}async showWithLocale(e,t){return this.get([e,"sections",t])}async create(e,t){return this.post(["categories",e,"sections"],t)}async createWithLocale(e,t,r){return this.post([e,"categories",t,"sections"],r)}async update(e,t){return this.put(["sections",e],t)}async updateWithLocale(e,t,r){return this.put([e,"sections",t],r)}async updateSourceLocale(e,t){return this.put(["sections",e,"source_locale"],t)}async delete(e){return super.delete(["sections",e])}};Ct.Sections=R});var It=n(Pt=>{var{Client:Nn}=i(),{ApiTypes:On}=p(),D=class extends Nn{constructor(e){super(e,On.helpcenter),this.jsonAPINames=["subscriptions","subscription"]}async listByUser(e){return this.getAll(["users",e,"subscriptions"])}async listByArticle(e){return this.getAll(["articles",e,"subscriptions"])}async listBySection(e){return this.getAll(["sections",e,"subscriptions"])}async showbyArticle(e,t){return this.get(["articles",e,"subscriptions",t])}async showbySection(e,t){return this.get(["sections",e,"subscriptions",t])}async createbyArticle(e,t){return this.post(["articles",e,"subscriptions"],t)}async createbySection(e,t){return this.post(["sections",e,"subscriptions"],t)}async deletebyArticle(e,t){return super.delete(["articles",e,"subscriptions",t])}async deletebySection(e,t){return super.delete(["articles",e,"subscriptions",t])}};Pt.Subscriptions=D});var Tt=n(zt=>{var{Client:En}=i(),{ApiTypes:Un}=p(),F=class extends En{constructor(e){super(e,Un.helpcenter),this.jsonAPINames=["translations","translation"]}async show(e,t){return this.get(["articles",e,"translations",t])}async listByArticle(e,t){return this.getAll(["articles",e,"translations",t])}async listBySection(e){return this.getAll(["sections",e,"translations"])}async listByCategory(e){return this.getAll(["categories",e,"translations"])}async listMissingLocalesByArticle(e){return this.get(["articles",e,"translations","missing"])}async listMissingLocalesBySection(e){return this.get(["sections",e,"translations","missing"])}async listMissingLocalesByCategory(e){return this.get(["categories",e,"translations","missing"])}async createForArticle(e,t){return this.post(["articles",e,"translations"],t)}async createForSection(e,t){return this.post(["sections",e,"translations"],t)}async createForCategory(e,t){return this.post(["categories",e,"translations"],t)}async updateForArticle(e,t,r){return this.put(["articles",e,"translations",t],r)}async updateForSection(e,t,r){return this.put(["sections",e,"translations",t],r)}async updateForCategory(e,t,r){return this.put(["categories",e,"translations",t],r)}async delete(e){return super.delete(["translations",e])}async listLocales(){return this.get(["locales"])}};zt.Translations=F});var Bt=n(St=>{var{Client:Mn}=i(),{ApiTypes:Ln}=p(),$=class extends Mn{constructor(e){super(e,Ln.helpcenter),this.jsonAPINames=["usersegments","usersegment"]}async list(){return this.getAll(["user_segments"])}async listApplicable(){return this.getAll(["user_segments","applicable"])}async listByUser(e){return this.getAll(["users",e,"user_segments"])}async show(e){return this.get(["user_segments",e])}async listSections(e){return this.getAll(["user_segments",e,"sections"])}async listTopics(e){return this.getAll(["user_segments",e,"topics"])}async create(e){return this.post(["user_segments"],e)}async update(e,t){return this.put(["user_segments",e],t)}async delete(e){return super.delete(["user_segments",e])}};St.UserSegments=$});var Ot=n(Nt=>{var{Client:Rn}=i(),{ApiTypes:Dn}=p(),G=class extends Rn{constructor(e){super(e,Dn.helpcenter),this.jsonAPINames=["votes","vote"]}async listByUser(e){return this.get(["users",e,"votes"])}async listByArticle(e){return this.get(["articles",e,"votes"])}async show(e){return this.get(["votes",e])}async createUpVoteForArticle(e){return this.post(["articles",e,"up"])}async createDownVoteForArticle(e){return this.post(["articles",e,"down"])}async createUpVoteForQuestion(e){return this.post(["questions",e,"up"])}async createDownVoteForQuestion(e){return this.post(["questions",e,"down"])}async createUpVoteForAnswer(e){return this.post(["answers",e,"up"])}async createDownVoteForAnswer(e){return this.post(["answers",e,"down"])}async delete(e){return super.delete(["votes",e])}};Nt.Votes=G});var Ut=n((Ca,Et)=>{var H=class{constructor(e){this.client=e}_instantiate(e){return this.client._instantiate(e)}get accesspolicies(){let{AccessPolicies:e}=dt();return this._instantiate(e)}get articleattachments(){let{ArticleAttachments:e}=gt();return this._instantiate(e)}get articlecomments(){let{ArticleComments:e}=_t();return this._instantiate(e)}get articlelabels(){let{ArticleLabels:e}=bt();return this._instantiate(e)}get articles(){let{Articles:e}=ft();return this._instantiate(e)}get categories(){let{Categories:e}=wt();return this._instantiate(e)}get search(){let{Search:e}=xt();return this._instantiate(e)}get sections(){let{Sections:e}=jt();return this._instantiate(e)}get subscriptions(){let{Subscriptions:e}=It();return this._instantiate(e)}get translations(){let{Translations:e}=Tt();return this._instantiate(e)}get usersegments(){let{UserSegments:e}=Bt();return this._instantiate(e)}get votes(){let{Votes:e}=Ot();return this._instantiate(e)}};Et.exports={ZendeskClientHelpcenter:H}});var Lt=n(Mt=>{var{Client:Fn}=i(),{ApiTypes:$n}=p(),W=class extends Fn{constructor(e){super(e,$n.services),this.jsonAPINames=["links"],this.sideLoadMap=[{field:"ticket_id",name:"ticket",dataset:"tickets"}]}async list(){this.getAll(["links"])}async show(e){this.get(["links","?ticket_id="+e.toString()])}};Mt.Links=W});var Dt=n((Pa,Rt)=>{var J=class{constructor(e){this.client=e}_instantiate(e){return this.client._instantiate(e)}get links(){let{Links:e}=Lt();return this._instantiate(e)}};Rt.exports={ZendeskClientServices:J}});var $t=n(Ft=>{var{Client:Gn}=i(),{ApiTypes:Hn}=p(),V=class extends Gn{constructor(e){super(e,Hn.voice),this.jsonAPINames=["current_queue_activity","current_queue_activities"]}async show(){return this.get(["stats","current_queue_activity"])}};Ft.CurrentQueueActivity=V});var Ht=n(Gt=>{var{Client:Wn}=i(),{ApiTypes:Jn}=p(),Q=class extends Wn{constructor(e){super(e,Jn.voice),this.jsonAPINames=["greeting_categories","greeting_category"]}async list(){return this.get(["greeting_categories"])}async show(e){return this.get(["greeting_category",e])}};Gt.GreetingCategories=Q});var Jt=n(Wt=>{var{Client:Vn}=i(),{ApiTypes:Qn}=p(),K=class extends Vn{constructor(e){super(e,Qn.voice),this.jsonAPINames=["greetings","greetings"]}async list(){return this.get(["greetings"])}async show(e){return this.get(["greetings",e])}async create(e){return this.post("POST",["greetings"],e)}async update(e,t){return this.put("PUT",["greetings",t],e)}async delete(e){return super.delete("DELETE",["greetings",e])}};Wt.Greetings=K});var Qt=n(Vt=>{var{Client:Kn}=i(),{ApiTypes:Xn}=p(),X=class extends Kn{constructor(e){super(e,Xn.voice),this.jsonAPINames=["historical_queue_activity","historical_queue_activities"]}async show(){return this.get(["stats","historical_queue_activity"])}};Vt.HistoricalQueueActivity=X});var Xt=n(Kt=>{var{Client:Zn}=i(),{ApiTypes:Yn}=p(),Z=class extends Zn{constructor(e){super(e,Yn.voice),this.jsonAPINames=["phone numbers","phone number"]}async search(e){return this.get(["phone_numbers","search",{query:e}])}async list(){return this.get(["phone_numbers"])}async create(e){return this.post(["phone_numbers"],e)}async update(e,t){return this.put(["phone_numbers",e],t)}async show(e){return this.get(["phone_numbers",e])}async delete(e){return super.delete(["phone_numbers",e])}};Kt.PhoneNumbers=Z});var Yt=n((Na,Zt)=>{var Y=class{constructor(e){this.client=e}_instantiate(e){return this.client._instantiate(e)}get currentqueueactivity(){let{CurrentQueueActivity:e}=$t();return this._instantiate(e)}get greetingcategories(){let{GreetingCategories:e}=Ht();return this._instantiate(e)}get greetings(){let{Greetings:e}=Jt();return this._instantiate(e)}get historicalqueueactivity(){let{HistoricalQueueActivity:e}=Qt();return this._instantiate(e)}get phonenumbers(){let{PhoneNumbers:e}=Xt();return this._instantiate(e)}};Zt.exports={ZendeskClientVoice:Y}});var ts=n(es=>{var{Client:ei}=i(),ee=class extends ei{constructor(e){super(e),this.jsonAPINames=["settings"]}async show(){return this.get(["account","settings"])}async update(e){return this.put(["account","settings"],e)}};es.AccountSettings=ee});var rs=n(ss=>{var{Client:ti}=i(),te=class extends ti{constructor(e){super(e),this.jsonAPINames=["activities","activity"]}async list(){return this.getAll("GET",["activities"])}async show(e){return this.get(["activities",e])}async count(){return this.get(["activities","count"])}};ss.ActivityStream=te});var is=n(ns=>{var{Client:si}=i(),se=class extends si{async upload(e,t){let r={filename:t.filename,binary:t.binary};return Object.hasOwn(t,"token")&&(r.token=t.token),this.requestUpload(["uploads",r],e)}async deleteUpload(e){return super.delete(["uploads",e])}async show(e){return this.get(["attachments",e])}async redactAttachmentComment(e,t,r){return super.delete(["tickets",e,"comments",t,"attachments",r,"redact"],{})}async updateAttachmentForMalware(e,t){let r={attachment:{malware_access_override:t}};return this.put(["attachments",e],r)}};ns.Attachments=se});var os=n(as=>{var{Client:ri}=i(),re=class extends ri{constructor(e){super(e),this.jsonAPINames=["automations","automation"]}async list(){return this.getAll(["automations"])}async listActive(){return this.getAll(["automations","active"])}async show(e){return this.get(["automations",e])}async create(e){return this.post(["automations"],e)}async update(e,t){return this.put(["automations",e],t)}async updateMany(e){return this.put(["automations","update_many"],{automations:e})}async delete(e){return super.delete(["automations",e])}async bulkDelete(e){return super.delete(["automations","destroy_many",{ids:e}])}async search(e){return this.getAll(["automations","search",e])}async reorder(e){return this.requestAll("PUT",["automations","reorder"],{automation_ids:e})}};as.Automations=re});var us=n(cs=>{var{Client:ni}=i(),ne=class extends ni{constructor(e){super(e),this.jsonAPINames=["brands"]}async list(){return this.get(["brands"])}async show(e){return this.get(["brands",e])}async create(e){return this.post(["brands"],e)}async update(e,t){return this.put(["brands",t],e)}async delete(e){return super.delete(["brands",e])}async checkHostMapping(e,t){return this.get(["brands","check_host_mapping",{host_mapping:e,subdomain:t}])}async checkHostMappingForExistingBrand(e){return this.get(["brands",e,"check_host_mapping"])}};cs.Brand=ne});var hs=n(ls=>{var{Client:ii}=i(),ie=class extends ii{constructor(e){super(e),this.jsonAPINames=["custom_roles"]}list(){return this.getAll(["custom_roles"])}show(e){return this.get(["custom_roles",e])}create(e){return this.post(["custom_roles"],{custom_role:e})}update(e,t){return this.put(["custom_roles",e],{custom_role:t})}delete(e){return super.delete(["custom_roles",e])}};ls.CustomAgentRoles=ie});var ds=n(ps=>{var{Client:ai}=i(),ae=class extends ai{constructor(e){super(e),this.jsonAPINames=["dynamic_content_items","dynamic_content_items"]}async listItems(){return this.get(["dynamic_content","items"])}async listAllItems(){return this.getAll(["dynamic_content","items"])}async showItem(e){return this.get(["dynamic_content","items",e])}async showManyItems(e){if(!Array.isArray(e)||e.length===0)throw new Error("A valid array of identifiers is required.");return this.get(["dynamic_content","items","show_many",{identifiers:e}])}async createItem(e){return this.post(["dynamic_content","items"],e)}async updateItem(e,t){return this.put(["dynamic_content","items",e],t)}async deleteItem(e){return super.delete(["dynamic_content","items",e])}};ps.DynamicContent=ae});var gs=n(ys=>{var{Client:oi}=i(),oe=class extends oi{constructor(e){super(e),this.jsonAPINames=["dynamic_content_item_variant","dynamic_content_item_variants"]}async list(e){return this.get(["dynamic_content","items",e,"variants"])}async show(e,t){return this.get(["dynamic_content","items",e,"variants",t])}async create(e,t){return this.post(["dynamic_content","items",e,"variants"],t)}async update(e,t,r){return this.put(["dynamic_content","items",e,"variants",t],r)}async delete(e,t){return super.delete(["dynamic_content","items",e,"variants",t])}async createMany(e,t){return this.post(["dynamic_content","items",e,"variants","create_many"],{variants:t})}async updateMany(e,t){return this.put(["dynamic_content","items",e,"variants","update_many"],{variants:t})}};ys.DynamicContentVariants=oe});var _s=n(ms=>{var{Client:ci}=i(),ce=class extends ci{constructor(e){super(e),this.jsonAPINames=["group_memberships","group_membership"],this.sideLoadMap=[{field:"group_id",name:"groups",dataset:"groups"},{field:"user_id",name:"user",dataset:"users"}]}async list(){return this.getAll(["group_memberships"])}async listByUser(e){return this.getAll(["users",e,"group_memberships"])}async listByGroup(e){return this.getAll(["groups",e,"memberships"])}async show(e){return this.get(["group_memberships",e])}async showByUser(e,t){return this.get(["users",e,"group_memberships",t])}async create(e){return this.post(["group_memberships"],e)}async createByUser(e,t){return this.post(["users",e,"group_memberships"],t)}async delete(e){return super.delete(["group_memberships",e])}async deleteByUser(e,t){return super.delete(["users",e,"group_memberships",t])}async makeDefault(e,t){return this.put(["users",e,"group_memberships",t,"make_default"])}async listAssignable(){return this.getAll(["group_memberships","assignable"])}async listAssignableByGroup(e){return this.getAll(["groups",e,"memberships","assignable"])}async bulkCreate(e){return this.post(["group_memberships","create_many"],{group_memberships:e})}async bulkDelete(e){return super.delete(["group_memberships","destroy_many",{ids:e.join(",")}])}};ms.GroupMemberships=ce});var bs=n(As=>{var{Client:ui}=i(),ue=class extends ui{constructor(e){super(e),this.jsonAPINames=["groups","group"],this.sideLoadMap=[{field:"user_id",name:"users",dataset:"users",all:!0}]}async list(){return this.getAll(["groups"])}async count(){return this.get(["groups","count"])}async countByUser(e){return this.get(["users",e,"groups","count"])}async assignable(){return this.getAll(["groups","assignable"])}async show(e){return this.get(["groups",e])}async create(e){return this.post(["groups"],e)}async update(e,t){return this.put(["groups",e],t)}async delete(e){return super.delete(["groups",e])}};As.Groups=ue});var fs=n(ks=>{var{Client:li}=i(),le=class extends li{constructor(e){super(e),this.jsonAPINames=["tickets","ticket"]}async ticket(e){return this.post(["imports","tickets"],e)}async ticketMany(e){return this.requestAll("POST",["imports","tickets","create_many"],e)}};ks.Imports=le});var ws=n(qs=>{var{Client:hi}=i(),he=class extends hi{constructor(e){super(e),this.jsonAPINames=["installations","installation"]}async list(){return this.getAll(["apps","installations"])}async show(e){return this.get(["apps","installations",e])}async create(e){return this.post(["apps","installations"],e)}async update(e,t){return this.put(["apps","installations",e],t)}async delete(e){return super.delete(["apps","installations",e])}};qs.Installations=he});var xs=n((Ja,vs)=>{var pi=new Set(["completed","failed","killed"]),pe=class{constructor(e){this.client=Cs().createClient(e)}async checkJobStatus(e){let{result:t}=await this.client.jobstatuses.show(e),{job_status:r}=t;return r}async monitorJobStatus(e,t=500,r=5){let a=0;return new Promise((o,h)=>{let c=setInterval(async()=>{try{let u=await this.checkJobStatus(e);pi.has(u.status)&&(clearInterval(c),o(u))}catch(u){u&&u.statusCode===404&&a<r?++a:(clearInterval(c),h(u))}},t)})}};vs.exports=pe});var Ps=n(js=>{var{Client:di}=i(),yi=xs(),de=class extends di{constructor(e){super(e),this.jsonAPINames=["jobstatuses"]}async list(){return this.get("job_statuses")}async show(e){return this.get(["job_statuses",e])}async showMany(e){if(!Array.isArray(e)||e.length===0)throw new Error("Expected jobStatusIDs to be a non-empty array.");return this.get(["job_statuses","show_many",{ids:e.join(",")}])}async watch(e,t,r){let a=new yi(this.options);try{let o=await a.monitorJobStatus(e,t,r);return super.emit("debug::result",o),o}catch(o){throw super.emit("debug::result",`Error watching job status: ${o}`),o}}};js.JobStatuses=de});var zs=n(Is=>{var{Client:gi}=i(),ye=class extends gi{constructor(e){super(e),this.jsonAPINames=["locales","locale"]}async list(){return this.getAll(["locales"])}async show(e){return this.get(["locales",e])}async showCurrent(){return this.get(["locales","current"])}async current(){return this.get(["locales","current"])}async listForAgent(){return this.getAll(["locales","agent"])}async listPublicLocales(){return this.getAll(["locales","public"])}async detectBestLocale(e){return this.put(["locales","detect_best_locale"],{available_locales:e})}};Is.Locales=ye});var Ss=n(Ts=>{var{Client:mi}=i(),ge=class extends mi{constructor(e){super(e),this.jsonAPINames=["macros"]}async list(){return this.getAll(["macros","active"])}async show(e){return this.get(["macros",e])}async search(e){return this.get(["macros","search",{query:e}])}async listActive(){return this.get(["macros","active"])}async listByParams(e){return this.getAll(["macros",e])}async apply(e){return this.get(["macros",e,"apply"])}async applyTicket(e,t){return this.get(["tickets",e,"macros",t,"apply"])}async create(e){return this.post(["macros"],e)}async categories(){return this.getAll(["macros","categories"])}async update(e,t){return this.put(["macros",e],t)}async delete(e){return super.delete(["macros",e])}async updateMany(e){return this.put(["macros","update_many"],{macros:e})}};Ts.Macros=ge});var Ns=n(Bs=>{var{Client:_i}=i(),me=class extends _i{constructor(e){super(e),this.jsonAPINames=["oauthclients","oauthclient","clients"]}async list(){return this.getAll(["oauth","clients"])}async show(e){return this.get(["oauth","clients",e])}async create(e){return this.post(["oauth","clients"],{client:e})}async update(e,t){return this.put(["oauth","clients",e],{client:t})}async delete(e){return super.delete(["oauth","clients",e])}async generateSecret(e){return this.put(["oauth","clients",e,"generate_secret"])}};Bs.OAuthClients=me});var Es=n(Os=>{var{Client:Ai}=i(),_e=class extends Ai{constructor(e){super(e),this.jsonAPINames=["oauthtokens","oauthtoken","token"]}async show(e){return this.get(["oauth","tokens",e])}async current(){return this.show("current")}async list(){return this.getAll(["oauth","tokens"])}async revoke(e){return super.delete(["oauth","tokens",e])}async create(e){return this.post(["oauth","tokens"],e)}};Os.OAuthTokens=_e});var Ms=n(Us=>{var{Client:bi}=i(),Ae=class extends bi{constructor(e){super(e),this.jsonAPINames=["organization_fields","organization_field"]}async list(){return this.getAll(["organization_fields"])}async show(e){return this.get(["organization_fields",e])}async create(e){return this.post(["organization_fields"],e)}async update(e,t){return this.put(["organization_fields",e],t)}async delete(e){return super.delete(["organization_fields",e])}async reorder(e){return this.put(["organization_fields","reorder"],{organization_field_ids:e})}};Us.OrganizationFields=Ae});var Rs=n(Ls=>{var{Client:ki}=i(),be=class extends ki{constructor(e){super(e),this.jsonAPINames=["organization_membership","organization_memberships"]}async list(){return this.getAll(["organization_memberships"])}async listByUser(e){return this.getAll(["users",e,"organization_memberships"])}async listByOrganization(e){return this.getAll(["organizations",e,"organization_memberships"])}async show(e){return this.get(["organization_memberships",e])}async showByUser(e,t){return this.get(["users",e,"organization_memberships",t])}async create(e){return this.post(["organization_memberships"],{organization_membership:e})}async createByUser(e,t){return this.post(["users",e,"organization_memberships"],{organization_membership:t})}async createMany(e){return this.post(["organization_memberships","create_many"],{organization_memberships:e})}async delete(e){return super.delete(["organization_memberships",e])}async deleteByUser(e,t){return super.delete(["users",e,"organization_memberships",t])}async deleteMany(e){return super.delete(["organization_memberships","destroy_many",{ids:e.join(",")}])}async makeDefault(e,t){return this.put(["users",e,"organization_memberships",t,"make_default"])}};Ls.OrganizationMemberships=be});var Fs=n(Ds=>{var{Client:fi}=i(),ke=class extends fi{constructor(e){super(e),this.jsonAPINames=["organizations","organization"]}async list(){return this.getAll(["organizations"])}async listByUser(e){return this.getAll(["users",e,"organizations"])}async count(){return(await this.getAll(["organizations","count"])).count}async countByUser(e){return(await this.getAll(["users",e,"organizations","count"])).count}async related(e){return this.get(["organizations",e,"related"])}async show(e){return this.get(["organizations",e])}async showMany(e){return this.getAll(["organizations","show_many",{ids:e}])}async showManyByExternalIds(e){return this.getAll(["organizations","show_many",{external_ids:e}])}async create(e){return this.post(["organizations"],e)}async createMany(e){return this.post(["organizations","create_many"],e)}async createOrUpdate(e){return this.post(["organizations","create_or_update"],e)}async update(e,t){return this.put(["organizations",e],t)}async updateMany(e){return this.put(["organizations","update_many"],e)}async upsert(e){return this.post(["organizations","create_or_update"],e)}async delete(e){return super.delete(["organizations",e])}async bulkDelete(e){return super.delete(["organizations","destroy_many",{ids:e}])}async bulkDeleteByExternalId(e){return super.delete(["organizations","destroy_many",{external_ids:e}])}async search(e){return this.getAll(["organizations","search",{external_id:e}])}async autocomplete(e){return this.getAll(["organizations","autocomplete",e])}async incrementalInclude(e,t){return this.getAll(["incremental","organizations",{start_time:e,include:t}])}async incremental(e){return this.getAll(["incremental","organizations",{start_time:e}])}async incrementalSample(e){return this.get(["incremental","organizations","sample",{start_time:e}])}};Ds.Organizations=ke});var Gs=n($s=>{var{Client:qi}=i(),fe=class extends qi{constructor(e){super(e),this.jsonAPINames=["permission_groups"]}async list(){return this.getAll(["guide","permission_groups"])}async show(e){return this.get(["guide","permission_groups",e])}async create(e){return this.post(["guide","permission_groups"],e)}async update(e,t){return this.put(["guide","permission_groups",e],t)}async delete(e){return super.delete(["guide","permission_groups",e])}};$s.PermissionGroups=fe});var Ws=n(Hs=>{var{Client:wi}=i(),qe=class extends wi{constructor(e){super(e),this.jsonAPINames=["slas/policies"]}async list(){return this.getAll(["slas/policies"])}async show(e){return this.get(["slas/policies",e])}async create(e){return this.post(["slas/policies"],e)}async update(e,t){return this.put(["slas/policies",e],t)}async delete(e){return super.delete(["slas/policies",e])}async reorder(e){return this.put(["slas/policies/reorder"],{sla_policy_ids:e})}async getDefinitions(){return this.get(["slas/policies/definitions"])}};Hs.Policies=qe});var Vs=n(Js=>{var{Client:vi}=i(),we=class extends vi{constructor(e){super(e),this.jsonAPINames=["requests","request"],this.sideLoadMap=[{field:"assignee_id",name:"assignee",dataset:"users"},{field:"requester_id",name:"requester",dataset:"users"},{field:"organization_id",name:"organization",dataset:"organizations"}]}async list(e){return this.getAll(["requests",e])}async listOpen(e){return this.getAll(["requests","open",e])}async listSolved(e){return this.getAll(["requests","solved",e])}async listCCD(e){return this.getAll(["requests","ccd",e])}async listByUser(e,t){return this.getAll(["users",e,"requests",t])}async listByOrganization(e,t){return this.getAll(["organizations",e,"requests",t])}async search(e){return this.get(["requests","search",e])}async show(e){return this.get(["requests",e])}async getRequest(e){return this.show(e)}async create(e){return this.post(["requests"],e)}async update(e,t){return this.put(["requests",e],t)}async listComments(e){return this.getAll(["requests",e,"comments"])}async getComment(e,t){return this.getAll(["requests",e,"comments",t])}};Js.Requests=we});var Ks=n(Qs=>{var{Client:xi}=i(),ve=class extends xi{constructor(e){super(e),this.jsonAPINames=["satisfaction_ratings"]}async list(){return this.getAll(["satisfaction_ratings"])}async received(){return this.getAll(["satisfaction_ratings","received"])}async show(e){return this.get(["satisfaction_ratings",e])}async create(e,t){return this.post(["tickets",e,"satisfaction_rating"],t)}async incremental(e){this.get(["satisfaction_ratings",{start_time:e}])}};Qs.SatisfactionRatings=ve});var Zs=n(Xs=>{var{Client:Ci}=i(),xe=class extends Ci{constructor(e){super(e),this.jsonAPINames=["results"]}async query(e){return this.get(["search",{query:e}])}async queryAll(e){return this.getAll(["search",{query:e}])}async queryAnonymous(e){return this.get(["portal","search",{query:e}])}async queryAnonymousAll(e){return this.getAll(["portal","search",{query:e}])}async showResultsCount(e){return this.get(["search","count",{query:e}])}async exportResults(e,t,r=100){return this.getAll(["search","export",{query:e,"filter[type]":t,"page[size]":r}])}};Xs.Search=xe});var er=n(Ys=>{var{Client:ji}=i(),Ce=class extends ji{constructor(e){super(e),this.jsonAPINames=["sessions"]}async list(){return this.getAll(["sessions"])}async getByUserId(e){return this.getAll(["users",e,"sessions"])}async getByUserIdBySessionId(e,t){return this.get(["users",e,"sessions",t])}async getMyAuthenticatedSession(){return this.get(["users","me","session"])}async deleteByUserIdBySessionId(e,t){return super.delete(["users",e,"sessions",t])}async bulkDeleteByUserId(e){return super.delete(["users",e,"sessions"])}async logMeOut(){return super.delete(["users","me","sessions"])}};Ys.Sessions=Ce});var sr=n(tr=>{var{Client:Pi}=i(),je=class extends Pi{constructor(e){super(e),this.jsonAPINames=["sharing-agreement"]}async show(){return this.get(["sharing_agreements"])}async showById(e){return this.get(["sharing_agreements",e])}async create(e){return this.post(["sharing_agreements"],{sharing_agreement:e})}async update(e,t){return this.put(["sharing_agreements",e],{sharing_agreement:t})}async delete(e){return super.delete(["sharing_agreements",e])}};tr.SharingAgreement=je});var nr=n(rr=>{var{Client:Ii}=i(),{ApiTypes:zi}=p(),Pe=class extends Ii{constructor(e){super(e,zi.core),this.jsonAPINames=["side_conversations"]}async create(e,t){return this.post(["tickets",e,"side_conversations"],t)}async reply(e,t,r){return this.post(["tickets",e,"side_conversations",t,"reply"],r)}async update(e,t,r){return this.put(["tickets",e,"side_conversations",t],r)}async list(e){return this.getAll(["tickets",e,"side_conversations"])}async show(e,t){return this.get(["tickets",e,"side_conversations",t])}async attachments(e,{filename:t}){let r=new FormData;return r.append("file",new Blob([e]),t),this.requestUpload(["tickets","side_conversations","attachments"],r)}};rr.SideConversations=Pe});var ar=n(ir=>{var{Client:Ti}=i(),Ie=class extends Ti{constructor(e){super(e),this.jsonAPINames=["suspended_tickets","suspended_ticket"]}async list(){return this.getAll(["suspended_tickets"])}async show(e){return this.get(["suspended_tickets",e])}async recover(e){return this.put(["suspended_tickets",e,"recover"])}async recoverMany(e){return this.put(["suspended_tickets","recover_many",{ids:e}])}async delete(e){return super.delete(["suspended_tickets",e])}async destroyMany(e){return super.delete(["suspended_tickets","destroy_many",{ids:e}])}async deleteMany(e){return this.destroyMany(e)}async attachments(e){return this.post(["suspended_tickets",e,"attachments"])}async exportTickets(){return this.post(["suspended_tickets","export"])}};ir.SuspendedTickets=Ie});var cr=n(or=>{var{Client:Si}=i(),ze=class extends Si{constructor(e){super(e),this.jsonAPINames=["tags"]}async list(){return this.getAll(["tags"])}async create(e){return this.post(["tags"],e)}async s