@@ -195,18 +195,21 @@ export class Client {
195
195
return story ;
196
196
}
197
197
198
- async create < Options extends IncludeOptions & { formats ?: Formats } > (
198
+ async create < Options extends IncludeOptions & { formats ?: Formats ; force ?: boolean } > (
199
199
payload : CreateRequest ,
200
- options ?: Exactly < Options , IncludeOptions & { formats ?: Formats } > ,
200
+ options ?: Exactly < Options , IncludeOptions & { formats ?: Formats ; force ?: boolean } > ,
201
201
) : Promise < ExtendedStory & InferExtraFields < Options > > {
202
- const { include, formats } = options ?? { } ;
202
+ const { include, formats, force = false } = options ?? { } ;
203
203
204
204
const { story } = await this . apiClient . post < {
205
205
story : ExtendedStory & InferExtraFields < Options > ;
206
206
} > ( routing . storiesUrl , {
207
207
headers : acceptedFormatsHeader ( formats ) ,
208
+ query : {
209
+ include,
210
+ force : force || undefined ,
211
+ } ,
208
212
payload,
209
- query : { include } ,
210
213
} ) ;
211
214
return story ;
212
215
}
@@ -252,15 +255,15 @@ export class Client {
252
255
return story ;
253
256
}
254
257
255
- async move < Options extends IncludeOptions & { force ?: true ; formats ?: Formats } > (
258
+ async move < Options extends IncludeOptions & { formats ?: Formats ; force ?: boolean } > (
256
259
id : StoryId ,
257
260
payload : MoveRequest ,
258
- options ?: Exactly < Options , IncludeOptions & { force ?: true ; formats ?: Formats } > ,
261
+ options ?: Exactly < Options , IncludeOptions & { formats ?: Formats ; force ?: boolean } > ,
259
262
) : Promise <
260
263
| ChangeNewsroomSuccessResponse < ExtendedStory & InferExtraFields < Options > >
261
264
| ChangeNewsroomUnsafeResponse
262
265
> {
263
- const { include, force , formats } = options ?? { } ;
266
+ const { include, formats , force = false } = options ?? { } ;
264
267
265
268
const url = `${ routing . storiesUrl } /${ id } /move` ;
266
269
@@ -269,7 +272,10 @@ export class Client {
269
272
story : ExtendedStory & InferExtraFields < Options > ;
270
273
} > ( url , {
271
274
headers : acceptedFormatsHeader ( formats ) ,
272
- query : { include : include as string [ ] | undefined , force } ,
275
+ query : {
276
+ include,
277
+ force : force || undefined , // only pass it if it's true
278
+ } ,
273
279
payload,
274
280
} ) ;
275
281
@@ -282,20 +288,23 @@ export class Client {
282
288
}
283
289
}
284
290
285
- async update < Options extends IncludeOptions & { formats ?: Formats } > (
291
+ async update < Options extends IncludeOptions & { formats ?: Formats ; force ?: boolean } > (
286
292
id : StoryId ,
287
293
payload : UpdateRequest ,
288
- options ?: Exactly < Options , IncludeOptions & { formats ?: Formats } > ,
294
+ options ?: Exactly < Options , IncludeOptions & { formats ?: Formats ; force ?: boolean } > ,
289
295
) : Promise < ExtendedStory & InferExtraFields < Options > > {
290
296
const url = `${ routing . storiesUrl } /${ id } ` ;
291
- const { include, formats } = options ?? { } ;
297
+ const { include, formats, force = false } = options ?? { } ;
292
298
293
299
const { story } = await this . apiClient . patch < {
294
300
story : ExtendedStory & InferExtraFields < Options > ;
295
301
} > ( url , {
296
302
headers : acceptedFormatsHeader ( formats ) ,
303
+ query : {
304
+ include,
305
+ force : force || undefined , // only pass it if it's true
306
+ } ,
297
307
payload,
298
- query : { include : include as string [ ] | undefined } ,
299
308
} ) ;
300
309
return story ;
301
310
}
@@ -316,7 +325,7 @@ export class Client {
316
325
} > ( url , {
317
326
headers : acceptedFormatsHeader ( formats ) ,
318
327
payload,
319
- query : { include : include as string [ ] | undefined } ,
328
+ query : { include } ,
320
329
} ) ;
321
330
return story ;
322
331
}
@@ -337,7 +346,7 @@ export class Client {
337
346
} > ( url , {
338
347
headers : acceptedFormatsHeader ( formats ) ,
339
348
payload,
340
- query : { include : include as string [ ] | undefined } ,
349
+ query : { include } ,
341
350
} ) ;
342
351
return story ;
343
352
}
@@ -355,7 +364,7 @@ export class Client {
355
364
} > ( url , {
356
365
headers : acceptedFormatsHeader ( formats ) ,
357
366
payload,
358
- query : { include : include as string [ ] | undefined } ,
367
+ query : { include } ,
359
368
} ) ;
360
369
return story ;
361
370
}
@@ -373,7 +382,7 @@ export class Client {
373
382
} > ( url , {
374
383
headers : acceptedFormatsHeader ( formats ) ,
375
384
payload,
376
- query : { include : include as string [ ] | undefined } ,
385
+ query : { include } ,
377
386
} ) ;
378
387
return story ;
379
388
}
@@ -391,7 +400,7 @@ export class Client {
391
400
} > ( url , {
392
401
headers : acceptedFormatsHeader ( formats ) ,
393
402
payload,
394
- query : { include : include as string [ ] | undefined } ,
403
+ query : { include } ,
395
404
} ) ;
396
405
return story ;
397
406
}
@@ -409,24 +418,24 @@ export class Client {
409
418
} > ( url , {
410
419
headers : acceptedFormatsHeader ( formats ) ,
411
420
payload,
412
- query : { include : include as string [ ] | undefined } ,
421
+ query : { include } ,
413
422
} ) ;
414
423
return story ;
415
424
}
416
425
417
- async pin < Options extends IncludeOptions & { force ?: boolean ; formats ?: Formats } > (
426
+ async pin < Options extends IncludeOptions & { formats ?: Formats ; force ?: boolean } > (
418
427
id : StoryId ,
419
- options ?: Exactly < Options , IncludeOptions & { force ?: boolean ; formats ?: Formats } > ,
428
+ options ?: Exactly < Options , IncludeOptions & { formats ?: Formats ; force ?: boolean } > ,
420
429
) : Promise < ExtendedStory & InferExtraFields < Options > > {
421
430
const url = `${ routing . storiesUrl } /${ id } /pin` ;
422
- const { include, force , formats } = options ?? { } ;
431
+ const { include, formats , force = false } = options ?? { } ;
423
432
424
433
const { story } = await this . apiClient . post < {
425
434
story : ExtendedStory & InferExtraFields < Options > ;
426
435
} > ( url , {
427
436
headers : acceptedFormatsHeader ( formats ) ,
428
437
query : {
429
- include : include as string [ ] | undefined ,
438
+ include : include ,
430
439
force : force || undefined ,
431
440
} ,
432
441
} ) ;
@@ -444,7 +453,7 @@ export class Client {
444
453
story : ExtendedStory & InferExtraFields < Options > ;
445
454
} > ( url , {
446
455
headers : acceptedFormatsHeader ( formats ) ,
447
- query : { include : include as string [ ] | undefined } ,
456
+ query : { include : include } ,
448
457
} ) ;
449
458
return story ;
450
459
}
0 commit comments