@@ -16,6 +16,7 @@ import type {
1616 DevupPutApiStructKey ,
1717 DevupPutApiStructScope ,
1818 ExtractValue ,
19+ IsCold ,
1920 Middleware ,
2021 RequiredOptions ,
2122} from '@devup-api/core'
@@ -59,8 +60,16 @@ export class DevupApi<S extends ConditionalKeys<DevupApiServers>> {
5960 > (
6061 path : T ,
6162 ...options : [ RequiredOptions < O > ] extends [ never ]
62- ? [ options ?: DevupApiRequestInit ]
63- : [ options : DevupApiRequestInit & Omit < O , 'response' | 'error' > ]
63+ ? [
64+ options ?: IsCold extends true
65+ ? DevupApiRequestInit
66+ : Omit < DevupApiRequestInit , 'params' > &
67+ Omit < O , 'response' | 'error' > ,
68+ ]
69+ : [
70+ options : Omit < DevupApiRequestInit , 'params' > &
71+ Omit < O , 'response' | 'error' > ,
72+ ]
6473 ) : Promise <
6574 DevupApiResponse < ExtractValue < O , 'response' > , ExtractValue < O , 'error' > >
6675 > {
@@ -76,8 +85,16 @@ export class DevupApi<S extends ConditionalKeys<DevupApiServers>> {
7685 > (
7786 path : T ,
7887 ...options : [ RequiredOptions < O > ] extends [ never ]
79- ? [ options ?: DevupApiRequestInit ]
80- : [ options : DevupApiRequestInit & Omit < O , 'response' | 'error' > ]
88+ ? [
89+ options ?: IsCold extends true
90+ ? DevupApiRequestInit
91+ : Omit < DevupApiRequestInit , 'params' > &
92+ Omit < O , 'response' | 'error' > ,
93+ ]
94+ : [
95+ options : Omit < DevupApiRequestInit , 'params' > &
96+ Omit < O , 'response' | 'error' > ,
97+ ]
8198 ) : Promise <
8299 DevupApiResponse < ExtractValue < O , 'response' > , ExtractValue < O , 'error' > >
83100 > {
@@ -93,8 +110,16 @@ export class DevupApi<S extends ConditionalKeys<DevupApiServers>> {
93110 > (
94111 path : T ,
95112 ...options : [ RequiredOptions < O > ] extends [ never ]
96- ? [ options ?: DevupApiRequestInit ]
97- : [ options : DevupApiRequestInit & Omit < O , 'response' | 'error' > ]
113+ ? [
114+ options ?: IsCold extends true
115+ ? DevupApiRequestInit
116+ : Omit < DevupApiRequestInit , 'params' > &
117+ Omit < O , 'response' | 'error' > ,
118+ ]
119+ : [
120+ options : Omit < DevupApiRequestInit , 'params' > &
121+ Omit < O , 'response' | 'error' > ,
122+ ]
98123 ) : Promise <
99124 DevupApiResponse < ExtractValue < O , 'response' > , ExtractValue < O , 'error' > >
100125 > {
@@ -110,8 +135,16 @@ export class DevupApi<S extends ConditionalKeys<DevupApiServers>> {
110135 > (
111136 path : T ,
112137 ...options : [ RequiredOptions < O > ] extends [ never ]
113- ? [ options ?: DevupApiRequestInit ]
114- : [ options : DevupApiRequestInit & Omit < O , 'response' | 'error' > ]
138+ ? [
139+ options ?: IsCold extends true
140+ ? DevupApiRequestInit
141+ : Omit < DevupApiRequestInit , 'params' > &
142+ Omit < O , 'response' | 'error' > ,
143+ ]
144+ : [
145+ options : Omit < DevupApiRequestInit , 'params' > &
146+ Omit < O , 'response' | 'error' > ,
147+ ]
115148 ) : Promise <
116149 DevupApiResponse < ExtractValue < O , 'response' > , ExtractValue < O , 'error' > >
117150 > {
@@ -127,8 +160,16 @@ export class DevupApi<S extends ConditionalKeys<DevupApiServers>> {
127160 > (
128161 path : T ,
129162 ...options : [ RequiredOptions < O > ] extends [ never ]
130- ? [ options ?: DevupApiRequestInit ]
131- : [ options : DevupApiRequestInit & Omit < O , 'response' | 'error' > ]
163+ ? [
164+ options ?: IsCold extends true
165+ ? DevupApiRequestInit
166+ : Omit < DevupApiRequestInit , 'params' > &
167+ Omit < O , 'response' | 'error' > ,
168+ ]
169+ : [
170+ options : Omit < DevupApiRequestInit , 'params' > &
171+ Omit < O , 'response' | 'error' > ,
172+ ]
132173 ) : Promise <
133174 DevupApiResponse < ExtractValue < O , 'response' > , ExtractValue < O , 'error' > >
134175 > {
@@ -144,8 +185,16 @@ export class DevupApi<S extends ConditionalKeys<DevupApiServers>> {
144185 > (
145186 path : T ,
146187 ...options : [ RequiredOptions < O > ] extends [ never ]
147- ? [ options ?: DevupApiRequestInit ]
148- : [ options : DevupApiRequestInit & Omit < O , 'response' | 'error' > ]
188+ ? [
189+ options ?: IsCold extends true
190+ ? DevupApiRequestInit
191+ : Omit < DevupApiRequestInit , 'params' > &
192+ Omit < O , 'response' | 'error' > ,
193+ ]
194+ : [
195+ options : Omit < DevupApiRequestInit , 'params' > &
196+ Omit < O , 'response' | 'error' > ,
197+ ]
149198 ) : Promise <
150199 DevupApiResponse < ExtractValue < O , 'response' > , ExtractValue < O , 'error' > >
151200 > {
@@ -161,8 +210,16 @@ export class DevupApi<S extends ConditionalKeys<DevupApiServers>> {
161210 > (
162211 path : T ,
163212 ...options : [ RequiredOptions < O > ] extends [ never ]
164- ? [ options ?: DevupApiRequestInit ]
165- : [ options : DevupApiRequestInit & Omit < O , 'response' | 'error' > ]
213+ ? [
214+ options ?: IsCold extends true
215+ ? DevupApiRequestInit
216+ : Omit < DevupApiRequestInit , 'params' > &
217+ Omit < O , 'response' | 'error' > ,
218+ ]
219+ : [
220+ options : Omit < DevupApiRequestInit , 'params' > &
221+ Omit < O , 'response' | 'error' > ,
222+ ]
166223 ) : Promise <
167224 DevupApiResponse < ExtractValue < O , 'response' > , ExtractValue < O , 'error' > >
168225 > {
@@ -178,8 +235,16 @@ export class DevupApi<S extends ConditionalKeys<DevupApiServers>> {
178235 > (
179236 path : T ,
180237 ...options : [ RequiredOptions < O > ] extends [ never ]
181- ? [ options ?: DevupApiRequestInit ]
182- : [ options : DevupApiRequestInit & Omit < O , 'response' | 'error' > ]
238+ ? [
239+ options ?: IsCold extends true
240+ ? DevupApiRequestInit
241+ : Omit < DevupApiRequestInit , 'params' > &
242+ Omit < O , 'response' | 'error' > ,
243+ ]
244+ : [
245+ options : Omit < DevupApiRequestInit , 'params' > &
246+ Omit < O , 'response' | 'error' > ,
247+ ]
183248 ) : Promise <
184249 DevupApiResponse < ExtractValue < O , 'response' > , ExtractValue < O , 'error' > >
185250 > {
@@ -195,8 +260,16 @@ export class DevupApi<S extends ConditionalKeys<DevupApiServers>> {
195260 > (
196261 path : T ,
197262 ...options : [ RequiredOptions < O > ] extends [ never ]
198- ? [ options ?: DevupApiRequestInit ]
199- : [ options : DevupApiRequestInit & Omit < O , 'response' | 'error' > ]
263+ ? [
264+ options ?: IsCold extends true
265+ ? DevupApiRequestInit
266+ : Omit < DevupApiRequestInit , 'params' > &
267+ Omit < O , 'response' | 'error' > ,
268+ ]
269+ : [
270+ options : Omit < DevupApiRequestInit , 'params' > &
271+ Omit < O , 'response' | 'error' > ,
272+ ]
200273 ) : Promise <
201274 DevupApiResponse < ExtractValue < O , 'response' > , ExtractValue < O , 'error' > >
202275 > {
@@ -212,8 +285,16 @@ export class DevupApi<S extends ConditionalKeys<DevupApiServers>> {
212285 > (
213286 path : T ,
214287 ...options : [ RequiredOptions < O > ] extends [ never ]
215- ? [ options ?: DevupApiRequestInit ]
216- : [ options : DevupApiRequestInit & Omit < O , 'response' | 'error' > ]
288+ ? [
289+ options ?: IsCold extends true
290+ ? DevupApiRequestInit
291+ : Omit < DevupApiRequestInit , 'params' > &
292+ Omit < O , 'response' | 'error' > ,
293+ ]
294+ : [
295+ options : Omit < DevupApiRequestInit , 'params' > &
296+ Omit < O , 'response' | 'error' > ,
297+ ]
217298 ) : Promise <
218299 DevupApiResponse < ExtractValue < O , 'response' > , ExtractValue < O , 'error' > >
219300 > {
@@ -229,8 +310,16 @@ export class DevupApi<S extends ConditionalKeys<DevupApiServers>> {
229310 > (
230311 path : T ,
231312 ...options : [ RequiredOptions < O > ] extends [ never ]
232- ? [ options ?: DevupApiRequestInit ]
233- : [ options : DevupApiRequestInit & Omit < O , 'response' | 'error' > ]
313+ ? [
314+ options ?: IsCold extends true
315+ ? DevupApiRequestInit
316+ : Omit < DevupApiRequestInit , 'params' > &
317+ Omit < O , 'response' | 'error' > ,
318+ ]
319+ : [
320+ options : Omit < DevupApiRequestInit , 'params' > &
321+ Omit < O , 'response' | 'error' > ,
322+ ]
234323 ) : Promise <
235324 DevupApiResponse < ExtractValue < O , 'response' > , ExtractValue < O , 'error' > >
236325 > {
@@ -242,7 +331,7 @@ export class DevupApi<S extends ConditionalKeys<DevupApiServers>> {
242331 body,
243332 params,
244333 ...restOptions
245- } = options [ 0 ] || { }
334+ } : DevupApiRequestInit = options [ 0 ] || { }
246335 const mergedHeaders = new Headers ( headers )
247336 const mergedOptions = {
248337 ...this . defaultOptions ,
@@ -354,19 +443,19 @@ export class DevupApi<S extends ConditionalKeys<DevupApiServers>> {
354443 } as DevupApiResponse < ExtractValue < O , 'response' > , ExtractValue < O , 'error' > >
355444 }
356445
357- setDefaultOptions ( options : DevupApiRequestInit ) {
446+ setDefaultOptions ( options : DevupApiRequestInit ) : void {
358447 this . defaultOptions = options
359448 }
360449
361- getBaseUrl ( ) {
450+ getBaseUrl ( ) : string {
362451 return this . baseUrl
363452 }
364453
365- getDefaultOptions ( ) {
454+ getDefaultOptions ( ) : DevupApiRequestInit {
366455 return this . defaultOptions
367456 }
368457
369- use ( ...middleware : Middleware [ ] ) {
458+ use ( ...middleware : Middleware [ ] ) : void {
370459 this . middleware . push ( ...middleware )
371460 }
372461}
0 commit comments