@ankinize/sdk 0.0.0-stage → 0.1.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.
Files changed (42) hide show
  1. package/README.md +78 -2
  2. package/dist/batch.d.ts +157 -0
  3. package/dist/batch.js +263 -0
  4. package/dist/gen/client/client.gen.d.ts +2 -0
  5. package/dist/gen/client/client.gen.js +216 -0
  6. package/dist/gen/client/index.d.ts +10 -0
  7. package/dist/gen/client/index.js +6 -0
  8. package/dist/gen/client/types.gen.d.ts +120 -0
  9. package/dist/gen/client/types.gen.js +2 -0
  10. package/dist/gen/client/utils.gen.d.ts +37 -0
  11. package/dist/gen/client/utils.gen.js +228 -0
  12. package/dist/gen/client.gen.d.ts +12 -0
  13. package/dist/gen/client.gen.js +4 -0
  14. package/dist/gen/core/auth.gen.d.ts +25 -0
  15. package/dist/gen/core/auth.gen.js +14 -0
  16. package/dist/gen/core/bodySerializer.gen.d.ts +25 -0
  17. package/dist/gen/core/bodySerializer.gen.js +57 -0
  18. package/dist/gen/core/params.gen.d.ts +43 -0
  19. package/dist/gen/core/params.gen.js +109 -0
  20. package/dist/gen/core/pathSerializer.gen.d.ts +33 -0
  21. package/dist/gen/core/pathSerializer.gen.js +106 -0
  22. package/dist/gen/core/queryKeySerializer.gen.d.ts +18 -0
  23. package/dist/gen/core/queryKeySerializer.gen.js +92 -0
  24. package/dist/gen/core/serverSentEvents.gen.d.ts +71 -0
  25. package/dist/gen/core/serverSentEvents.gen.js +132 -0
  26. package/dist/gen/core/types.gen.d.ts +83 -0
  27. package/dist/gen/core/types.gen.js +2 -0
  28. package/dist/gen/core/utils.gen.d.ts +19 -0
  29. package/dist/gen/core/utils.gen.js +87 -0
  30. package/dist/gen/public.gen.d.ts +1 -0
  31. package/dist/gen/public.gen.js +2 -0
  32. package/dist/gen/sdk.gen.d.ts +504 -0
  33. package/dist/gen/sdk.gen.js +880 -0
  34. package/dist/gen/types.gen.d.ts +3452 -0
  35. package/dist/gen/types.gen.js +2 -0
  36. package/dist/index.d.ts +6 -0
  37. package/dist/index.js +5 -0
  38. package/dist/runtime.d.ts +19 -0
  39. package/dist/runtime.js +57 -0
  40. package/dist/typed.d.ts +90 -0
  41. package/dist/typed.js +51 -0
  42. package/package.json +38 -5
@@ -0,0 +1,3452 @@
1
+ export type ClientOptions = {
2
+ baseUrl: `${string}://${string}` | (string & {});
3
+ };
4
+ export type Deck = {
5
+ /**
6
+ * Numeric id. Stable for the life of the deck.
7
+ */
8
+ id: number;
9
+ /**
10
+ * Full path, with `::` between parent and child.
11
+ */
12
+ name: string;
13
+ };
14
+ export type CreateDeckInput = {
15
+ /**
16
+ * Deck name. Use `::` to nest it.
17
+ */
18
+ name: string;
19
+ };
20
+ export type RenameDeckInput = {
21
+ /**
22
+ * The new full name.
23
+ */
24
+ name: string;
25
+ };
26
+ export type Note = {
27
+ /**
28
+ * Numeric id. Stable for the life of the note.
29
+ */
30
+ id: number;
31
+ /**
32
+ * Globally unique id. Anki uses it to tell whether an imported note is the same one.
33
+ */
34
+ guid: string;
35
+ /**
36
+ * The note type this note was made with.
37
+ */
38
+ notetypeId: number;
39
+ /**
40
+ * When the note last changed, in seconds since 1970.
41
+ */
42
+ mtime?: number;
43
+ /**
44
+ * Update sequence number used by sync. `-1` means changed here and not yet synced.
45
+ */
46
+ usn?: number;
47
+ /**
48
+ * Tags on the note.
49
+ */
50
+ tags: Array<string>;
51
+ /**
52
+ * Every field's content, keyed by the field's key (its name in camelCase, such as `backExtra`), in the order of the note type's fields. May contain HTML.
53
+ */
54
+ fields: {
55
+ [key: string]: string;
56
+ };
57
+ };
58
+ export type NoteDetails = Note & {
59
+ cards?: Array<GeneratedCard>;
60
+ };
61
+ export type CreateNoteInput = {
62
+ /**
63
+ * Which note type to use, by name (ignoring case). Send this or `notetypeId`.
64
+ */
65
+ notetypeName?: string;
66
+ /**
67
+ * Which note type to use, by id. See [List note types](#listNoteTypes). Send this or `notetypeName`.
68
+ */
69
+ notetypeId?: number;
70
+ /**
71
+ * The deck that receives the new cards, by name (ignoring case), such as `Languages::German`. Send this or `deckId`.
72
+ */
73
+ deckName?: string;
74
+ /**
75
+ * The deck that receives the new cards, by id. Without a deck the note goes to the `Default` deck.
76
+ */
77
+ deckId?: number;
78
+ /**
79
+ * The field contents, keyed by each field's key: its name in camelCase (`Back Extra` is `backExtra`) or its exact name. Fields left out are empty. HTML is allowed.
80
+ */
81
+ fields: {
82
+ [key: string]: string;
83
+ };
84
+ /**
85
+ * Tags to put on the note.
86
+ */
87
+ tags?: Array<string>;
88
+ /**
89
+ * Optional. Only set it to keep an identity from another system.
90
+ */
91
+ guid?: string;
92
+ };
93
+ export type Tag = {
94
+ /**
95
+ * The tag, spelled as it is stored.
96
+ */
97
+ name: string;
98
+ /**
99
+ * How many notes carry this tag or a tag nested under it.
100
+ */
101
+ noteCount: number;
102
+ };
103
+ export type CreateTagInput = {
104
+ /**
105
+ * The tag, with `::` for nesting. It can not contain a space or have an empty part.
106
+ */
107
+ name: string;
108
+ };
109
+ export type CreatedTag = {
110
+ /**
111
+ * The tag, spelled as it is stored.
112
+ */
113
+ name: string;
114
+ /**
115
+ * `false` when the tag already existed.
116
+ */
117
+ created: boolean;
118
+ };
119
+ export type RenameTagInput = {
120
+ /**
121
+ * The new name. If it is already a tag, the two are merged.
122
+ */
123
+ newName: string;
124
+ };
125
+ export type RenamedTag = {
126
+ /**
127
+ * The tag's new name, as stored.
128
+ */
129
+ name: string;
130
+ /**
131
+ * How many notes were changed.
132
+ */
133
+ notes: number;
134
+ };
135
+ export type CreateTagsBatchInput = {
136
+ /**
137
+ * The tags to create, 1 to 200.
138
+ */
139
+ names: Array<string>;
140
+ /**
141
+ * Write all or nothing. See [Create many notes](#createNotesBatch).
142
+ */
143
+ atomic?: boolean;
144
+ };
145
+ export type CreateTagsBatchResult = {
146
+ /**
147
+ * Echoes the request.
148
+ */
149
+ atomic: boolean;
150
+ /**
151
+ * Whether anything was written.
152
+ */
153
+ committed: boolean;
154
+ /**
155
+ * How many tags were new.
156
+ */
157
+ created: number;
158
+ /**
159
+ * How many entries were refused.
160
+ */
161
+ failed: number;
162
+ /**
163
+ * One entry per name sent, in order.
164
+ */
165
+ results: Array<CreateTagsBatchItem>;
166
+ };
167
+ export type CreateTagsBatchItem = {
168
+ index: number;
169
+ ok: boolean;
170
+ name?: string;
171
+ /**
172
+ * `false` when the tag already existed.
173
+ */
174
+ created?: boolean;
175
+ error?: ItemError;
176
+ };
177
+ export type UpdateTagsBatchInput = {
178
+ /**
179
+ * The renames, 1 to 200.
180
+ */
181
+ updates: Array<UpdateTagsBatchEntry>;
182
+ /**
183
+ * Write all or nothing. See [Create many notes](#createNotesBatch).
184
+ */
185
+ atomic?: boolean;
186
+ };
187
+ export type UpdateTagsBatchEntry = {
188
+ /**
189
+ * The tag to rename.
190
+ */
191
+ name: string;
192
+ /**
193
+ * Its new name.
194
+ */
195
+ newName: string;
196
+ };
197
+ export type UpdateTagsBatchResult = {
198
+ atomic: boolean;
199
+ /**
200
+ * Whether anything was written.
201
+ */
202
+ committed: boolean;
203
+ /**
204
+ * How many tags were renamed.
205
+ */
206
+ renamed: number;
207
+ /**
208
+ * How many entries were refused.
209
+ */
210
+ failed: number;
211
+ /**
212
+ * One entry per update sent, in order.
213
+ */
214
+ results: Array<UpdateTagsBatchItem>;
215
+ };
216
+ export type UpdateTagsBatchItem = {
217
+ index: number;
218
+ ok: boolean;
219
+ name?: string;
220
+ /**
221
+ * The name the tag now has, as stored.
222
+ */
223
+ newName?: string;
224
+ /**
225
+ * How many notes were changed.
226
+ */
227
+ notes?: number;
228
+ error?: ItemError;
229
+ };
230
+ export type DeleteTagsBatchInput = {
231
+ /**
232
+ * The tags to delete, 1 to 1000.
233
+ */
234
+ names: Array<string>;
235
+ };
236
+ export type UpdateNoteInput = {
237
+ /**
238
+ * The fields to change, keyed by each field's key (its name in camelCase, such as `backExtra`) or its exact name. Fields left out keep their content. HTML is allowed.
239
+ */
240
+ fields?: {
241
+ [key: string]: string;
242
+ };
243
+ /**
244
+ * The complete list of tags; it replaces the existing tags.
245
+ */
246
+ tags?: Array<string>;
247
+ };
248
+ export type MediaFile = {
249
+ name: string;
250
+ size: number;
251
+ sha1: string;
252
+ sha256?: string | null;
253
+ contentType: string;
254
+ mtime: number;
255
+ usn: number;
256
+ };
257
+ export type MediaPutResult = MediaFile & {
258
+ created: boolean;
259
+ unchanged: boolean;
260
+ };
261
+ export type GeneratedCard = {
262
+ /**
263
+ * Numeric id of the card.
264
+ */
265
+ id: number;
266
+ /**
267
+ * Which template of the note type made this card (0 is the first).
268
+ */
269
+ ord: number;
270
+ /**
271
+ * The deck the card was put in.
272
+ */
273
+ deckId: number;
274
+ /**
275
+ * Position in the new-card queue.
276
+ */
277
+ due: number;
278
+ };
279
+ export type Card = {
280
+ id: number;
281
+ /**
282
+ * The note this card was made from.
283
+ */
284
+ noteId: number;
285
+ deckId: number;
286
+ /**
287
+ * Which template of the note type made this card (0 is the first).
288
+ */
289
+ ord: number;
290
+ mtime?: number;
291
+ usn?: number;
292
+ /**
293
+ * 0 new, 1 learning, 2 review, 3 relearning.
294
+ */
295
+ type?: number;
296
+ /**
297
+ * Where the card sits in the scheduler: -3 or -2 buried, -1 suspended, 0 new, 1 learning, 2 review, 3 day-learning, 4 preview.
298
+ */
299
+ queue?: number;
300
+ /**
301
+ * When it is due. For a review card this is a day number; for a new card, its position in the queue.
302
+ */
303
+ due?: number;
304
+ /**
305
+ * Days until the next review, once it is a review card.
306
+ */
307
+ interval?: number;
308
+ /**
309
+ * Ease factor in permille: 2500 means 250%.
310
+ */
311
+ factor?: number;
312
+ /**
313
+ * How many times it has been reviewed.
314
+ */
315
+ reps?: number;
316
+ /**
317
+ * How many times it was forgotten after being learnt.
318
+ */
319
+ lapses?: number;
320
+ left?: number;
321
+ originalDue?: number;
322
+ originalDeckId?: number;
323
+ /**
324
+ * Colour flag, 0 for none.
325
+ */
326
+ flags?: number;
327
+ };
328
+ export type ItemError = {
329
+ /**
330
+ * `not_found`, `invalid_input`, `deck_error`, `card_state_error`, `validation_error`, or `batch_aborted` for an entry that was fine but not written because an atomic call was refused.
331
+ */
332
+ code: string;
333
+ /**
334
+ * A sentence explaining the refusal.
335
+ */
336
+ message: string;
337
+ };
338
+ export type CreateNotesBatchInput = {
339
+ /**
340
+ * The notes to create, 1 to 200, each shaped like the body of [Create a note](#createNote). An entry that is not valid is reported in its slot.
341
+ */
342
+ notes: Array<CreateNoteInput>;
343
+ /**
344
+ * Write all or nothing: one refused entry means nothing is written (`422`).
345
+ */
346
+ atomic?: boolean;
347
+ };
348
+ export type CreateNotesBatchResult = {
349
+ atomic: boolean;
350
+ committed: boolean;
351
+ created: number;
352
+ failed: number;
353
+ results: Array<CreateNotesBatchItem>;
354
+ };
355
+ export type CreateNotesBatchItem = {
356
+ /**
357
+ * Position of the note in `notes`.
358
+ */
359
+ index: number;
360
+ /**
361
+ * `true` when the note was created.
362
+ */
363
+ ok: boolean;
364
+ /**
365
+ * Numeric id of the new note.
366
+ */
367
+ id?: number;
368
+ /**
369
+ * The note's globally unique id.
370
+ */
371
+ guid?: string;
372
+ /**
373
+ * The cards its note type's templates produced.
374
+ */
375
+ cards?: Array<GeneratedCard>;
376
+ /**
377
+ * Tags this note introduced; a tag is listed only for the first note that uses it.
378
+ */
379
+ newTags?: Array<string>;
380
+ /**
381
+ * Why the note was refused. Absent when `ok`.
382
+ */
383
+ error?: ItemError;
384
+ };
385
+ export type UpdateNotesBatchInput = {
386
+ /**
387
+ * The edits, 1 to 200. An entry that is not valid is reported in its slot.
388
+ */
389
+ updates: Array<UpdateNotesBatchEntry>;
390
+ /**
391
+ * Write all or nothing: one refused entry means nothing is written (`422`).
392
+ */
393
+ atomic?: boolean;
394
+ };
395
+ export type UpdateNotesBatchEntry = {
396
+ /**
397
+ * The note to edit.
398
+ */
399
+ id: number;
400
+ /**
401
+ * The fields to change, keyed like `UpdateNoteInput.fields`. Fields left out keep their content.
402
+ */
403
+ fields?: {
404
+ [key: string]: string;
405
+ };
406
+ /**
407
+ * Replaces all the note's tags. Not with `addTags` or `removeTags`.
408
+ */
409
+ tags?: Array<string>;
410
+ /**
411
+ * Tags to add to the ones the note has.
412
+ */
413
+ addTags?: Array<string>;
414
+ /**
415
+ * Tags to remove from the ones the note has, ignoring case. A removed tag takes the tags below it (`a::b` for `a`) with it.
416
+ */
417
+ removeTags?: Array<string>;
418
+ };
419
+ export type UpdateNotesBatchResult = {
420
+ atomic: boolean;
421
+ committed: boolean;
422
+ changed: number;
423
+ failed: number;
424
+ results: Array<UpdateNotesBatchItem>;
425
+ };
426
+ export type UpdateNotesBatchItem = {
427
+ /**
428
+ * Position of the entry in `updates`.
429
+ */
430
+ index: number;
431
+ /**
432
+ * `true` when the note exists and the edit was valid.
433
+ */
434
+ ok: boolean;
435
+ /**
436
+ * The note id.
437
+ */
438
+ id?: number;
439
+ /**
440
+ * `false` when the note already matched, so nothing was written for it.
441
+ */
442
+ changed?: boolean;
443
+ /**
444
+ * Cards that the new field content caused to be generated.
445
+ */
446
+ newCards?: Array<GeneratedCard>;
447
+ /**
448
+ * Tags this entry introduced; a tag is listed only for the first entry that uses it.
449
+ */
450
+ newTags?: Array<string>;
451
+ /**
452
+ * Why the entry was refused. Absent when `ok`.
453
+ */
454
+ error?: ItemError;
455
+ };
456
+ export type DeleteCardsBatchInput = {
457
+ /**
458
+ * The cards to delete, 1 to 1000.
459
+ */
460
+ ids: Array<number>;
461
+ };
462
+ export type UpdateCardsBatchInput = {
463
+ /**
464
+ * The cards to change, 1 to 1000. Repeats are ignored.
465
+ */
466
+ ids: Array<number>;
467
+ /**
468
+ * The change, shaped like the body of [Edit a card](#updateCard).
469
+ */
470
+ patch: UpdateCardInput;
471
+ /**
472
+ * Write all or nothing: one refused card means nothing is written (`422`).
473
+ */
474
+ atomic?: boolean;
475
+ };
476
+ export type UpdateCardsBatchResult = {
477
+ atomic: boolean;
478
+ committed: boolean;
479
+ changed: number;
480
+ failed: number;
481
+ results: Array<UpdateCardsBatchItem>;
482
+ };
483
+ export type UpdateCardsBatchItem = {
484
+ /**
485
+ * The card id.
486
+ */
487
+ id: number;
488
+ /**
489
+ * `true` when the card exists and could take the change.
490
+ */
491
+ ok: boolean;
492
+ /**
493
+ * `false` when the card already matched, so nothing was written for it.
494
+ */
495
+ changed?: boolean;
496
+ /**
497
+ * The card as stored after the call.
498
+ */
499
+ card?: Card | null;
500
+ /**
501
+ * Why the card was refused. Absent when `ok`.
502
+ */
503
+ error?: ItemError;
504
+ };
505
+ export type DeleteNotesBatchInput = {
506
+ /**
507
+ * The notes to delete, 1 to 1000.
508
+ */
509
+ ids: Array<number>;
510
+ };
511
+ export type UpdateCardInput = {
512
+ deckId?: number;
513
+ flag?: number;
514
+ suspended?: boolean;
515
+ buried?: boolean;
516
+ };
517
+ export type AnswerCardInput = {
518
+ rating: 'again' | 'hard' | 'good' | 'easy' | number;
519
+ timeTakenMs?: number;
520
+ };
521
+ export type RenderedCard = {
522
+ cardId: number;
523
+ noteId?: number;
524
+ notetypeId?: number;
525
+ deckId?: number;
526
+ ord?: number;
527
+ isEmpty?: boolean;
528
+ /**
529
+ * The question or the answer holds a formula (`\(...\)` or `\[...\]`) for MathJax to typeset.
530
+ */
531
+ math: boolean;
532
+ question: string;
533
+ answer: string;
534
+ css: string;
535
+ media: Array<string>;
536
+ };
537
+ export type CardScheduling = {
538
+ cardId: number;
539
+ fsrs: boolean;
540
+ today?: number;
541
+ nextDayAt?: number;
542
+ buttons: Array<{
543
+ rating: 'again' | 'hard' | 'good' | 'easy';
544
+ intervalSecs: number;
545
+ }>;
546
+ };
547
+ export type NotetypeChange = {
548
+ /**
549
+ * Fields that are new.
550
+ */
551
+ fieldsAdded: number;
552
+ /**
553
+ * Fields that were removed, with their content.
554
+ */
555
+ fieldsRemoved: number;
556
+ /**
557
+ * Fields that kept their data but changed position.
558
+ */
559
+ fieldsMoved: number;
560
+ /**
561
+ * `true` when a different field is now the one the browser sorts by.
562
+ */
563
+ sortFieldChanged: boolean;
564
+ /**
565
+ * Card templates that are new.
566
+ */
567
+ templatesAdded: number;
568
+ /**
569
+ * Card templates that were removed.
570
+ */
571
+ templatesRemoved: number;
572
+ /**
573
+ * Card templates that changed position.
574
+ */
575
+ templatesMoved: number;
576
+ /**
577
+ * `true` when any field or template was removed, so note or card data was lost.
578
+ */
579
+ destructive: boolean;
580
+ };
581
+ export type NoteTypeDetails = {
582
+ id: number;
583
+ name: string;
584
+ /**
585
+ * `normal` makes one card per template; `cloze` makes one per cloze deletion.
586
+ */
587
+ kind: 'normal' | 'cloze';
588
+ /**
589
+ * Stylesheet shared by every card of this note type.
590
+ */
591
+ css?: string;
592
+ /**
593
+ * Index of the field the browser sorts by.
594
+ */
595
+ sortFieldIdx?: number;
596
+ latexPre?: string;
597
+ latexPost?: string;
598
+ latexSvg?: boolean;
599
+ fields: Array<NoteTypeField>;
600
+ templates: Array<{
601
+ [key: string]: unknown;
602
+ }>;
603
+ };
604
+ export type NoteTypeField = {
605
+ ord: number;
606
+ /**
607
+ * The field's name as Anki shows it.
608
+ */
609
+ name: string;
610
+ /**
611
+ * The key of this field in the `fields` of a note, whether you create, read or edit it: its name in camelCase (`The field` is `theField`). When two fields would get the same key, or a field's exact name is another field's key, they keep their exact names.
612
+ */
613
+ key: string;
614
+ sticky?: boolean;
615
+ rtl?: boolean;
616
+ plainText?: boolean;
617
+ collapsed?: boolean;
618
+ excludeFromSearch?: boolean;
619
+ preventDeletion?: boolean;
620
+ description?: string;
621
+ fontName?: string;
622
+ fontSize?: number;
623
+ };
624
+ export type CreateNotetypeInput = {
625
+ /**
626
+ * Start from one of Anki's stock designs.
627
+ */
628
+ stock?: string;
629
+ /**
630
+ * Name of the note type.
631
+ */
632
+ name?: string;
633
+ kind?: 'normal' | 'cloze';
634
+ /**
635
+ * Field definitions, in order. Each needs a `name`.
636
+ */
637
+ fields?: Array<{
638
+ [key: string]: unknown;
639
+ }>;
640
+ /**
641
+ * Card templates. Each needs a `name`, a question format `qFormat` and an answer format `aFormat`.
642
+ */
643
+ templates?: Array<{
644
+ [key: string]: unknown;
645
+ }>;
646
+ css?: string;
647
+ sortFieldIdx?: number;
648
+ };
649
+ export type UpdateNotetypeInput = {
650
+ name?: string;
651
+ css?: string;
652
+ sortFieldIdx?: number;
653
+ /**
654
+ * The full list of fields. A field with an `ord` is an existing one being kept or renamed; one without is new; an existing one that is missing is removed.
655
+ */
656
+ fields?: Array<{
657
+ [key: string]: unknown;
658
+ }>;
659
+ /**
660
+ * The full list of templates, following the same rule as `fields`.
661
+ */
662
+ templates?: Array<{
663
+ [key: string]: unknown;
664
+ }>;
665
+ };
666
+ export type ApiError = {
667
+ error: {
668
+ code: string;
669
+ message: string;
670
+ correlationId?: string;
671
+ };
672
+ correlationId?: string;
673
+ };
674
+ export type ListDecksData = {
675
+ body?: never;
676
+ path?: never;
677
+ query?: never;
678
+ url: '/api/v1/decks';
679
+ };
680
+ export type ListDecksErrors = {
681
+ /**
682
+ * The `Authorization` header is missing, or the key is invalid, disabled or expired.
683
+ */
684
+ 401: ApiError;
685
+ /**
686
+ * The key lacks the scope, the account is suspended or its email unverified, the account is over its storage quota (`over_quota`; deleting is still allowed), or a destructive schema change is switched off (`destructive_change_disabled`).
687
+ */
688
+ 403: ApiError;
689
+ /**
690
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
691
+ */
692
+ 429: ApiError;
693
+ };
694
+ export type ListDecksError = ListDecksErrors[keyof ListDecksErrors];
695
+ export type ListDecksResponses = {
696
+ /**
697
+ * List of decks
698
+ */
699
+ 200: {
700
+ /**
701
+ * Every deck, in no particular order.
702
+ */
703
+ decks: Array<Deck>;
704
+ };
705
+ };
706
+ export type ListDecksResponse = ListDecksResponses[keyof ListDecksResponses];
707
+ export type CreateDeckData = {
708
+ body: {
709
+ /**
710
+ * Deck name. Use `::` to nest it.
711
+ */
712
+ name: string;
713
+ };
714
+ headers?: {
715
+ /**
716
+ * Any unique string, such as a UUID. Send the same key when you retry a write: the first answer is replayed (marked `X-Idempotent-Replay: true`) instead of doing the work twice. Keys are remembered for 24 hours. Reusing a key with a different request is `422 idempotency_conflict`.
717
+ */
718
+ 'Idempotency-Key'?: string;
719
+ };
720
+ path?: never;
721
+ query?: never;
722
+ url: '/api/v1/decks';
723
+ };
724
+ export type CreateDeckErrors = {
725
+ /**
726
+ * The request was understood but is not valid, for example an unknown deck or a `fields` key that names no field of the note type. The code is `invalid_input`, `deck_error` or `card_type_error`.
727
+ */
728
+ 400: ApiError;
729
+ /**
730
+ * The `Authorization` header is missing, or the key is invalid, disabled or expired.
731
+ */
732
+ 401: ApiError;
733
+ /**
734
+ * The key lacks the scope, the account is suspended or its email unverified, the account is over its storage quota (`over_quota`; deleting is still allowed), or a destructive schema change is switched off (`destructive_change_disabled`).
735
+ */
736
+ 403: ApiError;
737
+ /**
738
+ * The body does not match the earlier request that used this `Idempotency-Key` (`idempotency_conflict`), or the body failed validation (`validation_error`).
739
+ */
740
+ 422: ApiError;
741
+ /**
742
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
743
+ */
744
+ 423: ApiError;
745
+ /**
746
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
747
+ */
748
+ 429: ApiError;
749
+ };
750
+ export type CreateDeckError = CreateDeckErrors[keyof CreateDeckErrors];
751
+ export type CreateDeckResponses = {
752
+ /**
753
+ * Deck created
754
+ */
755
+ 201: Deck;
756
+ };
757
+ export type CreateDeckResponse = CreateDeckResponses[keyof CreateDeckResponses];
758
+ export type DeleteDeckData = {
759
+ body?: never;
760
+ headers?: {
761
+ /**
762
+ * Any unique string, such as a UUID. Send the same key when you retry a write: the first answer is replayed (marked `X-Idempotent-Replay: true`) instead of doing the work twice. Keys are remembered for 24 hours. Reusing a key with a different request is `422 idempotency_conflict`.
763
+ */
764
+ 'Idempotency-Key'?: string;
765
+ };
766
+ path: {
767
+ /**
768
+ * The numeric id, as returned by the list endpoint or when it was created.
769
+ */
770
+ id: number;
771
+ };
772
+ query?: never;
773
+ url: '/api/v1/decks/{id}';
774
+ };
775
+ export type DeleteDeckErrors = {
776
+ /**
777
+ * No deck, note, note type or card has that id.
778
+ */
779
+ 404: ApiError;
780
+ /**
781
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
782
+ */
783
+ 423: ApiError;
784
+ /**
785
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
786
+ */
787
+ 429: ApiError;
788
+ };
789
+ export type DeleteDeckError = DeleteDeckErrors[keyof DeleteDeckErrors];
790
+ export type DeleteDeckResponses = {
791
+ /**
792
+ * Deck deleted
793
+ */
794
+ 200: {
795
+ /**
796
+ * `true` when the deck was deleted.
797
+ */
798
+ ok: boolean;
799
+ /**
800
+ * The deck and each of its subdecks.
801
+ */
802
+ deletedDeckIds: Array<number>;
803
+ /**
804
+ * Every card that was in those decks.
805
+ */
806
+ deletedCardIds: Array<number>;
807
+ /**
808
+ * Notes that were left with no cards and were removed with them.
809
+ */
810
+ deletedNoteIds: Array<number>;
811
+ /**
812
+ * `true` when the built-in `Default` deck was among the decks. It cannot be removed, so it was emptied and kept.
813
+ */
814
+ defaultDeckReset: boolean;
815
+ /**
816
+ * Cards that were in a deleted filtered deck. They go back to the deck they came from instead of being deleted.
817
+ */
818
+ returnedCardIds: Array<number>;
819
+ };
820
+ };
821
+ export type DeleteDeckResponse = DeleteDeckResponses[keyof DeleteDeckResponses];
822
+ export type GetDeckData = {
823
+ body?: never;
824
+ path: {
825
+ /**
826
+ * The numeric id, as returned by the list endpoint or when it was created.
827
+ */
828
+ id: number;
829
+ };
830
+ query?: never;
831
+ url: '/api/v1/decks/{id}';
832
+ };
833
+ export type GetDeckErrors = {
834
+ /**
835
+ * No deck, note, note type or card has that id.
836
+ */
837
+ 404: ApiError;
838
+ /**
839
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
840
+ */
841
+ 429: ApiError;
842
+ };
843
+ export type GetDeckError = GetDeckErrors[keyof GetDeckErrors];
844
+ export type GetDeckResponses = {
845
+ /**
846
+ * Deck details
847
+ */
848
+ 200: Deck;
849
+ };
850
+ export type GetDeckResponse = GetDeckResponses[keyof GetDeckResponses];
851
+ export type RenameDeckData = {
852
+ body: {
853
+ /**
854
+ * The new full name.
855
+ */
856
+ name: string;
857
+ };
858
+ headers?: {
859
+ /**
860
+ * Any unique string, such as a UUID. Send the same key when you retry a write: the first answer is replayed (marked `X-Idempotent-Replay: true`) instead of doing the work twice. Keys are remembered for 24 hours. Reusing a key with a different request is `422 idempotency_conflict`.
861
+ */
862
+ 'Idempotency-Key'?: string;
863
+ };
864
+ path: {
865
+ /**
866
+ * The numeric id, as returned by the list endpoint or when it was created.
867
+ */
868
+ id: number;
869
+ };
870
+ query?: never;
871
+ url: '/api/v1/decks/{id}';
872
+ };
873
+ export type RenameDeckErrors = {
874
+ /**
875
+ * No deck, note, note type or card has that id.
876
+ */
877
+ 404: ApiError;
878
+ /**
879
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
880
+ */
881
+ 423: ApiError;
882
+ /**
883
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
884
+ */
885
+ 429: ApiError;
886
+ };
887
+ export type RenameDeckError = RenameDeckErrors[keyof RenameDeckErrors];
888
+ export type RenameDeckResponses = {
889
+ /**
890
+ * Deck renamed
891
+ */
892
+ 200: Deck;
893
+ };
894
+ export type RenameDeckResponse = RenameDeckResponses[keyof RenameDeckResponses];
895
+ export type ListNotesData = {
896
+ body?: never;
897
+ path?: never;
898
+ query?: {
899
+ /**
900
+ * Only items that belong to this deck.
901
+ */
902
+ deckId?: number;
903
+ /**
904
+ * Only notes of this note type.
905
+ */
906
+ notetypeId?: number;
907
+ /**
908
+ * Only notes that carry exactly this tag.
909
+ */
910
+ tag?: string;
911
+ /**
912
+ * The id of the last item on the previous page, which is its `nextCursor`. Leave it out for the first page.
913
+ */
914
+ cursor?: string;
915
+ /**
916
+ * Page size, from 1 to 100. Defaults to 50.
917
+ */
918
+ limit?: number;
919
+ };
920
+ url: '/api/v1/notes';
921
+ };
922
+ export type ListNotesErrors = {
923
+ /**
924
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
925
+ */
926
+ 429: ApiError;
927
+ };
928
+ export type ListNotesError = ListNotesErrors[keyof ListNotesErrors];
929
+ export type ListNotesResponses = {
930
+ /**
931
+ * Paginated list of notes
932
+ */
933
+ 200: {
934
+ /**
935
+ * This page of notes, in ascending id order.
936
+ */
937
+ notes: Array<Note>;
938
+ /**
939
+ * Send this as `cursor` to get the next page. `null` on the last page.
940
+ */
941
+ nextCursor: string | null;
942
+ };
943
+ };
944
+ export type ListNotesResponse = ListNotesResponses[keyof ListNotesResponses];
945
+ export type CreateNoteData = {
946
+ body: {
947
+ /**
948
+ * Which note type to use, by name (ignoring case). Send this or `notetypeId`.
949
+ */
950
+ notetypeName?: string;
951
+ /**
952
+ * Which note type to use, by id. See [List note types](#listNoteTypes). Send this or `notetypeName`.
953
+ */
954
+ notetypeId?: number;
955
+ /**
956
+ * The deck that receives the new cards, by name (ignoring case), such as `Languages::German`. Send this or `deckId`.
957
+ */
958
+ deckName?: string;
959
+ /**
960
+ * The deck that receives the new cards, by id. Without a deck the note goes to the `Default` deck.
961
+ */
962
+ deckId?: number;
963
+ /**
964
+ * The field contents, keyed by each field's key: its name in camelCase (`Back Extra` is `backExtra`) or its exact name. Fields left out are empty. HTML is allowed.
965
+ */
966
+ fields: {
967
+ [key: string]: string;
968
+ };
969
+ /**
970
+ * Tags to put on the note.
971
+ */
972
+ tags?: Array<string>;
973
+ /**
974
+ * Optional. Only set it to keep an identity from another system.
975
+ */
976
+ guid?: string;
977
+ };
978
+ headers?: {
979
+ /**
980
+ * Any unique string, such as a UUID. Send the same key when you retry a write: the first answer is replayed (marked `X-Idempotent-Replay: true`) instead of doing the work twice. Keys are remembered for 24 hours. Reusing a key with a different request is `422 idempotency_conflict`.
981
+ */
982
+ 'Idempotency-Key'?: string;
983
+ };
984
+ path?: never;
985
+ query?: never;
986
+ url: '/api/v1/notes';
987
+ };
988
+ export type CreateNoteErrors = {
989
+ /**
990
+ * The request was understood but is not valid, for example an unknown deck or a `fields` key that names no field of the note type. The code is `invalid_input`, `deck_error` or `card_type_error`.
991
+ */
992
+ 400: ApiError;
993
+ /**
994
+ * The key lacks the scope, the account is suspended or its email unverified, the account is over its storage quota (`over_quota`; deleting is still allowed), or a destructive schema change is switched off (`destructive_change_disabled`).
995
+ */
996
+ 403: ApiError;
997
+ /**
998
+ * The body does not match the earlier request that used this `Idempotency-Key` (`idempotency_conflict`), or the body failed validation (`validation_error`).
999
+ */
1000
+ 422: ApiError;
1001
+ /**
1002
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
1003
+ */
1004
+ 423: ApiError;
1005
+ /**
1006
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
1007
+ */
1008
+ 429: ApiError;
1009
+ };
1010
+ export type CreateNoteError = CreateNoteErrors[keyof CreateNoteErrors];
1011
+ export type CreateNoteResponses = {
1012
+ /**
1013
+ * Note created
1014
+ */
1015
+ 201: {
1016
+ /**
1017
+ * Numeric id of the new note.
1018
+ */
1019
+ id: number;
1020
+ /**
1021
+ * The note's globally unique id: the one you sent, or a generated one.
1022
+ */
1023
+ guid: string;
1024
+ /**
1025
+ * The cards the note type's templates produced.
1026
+ */
1027
+ cards: Array<GeneratedCard>;
1028
+ /**
1029
+ * Tags that did not exist in the collection before and were created by this request.
1030
+ */
1031
+ newTags: Array<string>;
1032
+ };
1033
+ };
1034
+ export type CreateNoteResponse = CreateNoteResponses[keyof CreateNoteResponses];
1035
+ export type CreateNotesBatchData = {
1036
+ body: {
1037
+ /**
1038
+ * The notes to create, 1 to 200, each shaped like the body of [Create a note](#createNote). An entry that is not valid is reported in its slot.
1039
+ */
1040
+ notes: Array<CreateNoteInput>;
1041
+ /**
1042
+ * Write all or nothing: one refused entry means nothing is written (`422`).
1043
+ */
1044
+ atomic?: boolean;
1045
+ };
1046
+ headers?: {
1047
+ /**
1048
+ * Any unique string, such as a UUID. Send the same key when you retry a write: the first answer is replayed (marked `X-Idempotent-Replay: true`) instead of doing the work twice. Keys are remembered for 24 hours. Reusing a key with a different request is `422 idempotency_conflict`.
1049
+ */
1050
+ 'Idempotency-Key'?: string;
1051
+ };
1052
+ path?: never;
1053
+ query?: never;
1054
+ url: '/api/v1/notes/batch-create';
1055
+ };
1056
+ export type CreateNotesBatchErrors = {
1057
+ /**
1058
+ * The request was understood but is not valid, for example an unknown deck or a `fields` key that names no field of the note type. The code is `invalid_input`, `deck_error` or `card_type_error`.
1059
+ */
1060
+ 400: ApiError;
1061
+ /**
1062
+ * The key lacks the scope, the account is suspended or its email unverified, the account is over its storage quota (`over_quota`; deleting is still allowed), or a destructive schema change is switched off (`destructive_change_disabled`).
1063
+ */
1064
+ 403: ApiError;
1065
+ /**
1066
+ * The body failed validation (`validation_error`), or the call was `atomic` and an entry was refused: then the body is the usual batch answer with every entry's `error`, and nothing was written.
1067
+ */
1068
+ 422: ApiError | CreateNotesBatchResult | UpdateNotesBatchResult | UpdateCardsBatchResult;
1069
+ /**
1070
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
1071
+ */
1072
+ 423: ApiError;
1073
+ /**
1074
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
1075
+ */
1076
+ 429: ApiError;
1077
+ /**
1078
+ * Other batch operations are using the server. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
1079
+ */
1080
+ 503: ApiError;
1081
+ };
1082
+ export type CreateNotesBatchError = CreateNotesBatchErrors[keyof CreateNotesBatchErrors];
1083
+ export type CreateNotesBatchResponses = {
1084
+ /**
1085
+ * Every entry was handled; see `results`
1086
+ */
1087
+ 200: CreateNotesBatchResult;
1088
+ };
1089
+ export type CreateNotesBatchResponse = CreateNotesBatchResponses[keyof CreateNotesBatchResponses];
1090
+ export type UpdateNotesBatchData = {
1091
+ body: {
1092
+ /**
1093
+ * The edits, 1 to 200. An entry that is not valid is reported in its slot.
1094
+ */
1095
+ updates: Array<UpdateNotesBatchEntry>;
1096
+ /**
1097
+ * Write all or nothing: one refused entry means nothing is written (`422`).
1098
+ */
1099
+ atomic?: boolean;
1100
+ };
1101
+ headers?: {
1102
+ /**
1103
+ * Any unique string, such as a UUID. Send the same key when you retry a write: the first answer is replayed (marked `X-Idempotent-Replay: true`) instead of doing the work twice. Keys are remembered for 24 hours. Reusing a key with a different request is `422 idempotency_conflict`.
1104
+ */
1105
+ 'Idempotency-Key'?: string;
1106
+ };
1107
+ path?: never;
1108
+ query?: never;
1109
+ url: '/api/v1/notes/batch-update';
1110
+ };
1111
+ export type UpdateNotesBatchErrors = {
1112
+ /**
1113
+ * The request was understood but is not valid, for example an unknown deck or a `fields` key that names no field of the note type. The code is `invalid_input`, `deck_error` or `card_type_error`.
1114
+ */
1115
+ 400: ApiError;
1116
+ /**
1117
+ * The key lacks the scope, the account is suspended or its email unverified, the account is over its storage quota (`over_quota`; deleting is still allowed), or a destructive schema change is switched off (`destructive_change_disabled`).
1118
+ */
1119
+ 403: ApiError;
1120
+ /**
1121
+ * The body failed validation (`validation_error`), or the call was `atomic` and an entry was refused: then the body is the usual batch answer with every entry's `error`, and nothing was written.
1122
+ */
1123
+ 422: ApiError | CreateNotesBatchResult | UpdateNotesBatchResult | UpdateCardsBatchResult;
1124
+ /**
1125
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
1126
+ */
1127
+ 423: ApiError;
1128
+ /**
1129
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
1130
+ */
1131
+ 429: ApiError;
1132
+ /**
1133
+ * Other batch operations are using the server. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
1134
+ */
1135
+ 503: ApiError;
1136
+ };
1137
+ export type UpdateNotesBatchError = UpdateNotesBatchErrors[keyof UpdateNotesBatchErrors];
1138
+ export type UpdateNotesBatchResponses = {
1139
+ /**
1140
+ * Every entry was handled; see `results`
1141
+ */
1142
+ 200: UpdateNotesBatchResult;
1143
+ };
1144
+ export type UpdateNotesBatchResponse = UpdateNotesBatchResponses[keyof UpdateNotesBatchResponses];
1145
+ export type DeleteNotesBatchData = {
1146
+ body: {
1147
+ /**
1148
+ * The notes to delete, 1 to 1000.
1149
+ */
1150
+ ids: Array<number>;
1151
+ };
1152
+ headers?: {
1153
+ /**
1154
+ * Any unique string, such as a UUID. Send the same key when you retry a write: the first answer is replayed (marked `X-Idempotent-Replay: true`) instead of doing the work twice. Keys are remembered for 24 hours. Reusing a key with a different request is `422 idempotency_conflict`.
1155
+ */
1156
+ 'Idempotency-Key'?: string;
1157
+ };
1158
+ path?: never;
1159
+ query?: never;
1160
+ url: '/api/v1/notes/batch-delete';
1161
+ };
1162
+ export type DeleteNotesBatchErrors = {
1163
+ /**
1164
+ * The key lacks the scope, the account is suspended or its email unverified, the account is over its storage quota (`over_quota`; deleting is still allowed), or a destructive schema change is switched off (`destructive_change_disabled`).
1165
+ */
1166
+ 403: ApiError;
1167
+ /**
1168
+ * The body does not match the earlier request that used this `Idempotency-Key` (`idempotency_conflict`), or the body failed validation (`validation_error`).
1169
+ */
1170
+ 422: ApiError;
1171
+ /**
1172
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
1173
+ */
1174
+ 423: ApiError;
1175
+ /**
1176
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
1177
+ */
1178
+ 429: ApiError;
1179
+ /**
1180
+ * Other batch operations are using the server. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
1181
+ */
1182
+ 503: ApiError;
1183
+ };
1184
+ export type DeleteNotesBatchError = DeleteNotesBatchErrors[keyof DeleteNotesBatchErrors];
1185
+ export type DeleteNotesBatchResponses = {
1186
+ /**
1187
+ * The notes that existed were deleted
1188
+ */
1189
+ 200: {
1190
+ /**
1191
+ * How many notes were deleted.
1192
+ */
1193
+ deleted: number;
1194
+ /**
1195
+ * The notes that were deleted.
1196
+ */
1197
+ deletedNoteIds: Array<number>;
1198
+ /**
1199
+ * Every card that was made from them.
1200
+ */
1201
+ deletedCardIds: Array<number>;
1202
+ /**
1203
+ * Ids that did not exist and were ignored.
1204
+ */
1205
+ missingNoteIds: Array<number>;
1206
+ };
1207
+ };
1208
+ export type DeleteNotesBatchResponse = DeleteNotesBatchResponses[keyof DeleteNotesBatchResponses];
1209
+ export type DeleteNoteData = {
1210
+ body?: never;
1211
+ headers?: {
1212
+ /**
1213
+ * Any unique string, such as a UUID. Send the same key when you retry a write: the first answer is replayed (marked `X-Idempotent-Replay: true`) instead of doing the work twice. Keys are remembered for 24 hours. Reusing a key with a different request is `422 idempotency_conflict`.
1214
+ */
1215
+ 'Idempotency-Key'?: string;
1216
+ };
1217
+ path: {
1218
+ /**
1219
+ * The numeric id, as returned by the list endpoint or when it was created.
1220
+ */
1221
+ id: number;
1222
+ };
1223
+ query?: never;
1224
+ url: '/api/v1/notes/{id}';
1225
+ };
1226
+ export type DeleteNoteErrors = {
1227
+ /**
1228
+ * No deck, note, note type or card has that id.
1229
+ */
1230
+ 404: ApiError;
1231
+ /**
1232
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
1233
+ */
1234
+ 423: ApiError;
1235
+ /**
1236
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
1237
+ */
1238
+ 429: ApiError;
1239
+ };
1240
+ export type DeleteNoteError = DeleteNoteErrors[keyof DeleteNoteErrors];
1241
+ export type DeleteNoteResponses = {
1242
+ /**
1243
+ * Note deleted
1244
+ */
1245
+ 200: {
1246
+ /**
1247
+ * `true` when the note was deleted.
1248
+ */
1249
+ ok: boolean;
1250
+ /**
1251
+ * The note that was deleted.
1252
+ */
1253
+ deletedNoteIds: Array<number>;
1254
+ /**
1255
+ * Every card that was made from it.
1256
+ */
1257
+ deletedCardIds: Array<number>;
1258
+ };
1259
+ };
1260
+ export type DeleteNoteResponse = DeleteNoteResponses[keyof DeleteNoteResponses];
1261
+ export type GetNoteData = {
1262
+ body?: never;
1263
+ path: {
1264
+ /**
1265
+ * The numeric id, as returned by the list endpoint or when it was created.
1266
+ */
1267
+ id: number;
1268
+ };
1269
+ query?: never;
1270
+ url: '/api/v1/notes/{id}';
1271
+ };
1272
+ export type GetNoteErrors = {
1273
+ /**
1274
+ * No deck, note, note type or card has that id.
1275
+ */
1276
+ 404: ApiError;
1277
+ /**
1278
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
1279
+ */
1280
+ 429: ApiError;
1281
+ };
1282
+ export type GetNoteError = GetNoteErrors[keyof GetNoteErrors];
1283
+ export type GetNoteResponses = {
1284
+ /**
1285
+ * Note details
1286
+ */
1287
+ 200: NoteDetails;
1288
+ };
1289
+ export type GetNoteResponse = GetNoteResponses[keyof GetNoteResponses];
1290
+ export type UpdateNoteData = {
1291
+ body: {
1292
+ /**
1293
+ * The fields to change, keyed by each field's key (its name in camelCase, such as `backExtra`) or its exact name. Fields left out keep their content. HTML is allowed.
1294
+ */
1295
+ fields?: {
1296
+ [key: string]: string;
1297
+ };
1298
+ /**
1299
+ * The complete list of tags; it replaces the existing tags.
1300
+ */
1301
+ tags?: Array<string>;
1302
+ };
1303
+ headers?: {
1304
+ /**
1305
+ * Any unique string, such as a UUID. Send the same key when you retry a write: the first answer is replayed (marked `X-Idempotent-Replay: true`) instead of doing the work twice. Keys are remembered for 24 hours. Reusing a key with a different request is `422 idempotency_conflict`.
1306
+ */
1307
+ 'Idempotency-Key'?: string;
1308
+ };
1309
+ path: {
1310
+ /**
1311
+ * The numeric id, as returned by the list endpoint or when it was created.
1312
+ */
1313
+ id: number;
1314
+ };
1315
+ query?: never;
1316
+ url: '/api/v1/notes/{id}';
1317
+ };
1318
+ export type UpdateNoteErrors = {
1319
+ /**
1320
+ * No deck, note, note type or card has that id.
1321
+ */
1322
+ 404: ApiError;
1323
+ /**
1324
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
1325
+ */
1326
+ 423: ApiError;
1327
+ /**
1328
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
1329
+ */
1330
+ 429: ApiError;
1331
+ };
1332
+ export type UpdateNoteError = UpdateNoteErrors[keyof UpdateNoteErrors];
1333
+ export type UpdateNoteResponses = {
1334
+ /**
1335
+ * Note updated
1336
+ */
1337
+ 200: {
1338
+ /**
1339
+ * Numeric id of the note.
1340
+ */
1341
+ id: number;
1342
+ /**
1343
+ * `false` when nothing differed from what was stored, so nothing was written.
1344
+ */
1345
+ changed: boolean;
1346
+ /**
1347
+ * Cards that the new field content caused to be generated.
1348
+ */
1349
+ newCards: Array<GeneratedCard>;
1350
+ /**
1351
+ * Tags that did not exist in the collection before and were created by this request.
1352
+ */
1353
+ newTags: Array<string>;
1354
+ };
1355
+ };
1356
+ export type UpdateNoteResponse = UpdateNoteResponses[keyof UpdateNoteResponses];
1357
+ export type ListNoteTypesData = {
1358
+ body?: never;
1359
+ path?: never;
1360
+ query?: never;
1361
+ url: '/api/v1/note-types';
1362
+ };
1363
+ export type ListNoteTypesErrors = {
1364
+ /**
1365
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
1366
+ */
1367
+ 429: ApiError;
1368
+ };
1369
+ export type ListNoteTypesError = ListNoteTypesErrors[keyof ListNoteTypesErrors];
1370
+ export type ListNoteTypesResponses = {
1371
+ /**
1372
+ * List of note types
1373
+ */
1374
+ 200: {
1375
+ /**
1376
+ * Every note type, with its id and name. Fetch one by id for its fields and templates.
1377
+ */
1378
+ noteTypes: Array<{
1379
+ id?: number;
1380
+ name?: string;
1381
+ }>;
1382
+ };
1383
+ };
1384
+ export type ListNoteTypesResponse = ListNoteTypesResponses[keyof ListNoteTypesResponses];
1385
+ export type CreateNoteTypeData = {
1386
+ body: {
1387
+ /**
1388
+ * Start from one of Anki's stock designs.
1389
+ */
1390
+ stock?: string;
1391
+ /**
1392
+ * Name of the note type.
1393
+ */
1394
+ name?: string;
1395
+ kind?: 'normal' | 'cloze';
1396
+ /**
1397
+ * Field definitions, in order. Each needs a `name`.
1398
+ */
1399
+ fields?: Array<{
1400
+ [key: string]: unknown;
1401
+ }>;
1402
+ /**
1403
+ * Card templates. Each needs a `name`, a question format `qFormat` and an answer format `aFormat`.
1404
+ */
1405
+ templates?: Array<{
1406
+ [key: string]: unknown;
1407
+ }>;
1408
+ css?: string;
1409
+ sortFieldIdx?: number;
1410
+ };
1411
+ headers?: {
1412
+ /**
1413
+ * Any unique string, such as a UUID. Send the same key when you retry a write: the first answer is replayed (marked `X-Idempotent-Replay: true`) instead of doing the work twice. Keys are remembered for 24 hours. Reusing a key with a different request is `422 idempotency_conflict`.
1414
+ */
1415
+ 'Idempotency-Key'?: string;
1416
+ };
1417
+ path?: never;
1418
+ query?: never;
1419
+ url: '/api/v1/note-types';
1420
+ };
1421
+ export type CreateNoteTypeErrors = {
1422
+ /**
1423
+ * The request was understood but is not valid, for example an unknown deck or a `fields` key that names no field of the note type. The code is `invalid_input`, `deck_error` or `card_type_error`.
1424
+ */
1425
+ 400: ApiError;
1426
+ /**
1427
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
1428
+ */
1429
+ 423: ApiError;
1430
+ /**
1431
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
1432
+ */
1433
+ 429: ApiError;
1434
+ };
1435
+ export type CreateNoteTypeError = CreateNoteTypeErrors[keyof CreateNoteTypeErrors];
1436
+ export type CreateNoteTypeResponses = {
1437
+ /**
1438
+ * Note type created
1439
+ */
1440
+ 201: {
1441
+ /**
1442
+ * Numeric id of the new note type.
1443
+ */
1444
+ id: number;
1445
+ /**
1446
+ * Its name.
1447
+ */
1448
+ name: string;
1449
+ };
1450
+ };
1451
+ export type CreateNoteTypeResponse = CreateNoteTypeResponses[keyof CreateNoteTypeResponses];
1452
+ export type DeleteNoteTypeData = {
1453
+ body?: never;
1454
+ headers?: {
1455
+ /**
1456
+ * Any unique string, such as a UUID. Send the same key when you retry a write: the first answer is replayed (marked `X-Idempotent-Replay: true`) instead of doing the work twice. Keys are remembered for 24 hours. Reusing a key with a different request is `422 idempotency_conflict`.
1457
+ */
1458
+ 'Idempotency-Key'?: string;
1459
+ };
1460
+ path: {
1461
+ /**
1462
+ * The numeric id, as returned by the list endpoint or when it was created.
1463
+ */
1464
+ id: number;
1465
+ };
1466
+ query?: {
1467
+ /**
1468
+ * Set to `true` to accept that this change forces every device to download the whole collection again on its next sync. Without it the request is refused with `409 full_sync_required`.
1469
+ */
1470
+ acceptFullSync?: boolean;
1471
+ };
1472
+ url: '/api/v1/note-types/{id}';
1473
+ };
1474
+ export type DeleteNoteTypeErrors = {
1475
+ /**
1476
+ * The key lacks the scope, the account is suspended or its email unverified, the account is over its storage quota (`over_quota`; deleting is still allowed), or a destructive schema change is switched off (`destructive_change_disabled`).
1477
+ */
1478
+ 403: ApiError;
1479
+ /**
1480
+ * No deck, note, note type or card has that id.
1481
+ */
1482
+ 404: ApiError;
1483
+ /**
1484
+ * The change alters the collection's schema and needs `?acceptFullSync=true` (`full_sync_required`), or the card is in a state that does not allow this (`card_state_error`: suspended, buried, in a filtered deck, or an unsupported scheduler).
1485
+ */
1486
+ 409: ApiError;
1487
+ /**
1488
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
1489
+ */
1490
+ 423: ApiError;
1491
+ /**
1492
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
1493
+ */
1494
+ 429: ApiError;
1495
+ };
1496
+ export type DeleteNoteTypeError = DeleteNoteTypeErrors[keyof DeleteNoteTypeErrors];
1497
+ export type DeleteNoteTypeResponses = {
1498
+ /**
1499
+ * Note type deleted
1500
+ */
1501
+ 200: {
1502
+ /**
1503
+ * `true` when the note type was deleted.
1504
+ */
1505
+ ok: boolean;
1506
+ /**
1507
+ * Notes that used the note type and were removed.
1508
+ */
1509
+ deletedNotes: number;
1510
+ /**
1511
+ * Cards of those notes, removed with them.
1512
+ */
1513
+ deletedCards: number;
1514
+ /**
1515
+ * The note type Anki now treats as current: the first by name, or a new Basic one if none were left.
1516
+ */
1517
+ currentNotetypeId: number;
1518
+ /**
1519
+ * `true` when that was the last note type, so a stock Basic one was added.
1520
+ */
1521
+ addedBasic: boolean;
1522
+ };
1523
+ };
1524
+ export type DeleteNoteTypeResponse = DeleteNoteTypeResponses[keyof DeleteNoteTypeResponses];
1525
+ export type GetNoteTypeData = {
1526
+ body?: never;
1527
+ path: {
1528
+ /**
1529
+ * The numeric id, as returned by the list endpoint or when it was created.
1530
+ */
1531
+ id: number;
1532
+ };
1533
+ query?: never;
1534
+ url: '/api/v1/note-types/{id}';
1535
+ };
1536
+ export type GetNoteTypeErrors = {
1537
+ /**
1538
+ * No deck, note, note type or card has that id.
1539
+ */
1540
+ 404: ApiError;
1541
+ /**
1542
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
1543
+ */
1544
+ 429: ApiError;
1545
+ };
1546
+ export type GetNoteTypeError = GetNoteTypeErrors[keyof GetNoteTypeErrors];
1547
+ export type GetNoteTypeResponses = {
1548
+ /**
1549
+ * Note type details
1550
+ */
1551
+ 200: NoteTypeDetails;
1552
+ };
1553
+ export type GetNoteTypeResponse = GetNoteTypeResponses[keyof GetNoteTypeResponses];
1554
+ export type UpdateNoteTypeData = {
1555
+ body: {
1556
+ name?: string;
1557
+ css?: string;
1558
+ sortFieldIdx?: number;
1559
+ /**
1560
+ * The full list of fields. A field with an `ord` is an existing one being kept or renamed; one without is new; an existing one that is missing is removed.
1561
+ */
1562
+ fields?: Array<{
1563
+ [key: string]: unknown;
1564
+ }>;
1565
+ /**
1566
+ * The full list of templates, following the same rule as `fields`.
1567
+ */
1568
+ templates?: Array<{
1569
+ [key: string]: unknown;
1570
+ }>;
1571
+ };
1572
+ headers?: {
1573
+ /**
1574
+ * Any unique string, such as a UUID. Send the same key when you retry a write: the first answer is replayed (marked `X-Idempotent-Replay: true`) instead of doing the work twice. Keys are remembered for 24 hours. Reusing a key with a different request is `422 idempotency_conflict`.
1575
+ */
1576
+ 'Idempotency-Key'?: string;
1577
+ };
1578
+ path: {
1579
+ /**
1580
+ * The numeric id, as returned by the list endpoint or when it was created.
1581
+ */
1582
+ id: number;
1583
+ };
1584
+ query?: {
1585
+ /**
1586
+ * Set to `true` to accept that this change forces every device to download the whole collection again on its next sync. Without it the request is refused with `409 full_sync_required`.
1587
+ */
1588
+ acceptFullSync?: boolean;
1589
+ };
1590
+ url: '/api/v1/note-types/{id}';
1591
+ };
1592
+ export type UpdateNoteTypeErrors = {
1593
+ /**
1594
+ * The key lacks the scope, the account is suspended or its email unverified, the account is over its storage quota (`over_quota`; deleting is still allowed), or a destructive schema change is switched off (`destructive_change_disabled`).
1595
+ */
1596
+ 403: ApiError;
1597
+ /**
1598
+ * No deck, note, note type or card has that id.
1599
+ */
1600
+ 404: ApiError;
1601
+ /**
1602
+ * The change alters the collection's schema and needs `?acceptFullSync=true` (`full_sync_required`), or the card is in a state that does not allow this (`card_state_error`: suspended, buried, in a filtered deck, or an unsupported scheduler).
1603
+ */
1604
+ 409: ApiError;
1605
+ /**
1606
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
1607
+ */
1608
+ 423: ApiError;
1609
+ /**
1610
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
1611
+ */
1612
+ 429: ApiError;
1613
+ };
1614
+ export type UpdateNoteTypeError = UpdateNoteTypeErrors[keyof UpdateNoteTypeErrors];
1615
+ export type UpdateNoteTypeResponses = {
1616
+ /**
1617
+ * Note type updated
1618
+ */
1619
+ 200: {
1620
+ /**
1621
+ * Numeric id of the note type.
1622
+ */
1623
+ id: number;
1624
+ /**
1625
+ * Its name after the change.
1626
+ */
1627
+ name: string;
1628
+ /**
1629
+ * `true` when the change altered the collection's schema, so every device downloads the whole collection on its next sync.
1630
+ */
1631
+ schemaChanged: boolean;
1632
+ /**
1633
+ * What the change did to the note type's structure: how many fields and templates were added, removed or moved.
1634
+ */
1635
+ change: NotetypeChange;
1636
+ /**
1637
+ * Notes that were rewritten because a field was added, removed or moved, or the sort field changed.
1638
+ */
1639
+ updatedNotes: number;
1640
+ /**
1641
+ * Cards that were deleted because their template was removed.
1642
+ */
1643
+ deletedCards: number;
1644
+ /**
1645
+ * Cards whose template moved to a different position, so their number changed.
1646
+ */
1647
+ movedCards: number;
1648
+ /**
1649
+ * Cards that were generated because a template was added or now produces a card.
1650
+ */
1651
+ newCards: number;
1652
+ };
1653
+ };
1654
+ export type UpdateNoteTypeResponse = UpdateNoteTypeResponses[keyof UpdateNoteTypeResponses];
1655
+ export type GetStudyQueueData = {
1656
+ body?: never;
1657
+ path?: never;
1658
+ query?: {
1659
+ /**
1660
+ * Only items that belong to this deck.
1661
+ */
1662
+ deckId?: number;
1663
+ /**
1664
+ * Page size, from 1 to 100. Defaults to 50.
1665
+ */
1666
+ limit?: number;
1667
+ };
1668
+ url: '/api/v1/queue';
1669
+ };
1670
+ export type GetStudyQueueErrors = {
1671
+ /**
1672
+ * No deck, note, note type or card has that id.
1673
+ */
1674
+ 404: ApiError;
1675
+ /**
1676
+ * The change alters the collection's schema and needs `?acceptFullSync=true` (`full_sync_required`), or the card is in a state that does not allow this (`card_state_error`: suspended, buried, in a filtered deck, or an unsupported scheduler).
1677
+ */
1678
+ 409: ApiError;
1679
+ /**
1680
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
1681
+ */
1682
+ 429: ApiError;
1683
+ };
1684
+ export type GetStudyQueueError = GetStudyQueueErrors[keyof GetStudyQueueErrors];
1685
+ export type GetStudyQueueResponses = {
1686
+ /**
1687
+ * The next cards to study, in order
1688
+ */
1689
+ 200: {
1690
+ deckId: number;
1691
+ counts: {
1692
+ new: number;
1693
+ learning: number;
1694
+ review: number;
1695
+ };
1696
+ total: number;
1697
+ learnAheadSecs: number;
1698
+ cards: Array<Card & {
1699
+ kind: 'new' | 'learning' | 'review';
1700
+ }>;
1701
+ };
1702
+ };
1703
+ export type GetStudyQueueResponse = GetStudyQueueResponses[keyof GetStudyQueueResponses];
1704
+ export type ListTagsData = {
1705
+ body?: never;
1706
+ path?: never;
1707
+ query?: never;
1708
+ url: '/api/v1/tags';
1709
+ };
1710
+ export type ListTagsErrors = {
1711
+ /**
1712
+ * The `Authorization` header is missing, or the key is invalid, disabled or expired.
1713
+ */
1714
+ 401: ApiError;
1715
+ /**
1716
+ * The key lacks the scope, the account is suspended or its email unverified, the account is over its storage quota (`over_quota`; deleting is still allowed), or a destructive schema change is switched off (`destructive_change_disabled`).
1717
+ */
1718
+ 403: ApiError;
1719
+ /**
1720
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
1721
+ */
1722
+ 429: ApiError;
1723
+ };
1724
+ export type ListTagsError = ListTagsErrors[keyof ListTagsErrors];
1725
+ export type ListTagsResponses = {
1726
+ /**
1727
+ * List of tags
1728
+ */
1729
+ 200: {
1730
+ /**
1731
+ * Every tag, sorted by name.
1732
+ */
1733
+ tags: Array<string>;
1734
+ };
1735
+ };
1736
+ export type ListTagsResponse = ListTagsResponses[keyof ListTagsResponses];
1737
+ export type CreateTagData = {
1738
+ body: {
1739
+ /**
1740
+ * The tag, with `::` for nesting. It can not contain a space or have an empty part.
1741
+ */
1742
+ name: string;
1743
+ };
1744
+ headers?: {
1745
+ /**
1746
+ * Any unique string, such as a UUID. Send the same key when you retry a write: the first answer is replayed (marked `X-Idempotent-Replay: true`) instead of doing the work twice. Keys are remembered for 24 hours. Reusing a key with a different request is `422 idempotency_conflict`.
1747
+ */
1748
+ 'Idempotency-Key'?: string;
1749
+ };
1750
+ path?: never;
1751
+ query?: never;
1752
+ url: '/api/v1/tags';
1753
+ };
1754
+ export type CreateTagErrors = {
1755
+ /**
1756
+ * The request was understood but is not valid, for example an unknown deck or a `fields` key that names no field of the note type. The code is `invalid_input`, `deck_error` or `card_type_error`.
1757
+ */
1758
+ 400: ApiError;
1759
+ /**
1760
+ * The key lacks the scope, the account is suspended or its email unverified, the account is over its storage quota (`over_quota`; deleting is still allowed), or a destructive schema change is switched off (`destructive_change_disabled`).
1761
+ */
1762
+ 403: ApiError;
1763
+ /**
1764
+ * The body does not match the earlier request that used this `Idempotency-Key` (`idempotency_conflict`), or the body failed validation (`validation_error`).
1765
+ */
1766
+ 422: ApiError;
1767
+ /**
1768
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
1769
+ */
1770
+ 423: ApiError;
1771
+ /**
1772
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
1773
+ */
1774
+ 429: ApiError;
1775
+ };
1776
+ export type CreateTagError = CreateTagErrors[keyof CreateTagErrors];
1777
+ export type CreateTagResponses = {
1778
+ /**
1779
+ * The tag already existed
1780
+ */
1781
+ 200: CreatedTag;
1782
+ /**
1783
+ * Tag created
1784
+ */
1785
+ 201: CreatedTag;
1786
+ };
1787
+ export type CreateTagResponse = CreateTagResponses[keyof CreateTagResponses];
1788
+ export type DeleteTagData = {
1789
+ body?: never;
1790
+ headers?: {
1791
+ /**
1792
+ * Any unique string, such as a UUID. Send the same key when you retry a write: the first answer is replayed (marked `X-Idempotent-Replay: true`) instead of doing the work twice. Keys are remembered for 24 hours. Reusing a key with a different request is `422 idempotency_conflict`.
1793
+ */
1794
+ 'Idempotency-Key'?: string;
1795
+ };
1796
+ path: {
1797
+ /**
1798
+ * The tag's name, percent-encoded: `Languages%3A%3AGerman` is `Languages::German`.
1799
+ */
1800
+ name: string;
1801
+ };
1802
+ query?: never;
1803
+ url: '/api/v1/tags/{name}';
1804
+ };
1805
+ export type DeleteTagErrors = {
1806
+ /**
1807
+ * The request was understood but is not valid, for example an unknown deck or a `fields` key that names no field of the note type. The code is `invalid_input`, `deck_error` or `card_type_error`.
1808
+ */
1809
+ 400: ApiError;
1810
+ /**
1811
+ * The key lacks the scope, the account is suspended or its email unverified, the account is over its storage quota (`over_quota`; deleting is still allowed), or a destructive schema change is switched off (`destructive_change_disabled`).
1812
+ */
1813
+ 403: ApiError;
1814
+ /**
1815
+ * No deck, note, note type or card has that id.
1816
+ */
1817
+ 404: ApiError;
1818
+ /**
1819
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
1820
+ */
1821
+ 423: ApiError;
1822
+ /**
1823
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
1824
+ */
1825
+ 429: ApiError;
1826
+ };
1827
+ export type DeleteTagError = DeleteTagErrors[keyof DeleteTagErrors];
1828
+ export type DeleteTagResponses = {
1829
+ /**
1830
+ * Tag deleted
1831
+ */
1832
+ 200: {
1833
+ ok: boolean;
1834
+ /**
1835
+ * The tags that were removed from the list: the one named and those nested under it.
1836
+ */
1837
+ deletedTags: Array<string>;
1838
+ /**
1839
+ * How many notes lost a tag.
1840
+ */
1841
+ notes: number;
1842
+ };
1843
+ };
1844
+ export type DeleteTagResponse = DeleteTagResponses[keyof DeleteTagResponses];
1845
+ export type GetTagData = {
1846
+ body?: never;
1847
+ path: {
1848
+ /**
1849
+ * The tag's name, percent-encoded: `Languages%3A%3AGerman` is `Languages::German`.
1850
+ */
1851
+ name: string;
1852
+ };
1853
+ query?: never;
1854
+ url: '/api/v1/tags/{name}';
1855
+ };
1856
+ export type GetTagErrors = {
1857
+ /**
1858
+ * The request was understood but is not valid, for example an unknown deck or a `fields` key that names no field of the note type. The code is `invalid_input`, `deck_error` or `card_type_error`.
1859
+ */
1860
+ 400: ApiError;
1861
+ /**
1862
+ * No deck, note, note type or card has that id.
1863
+ */
1864
+ 404: ApiError;
1865
+ /**
1866
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
1867
+ */
1868
+ 429: ApiError;
1869
+ };
1870
+ export type GetTagError = GetTagErrors[keyof GetTagErrors];
1871
+ export type GetTagResponses = {
1872
+ /**
1873
+ * Tag details
1874
+ */
1875
+ 200: Tag;
1876
+ };
1877
+ export type GetTagResponse = GetTagResponses[keyof GetTagResponses];
1878
+ export type RenameTagData = {
1879
+ body: {
1880
+ /**
1881
+ * The new name. If it is already a tag, the two are merged.
1882
+ */
1883
+ newName: string;
1884
+ };
1885
+ headers?: {
1886
+ /**
1887
+ * Any unique string, such as a UUID. Send the same key when you retry a write: the first answer is replayed (marked `X-Idempotent-Replay: true`) instead of doing the work twice. Keys are remembered for 24 hours. Reusing a key with a different request is `422 idempotency_conflict`.
1888
+ */
1889
+ 'Idempotency-Key'?: string;
1890
+ };
1891
+ path: {
1892
+ /**
1893
+ * The tag's name, percent-encoded: `Languages%3A%3AGerman` is `Languages::German`.
1894
+ */
1895
+ name: string;
1896
+ };
1897
+ query?: never;
1898
+ url: '/api/v1/tags/{name}';
1899
+ };
1900
+ export type RenameTagErrors = {
1901
+ /**
1902
+ * The request was understood but is not valid, for example an unknown deck or a `fields` key that names no field of the note type. The code is `invalid_input`, `deck_error` or `card_type_error`.
1903
+ */
1904
+ 400: ApiError;
1905
+ /**
1906
+ * The key lacks the scope, the account is suspended or its email unverified, the account is over its storage quota (`over_quota`; deleting is still allowed), or a destructive schema change is switched off (`destructive_change_disabled`).
1907
+ */
1908
+ 403: ApiError;
1909
+ /**
1910
+ * No deck, note, note type or card has that id.
1911
+ */
1912
+ 404: ApiError;
1913
+ /**
1914
+ * The body does not match the earlier request that used this `Idempotency-Key` (`idempotency_conflict`), or the body failed validation (`validation_error`).
1915
+ */
1916
+ 422: ApiError;
1917
+ /**
1918
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
1919
+ */
1920
+ 423: ApiError;
1921
+ /**
1922
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
1923
+ */
1924
+ 429: ApiError;
1925
+ };
1926
+ export type RenameTagError = RenameTagErrors[keyof RenameTagErrors];
1927
+ export type RenameTagResponses = {
1928
+ /**
1929
+ * Tag renamed
1930
+ */
1931
+ 200: RenamedTag;
1932
+ };
1933
+ export type RenameTagResponse = RenameTagResponses[keyof RenameTagResponses];
1934
+ export type CreateTagsBatchData = {
1935
+ body: {
1936
+ /**
1937
+ * The tags to create, 1 to 200.
1938
+ */
1939
+ names: Array<string>;
1940
+ /**
1941
+ * Write all or nothing. See [Create many notes](#createNotesBatch).
1942
+ */
1943
+ atomic?: boolean;
1944
+ };
1945
+ headers?: {
1946
+ /**
1947
+ * Any unique string, such as a UUID. Send the same key when you retry a write: the first answer is replayed (marked `X-Idempotent-Replay: true`) instead of doing the work twice. Keys are remembered for 24 hours. Reusing a key with a different request is `422 idempotency_conflict`.
1948
+ */
1949
+ 'Idempotency-Key'?: string;
1950
+ };
1951
+ path?: never;
1952
+ query?: never;
1953
+ url: '/api/v1/tags/batch-create';
1954
+ };
1955
+ export type CreateTagsBatchErrors = {
1956
+ /**
1957
+ * The request was understood but is not valid, for example an unknown deck or a `fields` key that names no field of the note type. The code is `invalid_input`, `deck_error` or `card_type_error`.
1958
+ */
1959
+ 400: ApiError;
1960
+ /**
1961
+ * The key lacks the scope, the account is suspended or its email unverified, the account is over its storage quota (`over_quota`; deleting is still allowed), or a destructive schema change is switched off (`destructive_change_disabled`).
1962
+ */
1963
+ 403: ApiError;
1964
+ /**
1965
+ * The body failed validation (`validation_error`), or the call was `atomic` and an entry was refused: then the body is the usual batch answer with every entry's `error`, and nothing was written.
1966
+ */
1967
+ 422: ApiError | CreateNotesBatchResult | UpdateNotesBatchResult | UpdateCardsBatchResult;
1968
+ /**
1969
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
1970
+ */
1971
+ 423: ApiError;
1972
+ /**
1973
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
1974
+ */
1975
+ 429: ApiError;
1976
+ /**
1977
+ * Other batch operations are using the server. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
1978
+ */
1979
+ 503: ApiError;
1980
+ };
1981
+ export type CreateTagsBatchError = CreateTagsBatchErrors[keyof CreateTagsBatchErrors];
1982
+ export type CreateTagsBatchResponses = {
1983
+ /**
1984
+ * Every entry was handled; see `results`
1985
+ */
1986
+ 200: CreateTagsBatchResult;
1987
+ };
1988
+ export type CreateTagsBatchResponse = CreateTagsBatchResponses[keyof CreateTagsBatchResponses];
1989
+ export type UpdateTagsBatchData = {
1990
+ body: {
1991
+ /**
1992
+ * The renames, 1 to 200.
1993
+ */
1994
+ updates: Array<UpdateTagsBatchEntry>;
1995
+ /**
1996
+ * Write all or nothing. See [Create many notes](#createNotesBatch).
1997
+ */
1998
+ atomic?: boolean;
1999
+ };
2000
+ headers?: {
2001
+ /**
2002
+ * Any unique string, such as a UUID. Send the same key when you retry a write: the first answer is replayed (marked `X-Idempotent-Replay: true`) instead of doing the work twice. Keys are remembered for 24 hours. Reusing a key with a different request is `422 idempotency_conflict`.
2003
+ */
2004
+ 'Idempotency-Key'?: string;
2005
+ };
2006
+ path?: never;
2007
+ query?: never;
2008
+ url: '/api/v1/tags/batch-update';
2009
+ };
2010
+ export type UpdateTagsBatchErrors = {
2011
+ /**
2012
+ * The request was understood but is not valid, for example an unknown deck or a `fields` key that names no field of the note type. The code is `invalid_input`, `deck_error` or `card_type_error`.
2013
+ */
2014
+ 400: ApiError;
2015
+ /**
2016
+ * The key lacks the scope, the account is suspended or its email unverified, the account is over its storage quota (`over_quota`; deleting is still allowed), or a destructive schema change is switched off (`destructive_change_disabled`).
2017
+ */
2018
+ 403: ApiError;
2019
+ /**
2020
+ * The body failed validation (`validation_error`), or the call was `atomic` and an entry was refused: then the body is the usual batch answer with every entry's `error`, and nothing was written.
2021
+ */
2022
+ 422: ApiError | CreateNotesBatchResult | UpdateNotesBatchResult | UpdateCardsBatchResult;
2023
+ /**
2024
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
2025
+ */
2026
+ 423: ApiError;
2027
+ /**
2028
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
2029
+ */
2030
+ 429: ApiError;
2031
+ /**
2032
+ * Other batch operations are using the server. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
2033
+ */
2034
+ 503: ApiError;
2035
+ };
2036
+ export type UpdateTagsBatchError = UpdateTagsBatchErrors[keyof UpdateTagsBatchErrors];
2037
+ export type UpdateTagsBatchResponses = {
2038
+ /**
2039
+ * Every entry was handled; see `results`
2040
+ */
2041
+ 200: UpdateTagsBatchResult;
2042
+ };
2043
+ export type UpdateTagsBatchResponse = UpdateTagsBatchResponses[keyof UpdateTagsBatchResponses];
2044
+ export type DeleteTagsBatchData = {
2045
+ body: {
2046
+ /**
2047
+ * The tags to delete, 1 to 1000.
2048
+ */
2049
+ names: Array<string>;
2050
+ };
2051
+ headers?: {
2052
+ /**
2053
+ * Any unique string, such as a UUID. Send the same key when you retry a write: the first answer is replayed (marked `X-Idempotent-Replay: true`) instead of doing the work twice. Keys are remembered for 24 hours. Reusing a key with a different request is `422 idempotency_conflict`.
2054
+ */
2055
+ 'Idempotency-Key'?: string;
2056
+ };
2057
+ path?: never;
2058
+ query?: never;
2059
+ url: '/api/v1/tags/batch-delete';
2060
+ };
2061
+ export type DeleteTagsBatchErrors = {
2062
+ /**
2063
+ * The request was understood but is not valid, for example an unknown deck or a `fields` key that names no field of the note type. The code is `invalid_input`, `deck_error` or `card_type_error`.
2064
+ */
2065
+ 400: ApiError;
2066
+ /**
2067
+ * The key lacks the scope, the account is suspended or its email unverified, the account is over its storage quota (`over_quota`; deleting is still allowed), or a destructive schema change is switched off (`destructive_change_disabled`).
2068
+ */
2069
+ 403: ApiError;
2070
+ /**
2071
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
2072
+ */
2073
+ 423: ApiError;
2074
+ /**
2075
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
2076
+ */
2077
+ 429: ApiError;
2078
+ /**
2079
+ * Other batch operations are using the server. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
2080
+ */
2081
+ 503: ApiError;
2082
+ };
2083
+ export type DeleteTagsBatchError = DeleteTagsBatchErrors[keyof DeleteTagsBatchErrors];
2084
+ export type DeleteTagsBatchResponses = {
2085
+ /**
2086
+ * The tags that existed were deleted
2087
+ */
2088
+ 200: {
2089
+ /**
2090
+ * How many tags were removed from the list.
2091
+ */
2092
+ deleted: number;
2093
+ /**
2094
+ * The tags that were removed: those named and those nested under them.
2095
+ */
2096
+ deletedTags: Array<string>;
2097
+ /**
2098
+ * How many notes lost a tag.
2099
+ */
2100
+ notes: number;
2101
+ /**
2102
+ * Names that matched nothing and were ignored.
2103
+ */
2104
+ missingNames: Array<string>;
2105
+ };
2106
+ };
2107
+ export type DeleteTagsBatchResponse = DeleteTagsBatchResponses[keyof DeleteTagsBatchResponses];
2108
+ export type GetStatsData = {
2109
+ body?: never;
2110
+ path?: never;
2111
+ query?: {
2112
+ /**
2113
+ * A search, written in Anki's search syntax (the Searching chapter of the Anki manual): the same text you would type in the browser. Words match note text; `-` negates; `or`, `and` and parentheses combine; quotes group. Fields: `front:dog`, `front:*og`, `front:re:^d`, `*:text`, `nc:cafe` (ignore accents), `sc:text` (inside clozes), `re:regex`, `w:word`, `dupe:notetypeId,text`. Notes and cards: `deck:`, `note:`, `card:`, `tag:`, `preset:`, `flag:`, `nid:`, `cid:`, `is:new|learn|review|due|suspended|buried|buried-manually|buried-sibling`. Time: `added:`, `edited:`, `introduced:`, `rated:days[:button]`, `resched:`. Properties: `prop:ivl>=21`, `reps`, `lapses`, `ease`, `due`, `pos`, `rated`, and FSRS `s`, `d`, `r`; `prop:cdn:key>1`, `prop:cds:key=x` and `has-cd:key` for custom data. A search that Anki would refuse is `400 invalid_input` with Anki's own explanation. Differences from desktop Anki: regular expressions run on the RE2 engine (a `(?x)` flag, class set operations such as `[a-z&&[^aeiou]]`, backreferences and `\Q..\E` are `400 invalid_input`, and `\b` uses ASCII word characters, so use `w:` for Unicode words), and a search may be at most 1000 characters and 50 terms.
2114
+ */
2115
+ q?: string;
2116
+ /**
2117
+ * Days of review history to count, from today back; `0` (the default) is all of it. At most 36500.
2118
+ */
2119
+ days?: number;
2120
+ };
2121
+ url: '/api/v1/stats';
2122
+ };
2123
+ export type GetStatsErrors = {
2124
+ /**
2125
+ * The request was understood but is not valid, for example an unknown deck or a `fields` key that names no field of the note type. The code is `invalid_input`, `deck_error` or `card_type_error`.
2126
+ */
2127
+ 400: ApiError;
2128
+ /**
2129
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
2130
+ */
2131
+ 429: ApiError;
2132
+ };
2133
+ export type GetStatsError = GetStatsErrors[keyof GetStatsErrors];
2134
+ export type GetStatsResponses = {
2135
+ /**
2136
+ * The graphs of Anki's statistics screen
2137
+ */
2138
+ 200: {
2139
+ /**
2140
+ * How many times each answer button (Again, Hard, Good, Easy: the four numbers, in that order) was pressed, in learning, on young review cards (interval under 21 days) and on mature ones, over the last month, three months, year and all time.
2141
+ */
2142
+ buttons: {
2143
+ oneMonth: {
2144
+ learning: [
2145
+ number,
2146
+ number,
2147
+ number,
2148
+ number
2149
+ ];
2150
+ young: [
2151
+ number,
2152
+ number,
2153
+ number,
2154
+ number
2155
+ ];
2156
+ mature: [
2157
+ number,
2158
+ number,
2159
+ number,
2160
+ number
2161
+ ];
2162
+ };
2163
+ threeMonths: {
2164
+ learning: [
2165
+ number,
2166
+ number,
2167
+ number,
2168
+ number
2169
+ ];
2170
+ young: [
2171
+ number,
2172
+ number,
2173
+ number,
2174
+ number
2175
+ ];
2176
+ mature: [
2177
+ number,
2178
+ number,
2179
+ number,
2180
+ number
2181
+ ];
2182
+ };
2183
+ oneYear: {
2184
+ learning: [
2185
+ number,
2186
+ number,
2187
+ number,
2188
+ number
2189
+ ];
2190
+ young: [
2191
+ number,
2192
+ number,
2193
+ number,
2194
+ number
2195
+ ];
2196
+ mature: [
2197
+ number,
2198
+ number,
2199
+ number,
2200
+ number
2201
+ ];
2202
+ };
2203
+ allTime: {
2204
+ learning: [
2205
+ number,
2206
+ number,
2207
+ number,
2208
+ number
2209
+ ];
2210
+ young: [
2211
+ number,
2212
+ number,
2213
+ number,
2214
+ number
2215
+ ];
2216
+ mature: [
2217
+ number,
2218
+ number,
2219
+ number,
2220
+ number
2221
+ ];
2222
+ };
2223
+ };
2224
+ /**
2225
+ * Cards by kind. `includingInactive` counts suspended and buried cards by their kind; `excludingInactive` counts them only as `suspended` and `buried`. `young` and `mature` are review cards with an interval under and over 21 days.
2226
+ */
2227
+ cardCounts: {
2228
+ includingInactive: {
2229
+ new: number;
2230
+ learn: number;
2231
+ relearn: number;
2232
+ young: number;
2233
+ mature: number;
2234
+ suspended: number;
2235
+ buried: number;
2236
+ };
2237
+ excludingInactive: {
2238
+ new: number;
2239
+ learn: number;
2240
+ relearn: number;
2241
+ young: number;
2242
+ mature: number;
2243
+ suspended: number;
2244
+ buried: number;
2245
+ };
2246
+ };
2247
+ /**
2248
+ * Answers by hour of the day (24 entries, hour 0 first), in the collection's `localOffset`: how many (`total`) and how many were not Again (`correct`), over the last month, three months, year and all time.
2249
+ */
2250
+ hours: {
2251
+ oneMonth: [
2252
+ {
2253
+ total: number;
2254
+ correct: number;
2255
+ },
2256
+ {
2257
+ total: number;
2258
+ correct: number;
2259
+ },
2260
+ {
2261
+ total: number;
2262
+ correct: number;
2263
+ },
2264
+ {
2265
+ total: number;
2266
+ correct: number;
2267
+ },
2268
+ {
2269
+ total: number;
2270
+ correct: number;
2271
+ },
2272
+ {
2273
+ total: number;
2274
+ correct: number;
2275
+ },
2276
+ {
2277
+ total: number;
2278
+ correct: number;
2279
+ },
2280
+ {
2281
+ total: number;
2282
+ correct: number;
2283
+ },
2284
+ {
2285
+ total: number;
2286
+ correct: number;
2287
+ },
2288
+ {
2289
+ total: number;
2290
+ correct: number;
2291
+ },
2292
+ {
2293
+ total: number;
2294
+ correct: number;
2295
+ },
2296
+ {
2297
+ total: number;
2298
+ correct: number;
2299
+ },
2300
+ {
2301
+ total: number;
2302
+ correct: number;
2303
+ },
2304
+ {
2305
+ total: number;
2306
+ correct: number;
2307
+ },
2308
+ {
2309
+ total: number;
2310
+ correct: number;
2311
+ },
2312
+ {
2313
+ total: number;
2314
+ correct: number;
2315
+ },
2316
+ {
2317
+ total: number;
2318
+ correct: number;
2319
+ },
2320
+ {
2321
+ total: number;
2322
+ correct: number;
2323
+ },
2324
+ {
2325
+ total: number;
2326
+ correct: number;
2327
+ },
2328
+ {
2329
+ total: number;
2330
+ correct: number;
2331
+ },
2332
+ {
2333
+ total: number;
2334
+ correct: number;
2335
+ },
2336
+ {
2337
+ total: number;
2338
+ correct: number;
2339
+ },
2340
+ {
2341
+ total: number;
2342
+ correct: number;
2343
+ },
2344
+ {
2345
+ total: number;
2346
+ correct: number;
2347
+ }
2348
+ ];
2349
+ threeMonths: [
2350
+ {
2351
+ total: number;
2352
+ correct: number;
2353
+ },
2354
+ {
2355
+ total: number;
2356
+ correct: number;
2357
+ },
2358
+ {
2359
+ total: number;
2360
+ correct: number;
2361
+ },
2362
+ {
2363
+ total: number;
2364
+ correct: number;
2365
+ },
2366
+ {
2367
+ total: number;
2368
+ correct: number;
2369
+ },
2370
+ {
2371
+ total: number;
2372
+ correct: number;
2373
+ },
2374
+ {
2375
+ total: number;
2376
+ correct: number;
2377
+ },
2378
+ {
2379
+ total: number;
2380
+ correct: number;
2381
+ },
2382
+ {
2383
+ total: number;
2384
+ correct: number;
2385
+ },
2386
+ {
2387
+ total: number;
2388
+ correct: number;
2389
+ },
2390
+ {
2391
+ total: number;
2392
+ correct: number;
2393
+ },
2394
+ {
2395
+ total: number;
2396
+ correct: number;
2397
+ },
2398
+ {
2399
+ total: number;
2400
+ correct: number;
2401
+ },
2402
+ {
2403
+ total: number;
2404
+ correct: number;
2405
+ },
2406
+ {
2407
+ total: number;
2408
+ correct: number;
2409
+ },
2410
+ {
2411
+ total: number;
2412
+ correct: number;
2413
+ },
2414
+ {
2415
+ total: number;
2416
+ correct: number;
2417
+ },
2418
+ {
2419
+ total: number;
2420
+ correct: number;
2421
+ },
2422
+ {
2423
+ total: number;
2424
+ correct: number;
2425
+ },
2426
+ {
2427
+ total: number;
2428
+ correct: number;
2429
+ },
2430
+ {
2431
+ total: number;
2432
+ correct: number;
2433
+ },
2434
+ {
2435
+ total: number;
2436
+ correct: number;
2437
+ },
2438
+ {
2439
+ total: number;
2440
+ correct: number;
2441
+ },
2442
+ {
2443
+ total: number;
2444
+ correct: number;
2445
+ }
2446
+ ];
2447
+ oneYear: [
2448
+ {
2449
+ total: number;
2450
+ correct: number;
2451
+ },
2452
+ {
2453
+ total: number;
2454
+ correct: number;
2455
+ },
2456
+ {
2457
+ total: number;
2458
+ correct: number;
2459
+ },
2460
+ {
2461
+ total: number;
2462
+ correct: number;
2463
+ },
2464
+ {
2465
+ total: number;
2466
+ correct: number;
2467
+ },
2468
+ {
2469
+ total: number;
2470
+ correct: number;
2471
+ },
2472
+ {
2473
+ total: number;
2474
+ correct: number;
2475
+ },
2476
+ {
2477
+ total: number;
2478
+ correct: number;
2479
+ },
2480
+ {
2481
+ total: number;
2482
+ correct: number;
2483
+ },
2484
+ {
2485
+ total: number;
2486
+ correct: number;
2487
+ },
2488
+ {
2489
+ total: number;
2490
+ correct: number;
2491
+ },
2492
+ {
2493
+ total: number;
2494
+ correct: number;
2495
+ },
2496
+ {
2497
+ total: number;
2498
+ correct: number;
2499
+ },
2500
+ {
2501
+ total: number;
2502
+ correct: number;
2503
+ },
2504
+ {
2505
+ total: number;
2506
+ correct: number;
2507
+ },
2508
+ {
2509
+ total: number;
2510
+ correct: number;
2511
+ },
2512
+ {
2513
+ total: number;
2514
+ correct: number;
2515
+ },
2516
+ {
2517
+ total: number;
2518
+ correct: number;
2519
+ },
2520
+ {
2521
+ total: number;
2522
+ correct: number;
2523
+ },
2524
+ {
2525
+ total: number;
2526
+ correct: number;
2527
+ },
2528
+ {
2529
+ total: number;
2530
+ correct: number;
2531
+ },
2532
+ {
2533
+ total: number;
2534
+ correct: number;
2535
+ },
2536
+ {
2537
+ total: number;
2538
+ correct: number;
2539
+ },
2540
+ {
2541
+ total: number;
2542
+ correct: number;
2543
+ }
2544
+ ];
2545
+ allTime: [
2546
+ {
2547
+ total: number;
2548
+ correct: number;
2549
+ },
2550
+ {
2551
+ total: number;
2552
+ correct: number;
2553
+ },
2554
+ {
2555
+ total: number;
2556
+ correct: number;
2557
+ },
2558
+ {
2559
+ total: number;
2560
+ correct: number;
2561
+ },
2562
+ {
2563
+ total: number;
2564
+ correct: number;
2565
+ },
2566
+ {
2567
+ total: number;
2568
+ correct: number;
2569
+ },
2570
+ {
2571
+ total: number;
2572
+ correct: number;
2573
+ },
2574
+ {
2575
+ total: number;
2576
+ correct: number;
2577
+ },
2578
+ {
2579
+ total: number;
2580
+ correct: number;
2581
+ },
2582
+ {
2583
+ total: number;
2584
+ correct: number;
2585
+ },
2586
+ {
2587
+ total: number;
2588
+ correct: number;
2589
+ },
2590
+ {
2591
+ total: number;
2592
+ correct: number;
2593
+ },
2594
+ {
2595
+ total: number;
2596
+ correct: number;
2597
+ },
2598
+ {
2599
+ total: number;
2600
+ correct: number;
2601
+ },
2602
+ {
2603
+ total: number;
2604
+ correct: number;
2605
+ },
2606
+ {
2607
+ total: number;
2608
+ correct: number;
2609
+ },
2610
+ {
2611
+ total: number;
2612
+ correct: number;
2613
+ },
2614
+ {
2615
+ total: number;
2616
+ correct: number;
2617
+ },
2618
+ {
2619
+ total: number;
2620
+ correct: number;
2621
+ },
2622
+ {
2623
+ total: number;
2624
+ correct: number;
2625
+ },
2626
+ {
2627
+ total: number;
2628
+ correct: number;
2629
+ },
2630
+ {
2631
+ total: number;
2632
+ correct: number;
2633
+ },
2634
+ {
2635
+ total: number;
2636
+ correct: number;
2637
+ },
2638
+ {
2639
+ total: number;
2640
+ correct: number;
2641
+ }
2642
+ ];
2643
+ };
2644
+ /**
2645
+ * What was answered since the last day rollover: the number of answers and the milliseconds they took, how many were not Again, how many of those were on mature cards, and the answers by kind (`earlyReviewCount` is answers in a filtered deck).
2646
+ */
2647
+ today: {
2648
+ answerCount: number;
2649
+ answerMillis: number;
2650
+ correctCount: number;
2651
+ matureCorrect: number;
2652
+ matureCount: number;
2653
+ learnCount: number;
2654
+ reviewCount: number;
2655
+ relearnCount: number;
2656
+ earlyReviewCount: number;
2657
+ };
2658
+ /**
2659
+ * SM-2 cards: how many have each ease, as a percent (250 is 250%), and the median ease. Cards with an FSRS memory state are in `difficulty`.
2660
+ */
2661
+ eases: {
2662
+ eases: {
2663
+ [key: string]: number;
2664
+ };
2665
+ average: number;
2666
+ };
2667
+ /**
2668
+ * FSRS cards: how many fall in each 1% bin of difficulty (0 to 99), and the median difficulty in percent.
2669
+ */
2670
+ difficulty: {
2671
+ eases: {
2672
+ [key: string]: number;
2673
+ };
2674
+ average: number;
2675
+ };
2676
+ /**
2677
+ * Review and relearning cards by interval, in days.
2678
+ */
2679
+ intervals: {
2680
+ intervals: {
2681
+ [key: string]: number;
2682
+ };
2683
+ };
2684
+ /**
2685
+ * FSRS cards by stability, in days, rounded.
2686
+ */
2687
+ stability: {
2688
+ intervals: {
2689
+ [key: string]: number;
2690
+ };
2691
+ };
2692
+ /**
2693
+ * Cards that are due, by day (0 is today, 1 tomorrow, negative is overdue): suspended and new cards are left out, and buried cards that are already due. `haveBacklog` is true when something is overdue. `dailyLoad` is the average number of reviews a day the collection needs, from the intervals.
2694
+ */
2695
+ futureDue: {
2696
+ futureDue: {
2697
+ [key: string]: number;
2698
+ };
2699
+ haveBacklog: boolean;
2700
+ dailyLoad: number;
2701
+ };
2702
+ /**
2703
+ * Cards by the day they were created (0 is today, -1 yesterday).
2704
+ */
2705
+ added: {
2706
+ added: {
2707
+ [key: string]: number;
2708
+ };
2709
+ };
2710
+ /**
2711
+ * Answers (`count`) and the milliseconds they took (`time`) by day (0 is today, -1 yesterday), split into learning, relearning, young and mature review cards and filtered decks. Manual changes to the schedule are not answers.
2712
+ */
2713
+ reviews: {
2714
+ count: {
2715
+ [key: string]: {
2716
+ learn: number;
2717
+ relearn: number;
2718
+ young: number;
2719
+ mature: number;
2720
+ filtered: number;
2721
+ };
2722
+ };
2723
+ time: {
2724
+ [key: string]: {
2725
+ learn: number;
2726
+ relearn: number;
2727
+ young: number;
2728
+ mature: number;
2729
+ filtered: number;
2730
+ };
2731
+ };
2732
+ };
2733
+ /**
2734
+ * The hour of the day a new day starts (the `rollover` setting).
2735
+ */
2736
+ rolloverHour: number;
2737
+ /**
2738
+ * FSRS cards: how many fall in each 1% bin of the chance of recalling them now, the average in percent, and the sum of the chances over cards and over notes (the expected number of cards, and of notes, remembered).
2739
+ */
2740
+ retrievability: {
2741
+ retrievability: {
2742
+ [key: string]: number;
2743
+ };
2744
+ average: number;
2745
+ sumByCard: number;
2746
+ sumByNote: number;
2747
+ };
2748
+ /**
2749
+ * Whether the collection has FSRS turned on.
2750
+ */
2751
+ fsrs: boolean;
2752
+ /**
2753
+ * Of the review answers on cards that had an interval of a day or more, how many were passed and how many failed (Again), for young and mature cards: today, yesterday, the last week, month and year, and all time.
2754
+ */
2755
+ trueRetention: {
2756
+ today: {
2757
+ youngPassed: number;
2758
+ youngFailed: number;
2759
+ maturePassed: number;
2760
+ matureFailed: number;
2761
+ };
2762
+ yesterday: {
2763
+ youngPassed: number;
2764
+ youngFailed: number;
2765
+ maturePassed: number;
2766
+ matureFailed: number;
2767
+ };
2768
+ week: {
2769
+ youngPassed: number;
2770
+ youngFailed: number;
2771
+ maturePassed: number;
2772
+ matureFailed: number;
2773
+ };
2774
+ month: {
2775
+ youngPassed: number;
2776
+ youngFailed: number;
2777
+ maturePassed: number;
2778
+ matureFailed: number;
2779
+ };
2780
+ year: {
2781
+ youngPassed: number;
2782
+ youngFailed: number;
2783
+ maturePassed: number;
2784
+ matureFailed: number;
2785
+ };
2786
+ allTime: {
2787
+ youngPassed: number;
2788
+ youngFailed: number;
2789
+ maturePassed: number;
2790
+ matureFailed: number;
2791
+ };
2792
+ };
2793
+ /**
2794
+ * The number of cards the search matched.
2795
+ */
2796
+ cards: number;
2797
+ /**
2798
+ * The number of review-log entries read, which is the history inside `days` of the matched cards (all entries for an empty search, even those of deleted cards).
2799
+ */
2800
+ reviewEntries: number;
2801
+ /**
2802
+ * The clock the graphs use: `now` (when they were computed, which for a repeated request can be a few minutes ago) and `nextDayAt` (when the current day ends) in seconds since the epoch, `daysElapsed` since the collection was created, and `localOffsetSecs` east of UTC.
2803
+ */
2804
+ timing: {
2805
+ now: number;
2806
+ daysElapsed: number;
2807
+ nextDayAt: number;
2808
+ localOffsetSecs: number;
2809
+ };
2810
+ };
2811
+ };
2812
+ export type GetStatsResponse = GetStatsResponses[keyof GetStatsResponses];
2813
+ export type ListMediaData = {
2814
+ body?: never;
2815
+ path?: never;
2816
+ query?: {
2817
+ prefix?: string;
2818
+ /**
2819
+ * Page size, from 1 to 100. Defaults to 50.
2820
+ */
2821
+ limit?: number;
2822
+ /**
2823
+ * The id of the last item on the previous page, which is its `nextCursor`. Leave it out for the first page.
2824
+ */
2825
+ cursor?: string;
2826
+ };
2827
+ url: '/api/v1/media';
2828
+ };
2829
+ export type ListMediaErrors = {
2830
+ /**
2831
+ * The request was understood but is not valid, for example an unknown deck or a `fields` key that names no field of the note type. The code is `invalid_input`, `deck_error` or `card_type_error`.
2832
+ */
2833
+ 400: ApiError;
2834
+ /**
2835
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
2836
+ */
2837
+ 429: ApiError;
2838
+ };
2839
+ export type ListMediaError = ListMediaErrors[keyof ListMediaErrors];
2840
+ export type ListMediaResponses = {
2841
+ /**
2842
+ * A page of media files, in name order
2843
+ */
2844
+ 200: {
2845
+ items: Array<MediaFile>;
2846
+ nextCursor: string | null;
2847
+ };
2848
+ };
2849
+ export type ListMediaResponse = ListMediaResponses[keyof ListMediaResponses];
2850
+ export type DeleteMediaData = {
2851
+ body?: never;
2852
+ path: {
2853
+ /**
2854
+ * The tag's name, percent-encoded: `Languages%3A%3AGerman` is `Languages::German`.
2855
+ */
2856
+ name: string;
2857
+ };
2858
+ query?: never;
2859
+ url: '/api/v1/media/{name}';
2860
+ };
2861
+ export type DeleteMediaErrors = {
2862
+ /**
2863
+ * The key lacks the scope, the account is suspended or its email unverified, the account is over its storage quota (`over_quota`; deleting is still allowed), or a destructive schema change is switched off (`destructive_change_disabled`).
2864
+ */
2865
+ 403: ApiError;
2866
+ /**
2867
+ * No deck, note, note type or card has that id.
2868
+ */
2869
+ 404: ApiError;
2870
+ /**
2871
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
2872
+ */
2873
+ 423: ApiError;
2874
+ /**
2875
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
2876
+ */
2877
+ 429: ApiError;
2878
+ };
2879
+ export type DeleteMediaError = DeleteMediaErrors[keyof DeleteMediaErrors];
2880
+ export type DeleteMediaResponses = {
2881
+ /**
2882
+ * The file was deleted
2883
+ */
2884
+ 200: {
2885
+ ok: boolean;
2886
+ name: string;
2887
+ usn: number;
2888
+ };
2889
+ };
2890
+ export type DeleteMediaResponse = DeleteMediaResponses[keyof DeleteMediaResponses];
2891
+ export type GetMediaData = {
2892
+ body?: never;
2893
+ headers?: {
2894
+ Range?: string;
2895
+ };
2896
+ path: {
2897
+ /**
2898
+ * The tag's name, percent-encoded: `Languages%3A%3AGerman` is `Languages::German`.
2899
+ */
2900
+ name: string;
2901
+ };
2902
+ query?: never;
2903
+ url: '/api/v1/media/{name}';
2904
+ };
2905
+ export type GetMediaErrors = {
2906
+ /**
2907
+ * The key lacks the scope, the account is suspended or its email unverified, the account is over its storage quota (`over_quota`; deleting is still allowed), or a destructive schema change is switched off (`destructive_change_disabled`).
2908
+ */
2909
+ 403: ApiError;
2910
+ /**
2911
+ * No deck, note, note type or card has that id.
2912
+ */
2913
+ 404: ApiError;
2914
+ /**
2915
+ * The range is not inside the file
2916
+ */
2917
+ 416: unknown;
2918
+ /**
2919
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
2920
+ */
2921
+ 429: ApiError;
2922
+ };
2923
+ export type GetMediaError = GetMediaErrors[keyof GetMediaErrors];
2924
+ export type GetMediaResponses = {
2925
+ /**
2926
+ * The file
2927
+ */
2928
+ 200: Blob | File;
2929
+ /**
2930
+ * The requested byte range
2931
+ */
2932
+ 206: Blob | File;
2933
+ };
2934
+ export type GetMediaResponse = GetMediaResponses[keyof GetMediaResponses];
2935
+ export type PutMediaData = {
2936
+ body: Blob | File;
2937
+ path: {
2938
+ /**
2939
+ * The tag's name, percent-encoded: `Languages%3A%3AGerman` is `Languages::German`.
2940
+ */
2941
+ name: string;
2942
+ };
2943
+ query?: never;
2944
+ url: '/api/v1/media/{name}';
2945
+ };
2946
+ export type PutMediaErrors = {
2947
+ /**
2948
+ * The file name cannot be decoded (`invalid_media_name`), or the body is not as long as `Content-Length` says (`length_mismatch`)
2949
+ */
2950
+ 400: ApiError;
2951
+ /**
2952
+ * The key lacks the `write` scope, the account is suspended or unverified, the file would take the storage over its quota (`over_quota`), or the collection already holds the most file names it may (`media_entry_limit`)
2953
+ */
2954
+ 403: ApiError;
2955
+ /**
2956
+ * No Content-Length header (length_required)
2957
+ */
2958
+ 411: unknown;
2959
+ /**
2960
+ * A media file is larger than 100 MiB (`payload_too_large`).
2961
+ */
2962
+ 413: ApiError;
2963
+ /**
2964
+ * The name is not one Anki clients keep as it is (`invalid_media_name`), or the file is empty (`empty_file`)
2965
+ */
2966
+ 422: ApiError;
2967
+ /**
2968
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
2969
+ */
2970
+ 423: ApiError;
2971
+ /**
2972
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
2973
+ */
2974
+ 429: ApiError;
2975
+ };
2976
+ export type PutMediaError = PutMediaErrors[keyof PutMediaErrors];
2977
+ export type PutMediaResponses = {
2978
+ /**
2979
+ * The file replaced one, or the bytes were the same
2980
+ */
2981
+ 200: MediaPutResult;
2982
+ /**
2983
+ * The file was created
2984
+ */
2985
+ 201: MediaPutResult;
2986
+ };
2987
+ export type PutMediaResponse = PutMediaResponses[keyof PutMediaResponses];
2988
+ export type ListCardsData = {
2989
+ body?: never;
2990
+ path?: never;
2991
+ query?: {
2992
+ /**
2993
+ * A search, written in Anki's search syntax (the Searching chapter of the Anki manual): the same text you would type in the browser. Words match note text; `-` negates; `or`, `and` and parentheses combine; quotes group. Fields: `front:dog`, `front:*og`, `front:re:^d`, `*:text`, `nc:cafe` (ignore accents), `sc:text` (inside clozes), `re:regex`, `w:word`, `dupe:notetypeId,text`. Notes and cards: `deck:`, `note:`, `card:`, `tag:`, `preset:`, `flag:`, `nid:`, `cid:`, `is:new|learn|review|due|suspended|buried|buried-manually|buried-sibling`. Time: `added:`, `edited:`, `introduced:`, `rated:days[:button]`, `resched:`. Properties: `prop:ivl>=21`, `reps`, `lapses`, `ease`, `due`, `pos`, `rated`, and FSRS `s`, `d`, `r`; `prop:cdn:key>1`, `prop:cds:key=x` and `has-cd:key` for custom data. A search that Anki would refuse is `400 invalid_input` with Anki's own explanation. Differences from desktop Anki: regular expressions run on the RE2 engine (a `(?x)` flag, class set operations such as `[a-z&&[^aeiou]]`, backreferences and `\Q..\E` are `400 invalid_input`, and `\b` uses ASCII word characters, so use `w:` for Unicode words), and a search may be at most 1000 characters and 50 terms.
2994
+ */
2995
+ q?: string;
2996
+ /**
2997
+ * Only items that belong to this deck.
2998
+ */
2999
+ deckId?: number;
3000
+ /**
3001
+ * Only cards made from this note.
3002
+ */
3003
+ noteId?: number;
3004
+ /**
3005
+ * The id of the last item on the previous page, which is its `nextCursor`. Leave it out for the first page.
3006
+ */
3007
+ cursor?: string;
3008
+ /**
3009
+ * Page size, from 1 to 100. Defaults to 50.
3010
+ */
3011
+ limit?: number;
3012
+ };
3013
+ url: '/api/v1/cards';
3014
+ };
3015
+ export type ListCardsErrors = {
3016
+ /**
3017
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
3018
+ */
3019
+ 429: ApiError;
3020
+ };
3021
+ export type ListCardsError = ListCardsErrors[keyof ListCardsErrors];
3022
+ export type ListCardsResponses = {
3023
+ /**
3024
+ * Paginated list of cards
3025
+ */
3026
+ 200: {
3027
+ /**
3028
+ * This page of cards, in ascending id order.
3029
+ */
3030
+ cards: Array<Card>;
3031
+ /**
3032
+ * Send this as `cursor` to get the next page. `null` when the search is complete. While it is not `null` the page may hold fewer than `limit` cards, or none.
3033
+ */
3034
+ nextCursor: string | null;
3035
+ };
3036
+ };
3037
+ export type ListCardsResponse = ListCardsResponses[keyof ListCardsResponses];
3038
+ export type UpdateCardsBatchData = {
3039
+ body: {
3040
+ /**
3041
+ * The cards to change, 1 to 1000. Repeats are ignored.
3042
+ */
3043
+ ids: Array<number>;
3044
+ /**
3045
+ * The change, shaped like the body of [Edit a card](#updateCard).
3046
+ */
3047
+ patch: UpdateCardInput;
3048
+ /**
3049
+ * Write all or nothing: one refused card means nothing is written (`422`).
3050
+ */
3051
+ atomic?: boolean;
3052
+ };
3053
+ headers?: {
3054
+ /**
3055
+ * Any unique string, such as a UUID. Send the same key when you retry a write: the first answer is replayed (marked `X-Idempotent-Replay: true`) instead of doing the work twice. Keys are remembered for 24 hours. Reusing a key with a different request is `422 idempotency_conflict`.
3056
+ */
3057
+ 'Idempotency-Key'?: string;
3058
+ };
3059
+ path?: never;
3060
+ query?: never;
3061
+ url: '/api/v1/cards/batch-update';
3062
+ };
3063
+ export type UpdateCardsBatchErrors = {
3064
+ /**
3065
+ * The request was understood but is not valid, for example an unknown deck or a `fields` key that names no field of the note type. The code is `invalid_input`, `deck_error` or `card_type_error`.
3066
+ */
3067
+ 400: ApiError;
3068
+ /**
3069
+ * The key lacks the scope, the account is suspended or its email unverified, the account is over its storage quota (`over_quota`; deleting is still allowed), or a destructive schema change is switched off (`destructive_change_disabled`).
3070
+ */
3071
+ 403: ApiError;
3072
+ /**
3073
+ * The body failed validation (`validation_error`), or the call was `atomic` and an entry was refused: then the body is the usual batch answer with every entry's `error`, and nothing was written.
3074
+ */
3075
+ 422: ApiError | CreateNotesBatchResult | UpdateNotesBatchResult | UpdateCardsBatchResult;
3076
+ /**
3077
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
3078
+ */
3079
+ 423: ApiError;
3080
+ /**
3081
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
3082
+ */
3083
+ 429: ApiError;
3084
+ /**
3085
+ * Other batch operations are using the server. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
3086
+ */
3087
+ 503: ApiError;
3088
+ };
3089
+ export type UpdateCardsBatchError = UpdateCardsBatchErrors[keyof UpdateCardsBatchErrors];
3090
+ export type UpdateCardsBatchResponses = {
3091
+ /**
3092
+ * Every card was handled; see `results`
3093
+ */
3094
+ 200: UpdateCardsBatchResult;
3095
+ };
3096
+ export type UpdateCardsBatchResponse = UpdateCardsBatchResponses[keyof UpdateCardsBatchResponses];
3097
+ export type DeleteCardsBatchData = {
3098
+ body: {
3099
+ /**
3100
+ * The cards to delete, 1 to 1000.
3101
+ */
3102
+ ids: Array<number>;
3103
+ };
3104
+ headers?: {
3105
+ /**
3106
+ * Any unique string, such as a UUID. Send the same key when you retry a write: the first answer is replayed (marked `X-Idempotent-Replay: true`) instead of doing the work twice. Keys are remembered for 24 hours. Reusing a key with a different request is `422 idempotency_conflict`.
3107
+ */
3108
+ 'Idempotency-Key'?: string;
3109
+ };
3110
+ path?: never;
3111
+ query?: never;
3112
+ url: '/api/v1/cards/batch-delete';
3113
+ };
3114
+ export type DeleteCardsBatchErrors = {
3115
+ /**
3116
+ * The request was understood but is not valid, for example an unknown deck or a `fields` key that names no field of the note type. The code is `invalid_input`, `deck_error` or `card_type_error`.
3117
+ */
3118
+ 400: ApiError;
3119
+ /**
3120
+ * The key lacks the scope, the account is suspended or its email unverified, the account is over its storage quota (`over_quota`; deleting is still allowed), or a destructive schema change is switched off (`destructive_change_disabled`).
3121
+ */
3122
+ 403: ApiError;
3123
+ /**
3124
+ * The body does not match the earlier request that used this `Idempotency-Key` (`idempotency_conflict`), or the body failed validation (`validation_error`).
3125
+ */
3126
+ 422: ApiError;
3127
+ /**
3128
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
3129
+ */
3130
+ 423: ApiError;
3131
+ /**
3132
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
3133
+ */
3134
+ 429: ApiError;
3135
+ /**
3136
+ * Other batch operations are using the server. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
3137
+ */
3138
+ 503: ApiError;
3139
+ };
3140
+ export type DeleteCardsBatchError = DeleteCardsBatchErrors[keyof DeleteCardsBatchErrors];
3141
+ export type DeleteCardsBatchResponses = {
3142
+ /**
3143
+ * The cards that existed were deleted
3144
+ */
3145
+ 200: {
3146
+ /**
3147
+ * How many cards were deleted.
3148
+ */
3149
+ deleted: number;
3150
+ /**
3151
+ * The cards that were deleted.
3152
+ */
3153
+ deletedCardIds: Array<number>;
3154
+ /**
3155
+ * Notes that were deleted because their last card went.
3156
+ */
3157
+ deletedNoteIds: Array<number>;
3158
+ /**
3159
+ * Ids that did not exist and were ignored.
3160
+ */
3161
+ missingCardIds: Array<number>;
3162
+ };
3163
+ };
3164
+ export type DeleteCardsBatchResponse = DeleteCardsBatchResponses[keyof DeleteCardsBatchResponses];
3165
+ export type DeleteCardData = {
3166
+ body?: never;
3167
+ headers?: {
3168
+ /**
3169
+ * Any unique string, such as a UUID. Send the same key when you retry a write: the first answer is replayed (marked `X-Idempotent-Replay: true`) instead of doing the work twice. Keys are remembered for 24 hours. Reusing a key with a different request is `422 idempotency_conflict`.
3170
+ */
3171
+ 'Idempotency-Key'?: string;
3172
+ };
3173
+ path: {
3174
+ /**
3175
+ * The numeric id, as returned by the list endpoint or when it was created.
3176
+ */
3177
+ id: number;
3178
+ };
3179
+ query?: never;
3180
+ url: '/api/v1/cards/{id}';
3181
+ };
3182
+ export type DeleteCardErrors = {
3183
+ /**
3184
+ * No deck, note, note type or card has that id.
3185
+ */
3186
+ 404: ApiError;
3187
+ /**
3188
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
3189
+ */
3190
+ 423: ApiError;
3191
+ /**
3192
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
3193
+ */
3194
+ 429: ApiError;
3195
+ };
3196
+ export type DeleteCardError = DeleteCardErrors[keyof DeleteCardErrors];
3197
+ export type DeleteCardResponses = {
3198
+ /**
3199
+ * Card deleted
3200
+ */
3201
+ 200: {
3202
+ /**
3203
+ * `true` when the card was deleted.
3204
+ */
3205
+ ok: boolean;
3206
+ /**
3207
+ * The card that was deleted.
3208
+ */
3209
+ deletedCardIds: Array<number>;
3210
+ /**
3211
+ * The note, if the deleted card was its last one.
3212
+ */
3213
+ deletedNoteIds: Array<number>;
3214
+ };
3215
+ };
3216
+ export type DeleteCardResponse = DeleteCardResponses[keyof DeleteCardResponses];
3217
+ export type GetCardData = {
3218
+ body?: never;
3219
+ path: {
3220
+ /**
3221
+ * The numeric id, as returned by the list endpoint or when it was created.
3222
+ */
3223
+ id: number;
3224
+ };
3225
+ query?: never;
3226
+ url: '/api/v1/cards/{id}';
3227
+ };
3228
+ export type GetCardErrors = {
3229
+ /**
3230
+ * No deck, note, note type or card has that id.
3231
+ */
3232
+ 404: ApiError;
3233
+ /**
3234
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
3235
+ */
3236
+ 429: ApiError;
3237
+ };
3238
+ export type GetCardError = GetCardErrors[keyof GetCardErrors];
3239
+ export type GetCardResponses = {
3240
+ /**
3241
+ * Card details
3242
+ */
3243
+ 200: Card;
3244
+ };
3245
+ export type GetCardResponse = GetCardResponses[keyof GetCardResponses];
3246
+ export type UpdateCardData = {
3247
+ body: {
3248
+ deckId?: number;
3249
+ flag?: number;
3250
+ suspended?: boolean;
3251
+ buried?: boolean;
3252
+ };
3253
+ headers?: {
3254
+ /**
3255
+ * Any unique string, such as a UUID. Send the same key when you retry a write: the first answer is replayed (marked `X-Idempotent-Replay: true`) instead of doing the work twice. Keys are remembered for 24 hours. Reusing a key with a different request is `422 idempotency_conflict`.
3256
+ */
3257
+ 'Idempotency-Key'?: string;
3258
+ };
3259
+ path: {
3260
+ /**
3261
+ * The numeric id, as returned by the list endpoint or when it was created.
3262
+ */
3263
+ id: number;
3264
+ };
3265
+ query?: never;
3266
+ url: '/api/v1/cards/{id}';
3267
+ };
3268
+ export type UpdateCardErrors = {
3269
+ /**
3270
+ * The request was understood but is not valid, for example an unknown deck or a `fields` key that names no field of the note type. The code is `invalid_input`, `deck_error` or `card_type_error`.
3271
+ */
3272
+ 400: ApiError;
3273
+ /**
3274
+ * No deck, note, note type or card has that id.
3275
+ */
3276
+ 404: ApiError;
3277
+ /**
3278
+ * The body does not match the earlier request that used this `Idempotency-Key` (`idempotency_conflict`), or the body failed validation (`validation_error`).
3279
+ */
3280
+ 422: ApiError;
3281
+ /**
3282
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
3283
+ */
3284
+ 423: ApiError;
3285
+ /**
3286
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
3287
+ */
3288
+ 429: ApiError;
3289
+ };
3290
+ export type UpdateCardError = UpdateCardErrors[keyof UpdateCardErrors];
3291
+ export type UpdateCardResponses = {
3292
+ /**
3293
+ * Card updated
3294
+ */
3295
+ 200: {
3296
+ /**
3297
+ * `false` when nothing differed, so nothing was written.
3298
+ */
3299
+ changed: boolean;
3300
+ /**
3301
+ * The card as stored after the change.
3302
+ */
3303
+ card: Card;
3304
+ };
3305
+ };
3306
+ export type UpdateCardResponse = UpdateCardResponses[keyof UpdateCardResponses];
3307
+ export type RenderCardData = {
3308
+ body?: never;
3309
+ path: {
3310
+ /**
3311
+ * The numeric id, as returned by the list endpoint or when it was created.
3312
+ */
3313
+ id: number;
3314
+ };
3315
+ query?: {
3316
+ /**
3317
+ * `json` (default) or `html` for one complete, sandboxed HTML document.
3318
+ */
3319
+ format?: 'json' | 'html';
3320
+ /**
3321
+ * What the learner typed, for a `{{type:Field}}` comparison. At most 1000 characters.
3322
+ */
3323
+ typedAnswer?: string;
3324
+ /**
3325
+ * An `http(s)` URL prefix. Media file names in the card are turned into this prefix plus the URL-encoded name.
3326
+ */
3327
+ mediaBaseUrl?: string;
3328
+ };
3329
+ url: '/api/v1/cards/{id}/render';
3330
+ };
3331
+ export type RenderCardErrors = {
3332
+ /**
3333
+ * No deck, note, note type or card has that id.
3334
+ */
3335
+ 404: ApiError;
3336
+ /**
3337
+ * The card's template has a syntax error or refers to a field that does not exist (`render_error`).
3338
+ */
3339
+ 422: ApiError;
3340
+ /**
3341
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
3342
+ */
3343
+ 429: ApiError;
3344
+ };
3345
+ export type RenderCardError = RenderCardErrors[keyof RenderCardErrors];
3346
+ export type RenderCardResponses = {
3347
+ /**
3348
+ * The rendered card
3349
+ */
3350
+ 200: RenderedCard;
3351
+ };
3352
+ export type RenderCardResponse = RenderCardResponses[keyof RenderCardResponses];
3353
+ export type GetCardSchedulingData = {
3354
+ body?: never;
3355
+ path: {
3356
+ /**
3357
+ * The numeric id, as returned by the list endpoint or when it was created.
3358
+ */
3359
+ id: number;
3360
+ };
3361
+ query?: never;
3362
+ url: '/api/v1/cards/{id}/scheduling';
3363
+ };
3364
+ export type GetCardSchedulingErrors = {
3365
+ /**
3366
+ * No deck, note, note type or card has that id.
3367
+ */
3368
+ 404: ApiError;
3369
+ /**
3370
+ * The change alters the collection's schema and needs `?acceptFullSync=true` (`full_sync_required`), or the card is in a state that does not allow this (`card_state_error`: suspended, buried, in a filtered deck, or an unsupported scheduler).
3371
+ */
3372
+ 409: ApiError;
3373
+ /**
3374
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
3375
+ */
3376
+ 429: ApiError;
3377
+ };
3378
+ export type GetCardSchedulingError = GetCardSchedulingErrors[keyof GetCardSchedulingErrors];
3379
+ export type GetCardSchedulingResponses = {
3380
+ /**
3381
+ * What each answer would do
3382
+ */
3383
+ 200: CardScheduling;
3384
+ };
3385
+ export type GetCardSchedulingResponse = GetCardSchedulingResponses[keyof GetCardSchedulingResponses];
3386
+ export type AnswerCardData = {
3387
+ body: {
3388
+ rating: 'again' | 'hard' | 'good' | 'easy' | number;
3389
+ timeTakenMs?: number;
3390
+ };
3391
+ headers?: {
3392
+ /**
3393
+ * Any unique string, such as a UUID. Send the same key when you retry a write: the first answer is replayed (marked `X-Idempotent-Replay: true`) instead of doing the work twice. Keys are remembered for 24 hours. Reusing a key with a different request is `422 idempotency_conflict`.
3394
+ */
3395
+ 'Idempotency-Key'?: string;
3396
+ };
3397
+ path: {
3398
+ /**
3399
+ * The numeric id, as returned by the list endpoint or when it was created.
3400
+ */
3401
+ id: number;
3402
+ };
3403
+ query?: never;
3404
+ url: '/api/v1/cards/{id}/answer';
3405
+ };
3406
+ export type AnswerCardErrors = {
3407
+ /**
3408
+ * No deck, note, note type or card has that id.
3409
+ */
3410
+ 404: ApiError;
3411
+ /**
3412
+ * The change alters the collection's schema and needs `?acceptFullSync=true` (`full_sync_required`), or the card is in a state that does not allow this (`card_state_error`: suspended, buried, in a filtered deck, or an unsupported scheduler).
3413
+ */
3414
+ 409: ApiError;
3415
+ /**
3416
+ * The body does not match the earlier request that used this `Idempotency-Key` (`idempotency_conflict`), or the body failed validation (`validation_error`).
3417
+ */
3418
+ 422: ApiError;
3419
+ /**
3420
+ * Another write or an Anki sync is using the collection. Wait the number of seconds in `Retry-After` and retry; nothing was changed.
3421
+ */
3422
+ 423: ApiError;
3423
+ /**
3424
+ * The plan's rate limit is used up: a limit per minute on every plan, and a limit per day on Free. Nothing was changed. Wait Retry-After seconds and send the same request again.
3425
+ */
3426
+ 429: ApiError;
3427
+ };
3428
+ export type AnswerCardError = AnswerCardErrors[keyof AnswerCardErrors];
3429
+ export type AnswerCardResponses = {
3430
+ /**
3431
+ * The card was scheduled and the review logged
3432
+ */
3433
+ 200: {
3434
+ /**
3435
+ * Id of the review-log entry, a millisecond timestamp.
3436
+ */
3437
+ revlogId: number;
3438
+ /**
3439
+ * `true` when this answer made the card a leech.
3440
+ */
3441
+ leeched: boolean;
3442
+ /**
3443
+ * Other cards of the same note that were buried until tomorrow.
3444
+ */
3445
+ buriedSiblingIds: Array<number>;
3446
+ /**
3447
+ * The card as stored after the answer.
3448
+ */
3449
+ card: Card;
3450
+ };
3451
+ };
3452
+ export type AnswerCardResponse = AnswerCardResponses[keyof AnswerCardResponses];