@swishapp/api-client 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.d.ts CHANGED
@@ -27,6 +27,7 @@ declare class SwishClient {
27
27
  updateById: (listId: string, body: types.UpdateListInput) => Promise<ApiResponse<types.List>>;
28
28
  deleteById: (listId: string) => Promise<ApiResponse<unknown>>;
29
29
  orderItems: (listId: string, itemIds: types.SetListItemsOrderInput["itemIds"]) => Promise<ApiResponse<types.List>>;
30
+ addItemsToList: (listId: string, itemIds: types.AddItemsToListInput["itemIds"]) => Promise<ApiResponse<types.ListDetail>>;
30
31
  };
31
32
  readonly profiles: {
32
33
  customerAccountsVersion: () => Promise<ApiResponse<types.AccountsVersionResult>>;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- var K=Object.defineProperty;var o=(e,r)=>K(e,"name",{value:r,configurable:!0});var M=o(async(e,r)=>{let t=typeof r=="function"?await r(e):r;if(t)return e.scheme==="bearer"?`Bearer ${t}`:e.scheme==="basic"?`Basic ${btoa(t)}`:t},"A");var X={bodySerializer:o(e=>JSON.stringify(e,(r,t)=>typeof t=="bigint"?t.toString():t),"bodySerializer")};var Y=o(e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},"U"),Z=o(e=>{switch(e){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},"_"),ee=o(e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},"D"),g=o(({allowReserved:e,explode:r,name:t,style:s,value:i})=>{if(!r){let l=(e?i:i.map(d=>encodeURIComponent(d))).join(Z(s));switch(s){case"label":return`.${l}`;case"matrix":return`;${t}=${l}`;case"simple":return l;default:return`${t}=${l}`}}let a=Y(s),n=i.map(l=>s==="label"||s==="simple"?e?l:encodeURIComponent(l):E({allowReserved:e,name:t,value:l})).join(a);return s==="label"||s==="matrix"?a+n:n},"O"),E=o(({allowReserved:e,name:r,value:t})=>{if(t==null)return"";if(typeof t=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return`${r}=${e?t:encodeURIComponent(t)}`},"y"),B=o(({allowReserved:e,explode:r,name:t,style:s,value:i})=>{if(i instanceof Date)return`${t}=${i.toISOString()}`;if(s!=="deepObject"&&!r){let l=[];Object.entries(i).forEach(([y,u])=>{l=[...l,y,e?u:encodeURIComponent(u)]});let d=l.join(",");switch(s){case"form":return`${t}=${d}`;case"label":return`.${d}`;case"matrix":return`;${t}=${d}`;default:return d}}let a=ee(s),n=Object.entries(i).map(([l,d])=>E({allowReserved:e,name:s==="deepObject"?`${t}[${l}]`:l,value:d})).join(a);return s==="label"||s==="matrix"?a+n:n},"q"),re=/\{[^{}]+\}/g,te=o(({path:e,url:r})=>{let t=r,s=r.match(re);if(s)for(let i of s){let a=!1,n=i.substring(1,i.length-1),l="simple";n.endsWith("*")&&(a=!0,n=n.substring(0,n.length-1)),n.startsWith(".")?(n=n.substring(1),l="label"):n.startsWith(";")&&(n=n.substring(1),l="matrix");let d=e[n];if(d==null)continue;if(Array.isArray(d)){t=t.replace(i,g({explode:a,name:n,style:l,value:d}));continue}if(typeof d=="object"){t=t.replace(i,B({explode:a,name:n,style:l,value:d}));continue}if(l==="matrix"){t=t.replace(i,`;${E({name:n,value:d})}`);continue}let y=encodeURIComponent(l==="label"?`.${d}`:d);t=t.replace(i,y)}return t},"B"),S=o(({allowReserved:e,array:r,object:t}={})=>s=>{let i=[];if(s&&typeof s=="object")for(let a in s){let n=s[a];if(n!=null){if(Array.isArray(n)){i=[...i,g({allowReserved:e,explode:!0,name:a,style:"form",value:n,...r})];continue}if(typeof n=="object"){i=[...i,B({allowReserved:e,explode:!0,name:a,style:"deepObject",value:n,...t})];continue}i=[...i,E({allowReserved:e,name:a,value:n})]}}return i.join("&")},"E"),oe=o(e=>{var t;if(!e)return"stream";let r=(t=e.split(";")[0])==null?void 0:t.trim();if(r){if(r.startsWith("application/json")||r.endsWith("+json"))return"json";if(r==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some(s=>r.startsWith(s)))return"blob";if(r.startsWith("text/"))return"text"}},"P"),ne=o(async({security:e,...r})=>{for(let t of e){let s=await M(t,r.auth);if(!s)continue;let i=t.name??"Authorization";switch(t.in){case"query":r.query||(r.query={}),r.query[i]=s;break;case"header":default:r.headers.set(i,s);break}return}},"I"),R=o(e=>le({baseUrl:e.baseUrl,path:e.path,query:e.query,querySerializer:typeof e.querySerializer=="function"?e.querySerializer:S(e.querySerializer),url:e.url}),"S"),le=o(({baseUrl:e,path:r,query:t,querySerializer:s,url:i})=>{let a=i.startsWith("/")?i:`/${i}`,n=(e??"")+a;r&&(n=te({path:r,url:n}));let l=t?s(t):"";return l.startsWith("?")&&(l=l.substring(1)),l&&(n+=`?${l}`),n},"W"),x=o((e,r)=>{var s;let t={...e,...r};return(s=t.baseUrl)!=null&&s.endsWith("/")&&(t.baseUrl=t.baseUrl.substring(0,t.baseUrl.length-1)),t.headers=A(e.headers,r.headers),t},"C"),A=o((...e)=>{let r=new Headers;for(let t of e){if(!t||typeof t!="object")continue;let s=t instanceof Headers?t.entries():Object.entries(t);for(let[i,a]of s)if(a===null)r.delete(i);else if(Array.isArray(a))for(let n of a)r.append(i,n);else a!==void 0&&r.set(i,typeof a=="object"?JSON.stringify(a):a)}return r},"x"),C,b=(C=class{_fns;constructor(){this._fns=[]}clear(){this._fns=[]}exists(r){return this._fns.indexOf(r)!==-1}eject(r){let t=this._fns.indexOf(r);t!==-1&&(this._fns=[...this._fns.slice(0,t),...this._fns.slice(t+1)])}use(r){this._fns=[...this._fns,r]}},o(C,"m"),C),se=o(()=>({error:new b,request:new b,response:new b}),"T"),ie=S({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),ae={"Content-Type":"application/json"},m=o((e={})=>({...X,headers:ae,parseAs:"auto",querySerializer:ie,...e}),"w"),T=o((e={})=>{let r=x(m(),e),t=o(()=>({...r}),"e"),s=o(n=>(r=x(r,n),t()),"a"),i=se(),a=o(async n=>{let l={...r,...n,fetch:n.fetch??r.fetch??globalThis.fetch,headers:A(r.headers,n.headers)};l.security&&await ne({...l,security:l.security}),l.body&&l.bodySerializer&&(l.body=l.bodySerializer(l.body)),(l.body===void 0||l.body==="")&&l.headers.delete("Content-Type");let d=R(l),y={redirect:"follow",...l},u=new Request(d,y);for(let h of i.request._fns)u=await h(u,l);let Q=l.fetch,c=await Q(u);for(let h of i.response._fns)c=await h(c,u,l);let I={request:u,response:c};if(c.ok){if(c.status===204||c.headers.get("Content-Length")==="0")return{data:{},...I};let h=(l.parseAs==="auto"?oe(c.headers.get("Content-Type")):l.parseAs)??"json";if(h==="stream")return{data:c.body,...I};let w=await c[h]();return h==="json"&&(l.responseValidator&&await l.responseValidator(w),l.responseTransformer&&(w=await l.responseTransformer(w))),{data:w,...I}}let O=await c.text();try{O=JSON.parse(O)}catch{}let f=O;for(let h of i.error._fns)f=await h(O,c,u,l);if(f=f||{},l.throwOnError)throw f;return{error:f,...I}},"o");return{buildUrl:R,connect:o(n=>a({...n,method:"CONNECT"}),"connect"),delete:o(n=>a({...n,method:"DELETE"}),"delete"),get:o(n=>a({...n,method:"GET"}),"get"),getConfig:t,head:o(n=>a({...n,method:"HEAD"}),"head"),interceptors:i,options:o(n=>a({...n,method:"OPTIONS"}),"options"),patch:o(n=>a({...n,method:"PATCH"}),"patch"),post:o(n=>a({...n,method:"POST"}),"post"),put:o(n=>a({...n,method:"PUT"}),"put"),request:a,setConfig:s,trace:o(n=>a({...n,method:"TRACE"}),"trace")}},"J");var p=T(m({baseUrl:"https://swish.app/api/2025-04"}));var q=o(e=>((e==null?void 0:e.client)??p).get({url:"/lists",...e}),"listControllerFind"),v=o(e=>(e.client??p).post({url:"/lists",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"listControllerCreate"),j=o(e=>(e.client??p).delete({url:"/lists/{listId}",...e}),"listControllerDeleteById"),k=o(e=>(e.client??p).get({url:"/lists/{listId}",...e}),"listControllerFindById"),F=o(e=>(e.client??p).patch({url:"/lists/{listId}",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"listControllerUpdateById"),U=o(e=>(e.client??p).put({url:"/lists/{listId}/items/order",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"listControllerSetListItemsOrder"),P=o(e=>(e.client??p).delete({url:"/items",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"itemControllerDelete"),$=o(e=>((e==null?void 0:e.client)??p).get({url:"/items",...e}),"itemControllerFind"),z=o(e=>(e.client??p).post({url:"/items",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"itemControllerCreate"),N=o(e=>(e.client??p).delete({url:"/items/{itemId}",...e}),"itemControllerDeleteById"),_=o(e=>(e.client??p).get({url:"/items/{itemId}",...e}),"itemControllerFindById"),V=o(e=>(e.client??p).patch({url:"/items/{itemId}",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"itemControllerUpdateById"),W=o(e=>(e.client??p).put({url:"/items/{itemId}/lists",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"itemControllerSetListsById"),J=o(e=>((e==null?void 0:e.client)??p).get({url:"/profiles/accounts-version",...e}),"profileControllerCustomerAccountsVersion"),H=o(e=>(e.client??p).post({url:"/profiles/identify",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"profileControllerIdentify"),G=o(e=>(e.client??p).post({url:"/profiles/token",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"profileControllerCreateToken");var Ee=o(e=>new D(e),"createApiClient"),L=class L{constructor(r){this.client=T(m({baseUrl:"https://swish.app/api/2025-04"}));this.items={list:o(r=>this.handleRequest($({query:r,client:this.client})),"list"),create:o(r=>this.handleRequest(z({body:r,client:this.client})),"create"),delete:o(r=>this.handleRequest(P({body:{itemIds:r},client:this.client})),"delete"),findById:o(r=>this.handleRequest(_({path:{itemId:r},client:this.client})),"findById"),updateById:o((r,t)=>this.handleRequest(V({body:t,path:{itemId:r},client:this.client})),"updateById"),deleteById:o(r=>this.handleRequest(N({path:{itemId:r},client:this.client})),"deleteById"),setListsById:o((r,t)=>this.handleRequest(W({body:{listIds:t},path:{itemId:r},client:this.client})),"setListsById")};this.lists={list:o(r=>this.handleRequest(q({query:r,client:this.client})),"list"),create:o(r=>this.handleRequest(v({body:r,client:this.client})),"create"),findById:o((r,t)=>this.handleRequest(k({path:{listId:r},query:t??{sort:"recently_saved"},client:this.client})),"findById"),updateById:o((r,t)=>this.handleRequest(F({body:t,path:{listId:r},client:this.client})),"updateById"),deleteById:o(r=>this.handleRequest(j({path:{listId:r},client:this.client})),"deleteById"),orderItems:o((r,t)=>this.handleRequest(U({body:{itemIds:t},path:{listId:r},client:this.client})),"orderItems")};this.profiles={customerAccountsVersion:o(()=>this.handleRequest(J({client:this.client})),"customerAccountsVersion"),createToken:o((r={})=>this.handleRequest(G({body:r,client:this.client})),"createToken"),identify:o(r=>this.handleRequest(H({body:r,client:this.client})),"identify")};this.handleRequest=o(async r=>{let{data:t,error:s}=await r;if(s!=null&&s.error)return{data:null,error:s==null?void 0:s.error};if(t!=null&&t.data){let i={data:t.data,error:null};return t.pageInfo&&(i.pageInfo=t.pageInfo),i}return{data:null,error:null}},"handleRequest");this.profile=r.profile,r.authToken&&(this.authToken=r.authToken),r.config&&this.client.setConfig(r.config),this.client.interceptors.request.use(this.requestInterceptor.bind(this)),r.requestInterceptor&&this.client.interceptors.request.use(r.requestInterceptor),r.responseInterceptor&&this.client.interceptors.response.use(r.responseInterceptor)}setProfile(r){this.profile=r}setAuthToken(r){this.authToken=r}setConfig(r){this.client.setConfig(r)}requestInterceptor(r){return this.authToken&&r.headers.set("Authorization",`Bearer ${this.authToken}`),this.profile&&r.headers.set("Profile",this.profile),r}};o(L,"SwishClient");var D=L;export{Ee as createApiClient};
1
+ var M=Object.defineProperty;var o=(e,r)=>M(e,"name",{value:r,configurable:!0});var X=o(async(e,r)=>{let t=typeof r=="function"?await r(e):r;if(t)return e.scheme==="bearer"?`Bearer ${t}`:e.scheme==="basic"?`Basic ${btoa(t)}`:t},"A");var Y={bodySerializer:o(e=>JSON.stringify(e,(r,t)=>typeof t=="bigint"?t.toString():t),"bodySerializer")};var Z=o(e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},"U"),ee=o(e=>{switch(e){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},"_"),re=o(e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},"D"),g=o(({allowReserved:e,explode:r,name:t,style:s,value:i})=>{if(!r){let l=(e?i:i.map(d=>encodeURIComponent(d))).join(ee(s));switch(s){case"label":return`.${l}`;case"matrix":return`;${t}=${l}`;case"simple":return l;default:return`${t}=${l}`}}let a=Z(s),n=i.map(l=>s==="label"||s==="simple"?e?l:encodeURIComponent(l):w({allowReserved:e,name:t,value:l})).join(a);return s==="label"||s==="matrix"?a+n:n},"O"),w=o(({allowReserved:e,name:r,value:t})=>{if(t==null)return"";if(typeof t=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return`${r}=${e?t:encodeURIComponent(t)}`},"y"),B=o(({allowReserved:e,explode:r,name:t,style:s,value:i})=>{if(i instanceof Date)return`${t}=${i.toISOString()}`;if(s!=="deepObject"&&!r){let l=[];Object.entries(i).forEach(([y,h])=>{l=[...l,y,e?h:encodeURIComponent(h)]});let d=l.join(",");switch(s){case"form":return`${t}=${d}`;case"label":return`.${d}`;case"matrix":return`;${t}=${d}`;default:return d}}let a=re(s),n=Object.entries(i).map(([l,d])=>w({allowReserved:e,name:s==="deepObject"?`${t}[${l}]`:l,value:d})).join(a);return s==="label"||s==="matrix"?a+n:n},"q"),te=/\{[^{}]+\}/g,oe=o(({path:e,url:r})=>{let t=r,s=r.match(te);if(s)for(let i of s){let a=!1,n=i.substring(1,i.length-1),l="simple";n.endsWith("*")&&(a=!0,n=n.substring(0,n.length-1)),n.startsWith(".")?(n=n.substring(1),l="label"):n.startsWith(";")&&(n=n.substring(1),l="matrix");let d=e[n];if(d==null)continue;if(Array.isArray(d)){t=t.replace(i,g({explode:a,name:n,style:l,value:d}));continue}if(typeof d=="object"){t=t.replace(i,B({explode:a,name:n,style:l,value:d}));continue}if(l==="matrix"){t=t.replace(i,`;${w({name:n,value:d})}`);continue}let y=encodeURIComponent(l==="label"?`.${d}`:d);t=t.replace(i,y)}return t},"B"),S=o(({allowReserved:e,array:r,object:t}={})=>s=>{let i=[];if(s&&typeof s=="object")for(let a in s){let n=s[a];if(n!=null){if(Array.isArray(n)){i=[...i,g({allowReserved:e,explode:!0,name:a,style:"form",value:n,...r})];continue}if(typeof n=="object"){i=[...i,B({allowReserved:e,explode:!0,name:a,style:"deepObject",value:n,...t})];continue}i=[...i,w({allowReserved:e,name:a,value:n})]}}return i.join("&")},"E"),ne=o(e=>{var t;if(!e)return"stream";let r=(t=e.split(";")[0])==null?void 0:t.trim();if(r){if(r.startsWith("application/json")||r.endsWith("+json"))return"json";if(r==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some(s=>r.startsWith(s)))return"blob";if(r.startsWith("text/"))return"text"}},"P"),le=o(async({security:e,...r})=>{for(let t of e){let s=await X(t,r.auth);if(!s)continue;let i=t.name??"Authorization";switch(t.in){case"query":r.query||(r.query={}),r.query[i]=s;break;case"header":default:r.headers.set(i,s);break}return}},"I"),R=o(e=>se({baseUrl:e.baseUrl,path:e.path,query:e.query,querySerializer:typeof e.querySerializer=="function"?e.querySerializer:S(e.querySerializer),url:e.url}),"S"),se=o(({baseUrl:e,path:r,query:t,querySerializer:s,url:i})=>{let a=i.startsWith("/")?i:`/${i}`,n=(e??"")+a;r&&(n=oe({path:r,url:n}));let l=t?s(t):"";return l.startsWith("?")&&(l=l.substring(1)),l&&(n+=`?${l}`),n},"W"),x=o((e,r)=>{var s;let t={...e,...r};return(s=t.baseUrl)!=null&&s.endsWith("/")&&(t.baseUrl=t.baseUrl.substring(0,t.baseUrl.length-1)),t.headers=A(e.headers,r.headers),t},"C"),A=o((...e)=>{let r=new Headers;for(let t of e){if(!t||typeof t!="object")continue;let s=t instanceof Headers?t.entries():Object.entries(t);for(let[i,a]of s)if(a===null)r.delete(i);else if(Array.isArray(a))for(let n of a)r.append(i,n);else a!==void 0&&r.set(i,typeof a=="object"?JSON.stringify(a):a)}return r},"x"),C,L=(C=class{_fns;constructor(){this._fns=[]}clear(){this._fns=[]}exists(r){return this._fns.indexOf(r)!==-1}eject(r){let t=this._fns.indexOf(r);t!==-1&&(this._fns=[...this._fns.slice(0,t),...this._fns.slice(t+1)])}use(r){this._fns=[...this._fns,r]}},o(C,"m"),C),ie=o(()=>({error:new L,request:new L,response:new L}),"T"),ae=S({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),de={"Content-Type":"application/json"},m=o((e={})=>({...Y,headers:de,parseAs:"auto",querySerializer:ae,...e}),"w"),E=o((e={})=>{let r=x(m(),e),t=o(()=>({...r}),"e"),s=o(n=>(r=x(r,n),t()),"a"),i=ie(),a=o(async n=>{let l={...r,...n,fetch:n.fetch??r.fetch??globalThis.fetch,headers:A(r.headers,n.headers)};l.security&&await le({...l,security:l.security}),l.body&&l.bodySerializer&&(l.body=l.bodySerializer(l.body)),(l.body===void 0||l.body==="")&&l.headers.delete("Content-Type");let d=R(l),y={redirect:"follow",...l},h=new Request(d,y);for(let u of i.request._fns)h=await u(h,l);let K=l.fetch,c=await K(h);for(let u of i.response._fns)c=await u(c,h,l);let I={request:h,response:c};if(c.ok){if(c.status===204||c.headers.get("Content-Length")==="0")return{data:{},...I};let u=(l.parseAs==="auto"?ne(c.headers.get("Content-Type")):l.parseAs)??"json";if(u==="stream")return{data:c.body,...I};let T=await c[u]();return u==="json"&&(l.responseValidator&&await l.responseValidator(T),l.responseTransformer&&(T=await l.responseTransformer(T))),{data:T,...I}}let O=await c.text();try{O=JSON.parse(O)}catch{}let f=O;for(let u of i.error._fns)f=await u(O,c,h,l);if(f=f||{},l.throwOnError)throw f;return{error:f,...I}},"o");return{buildUrl:R,connect:o(n=>a({...n,method:"CONNECT"}),"connect"),delete:o(n=>a({...n,method:"DELETE"}),"delete"),get:o(n=>a({...n,method:"GET"}),"get"),getConfig:t,head:o(n=>a({...n,method:"HEAD"}),"head"),interceptors:i,options:o(n=>a({...n,method:"OPTIONS"}),"options"),patch:o(n=>a({...n,method:"PATCH"}),"patch"),post:o(n=>a({...n,method:"POST"}),"post"),put:o(n=>a({...n,method:"PUT"}),"put"),request:a,setConfig:s,trace:o(n=>a({...n,method:"TRACE"}),"trace")}},"J");var p=E(m({baseUrl:"https://swish.app/api/2025-07"}));var q=o(e=>((e==null?void 0:e.client)??p).get({url:"/lists",...e}),"listControllerFind"),j=o(e=>(e.client??p).post({url:"/lists",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"listControllerCreate"),k=o(e=>(e.client??p).delete({url:"/lists/{listId}",...e}),"listControllerDeleteById"),v=o(e=>(e.client??p).get({url:"/lists/{listId}",...e}),"listControllerFindById"),F=o(e=>(e.client??p).patch({url:"/lists/{listId}",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"listControllerUpdateById"),U=o(e=>(e.client??p).put({url:"/lists/{listId}/items/order",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"listControllerSetListItemsOrder"),P=o(e=>(e.client??p).post({url:"/lists/{listId}/items",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"listControllerAddItemsToList"),$=o(e=>(e.client??p).delete({url:"/items",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"itemControllerDelete"),z=o(e=>((e==null?void 0:e.client)??p).get({url:"/items",...e}),"itemControllerFind"),N=o(e=>(e.client??p).post({url:"/items",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"itemControllerCreate"),_=o(e=>(e.client??p).delete({url:"/items/{itemId}",...e}),"itemControllerDeleteById"),V=o(e=>(e.client??p).get({url:"/items/{itemId}",...e}),"itemControllerFindById"),W=o(e=>(e.client??p).patch({url:"/items/{itemId}",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"itemControllerUpdateById"),J=o(e=>(e.client??p).put({url:"/items/{itemId}/lists",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"itemControllerSetListsById"),H=o(e=>((e==null?void 0:e.client)??p).get({url:"/profiles/accounts-version",...e}),"profileControllerCustomerAccountsVersion"),G=o(e=>(e.client??p).post({url:"/profiles/identify",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"profileControllerIdentify"),Q=o(e=>(e.client??p).post({url:"/profiles/token",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"profileControllerCreateToken");var Ee=o(e=>new b(e),"createApiClient"),D=class D{constructor(r){this.client=E(m({baseUrl:"https://swish.app/api/2025-07"}));this.items={list:o(r=>this.handleRequest(z({query:r,client:this.client})),"list"),create:o(r=>this.handleRequest(N({body:r,client:this.client})),"create"),delete:o(r=>this.handleRequest($({body:{itemIds:r},client:this.client})),"delete"),findById:o(r=>this.handleRequest(V({path:{itemId:r},client:this.client})),"findById"),updateById:o((r,t)=>this.handleRequest(W({body:t,path:{itemId:r},client:this.client})),"updateById"),deleteById:o(r=>this.handleRequest(_({path:{itemId:r},client:this.client})),"deleteById"),setListsById:o((r,t)=>this.handleRequest(J({body:{listIds:t},path:{itemId:r},client:this.client})),"setListsById")};this.lists={list:o(r=>this.handleRequest(q({query:r,client:this.client})),"list"),create:o(r=>this.handleRequest(j({body:r,client:this.client})),"create"),findById:o((r,t)=>this.handleRequest(v({path:{listId:r},query:t??{sort:"recently_saved"},client:this.client})),"findById"),updateById:o((r,t)=>this.handleRequest(F({body:t,path:{listId:r},client:this.client})),"updateById"),deleteById:o(r=>this.handleRequest(k({path:{listId:r},client:this.client})),"deleteById"),orderItems:o((r,t)=>this.handleRequest(U({body:{itemIds:t},path:{listId:r},client:this.client})),"orderItems"),addItemsToList:o((r,t)=>this.handleRequest(P({body:{itemIds:t},path:{listId:r},client:this.client})),"addItemsToList")};this.profiles={customerAccountsVersion:o(()=>this.handleRequest(H({client:this.client})),"customerAccountsVersion"),createToken:o((r={})=>this.handleRequest(Q({body:r,client:this.client})),"createToken"),identify:o(r=>this.handleRequest(G({body:r,client:this.client})),"identify")};this.handleRequest=o(async r=>{let{data:t,error:s}=await r;if(s!=null&&s.error)return{data:null,error:s==null?void 0:s.error};if(t!=null&&t.data){let i={data:t.data,error:null};return t.pageInfo&&(i.pageInfo=t.pageInfo),i}return{data:null,error:null}},"handleRequest");this.profile=r.profile,r.authToken&&(this.authToken=r.authToken),r.config&&this.client.setConfig(r.config),this.client.interceptors.request.use(this.requestInterceptor.bind(this)),r.requestInterceptor&&this.client.interceptors.request.use(r.requestInterceptor),r.responseInterceptor&&this.client.interceptors.response.use(r.responseInterceptor)}setProfile(r){this.profile=r}setAuthToken(r){this.authToken=r}setConfig(r){this.client.setConfig(r)}requestInterceptor(r){return this.authToken&&r.headers.set("Authorization",`Bearer ${this.authToken}`),this.profile&&r.headers.set("Profile",this.profile),r}};o(D,"SwishClient");var b=D;export{Ee as createApiClient};
@@ -1,5 +1,5 @@
1
1
  import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';
2
- import type { ListControllerFindData, ListControllerFindError, ListControllerCreateData, ListControllerCreateError, ListControllerDeleteByIdData, ListControllerDeleteByIdError, ListControllerFindByIdData, ListControllerFindByIdError, ListControllerUpdateByIdData, ListControllerUpdateByIdError, ListControllerSetListItemsOrderData, ListControllerSetListItemsOrderError, ItemControllerDeleteData, ItemControllerDeleteError, ItemControllerFindData, ItemControllerFindError, ItemControllerCreateData, ItemControllerCreateError, ItemControllerDeleteByIdData, ItemControllerDeleteByIdError, ItemControllerFindByIdData, ItemControllerFindByIdError, ItemControllerUpdateByIdData, ItemControllerUpdateByIdError, ItemControllerSetListsByIdData, ItemControllerSetListsByIdError, ProfileControllerCustomerAccountsVersionData, ProfileControllerCustomerAccountsVersionError, ProfileControllerIdentifyData, ProfileControllerIdentifyError, ProfileControllerCreateTokenData, ProfileControllerCreateTokenError, AnalyticsControllerLoadSavedItemsData, AnalyticsControllerLoadSavedItemsError, AnalyticsControllerLoadSessionsData, AnalyticsControllerLoadSessionsError, AnalyticsControllerLoadNewListsData, AnalyticsControllerLoadNewListsError } from './types.gen';
2
+ import type { ListControllerFindData, ListControllerFindError, ListControllerCreateData, ListControllerCreateError, ListControllerDeleteByIdData, ListControllerDeleteByIdError, ListControllerFindByIdData, ListControllerFindByIdError, ListControllerUpdateByIdData, ListControllerUpdateByIdError, ListControllerSetListItemsOrderData, ListControllerSetListItemsOrderError, ListControllerAddItemsToListData, ListControllerAddItemsToListError, ItemControllerDeleteData, ItemControllerDeleteError, ItemControllerFindData, ItemControllerFindError, ItemControllerCreateData, ItemControllerCreateError, ItemControllerDeleteByIdData, ItemControllerDeleteByIdError, ItemControllerFindByIdData, ItemControllerFindByIdError, ItemControllerUpdateByIdData, ItemControllerUpdateByIdError, ItemControllerSetListsByIdData, ItemControllerSetListsByIdError, ProfileControllerCustomerAccountsVersionData, ProfileControllerCustomerAccountsVersionError, ProfileControllerIdentifyData, ProfileControllerIdentifyError, ProfileControllerCreateTokenData, ProfileControllerCreateTokenError, AnalyticsControllerLoadSavedItemsData, AnalyticsControllerLoadSavedItemsError, AnalyticsControllerLoadSessionsData, AnalyticsControllerLoadSessionsError, AnalyticsControllerLoadNewListsData, AnalyticsControllerLoadNewListsError } from './types.gen';
3
3
  export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
4
4
  /**
5
5
  * You can provide a client instance returned by `createClient()` instead of
@@ -29,6 +29,9 @@ export declare const listControllerUpdateById: <ThrowOnError extends boolean = f
29
29
  export declare const listControllerSetListItemsOrder: <ThrowOnError extends boolean = false>(options: Options<ListControllerSetListItemsOrderData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").Response & {
30
30
  data?: import("./types.gen").List;
31
31
  }, ListControllerSetListItemsOrderError, ThrowOnError>;
32
+ export declare const listControllerAddItemsToList: <ThrowOnError extends boolean = false>(options: Options<ListControllerAddItemsToListData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").Response & {
33
+ data?: import("./types.gen").ListDetail;
34
+ }, ListControllerAddItemsToListError, ThrowOnError>;
32
35
  export declare const itemControllerDelete: <ThrowOnError extends boolean = false>(options: Options<ItemControllerDeleteData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<void, ItemControllerDeleteError, ThrowOnError>;
33
36
  export declare const itemControllerFind: <ThrowOnError extends boolean = false>(options?: Options<ItemControllerFindData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").PaginatedResponse & {
34
37
  data?: Array<import("./types.gen").Item>;
@@ -10,9 +10,7 @@ export type Item = {
10
10
  /**
11
11
  * The Shopify ID of the variant
12
12
  */
13
- variantId: {
14
- [key: string]: unknown;
15
- } | null;
13
+ variantId: number | null;
16
14
  /**
17
15
  * The quantity of the item in the list
18
16
  */
@@ -65,6 +63,14 @@ export type List = {
65
63
  * The date and time the list was updated
66
64
  */
67
65
  updatedAt: string;
66
+ /**
67
+ * The number of items in the list
68
+ */
69
+ itemCount: number;
70
+ /**
71
+ * Array of image URLs for the first 4 items in the list
72
+ */
73
+ imageUrls: Array<string>;
68
74
  };
69
75
  export type _Error = {
70
76
  /**
@@ -94,15 +100,11 @@ export type PageInfo = {
94
100
  /**
95
101
  * The cursor for the next page
96
102
  */
97
- next: {
98
- [key: string]: unknown;
99
- } | null;
103
+ next: string | null;
100
104
  /**
101
105
  * The cursor for the previous page
102
106
  */
103
- previous: {
104
- [key: string]: unknown;
105
- } | null;
107
+ previous: string | null;
106
108
  };
107
109
  export type PaginatedResponse = {
108
110
  pageInfo: PageInfo;
@@ -128,6 +130,12 @@ export type SetListItemsOrderInput = {
128
130
  */
129
131
  itemIds: Array<string>;
130
132
  };
133
+ export type AddItemsToListInput = {
134
+ /**
135
+ * The list of item IDs to add to the list
136
+ */
137
+ itemIds: Array<string>;
138
+ };
131
139
  export type ItemDetail = {
132
140
  /**
133
141
  * The ID of the item
@@ -140,9 +148,7 @@ export type ItemDetail = {
140
148
  /**
141
149
  * The Shopify ID of the variant
142
150
  */
143
- variantId: {
144
- [key: string]: unknown;
145
- } | null;
151
+ variantId: number | null;
146
152
  /**
147
153
  * The quantity of the item in the list
148
154
  */
@@ -173,12 +179,19 @@ export type CreateItemInput = {
173
179
  * The quantity of the item
174
180
  */
175
181
  quantity?: number;
182
+ /**
183
+ * Tags associated with the item (must contain only lowercase letters, numbers, hyphens or underscores)
184
+ */
185
+ tags?: Array<string>;
176
186
  };
177
- export type DeleteItemsInput = {
187
+ export type ItemReference = {
178
188
  /**
179
- * The list of item IDs to delete
189
+ * The ID of the item
180
190
  */
181
- itemIds: Array<string>;
191
+ id: string;
192
+ };
193
+ export type DeleteItemsInput = {
194
+ itemIds: Array<ItemReference>;
182
195
  };
183
196
  export type UpdateItemInput = {
184
197
  /**
@@ -418,11 +431,11 @@ export type ListControllerFindByIdData = {
418
431
  */
419
432
  listId: string;
420
433
  };
421
- query?: {
434
+ query: {
422
435
  /**
423
436
  * The sort order of the items in the list
424
437
  */
425
- sort?: 'recently_saved' | 'custom';
438
+ sort: 'recently_saved' | 'custom';
426
439
  };
427
440
  url: '/lists/{listId}';
428
441
  };
@@ -592,6 +605,62 @@ export type ListControllerSetListItemsOrderResponses = {
592
605
  };
593
606
  };
594
607
  export type ListControllerSetListItemsOrderResponse = ListControllerSetListItemsOrderResponses[keyof ListControllerSetListItemsOrderResponses];
608
+ export type ListControllerAddItemsToListData = {
609
+ body: AddItemsToListInput;
610
+ path: {
611
+ listId: string;
612
+ };
613
+ query?: never;
614
+ url: '/lists/{listId}/items';
615
+ };
616
+ export type ListControllerAddItemsToListErrors = {
617
+ /**
618
+ * Bad Request
619
+ */
620
+ 400: ErrorResponse & {
621
+ error?: {
622
+ statusCode?: number;
623
+ error?: string;
624
+ };
625
+ };
626
+ /**
627
+ * Unauthorized
628
+ */
629
+ 401: ErrorResponse & {
630
+ error?: {
631
+ statusCode?: number;
632
+ error?: string;
633
+ };
634
+ };
635
+ /**
636
+ * Forbidden
637
+ */
638
+ 403: ErrorResponse & {
639
+ error?: {
640
+ statusCode?: number;
641
+ error?: string;
642
+ };
643
+ };
644
+ /**
645
+ * Not Found
646
+ */
647
+ 404: ErrorResponse & {
648
+ error?: {
649
+ statusCode?: number;
650
+ error?: string;
651
+ };
652
+ };
653
+ };
654
+ export type ListControllerAddItemsToListError = ListControllerAddItemsToListErrors[keyof ListControllerAddItemsToListErrors];
655
+ export type ListControllerAddItemsToListResponses = {
656
+ /**
657
+ * Items have been successfully added to the list.
658
+ */
659
+ 200: Response & {
660
+ data?: ListDetail;
661
+ };
662
+ };
663
+ export type ListControllerAddItemsToListResponse = ListControllerAddItemsToListResponses[keyof ListControllerAddItemsToListResponses];
595
664
  export type ItemControllerDeleteData = {
596
665
  body: DeleteItemsInput;
597
666
  path?: never;
@@ -1375,5 +1444,5 @@ export type AnalyticsControllerLoadNewListsResponses = {
1375
1444
  };
1376
1445
  export type AnalyticsControllerLoadNewListsResponse = AnalyticsControllerLoadNewListsResponses[keyof AnalyticsControllerLoadNewListsResponses];
1377
1446
  export type ClientOptions = {
1378
- baseUrl: 'https://swish.app/api/2025-04' | (string & {});
1447
+ baseUrl: 'https://swish.app/api/2025-07' | (string & {});
1379
1448
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swishapp/api-client",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "A lightweight JS client for the Swish REST API.",
5
5
  "homepage": "https://developers.swish.app/libraries/api-client",
6
6
  "type": "module",