@swishapp/api-client 0.27.0 → 0.29.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/index.js CHANGED
@@ -1,5 +1,5 @@
1
- var ke=Object.defineProperty;var n=(e,r)=>ke(e,"name",{value:r,configurable:!0});var j={bodySerializer:n(e=>JSON.stringify(e,(r,t)=>typeof t=="bigint"?t.toString():t),"bodySerializer")};var De={$body_:"body",$headers_:"headers",$path_:"path",$query_:"query"},Me=Object.entries(De);var _=n(({onRequest:e,onSseError:r,onSseEvent:t,responseTransformer:o,responseValidator:s,sseDefaultRetryDelay:p,sseMaxRetryAttempts:d,sseMaxRetryDelay:a,sseSleepFn:l,url:u,...i})=>{let h,k=l??(c=>new Promise(C=>setTimeout(C,c)));return{stream:n(async function*(){let c=p??3e3,C=0,R=i.signal??new AbortController().signal;for(;!R.aborted;){C++;let D=i.headers instanceof Headers?i.headers:new Headers(i.headers);h!==void 0&&D.set("Last-Event-ID",h);try{let T={redirect:"follow",...i,body:i.serializedBody,headers:D,signal:R},I=new Request(u,T);e&&(I=await e(u,T));let m=await(i.fetch??globalThis.fetch)(I);if(!m.ok)throw new Error(`SSE failed: ${m.status} ${m.statusText}`);if(!m.body)throw new Error("No body in SSE response");let g=m.body.pipeThrough(new TextDecoderStream).getReader(),F="",V=n(()=>{try{g.cancel()}catch{}},"abortHandler");R.addEventListener("abort",V);try{for(;;){let{done:Te,value:we}=await g.read();if(Te)break;F+=we;let M=F.split(`
1
+ var Le=Object.defineProperty;var s=(e,r)=>Le(e,"name",{value:r,configurable:!0});var j={bodySerializer:s(e=>JSON.stringify(e,(r,t)=>typeof t=="bigint"?t.toString():t),"bodySerializer")};var De={$body_:"body",$headers_:"headers",$path_:"path",$query_:"query"},Me=Object.entries(De);var _=s(({onRequest:e,onSseError:r,onSseEvent:t,responseTransformer:o,responseValidator:n,sseDefaultRetryDelay:p,sseMaxRetryAttempts:d,sseMaxRetryDelay:a,sseSleepFn:l,url:u,...i})=>{let h,L=l??(c=>new Promise(C=>setTimeout(C,c)));return{stream:s(async function*(){let c=p??3e3,C=0,R=i.signal??new AbortController().signal;for(;!R.aborted;){C++;let D=i.headers instanceof Headers?i.headers:new Headers(i.headers);h!==void 0&&D.set("Last-Event-ID",h);try{let T={redirect:"follow",...i,body:i.serializedBody,headers:D,signal:R},I=new Request(u,T);e&&(I=await e(u,T));let m=await(i.fetch??globalThis.fetch)(I);if(!m.ok)throw new Error(`SSE failed: ${m.status} ${m.statusText}`);if(!m.body)throw new Error("No body in SSE response");let g=m.body.pipeThrough(new TextDecoderStream).getReader(),z="",V=s(()=>{try{g.cancel()}catch{}},"abortHandler");R.addEventListener("abort",V);try{for(;;){let{done:Te,value:Se}=await g.read();if(Te)break;z+=Se;let M=z.split(`
2
2
 
3
- `);F=M.pop()??"";for(let Ee of M){let Se=Ee.split(`
4
- `),P=[],W;for(let O of Se)if(O.startsWith("data:"))P.push(O.replace(/^data:\s*/,""));else if(O.startsWith("event:"))W=O.replace(/^event:\s*/,"");else if(O.startsWith("id:"))h=O.replace(/^id:\s*/,"");else if(O.startsWith("retry:")){let J=Number.parseInt(O.replace(/^retry:\s*/,""),10);Number.isNaN(J)||(c=J)}let w,Q=!1;if(P.length){let O=P.join(`
5
- `);try{w=JSON.parse(O),Q=!0}catch{w=O}}Q&&(s&&await s(w),o&&(w=await o(w))),t==null||t({data:w,event:W,id:h,retry:c}),P.length&&(yield w)}}}finally{R.removeEventListener("abort",V),g.releaseLock()}break}catch(T){if(r==null||r(T),d!==void 0&&C>=d)break;let I=Math.min(c*2**(C-1),a??3e4);await k(I)}}},"createStream")()}},"createSseClient");var qe=n(e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},"separatorArrayExplode"),Le=n(e=>{switch(e){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},"separatorArrayNoExplode"),Pe=n(e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},"separatorObjectExplode"),A=n(({allowReserved:e,explode:r,name:t,style:o,value:s})=>{if(!r){let a=(e?s:s.map(l=>encodeURIComponent(l))).join(Le(o));switch(o){case"label":return`.${a}`;case"matrix":return`;${t}=${a}`;case"simple":return a;default:return`${t}=${a}`}}let p=qe(o),d=s.map(a=>o==="label"||o==="simple"?e?a:encodeURIComponent(a):E({allowReserved:e,name:t,value:a})).join(p);return o==="label"||o==="matrix"?p+d:d},"serializeArrayParam"),E=n(({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)}`},"serializePrimitiveParam"),B=n(({allowReserved:e,explode:r,name:t,style:o,value:s,valueOnly:p})=>{if(s instanceof Date)return p?s.toISOString():`${t}=${s.toISOString()}`;if(o!=="deepObject"&&!r){let l=[];Object.entries(s).forEach(([i,h])=>{l=[...l,i,e?h:encodeURIComponent(h)]});let u=l.join(",");switch(o){case"form":return`${t}=${u}`;case"label":return`.${u}`;case"matrix":return`;${t}=${u}`;default:return u}}let d=Pe(o),a=Object.entries(s).map(([l,u])=>E({allowReserved:e,name:o==="deepObject"?`${t}[${l}]`:l,value:u})).join(d);return o==="label"||o==="matrix"?d+a:a},"serializeObjectParam");var Ae=/\{[^{}]+\}/g,Be=n(({path:e,url:r})=>{let t=r,o=r.match(Ae);if(o)for(let s of o){let p=!1,d=s.substring(1,s.length-1),a="simple";d.endsWith("*")&&(p=!0,d=d.substring(0,d.length-1)),d.startsWith(".")?(d=d.substring(1),a="label"):d.startsWith(";")&&(d=d.substring(1),a="matrix");let l=e[d];if(l==null)continue;if(Array.isArray(l)){t=t.replace(s,A({explode:p,name:d,style:a,value:l}));continue}if(typeof l=="object"){t=t.replace(s,B({explode:p,name:d,style:a,value:l,valueOnly:!0}));continue}if(a==="matrix"){t=t.replace(s,`;${E({name:d,value:l})}`);continue}let u=encodeURIComponent(a==="label"?`.${l}`:l);t=t.replace(s,u)}return t},"defaultPathSerializer"),K=n(({baseUrl:e,path:r,query:t,querySerializer:o,url:s})=>{let p=s.startsWith("/")?s:`/${s}`,d=(e??"")+p;r&&(d=Be({path:r,url:d}));let a=t?o(t):"";return a.startsWith("?")&&(a=a.substring(1)),a&&(d+=`?${a}`),d},"getUrl");function G(e){let r=e.body!==void 0;if(r&&e.bodySerializer)return"serializedBody"in e?e.serializedBody!==void 0&&e.serializedBody!==""?e.serializedBody:null:e.body!==""?e.body:null;if(r)return e.body}n(G,"getValidRequestBody");var X=n(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},"getAuthToken");var Y=n(({allowReserved:e,array:r,object:t}={})=>n(s=>{let p=[];if(s&&typeof s=="object")for(let d in s){let a=s[d];if(a!=null)if(Array.isArray(a)){let l=A({allowReserved:e,explode:!0,name:d,style:"form",value:a,...r});l&&p.push(l)}else if(typeof a=="object"){let l=B({allowReserved:e,explode:!0,name:d,style:"deepObject",value:a,...t});l&&p.push(l)}else{let l=E({allowReserved:e,name:d,value:a});l&&p.push(l)}}return p.join("&")},"querySerializer"),"createQuerySerializer"),Z=n(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(o=>r.startsWith(o)))return"blob";if(r.startsWith("text/"))return"text"}},"getParseAs"),ze=n((e,r)=>{var t,o;return r?!!(e.headers.has(r)||(t=e.query)!=null&&t[r]||(o=e.headers.get("Cookie"))!=null&&o.includes(`${r}=`)):!1},"checkForExistence"),ee=n(async({security:e,...r})=>{for(let t of e){if(ze(r,t.name))continue;let o=await X(t,r.auth);if(!o)continue;let s=t.name??"Authorization";switch(t.in){case"query":r.query||(r.query={}),r.query[s]=o;break;case"cookie":r.headers.append("Cookie",`${s}=${o}`);break;case"header":default:r.headers.set(s,o);break}}},"setAuthParams"),v=n(e=>K({baseUrl:e.baseUrl,path:e.path,query:e.query,querySerializer:typeof e.querySerializer=="function"?e.querySerializer:Y(e.querySerializer),url:e.url}),"buildUrl"),U=n((e,r)=>{var o;let t={...e,...r};return(o=t.baseUrl)!=null&&o.endsWith("/")&&(t.baseUrl=t.baseUrl.substring(0,t.baseUrl.length-1)),t.headers=z(e.headers,r.headers),t},"mergeConfigs"),Fe=n(e=>{let r=[];return e.forEach((t,o)=>{r.push([o,t])}),r},"headersEntries"),z=n((...e)=>{let r=new Headers;for(let t of e){if(!t)continue;let o=t instanceof Headers?Fe(t):Object.entries(t);for(let[s,p]of o)if(p===null)r.delete(s);else if(Array.isArray(p))for(let d of p)r.append(s,d);else p!==void 0&&r.set(s,typeof p=="object"?JSON.stringify(p):p)}return r},"mergeHeaders"),$=class ${constructor(){this.fns=[]}clear(){this.fns=[]}eject(r){let t=this.getInterceptorIndex(r);this.fns[t]&&(this.fns[t]=null)}exists(r){let t=this.getInterceptorIndex(r);return!!this.fns[t]}getInterceptorIndex(r){return typeof r=="number"?this.fns[r]?r:-1:this.fns.indexOf(r)}update(r,t){let o=this.getInterceptorIndex(r);return this.fns[o]?(this.fns[o]=t,r):!1}use(r){return this.fns.push(r),this.fns.length-1}};n($,"Interceptors");var q=$,re=n(()=>({error:new q,request:new q,response:new q}),"createInterceptors"),je=Y({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),ve={"Content-Type":"application/json"},x=n((e={})=>({...j,headers:ve,parseAs:"auto",querySerializer:je,...e}),"createConfig");var S=n((e={})=>{let r=U(x(),e),t=n(()=>({...r}),"getConfig"),o=n(u=>(r=U(r,u),t()),"setConfig"),s=re(),p=n(async u=>{let i={...r,...u,fetch:u.fetch??r.fetch??globalThis.fetch,headers:z(r.headers,u.headers),serializedBody:void 0};i.security&&await ee({...i,security:i.security}),i.requestValidator&&await i.requestValidator(i),i.body!==void 0&&i.bodySerializer&&(i.serializedBody=i.bodySerializer(i.body)),(i.body===void 0||i.serializedBody==="")&&i.headers.delete("Content-Type");let h=v(i);return{opts:i,url:h}},"beforeRequest"),d=n(async u=>{let{opts:i,url:h}=await p(u),k={redirect:"follow",...i,body:G(i)},b=new Request(h,k);for(let f of s.request.fns)f&&(b=await f(b,i));let L=i.fetch,c=await L(b);for(let f of s.response.fns)f&&(c=await f(c,b,i));let C={request:b,response:c};if(c.ok){let f=(i.parseAs==="auto"?Z(c.headers.get("Content-Type")):i.parseAs)??"json";if(c.status===204||c.headers.get("Content-Length")==="0"){let g;switch(f){case"arrayBuffer":case"blob":case"text":g=await c[f]();break;case"formData":g=new FormData;break;case"stream":g=c.body;break;case"json":default:g={};break}return i.responseStyle==="data"?g:{data:g,...C}}let m;switch(f){case"arrayBuffer":case"blob":case"formData":case"json":case"text":m=await c[f]();break;case"stream":return i.responseStyle==="data"?c.body:{data:c.body,...C}}return f==="json"&&(i.responseValidator&&await i.responseValidator(m),i.responseTransformer&&(m=await i.responseTransformer(m))),i.responseStyle==="data"?m:{data:m,...C}}let R=await c.text(),D;try{D=JSON.parse(R)}catch{}let T=D??R,I=T;for(let f of s.error.fns)f&&(I=await f(T,c,b,i));if(I=I||{},i.throwOnError)throw I;return i.responseStyle==="data"?void 0:{error:I,...C}},"request"),a=n(u=>i=>d({...i,method:u}),"makeMethodFn"),l=n(u=>async i=>{let{opts:h,url:k}=await p(i);return _({...h,body:h.body,headers:h.headers,method:u,onRequest:n(async(b,L)=>{let c=new Request(b,L);for(let C of s.request.fns)C&&(c=await C(c,h));return c},"onRequest"),url:k})},"makeSseFn");return{buildUrl:v,connect:a("CONNECT"),delete:a("DELETE"),get:a("GET"),getConfig:t,head:a("HEAD"),interceptors:s,options:a("OPTIONS"),patch:a("PATCH"),post:a("POST"),put:a("PUT"),request:d,setConfig:o,sse:{connect:l("CONNECT"),delete:l("DELETE"),get:l("GET"),head:l("HEAD"),options:l("OPTIONS"),patch:l("PATCH"),post:l("POST"),put:l("PUT"),trace:l("TRACE")},trace:a("TRACE")}},"createClient");var y=S(x({baseUrl:"https://swish.app/api/2026-01"}));var te=n(e=>((e==null?void 0:e.client)??y).get({security:[{scheme:"bearer",type:"http"}],url:"/lists",...e}),"listControllerFind"),ne=n(e=>(e.client??y).post({security:[{scheme:"bearer",type:"http"}],url:"/lists",...e,headers:{"Content-Type":"application/json",...e.headers}}),"listControllerCreate"),oe=n(e=>(e.client??y).delete({security:[{scheme:"bearer",type:"http"}],url:"/lists/{listId}",...e}),"listControllerDeleteById"),se=n(e=>(e.client??y).get({security:[{scheme:"bearer",type:"http"}],url:"/lists/{listId}",...e}),"listControllerFindById"),ie=n(e=>(e.client??y).patch({security:[{scheme:"bearer",type:"http"}],url:"/lists/{listId}",...e,headers:{"Content-Type":"application/json",...e.headers}}),"listControllerUpdateById"),ae=n(e=>(e.client??y).put({security:[{scheme:"bearer",type:"http"}],url:"/lists/{listId}/items/order",...e,headers:{"Content-Type":"application/json",...e.headers}}),"listControllerSetListItemsOrder"),le=n(e=>(e.client??y).post({security:[{scheme:"bearer",type:"http"}],url:"/lists/{listId}/items",...e,headers:{"Content-Type":"application/json",...e.headers}}),"listControllerAddItemsToList"),de=n(e=>(e.client??y).delete({security:[{scheme:"bearer",type:"http"}],url:"/lists/{listId}/items/{itemId}",...e}),"listControllerRemoveItemFromList"),pe=n(e=>(e.client??y).delete({security:[{scheme:"bearer",type:"http"}],url:"/items",...e,headers:{"Content-Type":"application/json",...e.headers}}),"itemControllerDelete"),ce=n(e=>((e==null?void 0:e.client)??y).get({security:[{scheme:"bearer",type:"http"}],url:"/items",...e}),"itemControllerFind"),ue=n(e=>(e.client??y).post({security:[{scheme:"bearer",type:"http"}],url:"/items",...e,headers:{"Content-Type":"application/json",...e.headers}}),"itemControllerCreate"),ye=n(e=>((e==null?void 0:e.client)??y).get({security:[{scheme:"bearer",type:"http"}],url:"/items/count",...e}),"itemControllerCount"),he=n(e=>(e.client??y).delete({security:[{scheme:"bearer",type:"http"}],url:"/items/{itemId}",...e}),"itemControllerDeleteById"),fe=n(e=>(e.client??y).get({security:[{scheme:"bearer",type:"http"}],url:"/items/{itemId}",...e}),"itemControllerFindById"),Ce=n(e=>(e.client??y).patch({security:[{scheme:"bearer",type:"http"}],url:"/items/{itemId}",...e,headers:{"Content-Type":"application/json",...e.headers}}),"itemControllerUpdateById"),me=n(e=>(e.client??y).put({security:[{scheme:"bearer",type:"http"}],url:"/items/{itemId}/lists",...e,headers:{"Content-Type":"application/json",...e.headers}}),"itemControllerSetListsById"),Oe=n(e=>((e==null?void 0:e.client)??y).get({security:[{scheme:"bearer",type:"http"}],url:"/profiles/accounts-version",...e}),"profileControllerCustomerAccountsVersion"),Ie=n(e=>(e.client??y).post({security:[{scheme:"bearer",type:"http"}],url:"/profiles/identify",...e,headers:{"Content-Type":"application/json",...e.headers}}),"profileControllerIdentify"),ge=n(e=>(e.client??y).post({security:[{scheme:"bearer",type:"http"}],url:"/profiles/token",...e,headers:{"Content-Type":"application/json",...e.headers}}),"profileControllerCreateToken");var be=n(e=>((e==null?void 0:e.client)??y).get({security:[{scheme:"bearer",type:"http"}],url:"/orders",...e}),"ordersControllerFind"),xe=n(e=>(e.client??y).get({security:[{scheme:"bearer",type:"http"}],url:"/orders/{orderId}",...e}),"ordersControllerFindOne");var $e="2026-01",Re="/apps/wishlist/api",Dr=n(e=>new N(e),"createApiClient"),H=class H{constructor(r){this.useProxy=!1;this.version=$e;this.items={list:n(r=>this.handlePaginatedRequest(ce({query:r,client:this.useProxy?this.proxyClient:this.directClient})),"list"),create:n(r=>this.handleRequest(ue({body:r,client:this.useProxy?this.proxyClient:this.directClient})),"create"),delete:n(r=>this.handleRequest(pe({body:{itemIds:r},client:this.useProxy?this.proxyClient:this.directClient})),"delete"),findById:n(r=>this.handleRequest(fe({path:{itemId:r},client:this.useProxy?this.proxyClient:this.directClient})),"findById"),updateById:n((r,t)=>this.handleRequest(Ce({body:t,path:{itemId:r},client:this.useProxy?this.proxyClient:this.directClient})),"updateById"),deleteById:n(r=>this.handleRequest(he({path:{itemId:r},client:this.useProxy?this.proxyClient:this.directClient})),"deleteById"),setListsById:n((r,t)=>this.handleRequest(me({body:{listIds:t},path:{itemId:r},client:this.useProxy?this.proxyClient:this.directClient})),"setListsById"),count:n(()=>this.handleRequest(ye({client:this.useProxy?this.proxyClient:this.directClient})),"count")};this.lists={list:n(r=>this.handlePaginatedRequest(te({query:r,client:this.useProxy?this.proxyClient:this.directClient})),"list"),create:n(r=>this.handleRequest(ne({body:r,client:this.useProxy?this.proxyClient:this.directClient})),"create"),findById:n(r=>this.handleRequest(se({path:{listId:r},client:this.useProxy?this.proxyClient:this.directClient})),"findById"),updateById:n((r,t)=>this.handleRequest(ie({body:t,path:{listId:r},client:this.useProxy?this.proxyClient:this.directClient})),"updateById"),deleteById:n(r=>this.handleRequest(oe({path:{listId:r},client:this.useProxy?this.proxyClient:this.directClient})),"deleteById"),orderItems:n((r,t)=>this.handleRequest(ae({body:{itemIds:t},path:{listId:r},client:this.useProxy?this.proxyClient:this.directClient})),"orderItems"),addItemsToList:n((r,t)=>this.handleRequest(le({body:{itemIds:t},path:{listId:r},client:this.useProxy?this.proxyClient:this.directClient})),"addItemsToList"),removeItemFromList:n((r,t)=>this.handleRequest(de({path:{listId:r,itemId:t},client:this.useProxy?this.proxyClient:this.directClient})),"removeItemFromList")};this.profiles={customerAccountsVersion:n(()=>this.handleRequest(Oe({client:this.useProxy?this.proxyClient:this.directClient})),"customerAccountsVersion"),createToken:n((r={},t)=>this.handleRequest(ge({body:r,client:this.useProxy||t!=null&&t.useProxy?this.proxyClient:this.directClient})),"createToken"),identify:n(r=>this.handleRequest(Ie({body:r,client:this.useProxy?this.proxyClient:this.directClient})),"identify")};this.orders={list:n(r=>this.handlePaginatedRequest(be({query:r,client:this.useProxy?this.proxyClient:this.directClient})),"list"),findById:n(r=>this.handleRequest(xe({path:{orderId:r},client:this.useProxy?this.proxyClient:this.directClient})),"findById")};this.handleRequest=n(async r=>{let{data:t,error:o}=await r;return o!=null&&o.error?{error:o.error}:{data:t==null?void 0:t.data}},"handleRequest");this.handlePaginatedRequest=n(async r=>{var s;let{data:t,error:o}=await r;return o!=null&&o.error?{error:o.error}:{data:(t==null?void 0:t.data)??[],pageInfo:(t==null?void 0:t.pageInfo)??{next:null,previous:null,totalCount:((s=t==null?void 0:t.data)==null?void 0:s.length)??0}}},"handlePaginatedRequest");var t;this.profile=r.profile,(t=r.config)!=null&&t.version&&(this.version=r.config.version),this.directClient=S(x({baseUrl:`https://swish.app/api/${this.version}`})),this.proxyClient=S(x({baseUrl:Re})),r.authToken&&(this.authToken=r.authToken),r.config&&this.setConfig(r.config),r.requestInterceptor&&(this.proxyClient.interceptors.request.use(r.requestInterceptor),this.directClient.interceptors.request.use(r.requestInterceptor)),r.responseInterceptor&&(this.proxyClient.interceptors.response.use(r.responseInterceptor),this.directClient.interceptors.response.use(r.responseInterceptor)),this.proxyClient.interceptors.request.use(this.proxyRequestInterceptor.bind(this)),this.directClient.interceptors.request.use(this.directRequestInterceptor.bind(this))}setProfile(r){this.profile=r}getProfile(){return this.profile}setAuthToken(r){this.authToken=r}setConfig({proxyBaseUrl:r=Re,baseUrl:t,useProxy:o=!1,...s}){this.useProxy=o,this.proxyClient.setConfig({...s,baseUrl:r}),this.directClient.setConfig({...s})}proxyRequestInterceptor(r){return this.profile&&(r.headers.set("Profile",this.profile),r.headers.set("Swish-Api-Version",this.version)),r}directRequestInterceptor(r){return this.authToken&&r.headers.set("Authorization",`Bearer ${this.authToken}`),r}};n(H,"SwishClient");var N=H;export{Dr as createApiClient,$e as defaultApiVersion,Re as defaultProxyBaseUrl};
3
+ `);z=M.pop()??"";for(let we of M){let Ee=we.split(`
4
+ `),A=[],W;for(let O of Ee)if(O.startsWith("data:"))A.push(O.replace(/^data:\s*/,""));else if(O.startsWith("event:"))W=O.replace(/^event:\s*/,"");else if(O.startsWith("id:"))h=O.replace(/^id:\s*/,"");else if(O.startsWith("retry:")){let J=Number.parseInt(O.replace(/^retry:\s*/,""),10);Number.isNaN(J)||(c=J)}let S,Q=!1;if(A.length){let O=A.join(`
5
+ `);try{S=JSON.parse(O),Q=!0}catch{S=O}}Q&&(n&&await n(S),o&&(S=await o(S))),t==null||t({data:S,event:W,id:h,retry:c}),A.length&&(yield S)}}}finally{R.removeEventListener("abort",V),g.releaseLock()}break}catch(T){if(r==null||r(T),d!==void 0&&C>=d)break;let I=Math.min(c*2**(C-1),a??3e4);await L(I)}}},"createStream")()}},"createSseClient");var ke=s(e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},"separatorArrayExplode"),qe=s(e=>{switch(e){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},"separatorArrayNoExplode"),Ae=s(e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},"separatorObjectExplode"),P=s(({allowReserved:e,explode:r,name:t,style:o,value:n})=>{if(!r){let a=(e?n:n.map(l=>encodeURIComponent(l))).join(qe(o));switch(o){case"label":return`.${a}`;case"matrix":return`;${t}=${a}`;case"simple":return a;default:return`${t}=${a}`}}let p=ke(o),d=n.map(a=>o==="label"||o==="simple"?e?a:encodeURIComponent(a):w({allowReserved:e,name:t,value:a})).join(p);return o==="label"||o==="matrix"?p+d:d},"serializeArrayParam"),w=s(({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)}`},"serializePrimitiveParam"),B=s(({allowReserved:e,explode:r,name:t,style:o,value:n,valueOnly:p})=>{if(n instanceof Date)return p?n.toISOString():`${t}=${n.toISOString()}`;if(o!=="deepObject"&&!r){let l=[];Object.entries(n).forEach(([i,h])=>{l=[...l,i,e?h:encodeURIComponent(h)]});let u=l.join(",");switch(o){case"form":return`${t}=${u}`;case"label":return`.${u}`;case"matrix":return`;${t}=${u}`;default:return u}}let d=Ae(o),a=Object.entries(n).map(([l,u])=>w({allowReserved:e,name:o==="deepObject"?`${t}[${l}]`:l,value:u})).join(d);return o==="label"||o==="matrix"?d+a:a},"serializeObjectParam");var Pe=/\{[^{}]+\}/g,Be=s(({path:e,url:r})=>{let t=r,o=r.match(Pe);if(o)for(let n of o){let p=!1,d=n.substring(1,n.length-1),a="simple";d.endsWith("*")&&(p=!0,d=d.substring(0,d.length-1)),d.startsWith(".")?(d=d.substring(1),a="label"):d.startsWith(";")&&(d=d.substring(1),a="matrix");let l=e[d];if(l==null)continue;if(Array.isArray(l)){t=t.replace(n,P({explode:p,name:d,style:a,value:l}));continue}if(typeof l=="object"){t=t.replace(n,B({explode:p,name:d,style:a,value:l,valueOnly:!0}));continue}if(a==="matrix"){t=t.replace(n,`;${w({name:d,value:l})}`);continue}let u=encodeURIComponent(a==="label"?`.${l}`:l);t=t.replace(n,u)}return t},"defaultPathSerializer"),K=s(({baseUrl:e,path:r,query:t,querySerializer:o,url:n})=>{let p=n.startsWith("/")?n:`/${n}`,d=(e??"")+p;r&&(d=Be({path:r,url:d}));let a=t?o(t):"";return a.startsWith("?")&&(a=a.substring(1)),a&&(d+=`?${a}`),d},"getUrl");function G(e){let r=e.body!==void 0;if(r&&e.bodySerializer)return"serializedBody"in e?e.serializedBody!==void 0&&e.serializedBody!==""?e.serializedBody:null:e.body!==""?e.body:null;if(r)return e.body}s(G,"getValidRequestBody");var X=s(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},"getAuthToken");var Y=s(({allowReserved:e,array:r,object:t}={})=>s(n=>{let p=[];if(n&&typeof n=="object")for(let d in n){let a=n[d];if(a!=null)if(Array.isArray(a)){let l=P({allowReserved:e,explode:!0,name:d,style:"form",value:a,...r});l&&p.push(l)}else if(typeof a=="object"){let l=B({allowReserved:e,explode:!0,name:d,style:"deepObject",value:a,...t});l&&p.push(l)}else{let l=w({allowReserved:e,name:d,value:a});l&&p.push(l)}}return p.join("&")},"querySerializer"),"createQuerySerializer"),Z=s(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(o=>r.startsWith(o)))return"blob";if(r.startsWith("text/"))return"text"}},"getParseAs"),Fe=s((e,r)=>{var t,o;return r?!!(e.headers.has(r)||(t=e.query)!=null&&t[r]||(o=e.headers.get("Cookie"))!=null&&o.includes(`${r}=`)):!1},"checkForExistence"),ee=s(async({security:e,...r})=>{for(let t of e){if(Fe(r,t.name))continue;let o=await X(t,r.auth);if(!o)continue;let n=t.name??"Authorization";switch(t.in){case"query":r.query||(r.query={}),r.query[n]=o;break;case"cookie":r.headers.append("Cookie",`${n}=${o}`);break;case"header":default:r.headers.set(n,o);break}}},"setAuthParams"),v=s(e=>K({baseUrl:e.baseUrl,path:e.path,query:e.query,querySerializer:typeof e.querySerializer=="function"?e.querySerializer:Y(e.querySerializer),url:e.url}),"buildUrl"),U=s((e,r)=>{var o;let t={...e,...r};return(o=t.baseUrl)!=null&&o.endsWith("/")&&(t.baseUrl=t.baseUrl.substring(0,t.baseUrl.length-1)),t.headers=F(e.headers,r.headers),t},"mergeConfigs"),ze=s(e=>{let r=[];return e.forEach((t,o)=>{r.push([o,t])}),r},"headersEntries"),F=s((...e)=>{let r=new Headers;for(let t of e){if(!t)continue;let o=t instanceof Headers?ze(t):Object.entries(t);for(let[n,p]of o)if(p===null)r.delete(n);else if(Array.isArray(p))for(let d of p)r.append(n,d);else p!==void 0&&r.set(n,typeof p=="object"?JSON.stringify(p):p)}return r},"mergeHeaders"),$=class ${constructor(){this.fns=[]}clear(){this.fns=[]}eject(r){let t=this.getInterceptorIndex(r);this.fns[t]&&(this.fns[t]=null)}exists(r){let t=this.getInterceptorIndex(r);return!!this.fns[t]}getInterceptorIndex(r){return typeof r=="number"?this.fns[r]?r:-1:this.fns.indexOf(r)}update(r,t){let o=this.getInterceptorIndex(r);return this.fns[o]?(this.fns[o]=t,r):!1}use(r){return this.fns.push(r),this.fns.length-1}};s($,"Interceptors");var k=$,re=s(()=>({error:new k,request:new k,response:new k}),"createInterceptors"),je=Y({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),ve={"Content-Type":"application/json"},x=s((e={})=>({...j,headers:ve,parseAs:"auto",querySerializer:je,...e}),"createConfig");var E=s((e={})=>{let r=U(x(),e),t=s(()=>({...r}),"getConfig"),o=s(u=>(r=U(r,u),t()),"setConfig"),n=re(),p=s(async u=>{let i={...r,...u,fetch:u.fetch??r.fetch??globalThis.fetch,headers:F(r.headers,u.headers),serializedBody:void 0};i.security&&await ee({...i,security:i.security}),i.requestValidator&&await i.requestValidator(i),i.body!==void 0&&i.bodySerializer&&(i.serializedBody=i.bodySerializer(i.body)),(i.body===void 0||i.serializedBody==="")&&i.headers.delete("Content-Type");let h=v(i);return{opts:i,url:h}},"beforeRequest"),d=s(async u=>{let{opts:i,url:h}=await p(u),L={redirect:"follow",...i,body:G(i)},b=new Request(h,L);for(let f of n.request.fns)f&&(b=await f(b,i));let q=i.fetch,c=await q(b);for(let f of n.response.fns)f&&(c=await f(c,b,i));let C={request:b,response:c};if(c.ok){let f=(i.parseAs==="auto"?Z(c.headers.get("Content-Type")):i.parseAs)??"json";if(c.status===204||c.headers.get("Content-Length")==="0"){let g;switch(f){case"arrayBuffer":case"blob":case"text":g=await c[f]();break;case"formData":g=new FormData;break;case"stream":g=c.body;break;case"json":default:g={};break}return i.responseStyle==="data"?g:{data:g,...C}}let m;switch(f){case"arrayBuffer":case"blob":case"formData":case"json":case"text":m=await c[f]();break;case"stream":return i.responseStyle==="data"?c.body:{data:c.body,...C}}return f==="json"&&(i.responseValidator&&await i.responseValidator(m),i.responseTransformer&&(m=await i.responseTransformer(m))),i.responseStyle==="data"?m:{data:m,...C}}let R=await c.text(),D;try{D=JSON.parse(R)}catch{}let T=D??R,I=T;for(let f of n.error.fns)f&&(I=await f(T,c,b,i));if(I=I||{},i.throwOnError)throw I;return i.responseStyle==="data"?void 0:{error:I,...C}},"request"),a=s(u=>i=>d({...i,method:u}),"makeMethodFn"),l=s(u=>async i=>{let{opts:h,url:L}=await p(i);return _({...h,body:h.body,headers:h.headers,method:u,onRequest:s(async(b,q)=>{let c=new Request(b,q);for(let C of n.request.fns)C&&(c=await C(c,h));return c},"onRequest"),url:L})},"makeSseFn");return{buildUrl:v,connect:a("CONNECT"),delete:a("DELETE"),get:a("GET"),getConfig:t,head:a("HEAD"),interceptors:n,options:a("OPTIONS"),patch:a("PATCH"),post:a("POST"),put:a("PUT"),request:d,setConfig:o,sse:{connect:l("CONNECT"),delete:l("DELETE"),get:l("GET"),head:l("HEAD"),options:l("OPTIONS"),patch:l("PATCH"),post:l("POST"),put:l("PUT"),trace:l("TRACE")},trace:a("TRACE")}},"createClient");var y=E(x({baseUrl:"https://swish.app/api/2026-01"}));var te=s(e=>((e==null?void 0:e.client)??y).get({security:[{scheme:"bearer",type:"http"}],url:"/lists",...e}),"listControllerFind"),se=s(e=>(e.client??y).post({security:[{scheme:"bearer",type:"http"}],url:"/lists",...e,headers:{"Content-Type":"application/json",...e.headers}}),"listControllerCreate"),oe=s(e=>(e.client??y).delete({security:[{scheme:"bearer",type:"http"}],url:"/lists/{listId}",...e}),"listControllerDeleteById"),ne=s(e=>(e.client??y).get({security:[{scheme:"bearer",type:"http"}],url:"/lists/{listId}",...e}),"listControllerFindById"),ie=s(e=>(e.client??y).patch({security:[{scheme:"bearer",type:"http"}],url:"/lists/{listId}",...e,headers:{"Content-Type":"application/json",...e.headers}}),"listControllerUpdateById"),ae=s(e=>(e.client??y).put({security:[{scheme:"bearer",type:"http"}],url:"/lists/{listId}/items/order",...e,headers:{"Content-Type":"application/json",...e.headers}}),"listControllerSetListItemsOrder"),le=s(e=>(e.client??y).post({security:[{scheme:"bearer",type:"http"}],url:"/lists/{listId}/items",...e,headers:{"Content-Type":"application/json",...e.headers}}),"listControllerAddItemsToList"),de=s(e=>(e.client??y).delete({security:[{scheme:"bearer",type:"http"}],url:"/lists/{listId}/items/{itemId}",...e}),"listControllerRemoveItemFromList"),pe=s(e=>(e.client??y).delete({security:[{scheme:"bearer",type:"http"}],url:"/items",...e,headers:{"Content-Type":"application/json",...e.headers}}),"itemControllerDelete"),ce=s(e=>((e==null?void 0:e.client)??y).get({security:[{scheme:"bearer",type:"http"}],url:"/items",...e}),"itemControllerFind"),ue=s(e=>(e.client??y).post({security:[{scheme:"bearer",type:"http"}],url:"/items",...e,headers:{"Content-Type":"application/json",...e.headers}}),"itemControllerCreate"),ye=s(e=>((e==null?void 0:e.client)??y).get({security:[{scheme:"bearer",type:"http"}],url:"/items/count",...e}),"itemControllerCount"),he=s(e=>(e.client??y).delete({security:[{scheme:"bearer",type:"http"}],url:"/items/{itemId}",...e}),"itemControllerDeleteById"),fe=s(e=>(e.client??y).get({security:[{scheme:"bearer",type:"http"}],url:"/items/{itemId}",...e}),"itemControllerFindById"),Ce=s(e=>(e.client??y).patch({security:[{scheme:"bearer",type:"http"}],url:"/items/{itemId}",...e,headers:{"Content-Type":"application/json",...e.headers}}),"itemControllerUpdateById"),me=s(e=>(e.client??y).put({security:[{scheme:"bearer",type:"http"}],url:"/items/{itemId}/lists",...e,headers:{"Content-Type":"application/json",...e.headers}}),"itemControllerSetListsById"),Oe=s(e=>((e==null?void 0:e.client)??y).get({security:[{scheme:"bearer",type:"http"}],url:"/profiles/accounts-version",...e}),"profileControllerCustomerAccountsVersion"),Ie=s(e=>(e.client??y).post({security:[{scheme:"bearer",type:"http"}],url:"/profiles/identify",...e,headers:{"Content-Type":"application/json",...e.headers}}),"profileControllerIdentify"),ge=s(e=>(e.client??y).post({security:[{scheme:"bearer",type:"http"}],url:"/profiles/token",...e,headers:{"Content-Type":"application/json",...e.headers}}),"profileControllerCreateToken");var be=s(e=>((e==null?void 0:e.client)??y).get({security:[{scheme:"bearer",type:"http"}],url:"/orders",...e}),"ordersControllerFind"),xe=s(e=>(e.client??y).get({security:[{scheme:"bearer",type:"http"}],url:"/orders/{orderId}",...e}),"ordersControllerFindOne");var $e="2026-01",Re="/apps/wishlist/api",Dr=s(e=>new N(e),"createApiClient"),H=class H{constructor(r){this.useProxy=!1;this.version=$e;this.items={list:s(r=>this.handlePaginatedRequest(ce({query:r,client:this.useProxy?this.proxyClient:this.directClient})),"list"),create:s(r=>this.handleRequest(ue({body:r,client:this.useProxy?this.proxyClient:this.directClient})),"create"),delete:s(r=>this.handleRequest(pe({body:{itemIds:r},client:this.useProxy?this.proxyClient:this.directClient})),"delete"),findById:s(r=>this.handleRequest(fe({path:{itemId:r},client:this.useProxy?this.proxyClient:this.directClient})),"findById"),updateById:s((r,t)=>this.handleRequest(Ce({body:t,path:{itemId:r},client:this.useProxy?this.proxyClient:this.directClient})),"updateById"),deleteById:s(r=>this.handleRequest(he({path:{itemId:r},client:this.useProxy?this.proxyClient:this.directClient})),"deleteById"),setListsById:s((r,t)=>this.handleRequest(me({body:{listIds:t},path:{itemId:r},client:this.useProxy?this.proxyClient:this.directClient})),"setListsById"),count:s(()=>this.handleRequest(ye({client:this.useProxy?this.proxyClient:this.directClient})),"count")};this.lists={list:s(r=>this.handlePaginatedRequest(te({query:r,client:this.useProxy?this.proxyClient:this.directClient})),"list"),create:s(r=>this.handleRequest(se({body:r,client:this.useProxy?this.proxyClient:this.directClient})),"create"),findById:s(r=>this.handleRequest(ne({path:{listId:r},client:this.useProxy?this.proxyClient:this.directClient})),"findById"),updateById:s((r,t)=>this.handleRequest(ie({body:t,path:{listId:r},client:this.useProxy?this.proxyClient:this.directClient})),"updateById"),deleteById:s(r=>this.handleRequest(oe({path:{listId:r},client:this.useProxy?this.proxyClient:this.directClient})),"deleteById"),orderItems:s((r,t)=>this.handleRequest(ae({body:{itemIds:t},path:{listId:r},client:this.useProxy?this.proxyClient:this.directClient})),"orderItems"),addItemsToList:s((r,t)=>this.handleRequest(le({body:{itemIds:t},path:{listId:r},client:this.useProxy?this.proxyClient:this.directClient})),"addItemsToList"),removeItemFromList:s((r,t)=>this.handleRequest(de({path:{listId:r,itemId:t},client:this.useProxy?this.proxyClient:this.directClient})),"removeItemFromList")};this.profiles={customerAccountsVersion:s(()=>this.handleRequest(Oe({client:this.useProxy?this.proxyClient:this.directClient})),"customerAccountsVersion"),createToken:s((r={},t)=>this.handleRequest(ge({body:r,client:this.useProxy||t!=null&&t.useProxy?this.proxyClient:this.directClient})),"createToken"),identify:s(r=>this.handleRequest(Ie({body:r,client:this.useProxy?this.proxyClient:this.directClient})),"identify")};this.orders={list:s(r=>this.handlePaginatedRequest(be({query:r,client:this.useProxy?this.proxyClient:this.directClient})),"list"),findById:s(r=>this.handleRequest(xe({path:{orderId:r},client:this.useProxy?this.proxyClient:this.directClient})),"findById")};this.handleRequest=s(async r=>{let{data:t,error:o}=await r;return o!=null&&o.error?{error:o.error}:{data:t==null?void 0:t.data}},"handleRequest");this.handlePaginatedRequest=s(async r=>{var n;let{data:t,error:o}=await r;return o!=null&&o.error?{error:o.error}:{data:(t==null?void 0:t.data)??[],pageInfo:(t==null?void 0:t.pageInfo)??{next:null,previous:null,totalCount:((n=t==null?void 0:t.data)==null?void 0:n.length)??0}}},"handlePaginatedRequest");var t;this.profile=r.profile,(t=r.config)!=null&&t.version&&(this.version=r.config.version),this.directClient=E(x({baseUrl:`https://swish.app/api/${this.version}`})),this.proxyClient=E(x({baseUrl:Re})),r.authToken&&(this.authToken=r.authToken),r.config&&this.setConfig(r.config),r.requestInterceptor&&(this.proxyClient.interceptors.request.use(r.requestInterceptor),this.directClient.interceptors.request.use(r.requestInterceptor)),r.responseInterceptor&&(this.proxyClient.interceptors.response.use(r.responseInterceptor),this.directClient.interceptors.response.use(r.responseInterceptor)),this.proxyClient.interceptors.request.use(this.proxyRequestInterceptor.bind(this)),this.directClient.interceptors.request.use(this.directRequestInterceptor.bind(this))}setProfile(r){this.profile=r}getProfile(){return this.profile}setAuthToken(r){this.authToken=r}setConfig({proxyBaseUrl:r=Re,baseUrl:t,useProxy:o=!1,...n}){this.useProxy=o,this.proxyClient.setConfig({...n,baseUrl:r}),this.directClient.setConfig({...n})}proxyRequestInterceptor(r){return this.profile&&(r.headers.set("Profile",this.profile),r.headers.set("Swish-Api-Version",this.version)),r}directRequestInterceptor(r){return this.authToken&&r.headers.set("Authorization",`Bearer ${this.authToken}`),r}};s(H,"SwishClient");var N=H;export{Dr as createApiClient,$e as defaultApiVersion,Re as defaultProxyBaseUrl};
@@ -1,5 +1,5 @@
1
1
  import type { Client, Options as Options2, TDataShape } from './client';
2
- import type { AnalyticsControllerLoadNewListsData, AnalyticsControllerLoadNewListsErrors, AnalyticsControllerLoadNewListsResponses, AnalyticsControllerLoadSavedItemsData, AnalyticsControllerLoadSavedItemsErrors, AnalyticsControllerLoadSavedItemsResponses, AnalyticsControllerLoadSessionsData, AnalyticsControllerLoadSessionsErrors, AnalyticsControllerLoadSessionsResponses, ItemControllerCountData, ItemControllerCountErrors, ItemControllerCountResponses, ItemControllerCreateData, ItemControllerCreateErrors, ItemControllerCreateResponses, ItemControllerDeleteByIdData, ItemControllerDeleteByIdErrors, ItemControllerDeleteByIdResponses, ItemControllerDeleteData, ItemControllerDeleteErrors, ItemControllerDeleteResponses, ItemControllerFindByIdData, ItemControllerFindByIdErrors, ItemControllerFindByIdResponses, ItemControllerFindData, ItemControllerFindErrors, ItemControllerFindResponses, ItemControllerSetListsByIdData, ItemControllerSetListsByIdErrors, ItemControllerSetListsByIdResponses, ItemControllerUpdateByIdData, ItemControllerUpdateByIdErrors, ItemControllerUpdateByIdResponses, ListControllerAddItemsToListData, ListControllerAddItemsToListErrors, ListControllerAddItemsToListResponses, ListControllerCreateData, ListControllerCreateErrors, ListControllerCreateResponses, ListControllerDeleteByIdData, ListControllerDeleteByIdErrors, ListControllerDeleteByIdResponses, ListControllerFindByIdData, ListControllerFindByIdErrors, ListControllerFindByIdResponses, ListControllerFindData, ListControllerFindErrors, ListControllerFindResponses, ListControllerRemoveItemFromListData, ListControllerRemoveItemFromListErrors, ListControllerRemoveItemFromListResponses, ListControllerSetListItemsOrderData, ListControllerSetListItemsOrderErrors, ListControllerSetListItemsOrderResponses, ListControllerUpdateByIdData, ListControllerUpdateByIdErrors, ListControllerUpdateByIdResponses, OrdersControllerFindData, OrdersControllerFindErrors, OrdersControllerFindOneData, OrdersControllerFindOneErrors, OrdersControllerFindOneResponses, OrdersControllerFindResponses, ProfileControllerCreateTokenData, ProfileControllerCreateTokenErrors, ProfileControllerCreateTokenResponses, ProfileControllerCustomerAccountsVersionData, ProfileControllerCustomerAccountsVersionErrors, ProfileControllerCustomerAccountsVersionResponses, ProfileControllerIdentifyData, ProfileControllerIdentifyErrors, ProfileControllerIdentifyResponses, TrackingControllerTrackData, TrackingControllerTrackErrors, TrackingControllerTrackResponses } from './types.gen';
2
+ import type { AnalyticsControllerLoadNewListsData, AnalyticsControllerLoadNewListsErrors, AnalyticsControllerLoadNewListsResponses, AnalyticsControllerLoadSavedItemsData, AnalyticsControllerLoadSavedItemsErrors, AnalyticsControllerLoadSavedItemsResponses, AnalyticsControllerLoadSessionsData, AnalyticsControllerLoadSessionsErrors, AnalyticsControllerLoadSessionsResponses, ItemControllerCountData, ItemControllerCountErrors, ItemControllerCountResponses, ItemControllerCreateData, ItemControllerCreateErrors, ItemControllerCreateResponses, ItemControllerDeleteByIdData, ItemControllerDeleteByIdErrors, ItemControllerDeleteByIdResponses, ItemControllerDeleteData, ItemControllerDeleteErrors, ItemControllerDeleteResponses, ItemControllerFindByIdData, ItemControllerFindByIdErrors, ItemControllerFindByIdResponses, ItemControllerFindData, ItemControllerFindErrors, ItemControllerFindResponses, ItemControllerSetListsByIdData, ItemControllerSetListsByIdErrors, ItemControllerSetListsByIdResponses, ItemControllerUpdateByIdData, ItemControllerUpdateByIdErrors, ItemControllerUpdateByIdResponses, ListControllerAddItemsToListData, ListControllerAddItemsToListErrors, ListControllerAddItemsToListResponses, ListControllerCreateData, ListControllerCreateErrors, ListControllerCreateResponses, ListControllerDeleteByIdData, ListControllerDeleteByIdErrors, ListControllerDeleteByIdResponses, ListControllerFindByIdData, ListControllerFindByIdErrors, ListControllerFindByIdResponses, ListControllerFindData, ListControllerFindErrors, ListControllerFindResponses, ListControllerRemoveItemFromListData, ListControllerRemoveItemFromListErrors, ListControllerRemoveItemFromListResponses, ListControllerSetListItemsOrderData, ListControllerSetListItemsOrderErrors, ListControllerSetListItemsOrderResponses, ListControllerUpdateByIdData, ListControllerUpdateByIdErrors, ListControllerUpdateByIdResponses, OrdersControllerFindData, OrdersControllerFindErrors, OrdersControllerFindOneData, OrdersControllerFindOneErrors, OrdersControllerFindOneResponses, OrdersControllerFindResponses, ProfileControllerCreateTokenData, ProfileControllerCreateTokenErrors, ProfileControllerCreateTokenResponses, ProfileControllerCustomerAccountsVersionData, ProfileControllerCustomerAccountsVersionErrors, ProfileControllerCustomerAccountsVersionResponses, ProfileControllerIdentifyData, ProfileControllerIdentifyErrors, ProfileControllerIdentifyResponses, SharedListsControllerDeleteByIdData, SharedListsControllerDeleteByIdErrors, SharedListsControllerDeleteByIdResponses, SharedListsControllerFindAllData, SharedListsControllerFindAllErrors, SharedListsControllerFindAllResponses, SharedListsControllerFindByIdData, SharedListsControllerFindByIdErrors, SharedListsControllerFindByIdResponses, SharedListsControllerSaveData, SharedListsControllerSaveErrors, SharedListsControllerSaveResponses, TrackingControllerTrackData, TrackingControllerTrackErrors, TrackingControllerTrackResponses } from './types.gen';
3
3
  export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {
4
4
  /**
5
5
  * You can provide a client instance returned by `createClient()` instead of
@@ -42,3 +42,7 @@ export declare const analyticsControllerLoadNewLists: <ThrowOnError extends bool
42
42
  export declare const trackingControllerTrack: <ThrowOnError extends boolean = false>(options: Options<TrackingControllerTrackData, ThrowOnError>) => import("./client").RequestResult<TrackingControllerTrackResponses, TrackingControllerTrackErrors, ThrowOnError, "fields">;
43
43
  export declare const ordersControllerFind: <ThrowOnError extends boolean = false>(options?: Options<OrdersControllerFindData, ThrowOnError>) => import("./client").RequestResult<OrdersControllerFindResponses, OrdersControllerFindErrors, ThrowOnError, "fields">;
44
44
  export declare const ordersControllerFindOne: <ThrowOnError extends boolean = false>(options: Options<OrdersControllerFindOneData, ThrowOnError>) => import("./client").RequestResult<OrdersControllerFindOneResponses, OrdersControllerFindOneErrors, ThrowOnError, "fields">;
45
+ export declare const sharedListsControllerSave: <ThrowOnError extends boolean = false>(options: Options<SharedListsControllerSaveData, ThrowOnError>) => import("./client").RequestResult<SharedListsControllerSaveResponses, SharedListsControllerSaveErrors, ThrowOnError, "fields">;
46
+ export declare const sharedListsControllerDeleteById: <ThrowOnError extends boolean = false>(options: Options<SharedListsControllerDeleteByIdData, ThrowOnError>) => import("./client").RequestResult<SharedListsControllerDeleteByIdResponses, SharedListsControllerDeleteByIdErrors, ThrowOnError, "fields">;
47
+ export declare const sharedListsControllerFindById: <ThrowOnError extends boolean = false>(options: Options<SharedListsControllerFindByIdData, ThrowOnError>) => import("./client").RequestResult<SharedListsControllerFindByIdResponses, SharedListsControllerFindByIdErrors, ThrowOnError, "fields">;
48
+ export declare const sharedListsControllerFindAll: <ThrowOnError extends boolean = false>(options?: Options<SharedListsControllerFindAllData, ThrowOnError>) => import("./client").RequestResult<SharedListsControllerFindAllResponses, SharedListsControllerFindAllErrors, ThrowOnError, "fields">;
@@ -309,10 +309,18 @@ export type TrackingEventRequestDto = {
309
309
  [key: string]: unknown;
310
310
  };
311
311
  export type ProductVariantDto = {
312
+ /**
313
+ * The product variant’s ID
314
+ */
315
+ id: string;
312
316
  /**
313
317
  * The product variant’s title
314
318
  */
315
319
  title: string;
320
+ /**
321
+ * Whether the product variant is available for sale
322
+ */
323
+ availableForSale: boolean;
316
324
  /**
317
325
  * The image of the variant
318
326
  */
@@ -418,6 +426,36 @@ export type OrderDto = {
418
426
  */
419
427
  previewImages?: Array<PreviewImageDto>;
420
428
  };
429
+ export type SharedList = {
430
+ /**
431
+ * The ID of the shared list entry
432
+ */
433
+ id: string;
434
+ /**
435
+ * The ID of the list that was saved
436
+ */
437
+ listId: string;
438
+ /**
439
+ * The name of the list
440
+ */
441
+ name: string;
442
+ /**
443
+ * The number of items in the list
444
+ */
445
+ itemCount: number;
446
+ /**
447
+ * Array of preview image objects for the first 4 items in the list
448
+ */
449
+ previewImages: Array<PreviewImageDto>;
450
+ /**
451
+ * The date and time the shared list was created
452
+ */
453
+ createdAt: string;
454
+ /**
455
+ * The date and time the shared list was last updated
456
+ */
457
+ updatedAt: string;
458
+ };
421
459
  export type ListControllerFindData = {
422
460
  body?: never;
423
461
  path?: never;
@@ -1916,3 +1954,241 @@ export type OrdersControllerFindOneResponses = {
1916
1954
  };
1917
1955
  };
1918
1956
  export type OrdersControllerFindOneResponse = OrdersControllerFindOneResponses[keyof OrdersControllerFindOneResponses];
1957
+ export type SharedListsControllerSaveData = {
1958
+ body?: never;
1959
+ path: {
1960
+ /**
1961
+ * The ID of the list to save as shared
1962
+ */
1963
+ listId: string;
1964
+ };
1965
+ query?: never;
1966
+ url: '/shared-lists/{listId}/save';
1967
+ };
1968
+ export type SharedListsControllerSaveErrors = {
1969
+ /**
1970
+ * Bad Request
1971
+ */
1972
+ 400: ErrorResponse & {
1973
+ error?: {
1974
+ statusCode?: number;
1975
+ error?: string;
1976
+ };
1977
+ };
1978
+ /**
1979
+ * Unauthorized
1980
+ */
1981
+ 401: ErrorResponse & {
1982
+ error?: {
1983
+ statusCode?: number;
1984
+ error?: string;
1985
+ };
1986
+ };
1987
+ /**
1988
+ * Forbidden
1989
+ */
1990
+ 403: ErrorResponse & {
1991
+ error?: {
1992
+ statusCode?: number;
1993
+ error?: string;
1994
+ };
1995
+ };
1996
+ /**
1997
+ * Not Found
1998
+ */
1999
+ 404: ErrorResponse & {
2000
+ error?: {
2001
+ statusCode?: number;
2002
+ error?: string;
2003
+ };
2004
+ };
2005
+ };
2006
+ export type SharedListsControllerSaveError = SharedListsControllerSaveErrors[keyof SharedListsControllerSaveErrors];
2007
+ export type SharedListsControllerSaveResponses = {
2008
+ /**
2009
+ * The shared list has been successfully saved.
2010
+ */
2011
+ 201: Response & {
2012
+ data?: SharedList;
2013
+ };
2014
+ };
2015
+ export type SharedListsControllerSaveResponse = SharedListsControllerSaveResponses[keyof SharedListsControllerSaveResponses];
2016
+ export type SharedListsControllerDeleteByIdData = {
2017
+ body?: never;
2018
+ path: {
2019
+ /**
2020
+ * The ID of the list to save as shared
2021
+ */
2022
+ listId: string;
2023
+ };
2024
+ query?: never;
2025
+ url: '/shared-lists/{listId}';
2026
+ };
2027
+ export type SharedListsControllerDeleteByIdErrors = {
2028
+ /**
2029
+ * Bad Request
2030
+ */
2031
+ 400: ErrorResponse & {
2032
+ error?: {
2033
+ statusCode?: number;
2034
+ error?: string;
2035
+ };
2036
+ };
2037
+ /**
2038
+ * Unauthorized
2039
+ */
2040
+ 401: ErrorResponse & {
2041
+ error?: {
2042
+ statusCode?: number;
2043
+ error?: string;
2044
+ };
2045
+ };
2046
+ /**
2047
+ * Forbidden
2048
+ */
2049
+ 403: ErrorResponse & {
2050
+ error?: {
2051
+ statusCode?: number;
2052
+ error?: string;
2053
+ };
2054
+ };
2055
+ /**
2056
+ * Not Found
2057
+ */
2058
+ 404: ErrorResponse & {
2059
+ error?: {
2060
+ statusCode?: number;
2061
+ error?: string;
2062
+ };
2063
+ };
2064
+ };
2065
+ export type SharedListsControllerDeleteByIdError = SharedListsControllerDeleteByIdErrors[keyof SharedListsControllerDeleteByIdErrors];
2066
+ export type SharedListsControllerDeleteByIdResponses = {
2067
+ /**
2068
+ * The shared list has been successfully deleted.
2069
+ */
2070
+ 204: void;
2071
+ };
2072
+ export type SharedListsControllerDeleteByIdResponse = SharedListsControllerDeleteByIdResponses[keyof SharedListsControllerDeleteByIdResponses];
2073
+ export type SharedListsControllerFindByIdData = {
2074
+ body?: never;
2075
+ path: {
2076
+ /**
2077
+ * The ID of the list to save as shared
2078
+ */
2079
+ listId: string;
2080
+ };
2081
+ query?: never;
2082
+ url: '/shared-lists/{listId}';
2083
+ };
2084
+ export type SharedListsControllerFindByIdErrors = {
2085
+ /**
2086
+ * Bad Request
2087
+ */
2088
+ 400: ErrorResponse & {
2089
+ error?: {
2090
+ statusCode?: number;
2091
+ error?: string;
2092
+ };
2093
+ };
2094
+ /**
2095
+ * Unauthorized
2096
+ */
2097
+ 401: ErrorResponse & {
2098
+ error?: {
2099
+ statusCode?: number;
2100
+ error?: string;
2101
+ };
2102
+ };
2103
+ /**
2104
+ * Forbidden
2105
+ */
2106
+ 403: ErrorResponse & {
2107
+ error?: {
2108
+ statusCode?: number;
2109
+ error?: string;
2110
+ };
2111
+ };
2112
+ /**
2113
+ * Not Found
2114
+ */
2115
+ 404: ErrorResponse & {
2116
+ error?: {
2117
+ statusCode?: number;
2118
+ error?: string;
2119
+ };
2120
+ };
2121
+ };
2122
+ export type SharedListsControllerFindByIdError = SharedListsControllerFindByIdErrors[keyof SharedListsControllerFindByIdErrors];
2123
+ export type SharedListsControllerFindByIdResponses = {
2124
+ /**
2125
+ * Returns the shared list entry.
2126
+ */
2127
+ 200: Response & {
2128
+ data?: SharedList;
2129
+ };
2130
+ };
2131
+ export type SharedListsControllerFindByIdResponse = SharedListsControllerFindByIdResponses[keyof SharedListsControllerFindByIdResponses];
2132
+ export type SharedListsControllerFindAllData = {
2133
+ body?: never;
2134
+ path?: never;
2135
+ query?: {
2136
+ /**
2137
+ * The page cursor
2138
+ */
2139
+ page?: string;
2140
+ /**
2141
+ * Number of lists/items to return
2142
+ */
2143
+ limit?: number;
2144
+ };
2145
+ url: '/shared-lists';
2146
+ };
2147
+ export type SharedListsControllerFindAllErrors = {
2148
+ /**
2149
+ * Bad Request
2150
+ */
2151
+ 400: ErrorResponse & {
2152
+ error?: {
2153
+ statusCode?: number;
2154
+ error?: string;
2155
+ };
2156
+ };
2157
+ /**
2158
+ * Unauthorized
2159
+ */
2160
+ 401: ErrorResponse & {
2161
+ error?: {
2162
+ statusCode?: number;
2163
+ error?: string;
2164
+ };
2165
+ };
2166
+ /**
2167
+ * Forbidden
2168
+ */
2169
+ 403: ErrorResponse & {
2170
+ error?: {
2171
+ statusCode?: number;
2172
+ error?: string;
2173
+ };
2174
+ };
2175
+ /**
2176
+ * Not Found
2177
+ */
2178
+ 404: ErrorResponse & {
2179
+ error?: {
2180
+ statusCode?: number;
2181
+ error?: string;
2182
+ };
2183
+ };
2184
+ };
2185
+ export type SharedListsControllerFindAllError = SharedListsControllerFindAllErrors[keyof SharedListsControllerFindAllErrors];
2186
+ export type SharedListsControllerFindAllResponses = {
2187
+ /**
2188
+ * Returns all shared lists as paginated response
2189
+ */
2190
+ 200: PaginatedResponse & {
2191
+ data?: Array<SharedList>;
2192
+ };
2193
+ };
2194
+ export type SharedListsControllerFindAllResponse = SharedListsControllerFindAllResponses[keyof SharedListsControllerFindAllResponses];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swishapp/api-client",
3
- "version": "0.27.0",
3
+ "version": "0.29.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",