@swishapp/api-client 0.41.0 → 0.43.0-unstable.20260305130147

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.
Files changed (65) hide show
  1. package/README.md +55 -0
  2. package/dist/{client.d.ts → 2026-01/client.d.ts} +19 -8
  3. package/dist/2026-01/index.d.ts +3 -0
  4. package/dist/2026-01/index.js +7 -0
  5. package/dist/{openapi → 2026-01/openapi}/client/index.d.ts +2 -1
  6. package/dist/{openapi → 2026-01/openapi}/client/types.gen.d.ts +2 -9
  7. package/dist/{openapi → 2026-01/openapi}/client/utils.gen.d.ts +1 -1
  8. package/dist/{openapi → 2026-01/openapi}/core/bodySerializer.gen.d.ts +12 -4
  9. package/dist/{openapi → 2026-01/openapi}/core/params.gen.d.ts +10 -0
  10. package/dist/2026-01/openapi/core/queryKeySerializer.gen.d.ts +18 -0
  11. package/dist/2026-01/openapi/index.d.ts +2 -0
  12. package/dist/{openapi → 2026-01/openapi}/sdk.gen.d.ts +14 -4
  13. package/dist/{openapi → 2026-01/openapi}/types.gen.d.ts +775 -20
  14. package/dist/{types.d.ts → 2026-01/types.d.ts} +1 -2
  15. package/dist/2026-04/client.d.ts +143 -0
  16. package/dist/2026-04/index.d.ts +3 -0
  17. package/dist/2026-04/index.js +7 -0
  18. package/dist/2026-04/openapi/client/client.gen.d.ts +2 -0
  19. package/dist/2026-04/openapi/client/index.d.ts +8 -0
  20. package/dist/2026-04/openapi/client/types.gen.d.ts +117 -0
  21. package/dist/2026-04/openapi/client/utils.gen.d.ts +33 -0
  22. package/dist/2026-04/openapi/client.gen.d.ts +12 -0
  23. package/dist/2026-04/openapi/core/auth.gen.d.ts +18 -0
  24. package/dist/2026-04/openapi/core/bodySerializer.gen.d.ts +25 -0
  25. package/dist/2026-04/openapi/core/params.gen.d.ts +43 -0
  26. package/dist/2026-04/openapi/core/pathSerializer.gen.d.ts +33 -0
  27. package/dist/2026-04/openapi/core/queryKeySerializer.gen.d.ts +18 -0
  28. package/dist/2026-04/openapi/core/serverSentEvents.gen.d.ts +71 -0
  29. package/dist/2026-04/openapi/core/types.gen.d.ts +78 -0
  30. package/dist/2026-04/openapi/core/utils.gen.d.ts +19 -0
  31. package/dist/2026-04/openapi/index.d.ts +2 -0
  32. package/dist/2026-04/openapi/sdk.gen.d.ts +279 -0
  33. package/dist/2026-04/openapi/types.gen.d.ts +4502 -0
  34. package/dist/2026-04/types.d.ts +57 -0
  35. package/dist/index.d.ts +1 -3
  36. package/dist/index.js +6 -4
  37. package/dist/unstable/client.d.ts +143 -0
  38. package/dist/unstable/index.d.ts +3 -0
  39. package/dist/unstable/index.js +7 -0
  40. package/dist/unstable/openapi/client/client.gen.d.ts +2 -0
  41. package/dist/unstable/openapi/client/index.d.ts +8 -0
  42. package/dist/unstable/openapi/client/types.gen.d.ts +117 -0
  43. package/dist/unstable/openapi/client/utils.gen.d.ts +33 -0
  44. package/dist/unstable/openapi/client.gen.d.ts +12 -0
  45. package/dist/unstable/openapi/core/auth.gen.d.ts +18 -0
  46. package/dist/unstable/openapi/core/bodySerializer.gen.d.ts +25 -0
  47. package/dist/unstable/openapi/core/params.gen.d.ts +43 -0
  48. package/dist/unstable/openapi/core/pathSerializer.gen.d.ts +33 -0
  49. package/dist/unstable/openapi/core/queryKeySerializer.gen.d.ts +18 -0
  50. package/dist/unstable/openapi/core/serverSentEvents.gen.d.ts +71 -0
  51. package/dist/unstable/openapi/core/types.gen.d.ts +78 -0
  52. package/dist/unstable/openapi/core/utils.gen.d.ts +19 -0
  53. package/dist/unstable/openapi/index.d.ts +2 -0
  54. package/dist/unstable/openapi/sdk.gen.d.ts +279 -0
  55. package/dist/unstable/openapi/types.gen.d.ts +4502 -0
  56. package/dist/unstable/types.d.ts +57 -0
  57. package/package.json +52 -22
  58. package/dist/openapi/index.d.ts +0 -2
  59. /package/dist/{openapi → 2026-01/openapi}/client/client.gen.d.ts +0 -0
  60. /package/dist/{openapi → 2026-01/openapi}/client.gen.d.ts +0 -0
  61. /package/dist/{openapi → 2026-01/openapi}/core/auth.gen.d.ts +0 -0
  62. /package/dist/{openapi → 2026-01/openapi}/core/pathSerializer.gen.d.ts +0 -0
  63. /package/dist/{openapi → 2026-01/openapi}/core/serverSentEvents.gen.d.ts +0 -0
  64. /package/dist/{openapi → 2026-01/openapi}/core/types.gen.d.ts +0 -0
  65. /package/dist/{openapi → 2026-01/openapi}/core/utils.gen.d.ts +0 -0
@@ -1,7 +1,7 @@
1
1
  import type { SwishClient } from "./client";
2
2
  import type { Client, ClientOptions, Config } from "./openapi/client";
3
3
  import type { PageInfo } from "./openapi/types.gen";
4
- export type { SwishClient };
4
+ export type { SwishClient } from "./client";
5
5
  export interface SwishClientOptions {
6
6
  authToken?: string;
7
7
  config?: SwishClientConfig;
@@ -10,7 +10,6 @@ export interface SwishClientOptions {
10
10
  }
11
11
  export type SwishClientConfig = Config<ClientOptions> & {
12
12
  authProxy?: string;
13
- version?: string;
14
13
  };
15
14
  export type ListItemsResponse = Awaited<ReturnType<SwishClient["items"]["list"]>>;
16
15
  export type CreateItemResponse = Awaited<ReturnType<SwishClient["items"]["create"]>>;
@@ -0,0 +1,143 @@
1
+ import type { SwishClientOptions, ApiResponse, PaginatedApiResponse } from "./types";
2
+ import type * as types from "./openapi/types.gen";
3
+ export declare const apiVersion = "2026-04";
4
+ export declare const createApiClient: (options: SwishClientOptions) => SwishClient;
5
+ export type { SwishClient };
6
+ declare class SwishClient {
7
+ private authToken?;
8
+ private readonly version;
9
+ private readonly client;
10
+ constructor(options: SwishClientOptions);
11
+ setAuthToken(authToken: string): void;
12
+ directRequestInterceptor(request: Request): Request;
13
+ readonly items: {
14
+ list: (query?: types.ItemControllerFindData["query"]) => Promise<PaginatedApiResponse<types.Item>>;
15
+ create: (items: types.CreateItem) => Promise<ApiResponse<{
16
+ [key: string]: unknown;
17
+ } & types.Item>>;
18
+ delete: (itemIds: types.DeleteItems["itemIds"]) => Promise<ApiResponse<{
19
+ [key: string]: unknown;
20
+ } & types.Item[]>>;
21
+ findById: (itemId: string) => Promise<ApiResponse<{
22
+ [key: string]: unknown;
23
+ } & types.ItemDetail>>;
24
+ updateById: (itemId: string, body: types.UpdateItem) => Promise<ApiResponse<{
25
+ [key: string]: unknown;
26
+ } & types.Item>>;
27
+ deleteById: (itemId: string) => Promise<ApiResponse<{
28
+ [key: string]: unknown;
29
+ } & types.Item>>;
30
+ setListsById: (itemId: string, listIds: types.SetItemLists["listIds"]) => Promise<ApiResponse<{
31
+ [key: string]: unknown;
32
+ } & types.ItemDetail>>;
33
+ count: () => Promise<ApiResponse<{
34
+ [key: string]: unknown;
35
+ } & types.ItemCount>>;
36
+ };
37
+ readonly lists: {
38
+ list: (query?: types.ListControllerFindData["query"]) => Promise<PaginatedApiResponse<types.ListDetail>>;
39
+ create: (list: types.CreateList) => Promise<ApiResponse<{
40
+ [key: string]: unknown;
41
+ } & types.List>>;
42
+ findById: (listId: string) => Promise<ApiResponse<{
43
+ [key: string]: unknown;
44
+ } & types.ListDetail>>;
45
+ updateById: (listId: string, body: types.UpdateList) => Promise<ApiResponse<{
46
+ [key: string]: unknown;
47
+ } & types.List>>;
48
+ deleteById: (listId: string) => Promise<ApiResponse<{
49
+ [key: string]: unknown;
50
+ } & types.List>>;
51
+ orderItems: (listId: string, itemIds: types.SetListItemsOrder["itemIds"]) => Promise<ApiResponse<{
52
+ [key: string]: unknown;
53
+ } & types.List>>;
54
+ addItemsToList: (listId: string, itemIds: types.AddItemsToList["itemIds"]) => Promise<ApiResponse<{
55
+ [key: string]: unknown;
56
+ } & types.ListDetail>>;
57
+ removeItemFromList: (listId: string, itemId: string) => Promise<ApiResponse<unknown>>;
58
+ };
59
+ readonly profiles: {
60
+ createToken: (body?: types.CreateProfileToken) => Promise<ApiResponse<{
61
+ [key: string]: unknown;
62
+ } & types.CreateProfileTokenResult>>;
63
+ identify: (body: types.IdentifyProfile) => Promise<ApiResponse<unknown>>;
64
+ getProfile: () => Promise<ApiResponse<{
65
+ [key: string]: unknown;
66
+ } & types.Profile>>;
67
+ updateProfile: (body: types.UpdateProfile) => Promise<ApiResponse<{
68
+ [key: string]: unknown;
69
+ } & types.Profile>>;
70
+ };
71
+ readonly orders: {
72
+ list: (query?: types.OrdersControllerFindData["query"]) => Promise<PaginatedApiResponse<types.Order>>;
73
+ findById: (orderId: number) => Promise<ApiResponse<{
74
+ [key: string]: unknown;
75
+ } & types.OrderDetail>>;
76
+ };
77
+ readonly sharedLists: {
78
+ list: (query?: types.SharedListsControllerFindAllData["query"]) => Promise<PaginatedApiResponse<types.ListDetail>>;
79
+ save: (listId: string) => Promise<ApiResponse<{
80
+ [key: string]: unknown;
81
+ } & types.ListDetail>>;
82
+ findById: (sharedListId: string) => Promise<ApiResponse<{
83
+ [key: string]: unknown;
84
+ } & types.ListDetail>>;
85
+ deleteById: (sharedListId: string) => Promise<ApiResponse<unknown>>;
86
+ findItems: (sharedListId: string, query?: types.SharedListsControllerFindItemsData["query"]) => Promise<PaginatedApiResponse<types.Item>>;
87
+ };
88
+ readonly analytics: {
89
+ savedItems: (query: types.AnalyticsControllerLoadSavedItemsData["query"]) => Promise<ApiResponse<{
90
+ [key: string]: unknown;
91
+ } & types.Analytics[]>>;
92
+ sessions: (query: types.AnalyticsControllerLoadSessionsData["query"]) => Promise<ApiResponse<{
93
+ [key: string]: unknown;
94
+ } & types.Analytics[]>>;
95
+ newLists: (query: types.AnalyticsControllerLoadNewListsData["query"]) => Promise<ApiResponse<{
96
+ [key: string]: unknown;
97
+ } & types.Analytics[]>>;
98
+ };
99
+ readonly tracking: {
100
+ track: (body: types.TrackingEventRequest) => Promise<ApiResponse<unknown>>;
101
+ };
102
+ readonly notifications: {
103
+ list: (query?: types.NotificationsControllerFindData["query"]) => Promise<PaginatedApiResponse<types.Notification>>;
104
+ getUnreadCount: () => Promise<ApiResponse<{
105
+ [key: string]: unknown;
106
+ } & types.NotificationUnreadCount>>;
107
+ markAsRead: (notificationIds: types.MarkAsRead["notificationIds"]) => Promise<ApiResponse<{
108
+ [key: string]: unknown;
109
+ } & types.Notification[]>>;
110
+ markAllAsRead: () => Promise<ApiResponse<{
111
+ [key: string]: unknown;
112
+ } & types.Notification[]>>;
113
+ deleteById: (id: string) => Promise<ApiResponse<{
114
+ [key: string]: unknown;
115
+ } & types.Notification>>;
116
+ };
117
+ readonly subscriptions: {
118
+ list: (query?: types.SubscriptionsControllerFindData["query"]) => Promise<PaginatedApiResponse<types.Subscription>>;
119
+ create: (body: types.CreateSubscription) => Promise<ApiResponse<{
120
+ [key: string]: unknown;
121
+ } & types.Subscription>>;
122
+ findById: (id: string) => Promise<ApiResponse<{
123
+ [key: string]: unknown;
124
+ } & types.Subscription>>;
125
+ updateById: (id: string, body: types.UpdateSubscription) => Promise<ApiResponse<{
126
+ [key: string]: unknown;
127
+ } & types.Subscription>>;
128
+ deleteById: (id: string) => Promise<ApiResponse<{
129
+ [key: string]: unknown;
130
+ } & types.Subscription>>;
131
+ };
132
+ readonly smartLists: {
133
+ list: () => Promise<ApiResponse<{
134
+ [key: string]: unknown;
135
+ } & types.ListDetail[]>>;
136
+ findById: (smartListId: string) => Promise<ApiResponse<{
137
+ [key: string]: unknown;
138
+ } & types.ListDetail>>;
139
+ findItems: (smartListId: string, query?: types.SmartListsControllerFindItemsData["query"]) => Promise<PaginatedApiResponse<types.Item>>;
140
+ };
141
+ private readonly handleRequest;
142
+ private readonly handlePaginatedRequest;
143
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./client";
2
+ export type * from "./types";
3
+ export type * from "./openapi/types.gen";
@@ -0,0 +1,7 @@
1
+ var _e=Object.defineProperty;var t=(e,r)=>_e(e,"name",{value:r,configurable:!0});var ve={bodySerializer:t(e=>JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString():o),"bodySerializer")};var ze=t(({onRequest:e,onSseError:r,onSseEvent:o,responseTransformer:s,responseValidator:l,sseDefaultRetryDelay:c,sseMaxRetryAttempts:d,sseMaxRetryDelay:a,sseSleepFn:p,url:h,...n})=>{let f,g=p??(C=>new Promise(I=>setTimeout(I,C)));return{stream:t(async function*(){let C=c??3e3,I=0,O=n.signal??new AbortController().signal;for(;!O.aborted;){I++;let w=n.headers instanceof Headers?n.headers:new Headers(n.headers);f!==void 0&&w.set("Last-Event-ID",f);try{let L={redirect:"follow",...n,body:n.serializedBody,headers:w,signal:O},E=new Request(h,L);e&&(E=await e(h,L));let y=await(n.fetch??globalThis.fetch)(E);if(!y.ok)throw new Error(`SSE failed: ${y.status} ${y.statusText}`);if(!y.body)throw new Error("No body in SSE response");let m=y.body.pipeThrough(new TextDecoderStream).getReader(),F="",ke=t(()=>{try{m.cancel()}catch{}},"abortHandler");O.addEventListener("abort",ke);try{for(;;){let{done:Qe,value:We}=await m.read();if(Qe)break;F+=We,F=F.replace(/\r\n/g,`
2
+ `).replace(/\r/g,`
3
+ `);let Pe=F.split(`
4
+
5
+ `);F=Pe.pop()??"";for(let Je of Pe){let Ke=Je.split(`
6
+ `),k=[],qe;for(let S of Ke)if(S.startsWith("data:"))k.push(S.replace(/^data:\s*/,""));else if(S.startsWith("event:"))qe=S.replace(/^event:\s*/,"");else if(S.startsWith("id:"))f=S.replace(/^id:\s*/,"");else if(S.startsWith("retry:")){let Ne=Number.parseInt(S.replace(/^retry:\s*/,""),10);Number.isNaN(Ne)||(C=Ne)}let b,Ue=!1;if(k.length){let S=k.join(`
7
+ `);try{b=JSON.parse(S),Ue=!0}catch{b=S}}Ue&&(l&&await l(b),s&&(b=await s(b))),o==null||o({data:b,event:qe,id:f,retry:C}),k.length&&(yield b)}}}finally{O.removeEventListener("abort",ke),m.releaseLock()}break}catch(L){if(r==null||r(L),d!==void 0&&I>=d)break;let E=Math.min(C*2**(I-1),a??3e4);await g(E)}}},"createStream")()}},"createSseClient");var Xe=t(e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},"separatorArrayExplode"),Ye=t(e=>{switch(e){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},"separatorArrayNoExplode"),Ze=t(e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},"separatorObjectExplode"),P=t(({allowReserved:e,explode:r,name:o,style:s,value:l})=>{if(!r){let a=(e?l:l.map(p=>encodeURIComponent(p))).join(Ye(s));switch(s){case"label":return`.${a}`;case"matrix":return`;${o}=${a}`;case"simple":return a;default:return`${o}=${a}`}}let c=Xe(s),d=l.map(a=>s==="label"||s==="simple"?e?a:encodeURIComponent(a):D({allowReserved:e,name:o,value:a})).join(c);return s==="label"||s==="matrix"?c+d:d},"serializeArrayParam"),D=t(({allowReserved:e,name:r,value:o})=>{if(o==null)return"";if(typeof o=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return`${r}=${e?o:encodeURIComponent(o)}`},"serializePrimitiveParam"),q=t(({allowReserved:e,explode:r,name:o,style:s,value:l,valueOnly:c})=>{if(l instanceof Date)return c?l.toISOString():`${o}=${l.toISOString()}`;if(s!=="deepObject"&&!r){let p=[];Object.entries(l).forEach(([n,f])=>{p=[...p,n,e?f:encodeURIComponent(f)]});let h=p.join(",");switch(s){case"form":return`${o}=${h}`;case"label":return`.${h}`;case"matrix":return`;${o}=${h}`;default:return h}}let d=Ze(s),a=Object.entries(l).map(([p,h])=>D({allowReserved:e,name:s==="deepObject"?`${o}[${p}]`:p,value:h})).join(d);return s==="label"||s==="matrix"?d+a:a},"serializeObjectParam");var er=/\{[^{}]+\}/g,rr=t(({path:e,url:r})=>{let o=r,s=r.match(er);if(s)for(let l of s){let c=!1,d=l.substring(1,l.length-1),a="simple";d.endsWith("*")&&(c=!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 p=e[d];if(p==null)continue;if(Array.isArray(p)){o=o.replace(l,P({explode:c,name:d,style:a,value:p}));continue}if(typeof p=="object"){o=o.replace(l,q({explode:c,name:d,style:a,value:p,valueOnly:!0}));continue}if(a==="matrix"){o=o.replace(l,`;${D({name:d,value:p})}`);continue}let h=encodeURIComponent(a==="label"?`.${p}`:p);o=o.replace(l,h)}return o},"defaultPathSerializer"),je=t(({baseUrl:e,path:r,query:o,querySerializer:s,url:l})=>{let c=l.startsWith("/")?l:`/${l}`,d=(e??"")+c;r&&(d=rr({path:r,url:d}));let a=o?s(o):"";return a.startsWith("?")&&(a=a.substring(1)),a&&(d+=`?${a}`),d},"getUrl");function N(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}t(N,"getValidRequestBody");var Me=t(async(e,r)=>{let o=typeof r=="function"?await r(e):r;if(o)return e.scheme==="bearer"?`Bearer ${o}`:e.scheme==="basic"?`Basic ${btoa(o)}`:o},"getAuthToken");var Ge=t(({parameters:e={},...r}={})=>t(s=>{let l=[];if(s&&typeof s=="object")for(let c in s){let d=s[c];if(d==null)continue;let a=e[c]||r;if(Array.isArray(d)){let p=P({allowReserved:a.allowReserved,explode:!0,name:c,style:"form",value:d,...a.array});p&&l.push(p)}else if(typeof d=="object"){let p=q({allowReserved:a.allowReserved,explode:!0,name:c,style:"deepObject",value:d,...a.object});p&&l.push(p)}else{let p=D({allowReserved:a.allowReserved,name:c,value:d});p&&l.push(p)}}return l.join("&")},"querySerializer"),"createQuerySerializer"),$e=t(e=>{var o;if(!e)return"stream";let r=(o=e.split(";")[0])==null?void 0:o.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"}},"getParseAs"),tr=t((e,r)=>{var o,s;return r?!!(e.headers.has(r)||(o=e.query)!=null&&o[r]||(s=e.headers.get("Cookie"))!=null&&s.includes(`${r}=`)):!1},"checkForExistence"),He=t(async({security:e,...r})=>{for(let o of e){if(tr(r,o.name))continue;let s=await Me(o,r.auth);if(!s)continue;let l=o.name??"Authorization";switch(o.in){case"query":r.query||(r.query={}),r.query[l]=s;break;case"cookie":r.headers.append("Cookie",`${l}=${s}`);break;default:r.headers.set(l,s);break}}},"setAuthParams"),v=t(e=>je({baseUrl:e.baseUrl,path:e.path,query:e.query,querySerializer:typeof e.querySerializer=="function"?e.querySerializer:Ge(e.querySerializer),url:e.url}),"buildUrl"),z=t((e,r)=>{var s;let o={...e,...r};return(s=o.baseUrl)!=null&&s.endsWith("/")&&(o.baseUrl=o.baseUrl.substring(0,o.baseUrl.length-1)),o.headers=U(e.headers,r.headers),o},"mergeConfigs"),or=t(e=>{let r=[];return e.forEach((o,s)=>{r.push([s,o])}),r},"headersEntries"),U=t((...e)=>{let r=new Headers;for(let o of e){if(!o)continue;let s=o instanceof Headers?or(o):Object.entries(o);for(let[l,c]of s)if(c===null)r.delete(l);else if(Array.isArray(c))for(let d of c)r.append(l,d);else c!==void 0&&r.set(l,typeof c=="object"?JSON.stringify(c):c)}return r},"mergeHeaders"),j=class j{constructor(){this.fns=[]}clear(){this.fns=[]}eject(r){let o=this.getInterceptorIndex(r);this.fns[o]&&(this.fns[o]=null)}exists(r){let o=this.getInterceptorIndex(r);return!!this.fns[o]}getInterceptorIndex(r){return typeof r=="number"?this.fns[r]?r:-1:this.fns.indexOf(r)}update(r,o){let s=this.getInterceptorIndex(r);return this.fns[s]?(this.fns[s]=o,r):!1}use(r){return this.fns.push(r),this.fns.length-1}};t(j,"Interceptors");var B=j,Ve=t(()=>({error:new B,request:new B,response:new B}),"createInterceptors"),sr=Ge({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),nr={"Content-Type":"application/json"},T=t((e={})=>({...ve,headers:nr,parseAs:"auto",querySerializer:sr,...e}),"createConfig");var A=t((e={})=>{let r=z(T(),e),o=t(()=>({...r}),"getConfig"),s=t(h=>(r=z(r,h),o()),"setConfig"),l=Ve(),c=t(async h=>{let n={...r,...h,fetch:h.fetch??r.fetch??globalThis.fetch,headers:U(r.headers,h.headers),serializedBody:void 0};n.security&&await He({...n,security:n.security}),n.requestValidator&&await n.requestValidator(n),n.body!==void 0&&n.bodySerializer&&(n.serializedBody=n.bodySerializer(n.body)),(n.body===void 0||n.serializedBody==="")&&n.headers.delete("Content-Type");let f=v(n);return{opts:n,url:f}},"beforeRequest"),d=t(async h=>{let{opts:n,url:f}=await c(h),g={redirect:"follow",...n,body:N(n)},R=new Request(f,g);for(let u of l.request.fns)u&&(R=await u(R,n));let x=n.fetch,C;try{C=await x(R)}catch(u){let y=u;for(let m of l.error.fns)m&&(y=await m(u,void 0,R,n));if(y=y||{},n.throwOnError)throw y;return n.responseStyle==="data"?void 0:{error:y,request:R,response:void 0}}for(let u of l.response.fns)u&&(C=await u(C,R,n));let I={request:R,response:C};if(C.ok){let u=(n.parseAs==="auto"?$e(C.headers.get("Content-Type")):n.parseAs)??"json";if(C.status===204||C.headers.get("Content-Length")==="0"){let m;switch(u){case"arrayBuffer":case"blob":case"text":m=await C[u]();break;case"formData":m=new FormData;break;case"stream":m=C.body;break;default:m={};break}return n.responseStyle==="data"?m:{data:m,...I}}let y;switch(u){case"arrayBuffer":case"blob":case"formData":case"text":y=await C[u]();break;case"json":{let m=await C.text();y=m?JSON.parse(m):{};break}case"stream":return n.responseStyle==="data"?C.body:{data:C.body,...I}}return u==="json"&&(n.responseValidator&&await n.responseValidator(y),n.responseTransformer&&(y=await n.responseTransformer(y))),n.responseStyle==="data"?y:{data:y,...I}}let O=await C.text(),w;try{w=JSON.parse(O)}catch{}let L=w??O,E=L;for(let u of l.error.fns)u&&(E=await u(L,C,R,n));if(E=E||{},n.throwOnError)throw E;return n.responseStyle==="data"?void 0:{error:E,...I}},"request"),a=t(h=>n=>d({...n,method:h}),"makeMethodFn"),p=t(h=>async n=>{let{opts:f,url:g}=await c(n);return ze({...f,body:f.body,headers:f.headers,method:h,onRequest:t(async(R,x)=>{let C=new Request(R,x);for(let I of l.request.fns)I&&(C=await I(C,f));return C},"onRequest"),serializedBody:N(f),url:g})},"makeSseFn");return{buildUrl:v,connect:a("CONNECT"),delete:a("DELETE"),get:a("GET"),getConfig:o,head:a("HEAD"),interceptors:l,options:a("OPTIONS"),patch:a("PATCH"),post:a("POST"),put:a("PUT"),request:d,setConfig:s,sse:{connect:p("CONNECT"),delete:p("DELETE"),get:p("GET"),head:p("HEAD"),options:p("OPTIONS"),patch:p("PATCH"),post:p("POST"),put:p("PUT"),trace:p("TRACE")},trace:a("TRACE")}},"createClient");var i=A(T({baseUrl:"https://swish.app/api/2026-04"}));var M=t(e=>((e==null?void 0:e.client)??i).get({security:[{scheme:"bearer",type:"http"}],url:"/lists",...e}),"listControllerFind"),G=t(e=>(e.client??i).post({security:[{scheme:"bearer",type:"http"}],url:"/lists",...e,headers:{"Content-Type":"application/json",...e.headers}}),"listControllerCreate"),$=t(e=>(e.client??i).delete({security:[{scheme:"bearer",type:"http"}],url:"/lists/{listId}",...e}),"listControllerDeleteById"),H=t(e=>(e.client??i).get({security:[{scheme:"bearer",type:"http"}],url:"/lists/{listId}",...e}),"listControllerFindById"),V=t(e=>(e.client??i).patch({security:[{scheme:"bearer",type:"http"}],url:"/lists/{listId}",...e,headers:{"Content-Type":"application/json",...e.headers}}),"listControllerUpdateById"),Q=t(e=>(e.client??i).put({security:[{scheme:"bearer",type:"http"}],url:"/lists/{listId}/items/order",...e,headers:{"Content-Type":"application/json",...e.headers}}),"listControllerSetListItemsOrder"),W=t(e=>(e.client??i).post({security:[{scheme:"bearer",type:"http"}],url:"/lists/{listId}/items",...e,headers:{"Content-Type":"application/json",...e.headers}}),"listControllerAddItemsToList"),J=t(e=>(e.client??i).delete({security:[{scheme:"bearer",type:"http"}],url:"/lists/{listId}/items/{itemId}",...e}),"listControllerRemoveItemFromList"),K=t(e=>(e.client??i).delete({security:[{scheme:"bearer",type:"http"}],url:"/items",...e,headers:{"Content-Type":"application/json",...e.headers}}),"itemControllerDelete"),_=t(e=>((e==null?void 0:e.client)??i).get({security:[{scheme:"bearer",type:"http"}],url:"/items",...e}),"itemControllerFind"),X=t(e=>(e.client??i).post({security:[{scheme:"bearer",type:"http"}],url:"/items",...e,headers:{"Content-Type":"application/json",...e.headers}}),"itemControllerCreate"),Y=t(e=>((e==null?void 0:e.client)??i).get({security:[{scheme:"bearer",type:"http"}],url:"/items/count",...e}),"itemControllerCount"),Z=t(e=>(e.client??i).delete({security:[{scheme:"bearer",type:"http"}],url:"/items/{itemId}",...e}),"itemControllerDeleteById"),ee=t(e=>(e.client??i).get({security:[{scheme:"bearer",type:"http"}],url:"/items/{itemId}",...e}),"itemControllerFindById"),re=t(e=>(e.client??i).patch({security:[{scheme:"bearer",type:"http"}],url:"/items/{itemId}",...e,headers:{"Content-Type":"application/json",...e.headers}}),"itemControllerUpdateById"),te=t(e=>(e.client??i).put({security:[{scheme:"bearer",type:"http"}],url:"/items/{itemId}/lists",...e,headers:{"Content-Type":"application/json",...e.headers}}),"itemControllerSetListsById"),oe=t(e=>(e.client??i).post({security:[{scheme:"bearer",type:"http"}],url:"/profiles/identify",...e,headers:{"Content-Type":"application/json",...e.headers}}),"profileControllerIdentify"),se=t(e=>(e.client??i).post({security:[{scheme:"bearer",type:"http"}],url:"/profiles/token",...e,headers:{"Content-Type":"application/json",...e.headers}}),"profileControllerCreateToken"),ne=t(e=>((e==null?void 0:e.client)??i).get({security:[{scheme:"bearer",type:"http"}],url:"/profiles",...e}),"profileControllerGetProfile"),le=t(e=>(e.client??i).patch({security:[{scheme:"bearer",type:"http"}],url:"/profiles/profile",...e,headers:{"Content-Type":"application/json",...e.headers}}),"profileControllerUpdateProfile"),ie=t(e=>(e.client??i).get({security:[{scheme:"bearer",type:"http"}],url:"/analytics/saved-items",...e}),"analyticsControllerLoadSavedItems"),ae=t(e=>(e.client??i).get({security:[{scheme:"bearer",type:"http"}],url:"/analytics/sessions",...e}),"analyticsControllerLoadSessions"),de=t(e=>(e.client??i).get({security:[{scheme:"bearer",type:"http"}],url:"/analytics/new-lists",...e}),"analyticsControllerLoadNewLists"),pe=t(e=>(e.client??i).post({security:[{scheme:"bearer",type:"http"}],url:"/collect",...e,headers:{"Content-Type":"application/json",...e.headers}}),"trackingControllerCollect"),ce=t(e=>((e==null?void 0:e.client)??i).get({security:[{scheme:"bearer",type:"http"}],url:"/orders",...e}),"ordersControllerFind"),Ce=t(e=>(e.client??i).get({security:[{scheme:"bearer",type:"http"}],url:"/orders/{orderId}",...e}),"ordersControllerFindOne"),he=t(e=>((e==null?void 0:e.client)??i).get({security:[{scheme:"bearer",type:"http"}],url:"/shared-lists",...e}),"sharedListsControllerFindAll"),ye=t(e=>(e.client??i).post({security:[{scheme:"bearer",type:"http"}],url:"/shared-lists",...e,headers:{"Content-Type":"application/json",...e.headers}}),"sharedListsControllerSave"),ue=t(e=>(e.client??i).delete({security:[{scheme:"bearer",type:"http"}],url:"/shared-lists/{sharedListId}",...e}),"sharedListsControllerDeleteById"),fe=t(e=>(e.client??i).get({security:[{scheme:"bearer",type:"http"}],url:"/shared-lists/{sharedListId}",...e}),"sharedListsControllerFindById"),me=t(e=>(e.client??i).get({security:[{scheme:"bearer",type:"http"}],url:"/shared-lists/{sharedListId}/items",...e}),"sharedListsControllerFindItems"),Ie=t(e=>((e==null?void 0:e.client)??i).get({security:[{scheme:"bearer",type:"http"}],url:"/notifications",...e}),"notificationsControllerFind"),Re=t(e=>((e==null?void 0:e.client)??i).get({security:[{scheme:"bearer",type:"http"}],url:"/notifications/unread/count",...e}),"notificationsControllerGetUnreadCount"),Se=t(e=>(e.client??i).post({security:[{scheme:"bearer",type:"http"}],url:"/notifications/read",...e,headers:{"Content-Type":"application/json",...e.headers}}),"notificationsControllerMarkAsRead"),Ee=t(e=>((e==null?void 0:e.client)??i).post({security:[{scheme:"bearer",type:"http"}],url:"/notifications/read/all",...e}),"notificationsControllerMarkAllAsRead"),Oe=t(e=>(e.client??i).delete({security:[{scheme:"bearer",type:"http"}],url:"/notifications/{id}",...e}),"notificationsControllerDeleteById"),Le=t(e=>((e==null?void 0:e.client)??i).get({security:[{scheme:"bearer",type:"http"}],url:"/subscriptions",...e}),"subscriptionsControllerFind"),be=t(e=>(e.client??i).post({security:[{scheme:"bearer",type:"http"}],url:"/subscriptions",...e,headers:{"Content-Type":"application/json",...e.headers}}),"subscriptionsControllerCreate"),Te=t(e=>(e.client??i).delete({security:[{scheme:"bearer",type:"http"}],url:"/subscriptions/{id}",...e}),"subscriptionsControllerDelete"),De=t(e=>(e.client??i).get({security:[{scheme:"bearer",type:"http"}],url:"/subscriptions/{id}",...e}),"subscriptionsControllerFindById"),ge=t(e=>(e.client??i).patch({security:[{scheme:"bearer",type:"http"}],url:"/subscriptions/{id}",...e,headers:{"Content-Type":"application/json",...e.headers}}),"subscriptionsControllerUpdate"),we=t(e=>((e==null?void 0:e.client)??i).get({security:[{scheme:"bearer",type:"http"}],url:"/smart-lists",...e}),"smartListsControllerFindAll"),Fe=t(e=>(e.client??i).get({security:[{scheme:"bearer",type:"http"}],url:"/smart-lists/{smartListId}",...e}),"smartListsControllerFindById"),Be=t(e=>(e.client??i).get({security:[{scheme:"bearer",type:"http"}],url:"/smart-lists/{smartListId}/items",...e}),"smartListsControllerFindItems");var ir="2026-04",Gr=t(e=>new Ae(e),"createApiClient"),xe=class xe{constructor(r){this.version=ir;this.items={list:t(r=>this.handlePaginatedRequest(_({query:r,client:this.client})),"list"),create:t(r=>this.handleRequest(X({body:r,client:this.client})),"create"),delete:t(r=>this.handleRequest(K({body:{itemIds:r},client:this.client})),"delete"),findById:t(r=>this.handleRequest(ee({path:{itemId:r},client:this.client})),"findById"),updateById:t((r,o)=>this.handleRequest(re({body:o,path:{itemId:r},client:this.client})),"updateById"),deleteById:t(r=>this.handleRequest(Z({path:{itemId:r},client:this.client})),"deleteById"),setListsById:t((r,o)=>this.handleRequest(te({body:{listIds:o},path:{itemId:r},client:this.client})),"setListsById"),count:t(()=>this.handleRequest(Y({client:this.client})),"count")};this.lists={list:t(r=>this.handlePaginatedRequest(M({query:r,client:this.client})),"list"),create:t(r=>this.handleRequest(G({body:r,client:this.client})),"create"),findById:t(r=>this.handleRequest(H({path:{listId:r},client:this.client})),"findById"),updateById:t((r,o)=>this.handleRequest(V({body:o,path:{listId:r},client:this.client})),"updateById"),deleteById:t(r=>this.handleRequest($({path:{listId:r},client:this.client})),"deleteById"),orderItems:t((r,o)=>this.handleRequest(Q({body:{itemIds:o},path:{listId:r},client:this.client})),"orderItems"),addItemsToList:t((r,o)=>this.handleRequest(W({body:{itemIds:o},path:{listId:r},client:this.client})),"addItemsToList"),removeItemFromList:t((r,o)=>this.handleRequest(J({path:{listId:r,itemId:o},client:this.client})),"removeItemFromList")};this.profiles={createToken:t((r={})=>this.handleRequest(se({body:r,client:this.client})),"createToken"),identify:t(r=>this.handleRequest(oe({body:r,client:this.client})),"identify"),getProfile:t(()=>this.handleRequest(ne({client:this.client})),"getProfile"),updateProfile:t(r=>this.handleRequest(le({body:r,client:this.client})),"updateProfile")};this.orders={list:t(r=>this.handlePaginatedRequest(ce({query:r,client:this.client})),"list"),findById:t(r=>this.handleRequest(Ce({path:{orderId:r},client:this.client})),"findById")};this.sharedLists={list:t(r=>this.handlePaginatedRequest(he({query:r,client:this.client})),"list"),save:t(r=>this.handleRequest(ye({body:{listId:r},client:this.client})),"save"),findById:t(r=>this.handleRequest(fe({path:{sharedListId:r},client:this.client})),"findById"),deleteById:t(r=>this.handleRequest(ue({path:{sharedListId:r},client:this.client})),"deleteById"),findItems:t((r,o)=>this.handlePaginatedRequest(me({path:{sharedListId:r},query:o,client:this.client})),"findItems")};this.analytics={savedItems:t(r=>this.handleRequest(ie({query:r,client:this.client})),"savedItems"),sessions:t(r=>this.handleRequest(ae({query:r,client:this.client})),"sessions"),newLists:t(r=>this.handleRequest(de({query:r,client:this.client})),"newLists")};this.tracking={track:t(r=>this.handleRequest(pe({body:r,client:this.client})),"track")};this.notifications={list:t(r=>this.handlePaginatedRequest(Ie({query:r,client:this.client})),"list"),getUnreadCount:t(()=>this.handleRequest(Re({client:this.client})),"getUnreadCount"),markAsRead:t(r=>this.handleRequest(Se({body:{notificationIds:r},client:this.client})),"markAsRead"),markAllAsRead:t(()=>this.handleRequest(Ee({client:this.client})),"markAllAsRead"),deleteById:t(r=>this.handleRequest(Oe({path:{id:r},client:this.client})),"deleteById")};this.subscriptions={list:t(r=>this.handlePaginatedRequest(Le({query:r,client:this.client})),"list"),create:t(r=>this.handleRequest(be({body:r,client:this.client})),"create"),findById:t(r=>this.handleRequest(De({path:{id:r},client:this.client})),"findById"),updateById:t((r,o)=>this.handleRequest(ge({body:o,path:{id:r},client:this.client})),"updateById"),deleteById:t(r=>this.handleRequest(Te({path:{id:r},client:this.client})),"deleteById")};this.smartLists={list:t(()=>this.handleRequest(we({client:this.client})),"list"),findById:t(r=>this.handleRequest(Fe({path:{smartListId:r},client:this.client})),"findById"),findItems:t((r,o)=>this.handlePaginatedRequest(Be({path:{smartListId:r},query:o,client:this.client})),"findItems")};this.handleRequest=t(async r=>{let{data:o,error:s}=await r;return s!=null&&s.error?{error:s.error}:{data:o==null?void 0:o.data}},"handleRequest");this.handlePaginatedRequest=t(async r=>{var l;let{data:o,error:s}=await r;return s!=null&&s.error?{error:s.error}:{data:(o==null?void 0:o.data)??[],pageInfo:(o==null?void 0:o.pageInfo)??{next:null,previous:null,totalCount:((l=o==null?void 0:o.data)==null?void 0:l.length)??0}}},"handlePaginatedRequest");this.client=A(T({baseUrl:`https://swish.app/api/${this.version}`,...r.config})),r.authToken&&(this.authToken=r.authToken),r.requestInterceptor&&this.client.interceptors.request.use(r.requestInterceptor),r.responseInterceptor&&this.client.interceptors.response.use(r.responseInterceptor),this.client.interceptors.request.use(this.directRequestInterceptor.bind(this))}setAuthToken(r){this.authToken=r}directRequestInterceptor(r){return this.authToken&&r.headers.set("Authorization",`Bearer ${this.authToken}`),r}};t(xe,"SwishClient");var Ae=xe;export{ir as apiVersion,Gr as createApiClient};
@@ -0,0 +1,2 @@
1
+ import type { Client, Config } from './types.gen';
2
+ export declare const createClient: (config?: Config) => Client;
@@ -0,0 +1,8 @@
1
+ export type { Auth } from '../core/auth.gen';
2
+ export type { QuerySerializerOptions } from '../core/bodySerializer.gen';
3
+ export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer, } from '../core/bodySerializer.gen';
4
+ export { buildClientParams } from '../core/params.gen';
5
+ export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen';
6
+ export { createClient } from './client.gen';
7
+ export type { Client, ClientOptions, Config, CreateClientConfig, Options, RequestOptions, RequestResult, ResolvedRequestOptions, ResponseStyle, TDataShape, } from './types.gen';
8
+ export { createConfig, mergeHeaders } from './utils.gen';
@@ -0,0 +1,117 @@
1
+ import type { Auth } from '../core/auth.gen';
2
+ import type { ServerSentEventsOptions, ServerSentEventsResult } from '../core/serverSentEvents.gen';
3
+ import type { Client as CoreClient, Config as CoreConfig } from '../core/types.gen';
4
+ import type { Middleware } from './utils.gen';
5
+ export type ResponseStyle = 'data' | 'fields';
6
+ export interface Config<T extends ClientOptions = ClientOptions> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, CoreConfig {
7
+ /**
8
+ * Base URL for all requests made by this client.
9
+ */
10
+ baseUrl?: T['baseUrl'];
11
+ /**
12
+ * Fetch API implementation. You can use this option to provide a custom
13
+ * fetch instance.
14
+ *
15
+ * @default globalThis.fetch
16
+ */
17
+ fetch?: typeof fetch;
18
+ /**
19
+ * Please don't use the Fetch client for Next.js applications. The `next`
20
+ * options won't have any effect.
21
+ *
22
+ * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
23
+ */
24
+ next?: never;
25
+ /**
26
+ * Return the response data parsed in a specified format. By default, `auto`
27
+ * will infer the appropriate method from the `Content-Type` response header.
28
+ * You can override this behavior with any of the {@link Body} methods.
29
+ * Select `stream` if you don't want to parse response data at all.
30
+ *
31
+ * @default 'auto'
32
+ */
33
+ parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
34
+ /**
35
+ * Should we return only data or multiple fields (data, error, response, etc.)?
36
+ *
37
+ * @default 'fields'
38
+ */
39
+ responseStyle?: ResponseStyle;
40
+ /**
41
+ * Throw an error instead of returning it in the response?
42
+ *
43
+ * @default false
44
+ */
45
+ throwOnError?: T['throwOnError'];
46
+ }
47
+ export interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
48
+ responseStyle: TResponseStyle;
49
+ throwOnError: ThrowOnError;
50
+ }>, Pick<ServerSentEventsOptions<TData>, 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
51
+ /**
52
+ * Any body that you want to add to your request.
53
+ *
54
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
55
+ */
56
+ body?: unknown;
57
+ path?: Record<string, unknown>;
58
+ query?: Record<string, unknown>;
59
+ /**
60
+ * Security mechanism(s) to use for the request.
61
+ */
62
+ security?: ReadonlyArray<Auth>;
63
+ url: Url;
64
+ }
65
+ export interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
66
+ serializedBody?: string;
67
+ }
68
+ export type RequestResult<TData = unknown, TError = unknown, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle = 'fields'> = ThrowOnError extends true ? Promise<TResponseStyle extends 'data' ? TData extends Record<string, unknown> ? TData[keyof TData] : TData : {
69
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
70
+ request: Request;
71
+ response: Response;
72
+ }> : Promise<TResponseStyle extends 'data' ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
73
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
74
+ error: undefined;
75
+ } | {
76
+ data: undefined;
77
+ error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
78
+ }) & {
79
+ request: Request;
80
+ response: Response;
81
+ }>;
82
+ export interface ClientOptions {
83
+ baseUrl?: string;
84
+ responseStyle?: ResponseStyle;
85
+ throwOnError?: boolean;
86
+ }
87
+ type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
88
+ type SseFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData, TError>>;
89
+ type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> & Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
90
+ type BuildUrlFn = <TData extends {
91
+ body?: unknown;
92
+ path?: Record<string, unknown>;
93
+ query?: Record<string, unknown>;
94
+ url: string;
95
+ }>(options: TData & Options<TData>) => string;
96
+ export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
97
+ interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
98
+ };
99
+ /**
100
+ * The `createClientConfig()` function will be called on client initialization
101
+ * and the returned object will become the client's initial configuration.
102
+ *
103
+ * You may want to initialize your client this way instead of calling
104
+ * `setConfig()`. This is useful for example if you're using Next.js
105
+ * to ensure your client always has the correct values.
106
+ */
107
+ export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
108
+ export interface TDataShape {
109
+ body?: unknown;
110
+ headers?: unknown;
111
+ path?: unknown;
112
+ query?: unknown;
113
+ url: string;
114
+ }
115
+ type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
116
+ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown, TResponseStyle extends ResponseStyle = 'fields'> = OmitKeys<RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & ([TData] extends [never] ? unknown : Omit<TData, 'url'>);
117
+ export {};
@@ -0,0 +1,33 @@
1
+ import type { QuerySerializerOptions } from '../core/bodySerializer.gen';
2
+ import type { Client, ClientOptions, Config, RequestOptions } from './types.gen';
3
+ export declare const createQuerySerializer: <T = unknown>({ parameters, ...args }?: QuerySerializerOptions) => (queryParams: T) => string;
4
+ /**
5
+ * Infers parseAs value from provided Content-Type header.
6
+ */
7
+ export declare const getParseAs: (contentType: string | null) => Exclude<Config["parseAs"], "auto">;
8
+ export declare const setAuthParams: ({ security, ...options }: Pick<Required<RequestOptions>, "security"> & Pick<RequestOptions, "auth" | "query"> & {
9
+ headers: Headers;
10
+ }) => Promise<void>;
11
+ export declare const buildUrl: Client['buildUrl'];
12
+ export declare const mergeConfigs: (a: Config, b: Config) => Config;
13
+ export declare const mergeHeaders: (...headers: Array<Required<Config>["headers"] | undefined>) => Headers;
14
+ type ErrInterceptor<Err, Res, Req, Options> = (error: Err, response: Res, request: Req, options: Options) => Err | Promise<Err>;
15
+ type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
16
+ type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
17
+ declare class Interceptors<Interceptor> {
18
+ fns: Array<Interceptor | null>;
19
+ clear(): void;
20
+ eject(id: number | Interceptor): void;
21
+ exists(id: number | Interceptor): boolean;
22
+ getInterceptorIndex(id: number | Interceptor): number;
23
+ update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
24
+ use(fn: Interceptor): number;
25
+ }
26
+ export interface Middleware<Req, Res, Err, Options> {
27
+ error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;
28
+ request: Interceptors<ReqInterceptor<Req, Options>>;
29
+ response: Interceptors<ResInterceptor<Res, Req, Options>>;
30
+ }
31
+ export declare const createInterceptors: <Req, Res, Err, Options>() => Middleware<Req, Res, Err, Options>;
32
+ export declare const createConfig: <T extends ClientOptions = ClientOptions>(override?: Config<Omit<ClientOptions, keyof T> & T>) => Config<Omit<ClientOptions, keyof T> & T>;
33
+ export {};
@@ -0,0 +1,12 @@
1
+ import { type ClientOptions, type Config } from './client';
2
+ import type { ClientOptions as ClientOptions2 } from './types.gen';
3
+ /**
4
+ * The `createClientConfig()` function will be called on client initialization
5
+ * and the returned object will become the client's initial configuration.
6
+ *
7
+ * You may want to initialize your client this way instead of calling
8
+ * `setConfig()`. This is useful for example if you're using Next.js
9
+ * to ensure your client always has the correct values.
10
+ */
11
+ export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
12
+ export declare const client: import("./client").Client;
@@ -0,0 +1,18 @@
1
+ export type AuthToken = string | undefined;
2
+ export interface Auth {
3
+ /**
4
+ * Which part of the request do we use to send the auth?
5
+ *
6
+ * @default 'header'
7
+ */
8
+ in?: 'header' | 'query' | 'cookie';
9
+ /**
10
+ * Header or query parameter name.
11
+ *
12
+ * @default 'Authorization'
13
+ */
14
+ name?: string;
15
+ scheme?: 'basic' | 'bearer';
16
+ type: 'apiKey' | 'http';
17
+ }
18
+ export declare const getAuthToken: (auth: Auth, callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken) => Promise<string | undefined>;
@@ -0,0 +1,25 @@
1
+ import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerializer.gen';
2
+ export type QuerySerializer = (query: Record<string, unknown>) => string;
3
+ export type BodySerializer = (body: any) => any;
4
+ type QuerySerializerOptionsObject = {
5
+ allowReserved?: boolean;
6
+ array?: Partial<SerializerOptions<ArrayStyle>>;
7
+ object?: Partial<SerializerOptions<ObjectStyle>>;
8
+ };
9
+ export type QuerySerializerOptions = QuerySerializerOptionsObject & {
10
+ /**
11
+ * Per-parameter serialization overrides. When provided, these settings
12
+ * override the global array/object settings for specific parameter names.
13
+ */
14
+ parameters?: Record<string, QuerySerializerOptionsObject>;
15
+ };
16
+ export declare const formDataBodySerializer: {
17
+ bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T) => FormData;
18
+ };
19
+ export declare const jsonBodySerializer: {
20
+ bodySerializer: <T>(body: T) => string;
21
+ };
22
+ export declare const urlSearchParamsBodySerializer: {
23
+ bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T) => string;
24
+ };
25
+ export {};
@@ -0,0 +1,43 @@
1
+ type Slot = 'body' | 'headers' | 'path' | 'query';
2
+ export type Field = {
3
+ in: Exclude<Slot, 'body'>;
4
+ /**
5
+ * Field name. This is the name we want the user to see and use.
6
+ */
7
+ key: string;
8
+ /**
9
+ * Field mapped name. This is the name we want to use in the request.
10
+ * If omitted, we use the same value as `key`.
11
+ */
12
+ map?: string;
13
+ } | {
14
+ in: Extract<Slot, 'body'>;
15
+ /**
16
+ * Key isn't required for bodies.
17
+ */
18
+ key?: string;
19
+ map?: string;
20
+ } | {
21
+ /**
22
+ * Field name. This is the name we want the user to see and use.
23
+ */
24
+ key: string;
25
+ /**
26
+ * Field mapped name. This is the name we want to use in the request.
27
+ * If `in` is omitted, `map` aliases `key` to the transport layer.
28
+ */
29
+ map: Slot;
30
+ };
31
+ export interface Fields {
32
+ allowExtra?: Partial<Record<Slot, boolean>>;
33
+ args?: ReadonlyArray<Field>;
34
+ }
35
+ export type FieldsConfig = ReadonlyArray<Field | Fields>;
36
+ interface Params {
37
+ body: unknown;
38
+ headers: Record<string, unknown>;
39
+ path: Record<string, unknown>;
40
+ query: Record<string, unknown>;
41
+ }
42
+ export declare const buildClientParams: (args: ReadonlyArray<unknown>, fields: FieldsConfig) => Params;
43
+ export {};
@@ -0,0 +1,33 @@
1
+ interface SerializeOptions<T> extends SerializePrimitiveOptions, SerializerOptions<T> {
2
+ }
3
+ interface SerializePrimitiveOptions {
4
+ allowReserved?: boolean;
5
+ name: string;
6
+ }
7
+ export interface SerializerOptions<T> {
8
+ /**
9
+ * @default true
10
+ */
11
+ explode: boolean;
12
+ style: T;
13
+ }
14
+ export type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';
15
+ export type ArraySeparatorStyle = ArrayStyle | MatrixStyle;
16
+ type MatrixStyle = 'label' | 'matrix' | 'simple';
17
+ export type ObjectStyle = 'form' | 'deepObject';
18
+ type ObjectSeparatorStyle = ObjectStyle | MatrixStyle;
19
+ interface SerializePrimitiveParam extends SerializePrimitiveOptions {
20
+ value: string;
21
+ }
22
+ export declare const separatorArrayExplode: (style: ArraySeparatorStyle) => "." | ";" | "," | "&";
23
+ export declare const separatorArrayNoExplode: (style: ArraySeparatorStyle) => "," | "|" | "%20";
24
+ export declare const separatorObjectExplode: (style: ObjectSeparatorStyle) => "." | ";" | "," | "&";
25
+ export declare const serializeArrayParam: ({ allowReserved, explode, name, style, value, }: SerializeOptions<ArraySeparatorStyle> & {
26
+ value: unknown[];
27
+ }) => string;
28
+ export declare const serializePrimitiveParam: ({ allowReserved, name, value, }: SerializePrimitiveParam) => string;
29
+ export declare const serializeObjectParam: ({ allowReserved, explode, name, style, value, valueOnly, }: SerializeOptions<ObjectSeparatorStyle> & {
30
+ value: Record<string, unknown> | Date;
31
+ valueOnly?: boolean;
32
+ }) => string;
33
+ export {};
@@ -0,0 +1,18 @@
1
+ /**
2
+ * JSON-friendly union that mirrors what Pinia Colada can hash.
3
+ */
4
+ export type JsonValue = null | string | number | boolean | JsonValue[] | {
5
+ [key: string]: JsonValue;
6
+ };
7
+ /**
8
+ * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes.
9
+ */
10
+ export declare const queryKeyJsonReplacer: (_key: string, value: unknown) => {} | null | undefined;
11
+ /**
12
+ * Safely stringifies a value and parses it back into a JsonValue.
13
+ */
14
+ export declare const stringifyToJsonValue: (input: unknown) => JsonValue | undefined;
15
+ /**
16
+ * Normalizes any accepted value into a JSON-friendly shape for query keys.
17
+ */
18
+ export declare const serializeQueryKeyValue: (value: unknown) => JsonValue | undefined;
@@ -0,0 +1,71 @@
1
+ import type { Config } from './types.gen';
2
+ export type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, 'method'> & Pick<Config, 'method' | 'responseTransformer' | 'responseValidator'> & {
3
+ /**
4
+ * Fetch API implementation. You can use this option to provide a custom
5
+ * fetch instance.
6
+ *
7
+ * @default globalThis.fetch
8
+ */
9
+ fetch?: typeof fetch;
10
+ /**
11
+ * Implementing clients can call request interceptors inside this hook.
12
+ */
13
+ onRequest?: (url: string, init: RequestInit) => Promise<Request>;
14
+ /**
15
+ * Callback invoked when a network or parsing error occurs during streaming.
16
+ *
17
+ * This option applies only if the endpoint returns a stream of events.
18
+ *
19
+ * @param error The error that occurred.
20
+ */
21
+ onSseError?: (error: unknown) => void;
22
+ /**
23
+ * Callback invoked when an event is streamed from the server.
24
+ *
25
+ * This option applies only if the endpoint returns a stream of events.
26
+ *
27
+ * @param event Event streamed from the server.
28
+ * @returns Nothing (void).
29
+ */
30
+ onSseEvent?: (event: StreamEvent<TData>) => void;
31
+ serializedBody?: RequestInit['body'];
32
+ /**
33
+ * Default retry delay in milliseconds.
34
+ *
35
+ * This option applies only if the endpoint returns a stream of events.
36
+ *
37
+ * @default 3000
38
+ */
39
+ sseDefaultRetryDelay?: number;
40
+ /**
41
+ * Maximum number of retry attempts before giving up.
42
+ */
43
+ sseMaxRetryAttempts?: number;
44
+ /**
45
+ * Maximum retry delay in milliseconds.
46
+ *
47
+ * Applies only when exponential backoff is used.
48
+ *
49
+ * This option applies only if the endpoint returns a stream of events.
50
+ *
51
+ * @default 30000
52
+ */
53
+ sseMaxRetryDelay?: number;
54
+ /**
55
+ * Optional sleep function for retry backoff.
56
+ *
57
+ * Defaults to using `setTimeout`.
58
+ */
59
+ sseSleepFn?: (ms: number) => Promise<void>;
60
+ url: string;
61
+ };
62
+ export interface StreamEvent<TData = unknown> {
63
+ data: TData;
64
+ event?: string;
65
+ id?: string;
66
+ retry?: number;
67
+ }
68
+ export type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {
69
+ stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
70
+ };
71
+ export declare const createSseClient: <TData = unknown>({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }: ServerSentEventsOptions) => ServerSentEventsResult<TData>;