@swishapp/api-client 0.7.1 → 0.8.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/README.md +1 -1
- package/dist/client.d.ts +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/client/client.gen.js +0 -1
- package/dist/client/index.js +0 -1
- package/dist/client/sdk.gen.js +0 -1
- package/dist/client/types.gen.js +0 -0
- package/dist/client.js +0 -1
- /package/dist/{client → openapi}/client.gen.d.ts +0 -0
- /package/dist/{client → openapi}/index.d.ts +0 -0
- /package/dist/{client → openapi}/sdk.gen.d.ts +0 -0
- /package/dist/{client → openapi}/types.gen.d.ts +0 -0
package/README.md
CHANGED
package/dist/client.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { SwishClientConfig, SwishClientOptions, ApiError } from "./types";
|
|
2
|
-
import type * as types from "./
|
|
2
|
+
import type * as types from "./openapi/types.gen";
|
|
3
3
|
export declare const createClient: (options: SwishClientOptions) => SwishClient;
|
|
4
4
|
export type { SwishClient };
|
|
5
5
|
declare class SwishClient {
|
|
6
6
|
private authToken?;
|
|
7
7
|
private profile?;
|
|
8
|
+
private readonly client;
|
|
8
9
|
constructor(options: SwishClientOptions);
|
|
9
10
|
setProfile(profile: string): void;
|
|
10
11
|
setAuthToken(authToken: string): void;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./client";
|
|
1
|
+
var H=Object.defineProperty;var o=(e,r)=>H(e,"name",{value:r,configurable:!0});var G=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 Q={bodySerializer:o(e=>JSON.stringify(e,(r,t)=>typeof t=="bigint"?t.toString():t),"bodySerializer")};var K=o(e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},"U"),M=o(e=>{switch(e){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},"_"),X=o(e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},"D"),B=o(({allowReserved:e,explode:r,name:t,style:s,value:a})=>{if(!r){let l=(e?a:a.map(d=>encodeURIComponent(d))).join(M(s));switch(s){case"label":return`.${l}`;case"matrix":return`;${t}=${l}`;case"simple":return l;default:return`${t}=${l}`}}let i=K(s),n=a.map(l=>s==="label"||s==="simple"?e?l:encodeURIComponent(l):w({allowReserved:e,name:t,value:l})).join(i);return s==="label"||s==="matrix"?i+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"),q=o(({allowReserved:e,explode:r,name:t,style:s,value:a})=>{if(a instanceof Date)return`${t}=${a.toISOString()}`;if(s!=="deepObject"&&!r){let l=[];Object.entries(a).forEach(([C,c])=>{l=[...l,C,e?c:encodeURIComponent(c)]});let d=l.join(",");switch(s){case"form":return`${t}=${d}`;case"label":return`.${d}`;case"matrix":return`;${t}=${d}`;default:return d}}let i=X(s),n=Object.entries(a).map(([l,d])=>w({allowReserved:e,name:s==="deepObject"?`${t}[${l}]`:l,value:d})).join(i);return s==="label"||s==="matrix"?i+n:n},"q"),Y=/\{[^{}]+\}/g,Z=o(({path:e,url:r})=>{let t=r,s=r.match(Y);if(s)for(let a of s){let i=!1,n=a.substring(1,a.length-1),l="simple";n.endsWith("*")&&(i=!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(a,B({explode:i,name:n,style:l,value:d}));continue}if(typeof d=="object"){t=t.replace(a,q({explode:i,name:n,style:l,value:d}));continue}if(l==="matrix"){t=t.replace(a,`;${w({name:n,value:d})}`);continue}let C=encodeURIComponent(l==="label"?`.${d}`:d);t=t.replace(a,C)}return t},"B"),j=o(({allowReserved:e,array:r,object:t}={})=>s=>{let a=[];if(s&&typeof s=="object")for(let i in s){let n=s[i];if(n!=null){if(Array.isArray(n)){a=[...a,B({allowReserved:e,explode:!0,name:i,style:"form",value:n,...r})];continue}if(typeof n=="object"){a=[...a,q({allowReserved:e,explode:!0,name:i,style:"deepObject",value:n,...t})];continue}a=[...a,w({allowReserved:e,name:i,value:n})]}}return a.join("&")},"E"),ee=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"),re=o(async({security:e,...r})=>{for(let t of e){let s=await G(t,r.auth);if(!s)continue;let a=t.name??"Authorization";switch(t.in){case"query":r.query||(r.query={}),r.query[a]=s;break;case"header":default:r.headers.set(a,s);break}return}},"I"),g=o(e=>te({baseUrl:e.baseUrl,path:e.path,query:e.query,querySerializer:typeof e.querySerializer=="function"?e.querySerializer:j(e.querySerializer),url:e.url}),"S"),te=o(({baseUrl:e,path:r,query:t,querySerializer:s,url:a})=>{let i=a.startsWith("/")?a:`/${a}`,n=(e??"")+i;r&&(n=Z({path:r,url:n}));let l=t?s(t):"";return l.startsWith("?")&&(l=l.substring(1)),l&&(n+=`?${l}`),n},"W"),R=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=k(e.headers,r.headers),t},"C"),k=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[a,i]of s)if(i===null)r.delete(a);else if(Array.isArray(i))for(let n of i)r.append(a,n);else i!==void 0&&r.set(a,typeof i=="object"?JSON.stringify(i):i)}return r},"x"),f,E=(f=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(f,"m"),f),oe=o(()=>({error:new E,request:new E,response:new E}),"T"),ne=j({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),le={"Content-Type":"application/json"},m=o((e={})=>({...Q,headers:le,parseAs:"auto",querySerializer:ne,...e}),"w"),b=o((e={})=>{let r=R(m(),e),t=o(()=>({...r}),"e"),s=o(n=>(r=R(r,n),t()),"a"),a=oe(),i=o(async n=>{let l={...r,...n,fetch:n.fetch??r.fetch??globalThis.fetch,headers:k(r.headers,n.headers)};l.security&&await re({...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=g(l),C={redirect:"follow",...l},c=new Request(d,C);for(let h of a.request._fns)c=await h(c,l);let J=l.fetch,u=await J(c);for(let h of a.response._fns)u=await h(u,c,l);let I={request:c,response:u};if(u.ok){if(u.status===204||u.headers.get("Content-Length")==="0")return{data:{},...I};let h=(l.parseAs==="auto"?ee(u.headers.get("Content-Type")):l.parseAs)??"json";if(h==="stream")return{data:u.body,...I};let T=await u[h]();return h==="json"&&(l.responseValidator&&await l.responseValidator(T),l.responseTransformer&&(T=await l.responseTransformer(T))),{data:T,...I}}let O=await u.text();try{O=JSON.parse(O)}catch{}let y=O;for(let h of a.error._fns)y=await h(O,u,c,l);if(y=y||{},l.throwOnError)throw y;return{error:y,...I}},"o");return{buildUrl:g,connect:o(n=>i({...n,method:"CONNECT"}),"connect"),delete:o(n=>i({...n,method:"DELETE"}),"delete"),get:o(n=>i({...n,method:"GET"}),"get"),getConfig:t,head:o(n=>i({...n,method:"HEAD"}),"head"),interceptors:a,options:o(n=>i({...n,method:"OPTIONS"}),"options"),patch:o(n=>i({...n,method:"PATCH"}),"patch"),post:o(n=>i({...n,method:"POST"}),"post"),put:o(n=>i({...n,method:"PUT"}),"put"),request:i,setConfig:s,trace:o(n=>i({...n,method:"TRACE"}),"trace")}},"J");var p=b(m({baseUrl:"https://swish.app/api/unstable"}));var L=o(e=>((e==null?void 0:e.client)??p).get({url:"/lists",...e}),"listControllerFind"),S=o(e=>(e.client??p).post({url:"/lists",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"listControllerCreate"),U=o(e=>(e.client??p).delete({url:"/lists/{listId}",...e}),"listControllerDeleteById"),v=o(e=>(e.client??p).get({url:"/lists/{listId}",...e}),"listControllerFindById"),A=o(e=>(e.client??p).patch({url:"/lists/{listId}",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"listControllerUpdateById"),P=o(e=>(e.client??p).delete({url:"/items",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"itemControllerDelete"),F=o(e=>((e==null?void 0:e.client)??p).get({url:"/items",...e}),"itemControllerFind"),$=o(e=>(e.client??p).post({url:"/items",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"itemControllerCreate"),z=o(e=>(e.client??p).delete({url:"/items/{itemId}",...e}),"itemControllerDeleteById"),_=o(e=>(e.client??p).patch({url:"/items/{itemId}",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"itemControllerUpdateById"),V=o(e=>((e==null?void 0:e.client)??p).get({url:"/profiles/accounts-version",...e}),"profileControllerCustomerAccountsVersion"),W=o(e=>(e.client??p).post({url:"/profiles/identify",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"profileControllerIdentify"),N=o(e=>(e.client??p).post({url:"/profiles/token",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),"profileControllerCreateToken");var Ie=o(e=>new D(e),"createClient"),x=class x{constructor(r){this.client=b(m({baseUrl:"https://swish.app/api/2025-04"}));this.items={list:o(r=>this.handleRequest(F({query:r,client:this.client})),"list"),create:o(r=>this.handleRequest($({body:r,client:this.client})),"create"),delete:o(r=>this.handleRequest(P({body:{items:r},client:this.client})),"delete"),deleteById:o(r=>this.handleRequest(z({path:{itemId:r},client:this.client})),"deleteById"),updateById:o((r,t)=>this.handleRequest(_({body:t,path:{itemId:r},client:this.client})),"updateById")};this.lists={list:o(r=>this.handleRequest(L({query:r,client:this.client})),"list"),findById:o(r=>this.handleRequest(v({path:{listId:r},client:this.client})),"findById"),create:o(r=>this.handleRequest(S({body:r,client:this.client})),"create"),deleteById:o(r=>this.handleRequest(U({path:{listId:r},client:this.client})),"deleteById"),updateById:o((r,t)=>this.handleRequest(A({body:t,path:{listId:r},client:this.client})),"updateById")};this.profiles={customerAccountsVersion:o(()=>this.handleRequest(V({client:this.client})),"customerAccountsVersion"),createToken:o((r={})=>this.handleRequest(N({body:r,client:this.client})),"createToken"),identify:o(r=>this.handleRequest(W({body:r,client:this.client})),"identify")};this.handleRequest=o(async r=>{let{data:t,error:s}=await r;return s!=null&&s.error?{data:null,error:s==null?void 0:s.error}:t!=null&&t.data?{data:t.data,error:null}:{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(x,"SwishClient");var D=x;export{Ie as createClient};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var T=Object.defineProperty;var l=(n,r)=>T(n,"name",{value:r,configurable:!0});var z=l(async(n,r)=>{let e=typeof r=="function"?await r(n):r;if(e)return n.scheme==="bearer"?`Bearer ${e}`:n.scheme==="basic"?`Basic ${btoa(e)}`:e},"A");var U={bodySerializer:l(n=>JSON.stringify(n,(r,e)=>typeof e=="bigint"?e.toString():e),"bodySerializer")};var E=l(n=>{switch(n){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},"U"),D=l(n=>{switch(n){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},"_"),_=l(n=>{switch(n){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},"D"),v=l(({allowReserved:n,explode:r,name:e,style:i,value:s})=>{if(!r){let a=(n?s:s.map(u=>encodeURIComponent(u))).join(D(i));switch(i){case"label":return`.${a}`;case"matrix":return`;${e}=${a}`;case"simple":return a;default:return`${e}=${a}`}}let o=E(i),t=s.map(a=>i==="label"||i==="simple"?n?a:encodeURIComponent(a):g({allowReserved:n,name:e,value:a})).join(o);return i==="label"||i==="matrix"?o+t:t},"O"),g=l(({allowReserved:n,name:r,value:e})=>{if(e==null)return"";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return`${r}=${n?e:encodeURIComponent(e)}`},"y"),x=l(({allowReserved:n,explode:r,name:e,style:i,value:s})=>{if(s instanceof Date)return`${e}=${s.toISOString()}`;if(i!=="deepObject"&&!r){let a=[];Object.entries(s).forEach(([h,p])=>{a=[...a,h,n?p:encodeURIComponent(p)]});let u=a.join(",");switch(i){case"form":return`${e}=${u}`;case"label":return`.${u}`;case"matrix":return`;${e}=${u}`;default:return u}}let o=_(i),t=Object.entries(s).map(([a,u])=>g({allowReserved:n,name:i==="deepObject"?`${e}[${a}]`:a,value:u})).join(o);return i==="label"||i==="matrix"?o+t:t},"q"),W=/\{[^{}]+\}/g,N=l(({path:n,url:r})=>{let e=r,i=r.match(W);if(i)for(let s of i){let o=!1,t=s.substring(1,s.length-1),a="simple";t.endsWith("*")&&(o=!0,t=t.substring(0,t.length-1)),t.startsWith(".")?(t=t.substring(1),a="label"):t.startsWith(";")&&(t=t.substring(1),a="matrix");let u=n[t];if(u==null)continue;if(Array.isArray(u)){e=e.replace(s,v({explode:o,name:t,style:a,value:u}));continue}if(typeof u=="object"){e=e.replace(s,x({explode:o,name:t,style:a,value:u}));continue}if(a==="matrix"){e=e.replace(s,`;${g({name:t,value:u})}`);continue}let h=encodeURIComponent(a==="label"?`.${u}`:u);e=e.replace(s,h)}return e},"B"),$=l(({allowReserved:n,array:r,object:e}={})=>i=>{let s=[];if(i&&typeof i=="object")for(let o in i){let t=i[o];if(t!=null){if(Array.isArray(t)){s=[...s,v({allowReserved:n,explode:!0,name:o,style:"form",value:t,...r})];continue}if(typeof t=="object"){s=[...s,x({allowReserved:n,explode:!0,name:o,style:"deepObject",value:t,...e})];continue}s=[...s,g({allowReserved:n,name:o,value:t})]}}return s.join("&")},"E"),I=l(n=>{var e;if(!n)return"stream";let r=(e=n.split(";")[0])==null?void 0:e.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(i=>r.startsWith(i)))return"blob";if(r.startsWith("text/"))return"text"}},"P"),P=l(async({security:n,...r})=>{for(let e of n){let i=await z(e,r.auth);if(!i)continue;let s=e.name??"Authorization";switch(e.in){case"query":r.query||(r.query={}),r.query[s]=i;break;case"header":default:r.headers.set(s,i);break}return}},"I"),O=l(n=>B({baseUrl:n.baseUrl,path:n.path,query:n.query,querySerializer:typeof n.querySerializer=="function"?n.querySerializer:$(n.querySerializer),url:n.url}),"S"),B=l(({baseUrl:n,path:r,query:e,querySerializer:i,url:s})=>{let o=s.startsWith("/")?s:`/${s}`,t=(n??"")+o;r&&(t=N({path:r,url:t}));let a=e?i(e):"";return a.startsWith("?")&&(a=a.substring(1)),a&&(t+=`?${a}`),t},"W"),S=l((n,r)=>{var i;let e={...n,...r};return(i=e.baseUrl)!=null&&i.endsWith("/")&&(e.baseUrl=e.baseUrl.substring(0,e.baseUrl.length-1)),e.headers=q(n.headers,r.headers),e},"C"),q=l((...n)=>{let r=new Headers;for(let e of n){if(!e||typeof e!="object")continue;let i=e instanceof Headers?e.entries():Object.entries(e);for(let[s,o]of i)if(o===null)r.delete(s);else if(Array.isArray(o))for(let t of o)r.append(s,t);else o!==void 0&&r.set(s,typeof o=="object"?JSON.stringify(o):o)}return r},"x"),d,C=(d=class{_fns;constructor(){this._fns=[]}clear(){this._fns=[]}exists(r){return this._fns.indexOf(r)!==-1}eject(r){let e=this._fns.indexOf(r);e!==-1&&(this._fns=[...this._fns.slice(0,e),...this._fns.slice(e+1)])}use(r){this._fns=[...this._fns,r]}},l(d,"m"),d),J=l(()=>({error:new C,request:new C,response:new C}),"T"),H=$({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),k={"Content-Type":"application/json"},j=l((n={})=>({...U,headers:k,parseAs:"auto",querySerializer:H,...n}),"w"),R=l((n={})=>{let r=S(j(),n),e=l(()=>({...r}),"e"),i=l(t=>(r=S(r,t),e()),"a"),s=J(),o=l(async t=>{let a={...r,...t,fetch:t.fetch??r.fetch??globalThis.fetch,headers:q(r.headers,t.headers)};a.security&&await P({...a,security:a.security}),a.body&&a.bodySerializer&&(a.body=a.bodySerializer(a.body)),(a.body===void 0||a.body==="")&&a.headers.delete("Content-Type");let u=O(a),h={redirect:"follow",...a},p=new Request(u,h);for(let c of s.request._fns)p=await c(p,a);let A=a.fetch,f=await A(p);for(let c of s.response._fns)f=await c(f,p,a);let m={request:p,response:f};if(f.ok){if(f.status===204||f.headers.get("Content-Length")==="0")return{data:{},...m};let c=(a.parseAs==="auto"?I(f.headers.get("Content-Type")):a.parseAs)??"json";if(c==="stream")return{data:f.body,...m};let w=await f[c]();return c==="json"&&(a.responseValidator&&await a.responseValidator(w),a.responseTransformer&&(w=await a.responseTransformer(w))),{data:w,...m}}let b=await f.text();try{b=JSON.parse(b)}catch{}let y=b;for(let c of s.error._fns)y=await c(b,f,p,a);if(y=y||{},a.throwOnError)throw y;return{error:y,...m}},"o");return{buildUrl:O,connect:l(t=>o({...t,method:"CONNECT"}),"connect"),delete:l(t=>o({...t,method:"DELETE"}),"delete"),get:l(t=>o({...t,method:"GET"}),"get"),getConfig:e,head:l(t=>o({...t,method:"HEAD"}),"head"),interceptors:s,options:l(t=>o({...t,method:"OPTIONS"}),"options"),patch:l(t=>o({...t,method:"PATCH"}),"patch"),post:l(t=>o({...t,method:"POST"}),"post"),put:l(t=>o({...t,method:"PUT"}),"put"),request:o,setConfig:i,trace:l(t=>o({...t,method:"TRACE"}),"trace")}},"J");var Q=R(j({baseUrl:"https://swish.app/api/unstable"}));export{Q as client};
|
package/dist/client/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export*from"./types.gen";export*from"./sdk.gen";
|
package/dist/client/sdk.gen.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var l=Object.defineProperty;var e=(r,o)=>l(r,"name",{value:o,configurable:!0});import{client as t}from"./client.gen";const s=e(r=>((r==null?void 0:r.client)??t).get({url:"/lists",...r}),"listControllerFind"),C=e(r=>(r.client??t).post({url:"/lists",...r,headers:{"Content-Type":"application/json",...r==null?void 0:r.headers}}),"listControllerCreate"),d=e(r=>(r.client??t).delete({url:"/lists/{listId}",...r}),"listControllerDeleteById"),i=e(r=>(r.client??t).get({url:"/lists/{listId}",...r}),"listControllerFindById"),I=e(r=>(r.client??t).patch({url:"/lists/{listId}",...r,headers:{"Content-Type":"application/json",...r==null?void 0:r.headers}}),"listControllerUpdateById"),E=e(r=>(r.client??t).delete({url:"/items",...r,headers:{"Content-Type":"application/json",...r==null?void 0:r.headers}}),"itemControllerDelete"),h=e(r=>((r==null?void 0:r.client)??t).get({url:"/items",...r}),"itemControllerFind"),T=e(r=>(r.client??t).post({url:"/items",...r,headers:{"Content-Type":"application/json",...r==null?void 0:r.headers}}),"itemControllerCreate"),O=e(r=>(r.client??t).delete({url:"/items/{itemId}",...r}),"itemControllerDeleteById"),c=e(r=>(r.client??t).patch({url:"/items/{itemId}",...r,headers:{"Content-Type":"application/json",...r==null?void 0:r.headers}}),"itemControllerUpdateById"),m=e(r=>((r==null?void 0:r.client)??t).get({url:"/profiles/accounts-version",...r}),"profileControllerCustomerAccountsVersion"),p=e(r=>(r.client??t).post({url:"/profiles/identify",...r,headers:{"Content-Type":"application/json",...r==null?void 0:r.headers}}),"profileControllerIdentify"),y=e(r=>(r.client??t).post({url:"/profiles/token",...r,headers:{"Content-Type":"application/json",...r==null?void 0:r.headers}}),"profileControllerCreateToken");export{T as itemControllerCreate,E as itemControllerDelete,O as itemControllerDeleteById,h as itemControllerFind,c as itemControllerUpdateById,C as listControllerCreate,d as listControllerDeleteById,s as listControllerFind,i as listControllerFindById,I as listControllerUpdateById,y as profileControllerCreateToken,m as profileControllerCustomerAccountsVersion,p as profileControllerIdentify};
|
package/dist/client/types.gen.js
DELETED
|
File without changes
|
package/dist/client.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var d=Object.defineProperty;var t=(o,e)=>d(o,"name",{value:e,configurable:!0});import*as r from"./client/sdk.gen";import{client as n}from"./client/client.gen";const h=t(o=>new l(o),"createClient"),a=class a{constructor(e){this.items={list:t(e=>this.handleRequest(r.itemControllerFind({query:e})),"list"),create:t(e=>this.handleRequest(r.itemControllerCreate({body:e})),"create"),delete:t(e=>this.handleRequest(r.itemControllerDelete({body:{items:e}})),"delete"),deleteById:t(e=>this.handleRequest(r.itemControllerDeleteById({path:{itemId:e}})),"deleteById"),updateById:t((e,s)=>this.handleRequest(r.itemControllerUpdateById({body:s,path:{itemId:e}})),"updateById")};this.lists={list:t(e=>this.handleRequest(r.listControllerFind({query:e})),"list"),findById:t(e=>this.handleRequest(r.listControllerFindById({path:{listId:e}})),"findById"),create:t(e=>this.handleRequest(r.listControllerCreate({body:e})),"create"),deleteById:t(e=>this.handleRequest(r.listControllerDeleteById({path:{listId:e}})),"deleteById"),updateById:t((e,s)=>this.handleRequest(r.listControllerUpdateById({body:s,path:{listId:e}})),"updateById")};this.profiles={customerAccountsVersion:t(()=>this.handleRequest(r.profileControllerCustomerAccountsVersion()),"customerAccountsVersion"),createToken:t((e={})=>this.handleRequest(r.profileControllerCreateToken({body:e})),"createToken"),identify:t(e=>this.handleRequest(r.profileControllerIdentify({body:e})),"identify")};this.handleRequest=t(async e=>{const{data:s,error:i}=await e;return i!=null&&i.error?{data:null,error:i==null?void 0:i.error}:s!=null&&s.data?{data:s.data,error:null}:{data:null,error:null}},"handleRequest");this.profile=e.profile,e.authToken&&(this.authToken=e.authToken),e.config&&n.setConfig(e.config),n.interceptors.request.use(this.requestInterceptor.bind(this)),e.requestInterceptor&&n.interceptors.request.use(e.requestInterceptor),e.responseInterceptor&&n.interceptors.response.use(e.responseInterceptor)}setProfile(e){this.profile=e}setAuthToken(e){this.authToken=e}setConfig(e){n.setConfig(e)}requestInterceptor(e){return this.authToken&&e.headers.set("Authorization",`Bearer ${this.authToken}`),this.profile&&e.headers.set("Profile",this.profile),e}};t(a,"SwishClient");let l=a;export{h as createClient};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|