Skip to main content

hammer/
ops.rs

1//! Hammer's operations, typed. Each function runs one operation, as [`crate::call`] would. A plugin may
2//! call only those its manifest's `[permissions]` ask for: each function's documentation names what it needs.
3//!
4//! Generated from api/operations.json by kotlin/codegen: regenerate rather than edit.
5#![allow(clippy::all, unused_imports)]
6
7use serde::{Deserialize, Serialize};
8use std::collections::BTreeMap;
9
10/// A value this kit doesn't know, from a later Hammer, reads as [`Access::Unknown`].
11#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
12pub enum Access {
13    #[default]
14    #[serde(rename = "read")]
15    Read,
16    #[serde(rename = "write")]
17    Write,
18    #[serde(rename = "prose")]
19    Prose,
20    #[serde(rename = "destructive")]
21    Destructive,
22    /// A value this kit doesn't know. Hammer rejects it as an input.
23    #[serde(other)]
24    Unknown,
25}
26
27#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
28#[serde(default)]
29pub struct AccountStatus {
30    pub server: Option<String>,
31    pub ssl: Option<bool>,
32    pub email: Option<String>,
33    #[serde(rename = "loggedIn")]
34    pub logged_in: bool,
35    /// Null unless checked.
36    #[serde(rename = "tokenValid")]
37    pub token_valid: Option<bool>,
38}
39
40#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
41#[serde(default)]
42pub struct Activity {
43    pub days: Vec<DayWords>,
44    /// Lifetime totals, not limited to the range.
45    pub devices: Vec<DeviceWords>,
46}
47
48#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
49#[serde(default)]
50pub struct Appearance {
51    #[serde(rename = "entryId")]
52    pub entry_id: i32,
53    pub name: String,
54    pub r#type: EntryKind,
55    #[serde(rename = "sceneCount")]
56    pub scene_count: i32,
57}
58
59#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
60#[serde(default)]
61pub struct ArchivedScene {
62    pub id: i32,
63    pub name: String,
64}
65
66#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
67#[serde(default)]
68pub struct ArchivedScenes {
69    pub scenes: Vec<ArchivedScene>,
70}
71
72#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
73#[serde(default)]
74pub struct Backup {
75    /// An ISO 8601 instant, such as `2026-03-01T09:30:00Z`.
76    pub date: String,
77}
78
79#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
80#[serde(default)]
81pub struct Backups {
82    pub backups: Vec<Backup>,
83}
84
85/// A value this kit doesn't know, from a later Hammer, reads as [`Cadence::Unknown`].
86#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
87pub enum Cadence {
88    #[default]
89    #[serde(rename = "day")]
90    Day,
91    #[serde(rename = "week")]
92    Week,
93    /// A value this kit doesn't know. Hammer rejects it as an input.
94    #[serde(other)]
95    Unknown,
96}
97
98#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
99#[serde(default)]
100pub struct CalendarDto {
101    pub preset: CalendarPresetDto,
102    /// What year 0 of a story calendar is called, such as "The Fall".
103    #[serde(rename = "epochName")]
104    #[serde(skip_serializing_if = "Option::is_none", default)]
105    pub epoch_name: Option<String>,
106    /// Story calendar only: the coarsest unit dates use, so a one-day story can run in hours.
107    #[serde(rename = "coarsestUnit")]
108    #[serde(skip_serializing_if = "Option::is_none", default)]
109    pub coarsest_unit: Option<String>,
110}
111
112/// A value this kit doesn't know, from a later Hammer, reads as [`CalendarPresetDto::Unknown`].
113#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
114pub enum CalendarPresetDto {
115    #[default]
116    #[serde(rename = "story")]
117    Story,
118    #[serde(rename = "gregorian")]
119    Gregorian,
120    /// A value this kit doesn't know. Hammer rejects it as an input.
121    #[serde(other)]
122    Unknown,
123}
124
125#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
126#[serde(default)]
127pub struct ChapterWords {
128    pub id: i32,
129    pub name: String,
130    pub words: i32,
131}
132
133#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
134#[serde(default)]
135pub struct DayWords {
136    /// An ISO 8601 date, such as `2026-03-01`.
137    pub date: String,
138    pub words: i32,
139}
140
141#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
142#[serde(default)]
143pub struct DeviceWords {
144    pub device: String,
145    pub words: i32,
146}
147
148#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
149#[serde(default)]
150pub struct DraftApplied {
151    #[serde(rename = "sceneId")]
152    pub scene_id: i32,
153    /// The draft holding the text it replaced; null when the text was unchanged.
154    #[serde(rename = "previousDraftId")]
155    pub previous_draft_id: Option<i32>,
156    #[serde(rename = "wordCount")]
157    pub word_count: i32,
158}
159
160#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
161#[serde(default)]
162pub struct DraftInfo {
163    pub id: i32,
164    pub name: String,
165    /// An ISO 8601 instant, such as `2026-03-01T09:30:00Z`.
166    pub created: String,
167}
168
169#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
170#[serde(default)]
171pub struct DraftText {
172    pub id: i32,
173    #[serde(rename = "sceneId")]
174    pub scene_id: i32,
175    pub name: String,
176    /// An ISO 8601 instant, such as `2026-03-01T09:30:00Z`.
177    pub created: String,
178    pub markdown: String,
179}
180
181#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
182#[serde(default)]
183pub struct Drafts {
184    pub drafts: Vec<DraftInfo>,
185}
186
187/// A value this kit doesn't know, from a later Hammer, reads as [`EntityKind::Unknown`].
188#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
189pub enum EntityKind {
190    #[default]
191    #[serde(rename = "scene")]
192    Scene,
193    #[serde(rename = "note")]
194    Note,
195    #[serde(rename = "entry")]
196    Entry,
197    #[serde(rename = "timeline")]
198    Timeline,
199    /// A value this kit doesn't know. Hammer rejects it as an input.
200    #[serde(other)]
201    Unknown,
202}
203
204#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
205#[serde(default)]
206pub struct Entries {
207    pub entries: Vec<EntrySummary>,
208}
209
210#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
211#[serde(default)]
212pub struct Entry {
213    pub id: i32,
214    pub name: String,
215    pub r#type: EntryKind,
216    pub text: String,
217    pub tags: Vec<String>,
218    pub aliases: Vec<String>,
219    #[serde(rename = "hasImage")]
220    pub has_image: bool,
221    /// Image ids in order, primary first. An id can name an image no longer in the project.
222    #[serde(skip_serializing_if = "Option::is_none", default)]
223    pub images: Option<Vec<i32>>,
224    /// Scene ids whose references to this entry have been confirmed.
225    #[serde(rename = "referencedBy")]
226    pub referenced_by: Vec<i32>,
227}
228
229#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
230#[serde(default)]
231pub struct EntryCount {
232    pub r#type: EntryKind,
233    pub count: i32,
234}
235
236#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
237#[serde(default)]
238pub struct EntryImageSummary {
239    pub id: i32,
240    pub name: String,
241    /// One of [ImageFormat.ALLOWED_EXTENSIONS].
242    pub extension: String,
243}
244
245#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
246#[serde(default)]
247pub struct EntryImages {
248    pub images: Vec<EntryImageSummary>,
249}
250
251/// A value this kit doesn't know, from a later Hammer, reads as [`EntryKind::Unknown`].
252#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
253pub enum EntryKind {
254    #[default]
255    #[serde(rename = "person")]
256    Person,
257    #[serde(rename = "place")]
258    Place,
259    #[serde(rename = "thing")]
260    Thing,
261    #[serde(rename = "event")]
262    Event,
263    #[serde(rename = "idea")]
264    Idea,
265    /// A value this kit doesn't know. Hammer rejects it as an input.
266    #[serde(other)]
267    Unknown,
268}
269
270#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
271#[serde(default)]
272pub struct EntrySummary {
273    pub id: i32,
274    pub name: String,
275    pub r#type: EntryKind,
276    /// Other names the entry goes by.
277    #[serde(skip_serializing_if = "Option::is_none", default)]
278    pub aliases: Option<Vec<String>>,
279}
280
281#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
282#[serde(default)]
283pub struct EvenSpacingDto {
284    /// The calendar unit to step by, such as "day".
285    pub unit: String,
286    #[serde(skip_serializing_if = "Option::is_none", default)]
287    pub step: Option<i64>,
288    /// The first event's date, such as {"year": 97}.
289    pub origin: BTreeMap<String, i64>,
290}
291
292#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
293#[serde(default)]
294pub struct ExportFormat {
295    pub id: String,
296    #[serde(rename = "fileExtension")]
297    pub file_extension: String,
298    #[serde(rename = "mimeType")]
299    pub mime_type: String,
300}
301
302#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
303#[serde(default)]
304pub struct ExportFormats {
305    pub formats: Vec<ExportFormat>,
306}
307
308#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
309#[serde(default)]
310pub struct ExportedFile {
311    #[serde(rename = "fileName")]
312    pub file_name: String,
313    #[serde(rename = "mimeType")]
314    pub mime_type: String,
315    #[serde(with = "crate::base64::bytes")]
316    pub content: Vec<u8>,
317}
318
319#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
320#[serde(default)]
321pub struct Idea {
322    pub id: String,
323    pub title: Option<String>,
324    pub content: String,
325    pub tags: Vec<String>,
326    /// An ISO 8601 instant, such as `2026-03-01T09:30:00Z`.
327    pub created: String,
328    /// An ISO 8601 instant, such as `2026-03-01T09:30:00Z`.
329    pub updated: String,
330    /// An ISO 8601 instant, such as `2026-03-01T09:30:00Z`.
331    pub promoted: Option<String>,
332    /// An ISO 8601 instant, such as `2026-03-01T09:30:00Z`.
333    pub archived: Option<String>,
334}
335
336#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
337#[serde(default)]
338pub struct Ideas {
339    pub ideas: Vec<Idea>,
340}
341
342#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
343#[serde(default)]
344pub struct ImageContent {
345    pub id: i32,
346    pub name: String,
347    pub extension: String,
348    #[serde(with = "crate::base64::bytes")]
349    pub content: Vec<u8>,
350}
351
352#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
353#[serde(default)]
354pub struct ImageDeleted {
355    pub id: i32,
356    pub name: String,
357    pub extension: String,
358    /// Everything the image was taken out of before it was deleted.
359    #[serde(rename = "removedFrom")]
360    pub removed_from: Vec<ImageUser>,
361}
362
363#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
364#[serde(default)]
365pub struct ImageSummary {
366    pub id: i32,
367    pub name: String,
368    /// One of [ImageFormat.ALLOWED_EXTENSIONS].
369    pub extension: String,
370    /// Whether an entry or a text in the project uses the image.
371    #[serde(rename = "inUse")]
372    pub in_use: bool,
373}
374
375#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
376#[serde(default)]
377pub struct ImageUser {
378    pub kind: ImageUserKind,
379    /// Null for [ImageUserKind.Cover], which is not an entity.
380    #[serde(skip_serializing_if = "Option::is_none", default)]
381    pub id: Option<i32>,
382}
383
384/// A value this kit doesn't know, from a later Hammer, reads as [`ImageUserKind::Unknown`].
385#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
386pub enum ImageUserKind {
387    #[default]
388    #[serde(rename = "scene")]
389    Scene,
390    #[serde(rename = "note")]
391    Note,
392    #[serde(rename = "timeline")]
393    Timeline,
394    #[serde(rename = "entry")]
395    Entry,
396    #[serde(rename = "draft")]
397    Draft,
398    #[serde(rename = "image")]
399    Image,
400    #[serde(rename = "cover")]
401    Cover,
402    /// A value this kit doesn't know. Hammer rejects it as an input.
403    #[serde(other)]
404    Unknown,
405}
406
407#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
408#[serde(default)]
409pub struct Images {
410    pub images: Vec<ImageSummary>,
411}
412
413/// A value this kit doesn't know, from a later Hammer, reads as [`ImportFileFormat::Unknown`].
414#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
415pub enum ImportFileFormat {
416    #[default]
417    #[serde(rename = "markdown")]
418    Markdown,
419    #[serde(rename = "rtf")]
420    Rtf,
421    /// A value this kit doesn't know. Hammer rejects it as an input.
422    #[serde(other)]
423    Unknown,
424}
425
426/// A value this kit doesn't know, from a later Hammer, reads as [`MarkdownSplit::Unknown`].
427#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
428pub enum MarkdownSplit {
429    #[default]
430    #[serde(rename = "auto")]
431    Auto,
432    #[serde(rename = "h1")]
433    H1,
434    #[serde(rename = "h2")]
435    H2,
436    #[serde(rename = "pattern")]
437    Pattern,
438    /// A value this kit doesn't know. Hammer rejects it as an input.
439    #[serde(other)]
440    Unknown,
441}
442
443#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
444#[serde(default)]
445pub struct Note {
446    pub id: i32,
447    /// An ISO 8601 instant, such as `2026-03-01T09:30:00Z`.
448    pub created: String,
449    pub tags: Vec<String>,
450    pub content: String,
451}
452
453#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
454#[serde(default)]
455pub struct Notes {
456    pub notes: Vec<Note>,
457}
458
459#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
460#[serde(default)]
461pub struct OperationDescriptor {
462    pub name: String,
463    pub description: String,
464    pub access: Access,
465    pub scope: OperationScope,
466    pub input: BTreeMap<String, serde_json::Value>,
467    pub output: BTreeMap<String, serde_json::Value>,
468}
469
470#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
471#[serde(default)]
472pub struct OperationList {
473    pub operations: Vec<OperationDescriptor>,
474}
475
476/// A value this kit doesn't know, from a later Hammer, reads as [`OperationScope::Unknown`].
477#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
478pub enum OperationScope {
479    #[default]
480    #[serde(rename = "content")]
481    Content,
482    #[serde(rename = "account")]
483    Account,
484    #[serde(rename = "plugins")]
485    Plugins,
486    /// A value this kit doesn't know. Hammer rejects it as an input.
487    #[serde(other)]
488    Unknown,
489}
490
491#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
492#[serde(default)]
493pub struct PagedScene {
494    pub id: i32,
495    pub name: String,
496    /// Names of the groups containing the scene, outermost first.
497    pub path: Vec<String>,
498    pub markdown: String,
499    #[serde(rename = "wordCount")]
500    pub word_count: i32,
501    pub meta: SceneMeta,
502}
503
504#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
505#[serde(default)]
506pub struct PluginList {
507    pub plugins: Vec<PluginSummary>,
508}
509
510#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
511#[serde(default)]
512pub struct PluginSummary {
513    pub id: String,
514    /// Null, as are [version] and [description], when its package can no longer be read.
515    #[serde(skip_serializing_if = "Option::is_none", default)]
516    pub name: Option<String>,
517    #[serde(skip_serializing_if = "Option::is_none", default)]
518    pub version: Option<String>,
519    #[serde(skip_serializing_if = "Option::is_none", default)]
520    pub description: Option<String>,
521    pub enabled: bool,
522    /// The operations it may use.
523    #[serde(skip_serializing_if = "Option::is_none", default)]
524    pub operations: Option<Vec<String>>,
525    /// Hosts it may send what the user writes to.
526    #[serde(skip_serializing_if = "Option::is_none", default)]
527    pub http: Option<Vec<String>>,
528    /// The setting holding an address it may also send what the user writes to.
529    #[serde(rename = "userHostSetting")]
530    #[serde(skip_serializing_if = "Option::is_none", default)]
531    pub user_host_setting: Option<String>,
532}
533
534#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
535#[serde(default)]
536pub struct ProjectImported {
537    pub name: String,
538    pub scenes: i32,
539}
540
541#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
542#[serde(default)]
543pub struct ProjectInfo {
544    pub name: String,
545    #[serde(rename = "projectId")]
546    pub project_id: String,
547    /// An ISO 8601 instant, such as `2026-03-01T09:30:00Z`.
548    pub created: Option<String>,
549    /// An ISO 8601 instant, such as `2026-03-01T09:30:00Z`.
550    #[serde(rename = "lastAccessed")]
551    pub last_accessed: Option<String>,
552    #[serde(rename = "authorName")]
553    pub author_name: Option<String>,
554    pub language: Option<String>,
555    pub tags: Vec<String>,
556    #[serde(rename = "wordCountGoal")]
557    pub word_count_goal: Option<WordGoal>,
558    #[serde(rename = "wordCount")]
559    pub word_count: Option<i32>,
560    #[serde(rename = "sceneCount")]
561    pub scene_count: Option<i32>,
562    /// An ISO 8601 instant, such as `2026-03-01T09:30:00Z`.
563    #[serde(rename = "lastEdited")]
564    pub last_edited: Option<String>,
565}
566
567#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
568#[serde(default)]
569pub struct ProjectList {
570    pub projects: Vec<ProjectSummary>,
571}
572
573#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
574#[serde(default)]
575pub struct ProjectName {
576    pub name: String,
577}
578
579#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
580#[serde(default)]
581pub struct ProjectStats {
582    #[serde(rename = "totalWords")]
583    pub total_words: i32,
584    #[serde(rename = "sceneCount")]
585    pub scene_count: i32,
586    /// Top-level scenes and groups, in story order.
587    pub chapters: Vec<ChapterWords>,
588    #[serde(rename = "longestScene")]
589    pub longest_scene: Option<SceneWords>,
590    #[serde(rename = "shortestSceneWords")]
591    pub shortest_scene_words: i32,
592    #[serde(rename = "medianSceneWords")]
593    pub median_scene_words: i32,
594    #[serde(rename = "noteCount")]
595    pub note_count: i32,
596    #[serde(rename = "timelineEventCount")]
597    pub timeline_event_count: i32,
598    #[serde(rename = "entryCounts")]
599    pub entry_counts: Vec<EntryCount>,
600    /// People appearing in the most scenes.
601    #[serde(rename = "topAppearances")]
602    pub top_appearances: Vec<Appearance>,
603    #[serde(rename = "wordCountGoal")]
604    pub word_count_goal: Option<WordGoal>,
605    /// An ISO 8601 instant, such as `2026-03-01T09:30:00Z`.
606    #[serde(rename = "lastEdited")]
607    pub last_edited: Option<String>,
608    #[serde(rename = "lastEditedScene")]
609    pub last_edited_scene: Option<SceneRef>,
610}
611
612#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
613#[serde(default)]
614pub struct ProjectSummary {
615    pub name: String,
616    #[serde(rename = "projectId")]
617    pub project_id: String,
618    /// From the statistics cache; null until statistics are first calculated.
619    #[serde(rename = "wordCount")]
620    pub word_count: Option<i32>,
621    /// Null when the project's metadata can't be read. An ISO 8601 instant, such as `2026-03-01T09:30:00Z`.
622    pub created: Option<String>,
623    /// An ISO 8601 instant, such as `2026-03-01T09:30:00Z`.
624    #[serde(rename = "lastAccessed")]
625    pub last_accessed: Option<String>,
626    /// An ISO 8601 instant, such as `2026-03-01T09:30:00Z`.
627    #[serde(rename = "lastEdited")]
628    pub last_edited: Option<String>,
629}
630
631#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
632#[serde(default)]
633pub struct ProjectSyncStatus {
634    pub name: String,
635    /// True once the project has synced.
636    pub linked: bool,
637    /// Null when never synced. An ISO 8601 instant, such as `2026-03-01T09:30:00Z`.
638    #[serde(rename = "lastSync")]
639    pub last_sync: Option<String>,
640    #[serde(rename = "pendingChanges")]
641    pub pending_changes: i32,
642}
643
644/// A value this kit doesn't know, from a later Hammer, reads as [`RtfSplit::Unknown`].
645#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
646pub enum RtfSplit {
647    #[default]
648    #[serde(rename = "formatting")]
649    Formatting,
650    #[serde(rename = "pattern")]
651    Pattern,
652    #[serde(rename = "single")]
653    Single,
654    /// A value this kit doesn't know. Hammer rejects it as an input.
655    #[serde(other)]
656    Unknown,
657}
658
659#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
660#[serde(default)]
661pub struct SceneItemRef {
662    pub id: i32,
663    pub name: String,
664    pub kind: SceneKind,
665}
666
667/// A value this kit doesn't know, from a later Hammer, reads as [`SceneKind::Unknown`].
668#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
669pub enum SceneKind {
670    #[default]
671    #[serde(rename = "scene")]
672    Scene,
673    #[serde(rename = "group")]
674    Group,
675    /// A value this kit doesn't know. Hammer rejects it as an input.
676    #[serde(other)]
677    Unknown,
678}
679
680#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
681#[serde(default)]
682pub struct SceneMeta {
683    pub outline: String,
684    pub notes: String,
685    pub tags: Vec<String>,
686    #[serde(rename = "currentDraft")]
687    pub current_draft: String,
688    /// An ISO 8601 instant, such as `2026-03-01T09:30:00Z`.
689    pub created: Option<String>,
690    /// An ISO 8601 instant, such as `2026-03-01T09:30:00Z`.
691    #[serde(rename = "lastEdited")]
692    pub last_edited: Option<String>,
693    /// Entry ids confirmed as in the scene.
694    pub references: Vec<i32>,
695    /// Entry ids the writer dismissed, which name matching no longer adds.
696    #[serde(rename = "dismissedReferences")]
697    pub dismissed_references: Vec<i32>,
698}
699
700#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
701#[serde(default)]
702pub struct SceneNode {
703    pub id: i32,
704    pub name: String,
705    pub kind: SceneKind,
706    #[serde(rename = "wordCount")]
707    pub word_count: i32,
708    pub children: Vec<SceneNode>,
709}
710
711#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
712#[serde(default)]
713pub struct ScenePage {
714    pub scenes: Vec<PagedScene>,
715    /// The last scene's id when more follow, to pass as after; null on the last page.
716    pub next: Option<i32>,
717}
718
719#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
720#[serde(default)]
721pub struct SceneRef {
722    pub id: i32,
723    pub name: String,
724}
725
726#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
727#[serde(default)]
728pub struct SceneText {
729    pub id: i32,
730    pub name: String,
731    pub archived: bool,
732    pub markdown: String,
733    #[serde(rename = "wordCount")]
734    pub word_count: i32,
735    pub meta: SceneMeta,
736}
737
738#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
739#[serde(default)]
740pub struct SceneTree {
741    pub nodes: Vec<SceneNode>,
742}
743
744#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
745#[serde(default)]
746pub struct SceneWordCount {
747    #[serde(rename = "wordCount")]
748    pub word_count: i32,
749}
750
751#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
752#[serde(default)]
753pub struct SceneWords {
754    pub id: i32,
755    pub name: String,
756    pub words: i32,
757}
758
759#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
760#[serde(default)]
761pub struct SceneWriteResult {
762    /// The new draft, in draft mode.
763    #[serde(rename = "draftId")]
764    pub draft_id: Option<i32>,
765    /// In live mode, the draft holding the text it replaced; null when the text was unchanged.
766    #[serde(rename = "previousDraftId")]
767    pub previous_draft_id: Option<i32>,
768    #[serde(rename = "wordCount")]
769    pub word_count: i32,
770}
771
772/// A value this kit doesn't know, from a later Hammer, reads as [`SearchFilter::Unknown`].
773#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
774pub enum SearchFilter {
775    #[default]
776    #[serde(rename = "all")]
777    All,
778    #[serde(rename = "scenes")]
779    Scenes,
780    #[serde(rename = "notes")]
781    Notes,
782    #[serde(rename = "encyclopedia")]
783    Encyclopedia,
784    #[serde(rename = "timeline")]
785    Timeline,
786    /// A value this kit doesn't know. Hammer rejects it as an input.
787    #[serde(other)]
788    Unknown,
789}
790
791#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
792#[serde(default)]
793pub struct SearchHit {
794    pub kind: EntityKind,
795    pub id: i32,
796    pub title: String,
797    pub snippet: String,
798    /// The match's range within [snippet].
799    #[serde(rename = "matchStart")]
800    pub match_start: i32,
801    #[serde(rename = "matchEnd")]
802    pub match_end: i32,
803}
804
805#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
806#[serde(default)]
807pub struct SearchResults {
808    pub results: Vec<SearchHit>,
809}
810
811#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
812#[serde(default)]
813pub struct Session {
814    pub device: String,
815    /// An ISO 8601 instant, such as `2026-03-01T09:30:00Z`.
816    #[serde(rename = "startedAt")]
817    pub started_at: String,
818    /// An ISO 8601 instant, such as `2026-03-01T09:30:00Z`.
819    #[serde(rename = "endedAt")]
820    pub ended_at: String,
821    pub words: i32,
822}
823
824#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
825#[serde(default)]
826pub struct Sessions {
827    pub sessions: Vec<Session>,
828}
829
830#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
831#[serde(default)]
832pub struct SyncStatus {
833    pub projects: Vec<ProjectSyncStatus>,
834}
835
836#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
837#[serde(default)]
838pub struct TagCount {
839    pub tag: String,
840    pub count: i32,
841}
842
843#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
844#[serde(default)]
845pub struct TaggedEntities {
846    pub entities: Vec<TaggedEntity>,
847}
848
849#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
850#[serde(default)]
851pub struct TaggedEntity {
852    pub kind: EntityKind,
853    pub id: i32,
854}
855
856#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
857#[serde(default)]
858pub struct Tags {
859    pub tags: Vec<TagCount>,
860}
861
862#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
863#[serde(default)]
864pub struct Timeline {
865    pub events: Vec<TimelineEntry>,
866}
867
868#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
869#[serde(default)]
870pub struct TimelineDefDeleted {
871    /// The deleted timeline's id.
872    pub timeline: String,
873    /// How many events were on it, deleted with it.
874    #[serde(rename = "deletedEvents")]
875    pub deleted_events: i32,
876}
877
878#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
879#[serde(default)]
880pub struct TimelineDefDto {
881    /// Stable id; the main timeline is "main".
882    pub id: String,
883    pub name: String,
884    pub mode: TimelineModeDto,
885    /// The calendar dates are on; null until one is chosen.
886    pub calendar: Option<CalendarDto>,
887    /// Lanes in the order they are drawn; lanes in use but not listed follow alphabetically.
888    #[serde(rename = "laneOrder")]
889    pub lane_order: Vec<String>,
890}
891
892#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
893#[serde(default)]
894pub struct TimelineEntry {
895    pub id: i32,
896    /// Manual position. A dated timeline orders by start date and uses this only to break ties.
897    pub order: i32,
898    /// Deprecated alias of label, always equal to it.
899    pub date: Option<String>,
900    /// A plain event's markdown; always empty for a placement.
901    pub content: String,
902    /// A plain event's tags; always empty for a placement.
903    pub tags: Vec<String>,
904    /// A plain event, or the placement of an encyclopedia entry or a scene.
905    #[serde(skip_serializing_if = "Option::is_none", default)]
906    pub kind: Option<TimelineKindDto>,
907    /// The placed entry or scene id; null for a plain event.
908    #[serde(skip_serializing_if = "Option::is_none", default)]
909    pub subject: Option<i32>,
910    /// A plain event's own title.
911    #[serde(skip_serializing_if = "Option::is_none", default)]
912    pub title: Option<String>,
913    /// Free-text "when" a manual timeline shows, such as "Day 3" or "Spring, 1802".
914    #[serde(skip_serializing_if = "Option::is_none", default)]
915    pub label: Option<String>,
916    /// The name to show: the subject's name, else the title, the content's first line, or the cached title.
917    #[serde(rename = "displayTitle")]
918    #[serde(skip_serializing_if = "Option::is_none", default)]
919    pub display_title: Option<String>,
920    /// The lane it runs in; null for none.
921    #[serde(skip_serializing_if = "Option::is_none", default)]
922    pub lane: Option<String>,
923    /// A turning point, marked across every lane.
924    #[serde(skip_serializing_if = "Option::is_none", default)]
925    pub milestone: Option<bool>,
926    /// When it starts on the timeline's calendar, as filled units such as {"year": 97, "day": 210}.
927    #[serde(skip_serializing_if = "Option::is_none", default)]
928    pub start: Option<BTreeMap<String, i64>>,
929    /// When it ends, in the same form as start; null for a moment.
930    #[serde(skip_serializing_if = "Option::is_none", default)]
931    pub end: Option<BTreeMap<String, i64>>,
932    /// Scene and entry ids a plain event refers to.
933    #[serde(skip_serializing_if = "Option::is_none", default)]
934    pub references: Option<Vec<i32>>,
935    /// A placement's subject name when last seen, kept in case the subject is deleted.
936    #[serde(rename = "cachedTitle")]
937    #[serde(skip_serializing_if = "Option::is_none", default)]
938    pub cached_title: Option<String>,
939    /// The id of the timeline it is on, "main" for the main one; a straggler keeps its deleted timeline's.
940    #[serde(skip_serializing_if = "Option::is_none", default)]
941    pub timeline: Option<String>,
942}
943
944/// A value this kit doesn't know, from a later Hammer, reads as [`TimelineKindDto::Unknown`].
945#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
946pub enum TimelineKindDto {
947    #[default]
948    #[serde(rename = "event")]
949    Event,
950    #[serde(rename = "entry")]
951    Entry,
952    #[serde(rename = "scene")]
953    Scene,
954    /// A value this kit doesn't know. Hammer rejects it as an input.
955    #[serde(other)]
956    Unknown,
957}
958
959/// A value this kit doesn't know, from a later Hammer, reads as [`TimelineModeDto::Unknown`].
960#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
961pub enum TimelineModeDto {
962    #[default]
963    #[serde(rename = "manual")]
964    Manual,
965    #[serde(rename = "dated")]
966    Dated,
967    /// A value this kit doesn't know. Hammer rejects it as an input.
968    #[serde(other)]
969    Unknown,
970}
971
972#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
973#[serde(default)]
974pub struct TimelineSettings {
975    /// The project's timelines: main first, then the others in the order they were made.
976    pub timelines: Vec<TimelineDefDto>,
977    /// Events whose timeline was deleted, such as one made offline before a sync; timeline.list orphaned lists them.
978    #[serde(skip_serializing_if = "Option::is_none", default)]
979    pub orphaned: Option<i32>,
980}
981
982#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
983#[serde(default)]
984pub struct WordGoal {
985    pub cadence: Cadence,
986    pub count: i32,
987}
988
989/// A value this kit doesn't know, from a later Hammer, reads as [`WriteMode::Unknown`].
990#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
991pub enum WriteMode {
992    #[default]
993    #[serde(rename = "draft")]
994    Draft,
995    #[serde(rename = "live")]
996    Live,
997    /// A value this kit doesn't know. Hammer rejects it as an input.
998    #[serde(other)]
999    Unknown,
1000}
1001
1002/// The optional inputs of [`search`]; leave any out with `..Default::default()`.
1003#[derive(Debug, Clone, Default, PartialEq, Serialize)]
1004pub struct SearchOptions {
1005    #[serde(skip_serializing_if = "Option::is_none")]
1006    pub filter: Option<SearchFilter>,
1007}
1008
1009/// Search a project's scenes, notes, encyclopedia, and timeline. #tag in the query filters by tag.
1010///
1011/// Needs `search` or `content:read` in the manifest's `[permissions]`.
1012pub fn search(project: &str, query: &str, options: SearchOptions) -> crate::Result<SearchResults> {
1013    #[derive(Serialize)]
1014    struct Input<'a> {
1015        project: &'a str,
1016        query: &'a str,
1017        #[serde(flatten)]
1018        options: SearchOptions,
1019    }
1020    crate::call("search", &Input { project, query, options })
1021}
1022
1023/// The `account` operations.
1024pub mod account {
1025    use super::*;
1026
1027    /// The optional inputs of [`status`]; leave any out with `..Default::default()`.
1028    #[derive(Debug, Clone, Default, PartialEq, Serialize)]
1029    pub struct AccountStatusOptions {
1030        /// Ask the server whether the stored token is still good; needs the network.
1031        #[serde(skip_serializing_if = "Option::is_none")]
1032        pub check: Option<bool>,
1033    }
1034
1035    /// The sync server and account this install uses, and optionally whether the server still accepts it.
1036    ///
1037    /// Needs `account.status` or `account:read` in the manifest's `[permissions]`.
1038    pub fn status(options: AccountStatusOptions) -> crate::Result<AccountStatus> {
1039        #[derive(Serialize)]
1040        struct Input {
1041            #[serde(flatten)]
1042            options: AccountStatusOptions,
1043        }
1044        crate::call("account.status", &Input { options })
1045    }
1046
1047}
1048
1049/// The `backup` operations.
1050pub mod backup {
1051    use super::*;
1052
1053    /// Back up a project's saved files.
1054    ///
1055    /// Needs `backup.create` or `content:write` in the manifest's `[permissions]`.
1056    pub fn create(project: &str) -> crate::Result<Backup> {
1057        #[derive(Serialize)]
1058        struct Input<'a> {
1059            project: &'a str,
1060        }
1061        crate::call("backup.create", &Input { project })
1062    }
1063
1064    /// A project's backups, oldest first.
1065    ///
1066    /// Needs `backup.list` or `content:read` in the manifest's `[permissions]`.
1067    pub fn list(project: &str) -> crate::Result<Backups> {
1068        #[derive(Serialize)]
1069        struct Input<'a> {
1070            project: &'a str,
1071        }
1072        crate::call("backup.list", &Input { project })
1073    }
1074
1075}
1076
1077/// The `draft` operations.
1078pub mod draft {
1079    use super::*;
1080
1081    /// Replace a scene's text with one of its drafts, saving the replaced text as a draft first.
1082    ///
1083    /// Needs `draft.apply` or `content:prose` in the manifest's `[permissions]`.
1084    pub fn apply(project: &str, id: i32) -> crate::Result<DraftApplied> {
1085        #[derive(Serialize)]
1086        struct Input<'a> {
1087            project: &'a str,
1088            id: i32,
1089        }
1090        crate::call("draft.apply", &Input { project, id })
1091    }
1092
1093    /// Save a scene's current text as a named draft.
1094    ///
1095    /// Needs `draft.create` or `content:write` in the manifest's `[permissions]`.
1096    pub fn create(project: &str, scene_id: i32, name: &str) -> crate::Result<DraftInfo> {
1097        #[derive(Serialize)]
1098        struct Input<'a> {
1099            project: &'a str,
1100            #[serde(rename = "sceneId")]
1101            scene_id: i32,
1102            name: &'a str,
1103        }
1104        crate::call("draft.create", &Input { project, scene_id, name })
1105    }
1106
1107    /// Delete a draft for good.
1108    ///
1109    /// Needs `draft.delete` (by name) in the manifest's `[permissions]`.
1110    pub fn delete(project: &str, id: i32) -> crate::Result<DraftInfo> {
1111        #[derive(Serialize)]
1112        struct Input<'a> {
1113            project: &'a str,
1114            id: i32,
1115        }
1116        crate::call("draft.delete", &Input { project, id })
1117    }
1118
1119    /// A scene's saved drafts, oldest first.
1120    ///
1121    /// Needs `draft.list` or `content:read` in the manifest's `[permissions]`.
1122    pub fn list(project: &str, scene_id: i32) -> crate::Result<Drafts> {
1123        #[derive(Serialize)]
1124        struct Input<'a> {
1125            project: &'a str,
1126            #[serde(rename = "sceneId")]
1127            scene_id: i32,
1128        }
1129        crate::call("draft.list", &Input { project, scene_id })
1130    }
1131
1132    /// A draft's markdown.
1133    ///
1134    /// Needs `draft.read` or `content:read` in the manifest's `[permissions]`.
1135    pub fn read(project: &str, id: i32) -> crate::Result<DraftText> {
1136        #[derive(Serialize)]
1137        struct Input<'a> {
1138            project: &'a str,
1139            id: i32,
1140        }
1141        crate::call("draft.read", &Input { project, id })
1142    }
1143
1144}
1145
1146/// The `entry` operations.
1147pub mod entry {
1148    use super::*;
1149
1150    /// The optional inputs of [`create`]; leave any out with `..Default::default()`.
1151    #[derive(Debug, Clone, Default, PartialEq, Serialize)]
1152    pub struct EntryCreateOptions {
1153        #[serde(skip_serializing_if = "Option::is_none")]
1154        pub tags: Option<Vec<String>>,
1155        /// Other names the entry goes by, matched in scenes like its name.
1156        #[serde(skip_serializing_if = "Option::is_none")]
1157        pub aliases: Option<Vec<String>>,
1158    }
1159
1160    /// Add an encyclopedia entry to a project.
1161    ///
1162    /// Needs `entry.create` or `content:write` in the manifest's `[permissions]`.
1163    pub fn create(project: &str, name: &str, r#type: EntryKind, text: &str, options: EntryCreateOptions) -> crate::Result<Entry> {
1164        #[derive(Serialize)]
1165        struct Input<'a> {
1166            project: &'a str,
1167            name: &'a str,
1168            r#type: EntryKind,
1169            text: &'a str,
1170            #[serde(flatten)]
1171            options: EntryCreateOptions,
1172        }
1173        crate::call("entry.create", &Input { project, name, r#type, text, options })
1174    }
1175
1176    /// Delete an encyclopedia entry for good. Its images stay in the project.
1177    ///
1178    /// Needs `entry.delete` (by name) in the manifest's `[permissions]`.
1179    pub fn delete(project: &str, id: i32) -> crate::Result<EntrySummary> {
1180        #[derive(Serialize)]
1181        struct Input<'a> {
1182            project: &'a str,
1183            id: i32,
1184        }
1185        crate::call("entry.delete", &Input { project, id })
1186    }
1187
1188    /// The optional inputs of [`list`]; leave any out with `..Default::default()`.
1189    #[derive(Debug, Clone, Default, PartialEq, Serialize)]
1190    pub struct EntryListOptions {
1191        #[serde(skip_serializing_if = "Option::is_none")]
1192        pub r#type: Option<EntryKind>,
1193        #[serde(skip_serializing_if = "Option::is_none")]
1194        pub tag: Option<String>,
1195    }
1196
1197    /// A project's encyclopedia entries, with their aliases, optionally only one type or those with a tag.
1198    ///
1199    /// Needs `entry.list` or `content:read` in the manifest's `[permissions]`.
1200    pub fn list(project: &str, options: EntryListOptions) -> crate::Result<Entries> {
1201        #[derive(Serialize)]
1202        struct Input<'a> {
1203            project: &'a str,
1204            #[serde(flatten)]
1205            options: EntryListOptions,
1206        }
1207        crate::call("entry.list", &Input { project, options })
1208    }
1209
1210    /// An encyclopedia entry, with the scenes confirmed to reference it.
1211    ///
1212    /// Needs `entry.read` or `content:read` in the manifest's `[permissions]`.
1213    pub fn read(project: &str, id: i32) -> crate::Result<Entry> {
1214        #[derive(Serialize)]
1215        struct Input<'a> {
1216            project: &'a str,
1217            id: i32,
1218        }
1219        crate::call("entry.read", &Input { project, id })
1220    }
1221
1222    /// The optional inputs of [`update`]; leave any out with `..Default::default()`.
1223    #[derive(Debug, Clone, Default, PartialEq, Serialize)]
1224    pub struct EntryUpdateOptions {
1225        #[serde(skip_serializing_if = "Option::is_none")]
1226        pub name: Option<String>,
1227        #[serde(skip_serializing_if = "Option::is_none")]
1228        pub tags: Option<Vec<String>>,
1229        #[serde(skip_serializing_if = "Option::is_none")]
1230        pub aliases: Option<Vec<String>>,
1231    }
1232
1233    /// Replace an encyclopedia entry's text, and its name, tags, or aliases when given.
1234    ///
1235    /// Needs `entry.update` or `content:write` in the manifest's `[permissions]`.
1236    pub fn update(project: &str, id: i32, text: &str, options: EntryUpdateOptions) -> crate::Result<Entry> {
1237        #[derive(Serialize)]
1238        struct Input<'a> {
1239            project: &'a str,
1240            id: i32,
1241            text: &'a str,
1242            #[serde(flatten)]
1243            options: EntryUpdateOptions,
1244        }
1245        crate::call("entry.update", &Input { project, id, text, options })
1246    }
1247
1248    /// The `entry.images` operations.
1249    pub mod images {
1250        use super::*;
1251
1252        /// Add an image already in the project to the end of an encyclopedia entry's images.
1253        ///
1254        /// Needs `entry.images.add` or `content:write` in the manifest's `[permissions]`.
1255        pub fn add(project: &str, id: i32, image_id: i32) -> crate::Result<EntryImages> {
1256            #[derive(Serialize)]
1257            struct Input<'a> {
1258                project: &'a str,
1259                id: i32,
1260                #[serde(rename = "imageId")]
1261                image_id: i32,
1262            }
1263            crate::call("entry.images.add", &Input { project, id, image_id })
1264        }
1265
1266        /// Add a new image to the project, named after an encyclopedia entry, and to the end of the entry's images. The extension is jpg, jpeg, png, webp, or svg, and must match the image.
1267        ///
1268        /// Needs `entry.images.import` or `content:write` in the manifest's `[permissions]`.
1269        pub fn import(project: &str, id: i32, extension: &str, content: &[u8]) -> crate::Result<EntryImages> {
1270            #[derive(Serialize)]
1271            struct Input<'a> {
1272                project: &'a str,
1273                id: i32,
1274                extension: &'a str,
1275                #[serde(serialize_with = "crate::base64::serialize")]
1276                content: &'a [u8],
1277            }
1278            crate::call("entry.images.import", &Input { project, id, extension, content })
1279        }
1280
1281        /// The images an encyclopedia entry shows, primary first.
1282        ///
1283        /// Needs `entry.images.list` or `content:read` in the manifest's `[permissions]`.
1284        pub fn list(project: &str, id: i32) -> crate::Result<EntryImages> {
1285            #[derive(Serialize)]
1286            struct Input<'a> {
1287                project: &'a str,
1288                id: i32,
1289            }
1290            crate::call("entry.images.list", &Input { project, id })
1291        }
1292
1293        /// Make one of an encyclopedia entry's images its primary image, moving it first.
1294        ///
1295        /// Needs `entry.images.primary` or `content:write` in the manifest's `[permissions]`.
1296        pub fn primary(project: &str, id: i32, image_id: i32) -> crate::Result<EntryImages> {
1297            #[derive(Serialize)]
1298            struct Input<'a> {
1299                project: &'a str,
1300                id: i32,
1301                #[serde(rename = "imageId")]
1302                image_id: i32,
1303            }
1304            crate::call("entry.images.primary", &Input { project, id, image_id })
1305        }
1306
1307        /// Take an image off an encyclopedia entry. The image stays in the project.
1308        ///
1309        /// Needs `entry.images.remove` or `content:write` in the manifest's `[permissions]`.
1310        pub fn remove(project: &str, id: i32, image_id: i32) -> crate::Result<EntryImages> {
1311            #[derive(Serialize)]
1312            struct Input<'a> {
1313                project: &'a str,
1314                id: i32,
1315                #[serde(rename = "imageId")]
1316                image_id: i32,
1317            }
1318            crate::call("entry.images.remove", &Input { project, id, image_id })
1319        }
1320
1321    }
1322
1323}
1324
1325/// The `export` operations.
1326pub mod export {
1327    use super::*;
1328
1329    /// The formats project.export can produce.
1330    ///
1331    /// Needs `export.formats` or `content:read` in the manifest's `[permissions]`.
1332    pub fn formats() -> crate::Result<ExportFormats> {
1333        #[derive(Serialize)]
1334        struct Input {
1335        }
1336        crate::call("export.formats", &Input {  })
1337    }
1338
1339}
1340
1341/// The `idea` operations.
1342pub mod idea {
1343    use super::*;
1344
1345    /// Archive a story idea.
1346    ///
1347    /// Needs `idea.archive` or `content:write` in the manifest's `[permissions]`.
1348    pub fn archive(id: &str) -> crate::Result<Idea> {
1349        #[derive(Serialize)]
1350        struct Input<'a> {
1351            id: &'a str,
1352        }
1353        crate::call("idea.archive", &Input { id })
1354    }
1355
1356    /// The optional inputs of [`create`]; leave any out with `..Default::default()`.
1357    #[derive(Debug, Clone, Default, PartialEq, Serialize)]
1358    pub struct IdeaCreateOptions {
1359        #[serde(skip_serializing_if = "Option::is_none")]
1360        pub title: Option<String>,
1361        #[serde(skip_serializing_if = "Option::is_none")]
1362        pub tags: Option<Vec<String>>,
1363    }
1364
1365    /// Add a story idea.
1366    ///
1367    /// Needs `idea.create` or `content:write` in the manifest's `[permissions]`.
1368    pub fn create(content: &str, options: IdeaCreateOptions) -> crate::Result<Idea> {
1369        #[derive(Serialize)]
1370        struct Input<'a> {
1371            content: &'a str,
1372            #[serde(flatten)]
1373            options: IdeaCreateOptions,
1374        }
1375        crate::call("idea.create", &Input { content, options })
1376    }
1377
1378    /// Delete a story idea for good.
1379    ///
1380    /// Needs `idea.delete` (by name) in the manifest's `[permissions]`.
1381    pub fn delete(id: &str) -> crate::Result<Idea> {
1382        #[derive(Serialize)]
1383        struct Input<'a> {
1384            id: &'a str,
1385        }
1386        crate::call("idea.delete", &Input { id })
1387    }
1388
1389    /// The optional inputs of [`list`]; leave any out with `..Default::default()`.
1390    #[derive(Debug, Clone, Default, PartialEq, Serialize)]
1391    pub struct IdeaListOptions {
1392        /// True for only archived ideas, false for only active ones; omitted for both.
1393        #[serde(skip_serializing_if = "Option::is_none")]
1394        pub archived: Option<bool>,
1395    }
1396
1397    /// Story ideas, which belong to the account rather than a project.
1398    ///
1399    /// Needs `idea.list` or `content:read` in the manifest's `[permissions]`.
1400    pub fn list(options: IdeaListOptions) -> crate::Result<Ideas> {
1401        #[derive(Serialize)]
1402        struct Input {
1403            #[serde(flatten)]
1404            options: IdeaListOptions,
1405        }
1406        crate::call("idea.list", &Input { options })
1407    }
1408
1409    /// Return an archived story idea to the active ones.
1410    ///
1411    /// Needs `idea.unarchive` or `content:write` in the manifest's `[permissions]`.
1412    pub fn unarchive(id: &str) -> crate::Result<Idea> {
1413        #[derive(Serialize)]
1414        struct Input<'a> {
1415            id: &'a str,
1416        }
1417        crate::call("idea.unarchive", &Input { id })
1418    }
1419
1420    /// The optional inputs of [`update`]; leave any out with `..Default::default()`.
1421    #[derive(Debug, Clone, Default, PartialEq, Serialize)]
1422    pub struct IdeaUpdateOptions {
1423        /// Left out, unchanged; empty, cleared.
1424        #[serde(skip_serializing_if = "Option::is_none")]
1425        pub title: Option<String>,
1426        #[serde(skip_serializing_if = "Option::is_none")]
1427        pub tags: Option<Vec<String>>,
1428    }
1429
1430    /// Replace a story idea's text, and its title or tags when given. An empty title clears it.
1431    ///
1432    /// Needs `idea.update` or `content:write` in the manifest's `[permissions]`.
1433    pub fn update(id: &str, content: &str, options: IdeaUpdateOptions) -> crate::Result<Idea> {
1434        #[derive(Serialize)]
1435        struct Input<'a> {
1436            id: &'a str,
1437            content: &'a str,
1438            #[serde(flatten)]
1439            options: IdeaUpdateOptions,
1440        }
1441        crate::call("idea.update", &Input { id, content, options })
1442    }
1443
1444}
1445
1446/// The `image` operations.
1447pub mod image {
1448    use super::*;
1449
1450    /// Add an image to a project. The extension is jpg, jpeg, png, webp, or svg, and must match the image.
1451    ///
1452    /// Needs `image.add` or `content:write` in the manifest's `[permissions]`.
1453    pub fn add(project: &str, name: &str, extension: &str, content: &[u8]) -> crate::Result<ImageSummary> {
1454        #[derive(Serialize)]
1455        struct Input<'a> {
1456            project: &'a str,
1457            name: &'a str,
1458            extension: &'a str,
1459            #[serde(serialize_with = "crate::base64::serialize")]
1460            content: &'a [u8],
1461        }
1462        crate::call("image.add", &Input { project, name, extension, content })
1463    }
1464
1465    /// Delete an image for good, first taking it out of every entry and text that uses it, and the project cover.
1466    ///
1467    /// Needs `image.delete` (by name) in the manifest's `[permissions]`.
1468    pub fn delete(project: &str, id: i32) -> crate::Result<ImageDeleted> {
1469        #[derive(Serialize)]
1470        struct Input<'a> {
1471            project: &'a str,
1472            id: i32,
1473        }
1474        crate::call("image.delete", &Input { project, id })
1475    }
1476
1477    /// One image's name, extension, and bytes.
1478    ///
1479    /// Needs `image.get` or `content:read` in the manifest's `[permissions]`.
1480    pub fn get(project: &str, id: i32) -> crate::Result<ImageContent> {
1481        #[derive(Serialize)]
1482        struct Input<'a> {
1483            project: &'a str,
1484            id: i32,
1485        }
1486        crate::call("image.get", &Input { project, id })
1487    }
1488
1489    /// A project's images, with whether anything in the project uses each one.
1490    ///
1491    /// Needs `image.list` or `content:read` in the manifest's `[permissions]`.
1492    pub fn list(project: &str) -> crate::Result<Images> {
1493        #[derive(Serialize)]
1494        struct Input<'a> {
1495            project: &'a str,
1496        }
1497        crate::call("image.list", &Input { project })
1498    }
1499
1500    /// Rename an image.
1501    ///
1502    /// Needs `image.rename` or `content:write` in the manifest's `[permissions]`.
1503    pub fn rename(project: &str, id: i32, name: &str) -> crate::Result<ImageSummary> {
1504        #[derive(Serialize)]
1505        struct Input<'a> {
1506            project: &'a str,
1507            id: i32,
1508            name: &'a str,
1509        }
1510        crate::call("image.rename", &Input { project, id, name })
1511    }
1512
1513    /// Replace an image's bytes, keeping its id, so everything that uses it shows the new image. The extension is jpg, jpeg, png, webp, or svg, and must match the image.
1514    ///
1515    /// Needs `image.replace` or `content:write` in the manifest's `[permissions]`.
1516    pub fn replace(project: &str, id: i32, extension: &str, content: &[u8]) -> crate::Result<ImageSummary> {
1517        #[derive(Serialize)]
1518        struct Input<'a> {
1519            project: &'a str,
1520            id: i32,
1521            extension: &'a str,
1522            #[serde(serialize_with = "crate::base64::serialize")]
1523            content: &'a [u8],
1524        }
1525        crate::call("image.replace", &Input { project, id, extension, content })
1526    }
1527
1528}
1529
1530/// The `note` operations.
1531pub mod note {
1532    use super::*;
1533
1534    /// The optional inputs of [`create`]; leave any out with `..Default::default()`.
1535    #[derive(Debug, Clone, Default, PartialEq, Serialize)]
1536    pub struct NoteCreateOptions {
1537        #[serde(skip_serializing_if = "Option::is_none")]
1538        pub tags: Option<Vec<String>>,
1539    }
1540
1541    /// Add a note to a project.
1542    ///
1543    /// Needs `note.create` or `content:write` in the manifest's `[permissions]`.
1544    pub fn create(project: &str, content: &str, options: NoteCreateOptions) -> crate::Result<Note> {
1545        #[derive(Serialize)]
1546        struct Input<'a> {
1547            project: &'a str,
1548            content: &'a str,
1549            #[serde(flatten)]
1550            options: NoteCreateOptions,
1551        }
1552        crate::call("note.create", &Input { project, content, options })
1553    }
1554
1555    /// Delete a note for good.
1556    ///
1557    /// Needs `note.delete` (by name) in the manifest's `[permissions]`.
1558    pub fn delete(project: &str, id: i32) -> crate::Result<Note> {
1559        #[derive(Serialize)]
1560        struct Input<'a> {
1561            project: &'a str,
1562            id: i32,
1563        }
1564        crate::call("note.delete", &Input { project, id })
1565    }
1566
1567    /// The optional inputs of [`list`]; leave any out with `..Default::default()`.
1568    #[derive(Debug, Clone, Default, PartialEq, Serialize)]
1569    pub struct NoteListOptions {
1570        #[serde(skip_serializing_if = "Option::is_none")]
1571        pub tag: Option<String>,
1572    }
1573
1574    /// A project's notes, optionally only those with a tag.
1575    ///
1576    /// Needs `note.list` or `content:read` in the manifest's `[permissions]`.
1577    pub fn list(project: &str, options: NoteListOptions) -> crate::Result<Notes> {
1578        #[derive(Serialize)]
1579        struct Input<'a> {
1580            project: &'a str,
1581            #[serde(flatten)]
1582            options: NoteListOptions,
1583        }
1584        crate::call("note.list", &Input { project, options })
1585    }
1586
1587    /// One note.
1588    ///
1589    /// Needs `note.read` or `content:read` in the manifest's `[permissions]`.
1590    pub fn read(project: &str, id: i32) -> crate::Result<Note> {
1591        #[derive(Serialize)]
1592        struct Input<'a> {
1593            project: &'a str,
1594            id: i32,
1595        }
1596        crate::call("note.read", &Input { project, id })
1597    }
1598
1599    /// The optional inputs of [`update`]; leave any out with `..Default::default()`.
1600    #[derive(Debug, Clone, Default, PartialEq, Serialize)]
1601    pub struct NoteUpdateOptions {
1602        /// Left out, the tags stay as they are.
1603        #[serde(skip_serializing_if = "Option::is_none")]
1604        pub tags: Option<Vec<String>>,
1605    }
1606
1607    /// Replace a note's text, and its tags when given.
1608    ///
1609    /// Needs `note.update` or `content:write` in the manifest's `[permissions]`.
1610    pub fn update(project: &str, id: i32, content: &str, options: NoteUpdateOptions) -> crate::Result<Note> {
1611        #[derive(Serialize)]
1612        struct Input<'a> {
1613            project: &'a str,
1614            id: i32,
1615            content: &'a str,
1616            #[serde(flatten)]
1617            options: NoteUpdateOptions,
1618        }
1619        crate::call("note.update", &Input { project, id, content, options })
1620    }
1621
1622}
1623
1624/// The `ops` operations.
1625pub mod ops {
1626    use super::*;
1627
1628    /// Every operation you may call, with JSON schemas for its input and output.
1629    ///
1630    /// Needs `ops.list` or `content:read` in the manifest's `[permissions]`.
1631    pub fn list() -> crate::Result<OperationList> {
1632        #[derive(Serialize)]
1633        struct Input {
1634        }
1635        crate::call("ops.list", &Input {  })
1636    }
1637
1638}
1639
1640/// The `plugin` operations.
1641pub mod plugin {
1642    use super::*;
1643
1644    /// The installed runtime plugins, and what each may use.
1645    ///
1646    /// Needs `plugin.list` or `plugins:read` in the manifest's `[permissions]`.
1647    pub fn list() -> crate::Result<PluginList> {
1648        #[derive(Serialize)]
1649        struct Input {
1650        }
1651        crate::call("plugin.list", &Input {  })
1652    }
1653
1654}
1655
1656/// The `project` operations.
1657pub mod project {
1658    use super::*;
1659
1660    /// Create an empty project.
1661    ///
1662    /// Needs `project.create` or `content:write` in the manifest's `[permissions]`.
1663    pub fn create(name: &str) -> crate::Result<ProjectName> {
1664        #[derive(Serialize)]
1665        struct Input<'a> {
1666            name: &'a str,
1667        }
1668        crate::call("project.create", &Input { name })
1669    }
1670
1671    /// Delete a project, and everything in it, for good. It must not be open in Hammer.
1672    ///
1673    /// Needs `project.delete` (by name) in the manifest's `[permissions]`.
1674    pub fn delete(project: &str) -> crate::Result<ProjectName> {
1675        #[derive(Serialize)]
1676        struct Input<'a> {
1677            project: &'a str,
1678        }
1679        crate::call("project.delete", &Input { project })
1680    }
1681
1682    /// The optional inputs of [`export`]; leave any out with `..Default::default()`.
1683    #[derive(Debug, Clone, Default, PartialEq, Serialize)]
1684    pub struct ProjectExportOptions {
1685        /// Limits the export to these scenes; omitted exports the whole story.
1686        #[serde(rename = "sceneIds")]
1687        #[serde(skip_serializing_if = "Option::is_none")]
1688        pub scene_ids: Option<Vec<i32>>,
1689        #[serde(rename = "treatTopLevelAsChapters")]
1690        #[serde(skip_serializing_if = "Option::is_none")]
1691        pub treat_top_level_as_chapters: Option<bool>,
1692    }
1693
1694    /// Export a project, or some of its scenes, in one of the formats from export.formats.
1695    ///
1696    /// Needs `project.export` or `content:read` in the manifest's `[permissions]`.
1697    pub fn export(project: &str, format: &str, options: ProjectExportOptions) -> crate::Result<ExportedFile> {
1698        #[derive(Serialize)]
1699        struct Input<'a> {
1700            project: &'a str,
1701            format: &'a str,
1702            #[serde(flatten)]
1703            options: ProjectExportOptions,
1704        }
1705        crate::call("project.export", &Input { project, format, options })
1706    }
1707
1708    /// The optional inputs of [`import`]; leave any out with `..Default::default()`.
1709    #[derive(Debug, Clone, Default, PartialEq, Serialize)]
1710    pub struct ProjectImportOptions {
1711        /// Left out, the title the file gives itself.
1712        #[serde(skip_serializing_if = "Option::is_none")]
1713        pub name: Option<String>,
1714        #[serde(rename = "markdownSplit")]
1715        #[serde(skip_serializing_if = "Option::is_none")]
1716        pub markdown_split: Option<MarkdownSplit>,
1717        #[serde(rename = "rtfSplit")]
1718        #[serde(skip_serializing_if = "Option::is_none")]
1719        pub rtf_split: Option<RtfSplit>,
1720        /// A regular expression for the lines that start a chapter; left out, chapter, part, prologue, and epilogue.
1721        #[serde(rename = "chapterPattern")]
1722        #[serde(skip_serializing_if = "Option::is_none")]
1723        pub chapter_pattern: Option<String>,
1724        /// Put each chapter's scenes in a group.
1725        #[serde(rename = "chapterGroups")]
1726        #[serde(skip_serializing_if = "Option::is_none")]
1727        pub chapter_groups: Option<bool>,
1728    }
1729
1730    /// Create a project from a Markdown or RTF manuscript, split into scenes by its headings or a chapter pattern.
1731    ///
1732    /// Needs `project.import` or `content:prose` in the manifest's `[permissions]`.
1733    pub fn import(format: ImportFileFormat, content: &[u8], options: ProjectImportOptions) -> crate::Result<ProjectImported> {
1734        #[derive(Serialize)]
1735        struct Input<'a> {
1736            format: ImportFileFormat,
1737            #[serde(serialize_with = "crate::base64::serialize")]
1738            content: &'a [u8],
1739            #[serde(flatten)]
1740            options: ProjectImportOptions,
1741        }
1742        crate::call("project.import", &Input { format, content, options })
1743    }
1744
1745    /// A project's details: author, language, tags, word count goal, cached totals, and sync linkage.
1746    ///
1747    /// Needs `project.info` or `content:read` in the manifest's `[permissions]`.
1748    pub fn info(project: &str) -> crate::Result<ProjectInfo> {
1749        #[derive(Serialize)]
1750        struct Input<'a> {
1751            project: &'a str,
1752        }
1753        crate::call("project.info", &Input { project })
1754    }
1755
1756    /// List every project with its word count and when it was last edited.
1757    ///
1758    /// Needs `project.list` or `content:read` in the manifest's `[permissions]`.
1759    pub fn list() -> crate::Result<ProjectList> {
1760        #[derive(Serialize)]
1761        struct Input {
1762        }
1763        crate::call("project.list", &Input {  })
1764    }
1765
1766    /// Rename a project. It must not be open in Hammer.
1767    ///
1768    /// Needs `project.rename` or `content:write` in the manifest's `[permissions]`.
1769    pub fn rename(project: &str, name: &str) -> crate::Result<ProjectName> {
1770        #[derive(Serialize)]
1771        struct Input<'a> {
1772            project: &'a str,
1773            name: &'a str,
1774        }
1775        crate::call("project.rename", &Input { project, name })
1776    }
1777
1778}
1779
1780/// The `scene` operations.
1781pub mod scene {
1782    use super::*;
1783
1784    /// Add markdown to the end of a scene's text, as a new paragraph.
1785    ///
1786    /// Needs `scene.append` or `content:prose` in the manifest's `[permissions]`.
1787    pub fn append(project: &str, id: i32, markdown: &str) -> crate::Result<SceneWordCount> {
1788        #[derive(Serialize)]
1789        struct Input<'a> {
1790            project: &'a str,
1791            id: i32,
1792            markdown: &'a str,
1793        }
1794        crate::call("scene.append", &Input { project, id, markdown })
1795    }
1796
1797    /// Archive a scene: take it out of the story, keeping its text, drafts, and notes.
1798    ///
1799    /// Needs `scene.archive` or `content:write` in the manifest's `[permissions]`.
1800    pub fn archive(project: &str, id: i32) -> crate::Result<SceneItemRef> {
1801        #[derive(Serialize)]
1802        struct Input<'a> {
1803            project: &'a str,
1804            id: i32,
1805        }
1806        crate::call("scene.archive", &Input { project, id })
1807    }
1808
1809    /// A project's archived scenes.
1810    ///
1811    /// Needs `scene.archived` or `content:read` in the manifest's `[permissions]`.
1812    pub fn archived(project: &str) -> crate::Result<ArchivedScenes> {
1813        #[derive(Serialize)]
1814        struct Input<'a> {
1815            project: &'a str,
1816        }
1817        crate::call("scene.archived", &Input { project })
1818    }
1819
1820    /// The optional inputs of [`create`]; leave any out with `..Default::default()`.
1821    #[derive(Debug, Clone, Default, PartialEq, Serialize)]
1822    pub struct SceneCreateOptions {
1823        #[serde(skip_serializing_if = "Option::is_none")]
1824        pub kind: Option<SceneKind>,
1825        /// The group to create it in; left out, the top level.
1826        #[serde(rename = "parentId")]
1827        #[serde(skip_serializing_if = "Option::is_none")]
1828        pub parent_id: Option<i32>,
1829        /// Its position among its siblings; left out, the end.
1830        #[serde(skip_serializing_if = "Option::is_none")]
1831        pub index: Option<i32>,
1832    }
1833
1834    /// Create an empty scene or group, at the end of its parent unless an index is given.
1835    ///
1836    /// Needs `scene.create` or `content:write` in the manifest's `[permissions]`.
1837    pub fn create(project: &str, name: &str, options: SceneCreateOptions) -> crate::Result<SceneItemRef> {
1838        #[derive(Serialize)]
1839        struct Input<'a> {
1840            project: &'a str,
1841            name: &'a str,
1842            #[serde(flatten)]
1843            options: SceneCreateOptions,
1844        }
1845        crate::call("scene.create", &Input { project, name, options })
1846    }
1847
1848    /// Delete a scene, archived or not, or an empty group, for good.
1849    ///
1850    /// Needs `scene.delete` (by name) in the manifest's `[permissions]`.
1851    pub fn delete(project: &str, id: i32) -> crate::Result<SceneItemRef> {
1852        #[derive(Serialize)]
1853        struct Input<'a> {
1854            project: &'a str,
1855            id: i32,
1856        }
1857        crate::call("scene.delete", &Input { project, id })
1858    }
1859
1860    /// The optional inputs of [`r#move`]; leave any out with `..Default::default()`.
1861    #[derive(Debug, Clone, Default, PartialEq, Serialize)]
1862    pub struct SceneMoveOptions {
1863        /// The group to move into; left out, the top level.
1864        #[serde(rename = "parentId")]
1865        #[serde(skip_serializing_if = "Option::is_none")]
1866        pub parent_id: Option<i32>,
1867    }
1868
1869    /// Move a scene or group to a position within a group, or the top level when parentId is left out. index is its position there after the move.
1870    ///
1871    /// Needs `scene.move` or `content:write` in the manifest's `[permissions]`.
1872    pub fn r#move(project: &str, id: i32, index: i32, options: SceneMoveOptions) -> crate::Result<SceneItemRef> {
1873        #[derive(Serialize)]
1874        struct Input<'a> {
1875            project: &'a str,
1876            id: i32,
1877            index: i32,
1878            #[serde(flatten)]
1879            options: SceneMoveOptions,
1880        }
1881        crate::call("scene.move", &Input { project, id, index, options })
1882    }
1883
1884    /// A scene's markdown, including unsaved edits, with its outline, notes, and tags.
1885    ///
1886    /// Needs `scene.read` or `content:read` in the manifest's `[permissions]`.
1887    pub fn read(project: &str, id: i32) -> crate::Result<SceneText> {
1888        #[derive(Serialize)]
1889        struct Input<'a> {
1890            project: &'a str,
1891            id: i32,
1892        }
1893        crate::call("scene.read", &Input { project, id })
1894    }
1895
1896    /// Rename a scene or group.
1897    ///
1898    /// Needs `scene.rename` or `content:write` in the manifest's `[permissions]`.
1899    pub fn rename(project: &str, id: i32, name: &str) -> crate::Result<SceneItemRef> {
1900        #[derive(Serialize)]
1901        struct Input<'a> {
1902            project: &'a str,
1903            id: i32,
1904            name: &'a str,
1905        }
1906        crate::call("scene.rename", &Input { project, id, name })
1907    }
1908
1909    /// A project's scenes and groups in story order, with word counts.
1910    ///
1911    /// Needs `scene.tree` or `content:read` in the manifest's `[permissions]`.
1912    pub fn tree(project: &str) -> crate::Result<SceneTree> {
1913        #[derive(Serialize)]
1914        struct Input<'a> {
1915            project: &'a str,
1916        }
1917        crate::call("scene.tree", &Input { project })
1918    }
1919
1920    /// Return an archived scene to the story, at the end of the top level.
1921    ///
1922    /// Needs `scene.unarchive` or `content:write` in the manifest's `[permissions]`.
1923    pub fn unarchive(project: &str, id: i32) -> crate::Result<SceneItemRef> {
1924        #[derive(Serialize)]
1925        struct Input<'a> {
1926            project: &'a str,
1927            id: i32,
1928        }
1929        crate::call("scene.unarchive", &Input { project, id })
1930    }
1931
1932    /// The optional inputs of [`write`]; leave any out with `..Default::default()`.
1933    #[derive(Debug, Clone, Default, PartialEq, Serialize)]
1934    pub struct SceneWriteOptions {
1935        /// The new draft's name, in draft mode only.
1936        #[serde(rename = "draftName")]
1937        #[serde(skip_serializing_if = "Option::is_none")]
1938        pub draft_name: Option<String>,
1939    }
1940
1941    /// Replace a scene's text with markdown. Mode draft saves it as a new draft of the scene and leaves the scene alone. Mode live replaces the scene's text, saving the old text as a draft first.
1942    ///
1943    /// Needs `scene.write` or `content:prose` in the manifest's `[permissions]`.
1944    pub fn write(project: &str, id: i32, mode: WriteMode, markdown: &str, options: SceneWriteOptions) -> crate::Result<SceneWriteResult> {
1945        #[derive(Serialize)]
1946        struct Input<'a> {
1947            project: &'a str,
1948            id: i32,
1949            mode: WriteMode,
1950            markdown: &'a str,
1951            #[serde(flatten)]
1952            options: SceneWriteOptions,
1953        }
1954        crate::call("scene.write", &Input { project, id, mode, markdown, options })
1955    }
1956
1957    /// The `scene.meta` operations.
1958    pub mod meta {
1959        use super::*;
1960
1961        /// A scene's outline, notes, tags, and references: the entries confirmed as in it, and those dismissed.
1962        ///
1963        /// Needs `scene.meta.read` or `content:read` in the manifest's `[permissions]`.
1964        pub fn read(project: &str, id: i32) -> crate::Result<SceneMeta> {
1965            #[derive(Serialize)]
1966            struct Input<'a> {
1967                project: &'a str,
1968                id: i32,
1969            }
1970            crate::call("scene.meta.read", &Input { project, id })
1971        }
1972
1973        /// The optional inputs of [`write`]; leave any out with `..Default::default()`.
1974        #[derive(Debug, Clone, Default, PartialEq, Serialize)]
1975        pub struct SceneMetaWriteOptions {
1976            #[serde(skip_serializing_if = "Option::is_none")]
1977            pub outline: Option<String>,
1978            #[serde(skip_serializing_if = "Option::is_none")]
1979            pub notes: Option<String>,
1980            #[serde(skip_serializing_if = "Option::is_none")]
1981            pub tags: Option<Vec<String>>,
1982        }
1983
1984        /// Change a scene's outline, notes, or tags. Fields left out keep their value.
1985        ///
1986        /// Needs `scene.meta.write` or `content:write` in the manifest's `[permissions]`.
1987        pub fn write(project: &str, id: i32, options: SceneMetaWriteOptions) -> crate::Result<SceneMeta> {
1988            #[derive(Serialize)]
1989            struct Input<'a> {
1990                project: &'a str,
1991                id: i32,
1992                #[serde(flatten)]
1993                options: SceneMetaWriteOptions,
1994            }
1995            crate::call("scene.meta.write", &Input { project, id, options })
1996        }
1997
1998    }
1999
2000    /// The `scene.read` operations.
2001    pub mod read {
2002        use super::*;
2003
2004        /// The optional inputs of [`many`]; leave any out with `..Default::default()`.
2005        #[derive(Debug, Clone, Default, PartialEq, Serialize)]
2006        pub struct SceneReadManyOptions {
2007            /// A group whose scenes, at any depth, to read.
2008            #[serde(skip_serializing_if = "Option::is_none")]
2009            pub group: Option<i32>,
2010            #[serde(skip_serializing_if = "Option::is_none")]
2011            pub ids: Option<Vec<i32>>,
2012            /// The previous page's next.
2013            #[serde(skip_serializing_if = "Option::is_none")]
2014            pub after: Option<i32>,
2015            #[serde(rename = "maxWords")]
2016            #[serde(skip_serializing_if = "Option::is_none")]
2017            pub max_words: Option<i32>,
2018        }
2019
2020        /// Scenes in story order with their markdown, metadata, and the groups they sit in, a page of about maxWords, counting outlines and notes, at a time: every scene, a group's, or those in ids. Archived scenes are left out. Pass next as after for the following page; it is null on the last.
2021        ///
2022        /// Needs `scene.read.many` or `content:read` in the manifest's `[permissions]`.
2023        pub fn many(project: &str, options: SceneReadManyOptions) -> crate::Result<ScenePage> {
2024            #[derive(Serialize)]
2025            struct Input<'a> {
2026                project: &'a str,
2027                #[serde(flatten)]
2028                options: SceneReadManyOptions,
2029            }
2030            crate::call("scene.read.many", &Input { project, options })
2031        }
2032
2033    }
2034
2035    /// The `scene.references` operations.
2036    pub mod references {
2037        use super::*;
2038
2039        /// The optional inputs of [`set`]; leave any out with `..Default::default()`.
2040        #[derive(Debug, Clone, Default, PartialEq, Serialize)]
2041        pub struct SceneReferencesSetOptions {
2042            #[serde(skip_serializing_if = "Option::is_none")]
2043            pub confirm: Option<Vec<i32>>,
2044            #[serde(skip_serializing_if = "Option::is_none")]
2045            pub dismiss: Option<Vec<i32>>,
2046            #[serde(skip_serializing_if = "Option::is_none")]
2047            pub clear: Option<Vec<i32>>,
2048        }
2049
2050        /// Change which entries a scene references. confirm marks entries as in the scene, and un-dismisses them; dismiss marks entries as only mentioned, so name matching stops adding them; clear forgets entries either way, so a later match can add them again.
2051        ///
2052        /// Needs `scene.references.set` or `content:write` in the manifest's `[permissions]`.
2053        pub fn set(project: &str, id: i32, options: SceneReferencesSetOptions) -> crate::Result<SceneMeta> {
2054            #[derive(Serialize)]
2055            struct Input<'a> {
2056                project: &'a str,
2057                id: i32,
2058                #[serde(flatten)]
2059                options: SceneReferencesSetOptions,
2060            }
2061            crate::call("scene.references.set", &Input { project, id, options })
2062        }
2063
2064    }
2065
2066}
2067
2068/// The `stats` operations.
2069pub mod stats {
2070    use super::*;
2071
2072    /// The optional inputs of [`activity`]; leave any out with `..Default::default()`.
2073    #[derive(Debug, Clone, Default, PartialEq, Serialize)]
2074    pub struct StatsActivityOptions {
2075        /// First day included, in the device's time zone; omitted for no lower bound. An ISO 8601 date, such as `2026-03-01`.
2076        #[serde(skip_serializing_if = "Option::is_none")]
2077        pub from: Option<String>,
2078        /// Last day included; omitted for no upper bound. An ISO 8601 date, such as `2026-03-01`.
2079        #[serde(skip_serializing_if = "Option::is_none")]
2080        pub to: Option<String>,
2081    }
2082
2083    /// Words written per day over a date range, plus lifetime words per device.
2084    ///
2085    /// Needs `stats.activity` or `content:read` in the manifest's `[permissions]`.
2086    pub fn activity(project: &str, options: StatsActivityOptions) -> crate::Result<Activity> {
2087        #[derive(Serialize)]
2088        struct Input<'a> {
2089            project: &'a str,
2090            #[serde(flatten)]
2091            options: StatsActivityOptions,
2092        }
2093        crate::call("stats.activity", &Input { project, options })
2094    }
2095
2096    /// The optional inputs of [`project`]; leave any out with `..Default::default()`.
2097    #[derive(Debug, Clone, Default, PartialEq, Serialize)]
2098    pub struct StatsProjectOptions {
2099        /// Recalculate even when the cached statistics are current.
2100        #[serde(skip_serializing_if = "Option::is_none")]
2101        pub recalculate: Option<bool>,
2102    }
2103
2104    /// A project's statistics, as its Home screen shows them.
2105    ///
2106    /// Needs `stats.project` or `content:read` in the manifest's `[permissions]`.
2107    pub fn project(project: &str, options: StatsProjectOptions) -> crate::Result<ProjectStats> {
2108        #[derive(Serialize)]
2109        struct Input<'a> {
2110            project: &'a str,
2111            #[serde(flatten)]
2112            options: StatsProjectOptions,
2113        }
2114        crate::call("stats.project", &Input { project, options })
2115    }
2116
2117    /// The optional inputs of [`sessions`]; leave any out with `..Default::default()`.
2118    #[derive(Debug, Clone, Default, PartialEq, Serialize)]
2119    pub struct StatsSessionsOptions {
2120        /// First day included, in the device's time zone; omitted for no lower bound. An ISO 8601 date, such as `2026-03-01`.
2121        #[serde(skip_serializing_if = "Option::is_none")]
2122        pub from: Option<String>,
2123        /// Last day included; omitted for no upper bound. An ISO 8601 date, such as `2026-03-01`.
2124        #[serde(skip_serializing_if = "Option::is_none")]
2125        pub to: Option<String>,
2126    }
2127
2128    /// Writing sessions over a date range, from every device.
2129    ///
2130    /// Needs `stats.sessions` or `content:read` in the manifest's `[permissions]`.
2131    pub fn sessions(project: &str, options: StatsSessionsOptions) -> crate::Result<Sessions> {
2132        #[derive(Serialize)]
2133        struct Input<'a> {
2134            project: &'a str,
2135            #[serde(flatten)]
2136            options: StatsSessionsOptions,
2137        }
2138        crate::call("stats.sessions", &Input { project, options })
2139    }
2140
2141}
2142
2143/// The `sync` operations.
2144pub mod sync {
2145    use super::*;
2146
2147    /// Each project's link to the sync server, its last sync, and how many of its changes are waiting to sync.
2148    ///
2149    /// Needs `sync.status` or `account:read` in the manifest's `[permissions]`.
2150    pub fn status() -> crate::Result<SyncStatus> {
2151        #[derive(Serialize)]
2152        struct Input {
2153        }
2154        crate::call("sync.status", &Input {  })
2155    }
2156
2157}
2158
2159/// The `tag` operations.
2160pub mod tag {
2161    use super::*;
2162
2163    /// Every scene, note, entry, and timeline event carrying a tag.
2164    ///
2165    /// Needs `tag.find` or `content:read` in the manifest's `[permissions]`.
2166    pub fn find(project: &str, tag: &str) -> crate::Result<TaggedEntities> {
2167        #[derive(Serialize)]
2168        struct Input<'a> {
2169            project: &'a str,
2170            tag: &'a str,
2171        }
2172        crate::call("tag.find", &Input { project, tag })
2173    }
2174
2175    /// The optional inputs of [`list`]; leave any out with `..Default::default()`.
2176    #[derive(Debug, Clone, Default, PartialEq, Serialize)]
2177    pub struct TagListOptions {
2178        #[serde(skip_serializing_if = "Option::is_none")]
2179        pub kind: Option<EntityKind>,
2180        #[serde(skip_serializing_if = "Option::is_none")]
2181        pub limit: Option<i32>,
2182    }
2183
2184    /// The tags used in a project, most used first, optionally counting one kind of entity.
2185    ///
2186    /// Needs `tag.list` or `content:read` in the manifest's `[permissions]`.
2187    pub fn list(project: &str, options: TagListOptions) -> crate::Result<Tags> {
2188        #[derive(Serialize)]
2189        struct Input<'a> {
2190            project: &'a str,
2191            #[serde(flatten)]
2192            options: TagListOptions,
2193        }
2194        crate::call("tag.list", &Input { project, options })
2195    }
2196
2197}
2198
2199/// The `timeline` operations.
2200pub mod timeline {
2201    use super::*;
2202
2203    /// The optional inputs of [`create`]; leave any out with `..Default::default()`.
2204    #[derive(Debug, Clone, Default, PartialEq, Serialize)]
2205    pub struct TimelineCreateOptions {
2206        /// Deprecated alias of label; label wins when both are given.
2207        #[serde(skip_serializing_if = "Option::is_none")]
2208        pub date: Option<String>,
2209        #[serde(skip_serializing_if = "Option::is_none")]
2210        pub tags: Option<Vec<String>>,
2211        /// Its position in the timeline; left out, the end. A dated timeline takes none.
2212        #[serde(skip_serializing_if = "Option::is_none")]
2213        pub index: Option<i32>,
2214        /// Its own title; left out, the content's first line is shown.
2215        #[serde(skip_serializing_if = "Option::is_none")]
2216        pub title: Option<String>,
2217        /// Free-text "when" a manual timeline shows, such as "Day 3" or "Spring, 1802".
2218        #[serde(skip_serializing_if = "Option::is_none")]
2219        pub label: Option<String>,
2220        /// The lane it runs in.
2221        #[serde(skip_serializing_if = "Option::is_none")]
2222        pub lane: Option<String>,
2223        /// A turning point, marked across every lane.
2224        #[serde(skip_serializing_if = "Option::is_none")]
2225        pub milestone: Option<bool>,
2226        /// When it starts on the timeline's calendar, such as {"year": 97, "day": 210}; required on a dated timeline.
2227        #[serde(skip_serializing_if = "Option::is_none")]
2228        pub start: Option<BTreeMap<String, i64>>,
2229        /// When it ends, in the same form as start; needs a start.
2230        #[serde(skip_serializing_if = "Option::is_none")]
2231        pub end: Option<BTreeMap<String, i64>>,
2232        /// Scene and entry ids it refers to.
2233        #[serde(skip_serializing_if = "Option::is_none")]
2234        pub references: Option<Vec<i32>>,
2235        /// The timeline's id, from timeline.settings.read; left out, or "main", the main timeline.
2236        #[serde(skip_serializing_if = "Option::is_none")]
2237        pub timeline: Option<String>,
2238    }
2239
2240    /// Add a plain event to a project's timeline, main unless timeline names another, at the end unless an index is given. A dated timeline needs a start and takes no index. Entries and scenes are added with timeline.place.
2241    ///
2242    /// Needs `timeline.create` or `content:write` in the manifest's `[permissions]`.
2243    pub fn create(project: &str, content: &str, options: TimelineCreateOptions) -> crate::Result<TimelineEntry> {
2244        #[derive(Serialize)]
2245        struct Input<'a> {
2246            project: &'a str,
2247            content: &'a str,
2248            #[serde(flatten)]
2249            options: TimelineCreateOptions,
2250        }
2251        crate::call("timeline.create", &Input { project, content, options })
2252    }
2253
2254    /// Delete a timeline event for good. Deleting a placement leaves its entry or scene alone.
2255    ///
2256    /// Needs `timeline.delete` (by name) in the manifest's `[permissions]`.
2257    pub fn delete(project: &str, id: i32) -> crate::Result<TimelineEntry> {
2258        #[derive(Serialize)]
2259        struct Input<'a> {
2260            project: &'a str,
2261            id: i32,
2262        }
2263        crate::call("timeline.delete", &Input { project, id })
2264    }
2265
2266    /// The optional inputs of [`list`]; leave any out with `..Default::default()`.
2267    #[derive(Debug, Clone, Default, PartialEq, Serialize)]
2268    pub struct TimelineListOptions {
2269        /// The timeline's id; left out, or "main", the main timeline.
2270        #[serde(skip_serializing_if = "Option::is_none")]
2271        pub timeline: Option<String>,
2272        /// Instead, the events whose timeline was deleted.
2273        #[serde(skip_serializing_if = "Option::is_none")]
2274        pub orphaned: Option<bool>,
2275    }
2276
2277    /// A timeline's events in display order: their manual order, or by start date on a dated timeline. The main timeline unless timeline names another; orphaned lists, by order, the events left on timelines deleted since, such as one made offline before a sync.
2278    ///
2279    /// Needs `timeline.list` or `content:read` in the manifest's `[permissions]`.
2280    pub fn list(project: &str, options: TimelineListOptions) -> crate::Result<Timeline> {
2281        #[derive(Serialize)]
2282        struct Input<'a> {
2283            project: &'a str,
2284            #[serde(flatten)]
2285            options: TimelineListOptions,
2286        }
2287        crate::call("timeline.list", &Input { project, options })
2288    }
2289
2290    /// Move a timeline event to a position on its own timeline; index is its position after the move. A dated timeline is ordered by its dates, so nothing can be moved on it. timeline.set moves an event to another timeline.
2291    ///
2292    /// Needs `timeline.move` or `content:write` in the manifest's `[permissions]`.
2293    pub fn r#move(project: &str, id: i32, index: i32) -> crate::Result<TimelineEntry> {
2294        #[derive(Serialize)]
2295        struct Input<'a> {
2296            project: &'a str,
2297            id: i32,
2298            index: i32,
2299        }
2300        crate::call("timeline.move", &Input { project, id, index })
2301    }
2302
2303    /// The optional inputs of [`place`]; leave any out with `..Default::default()`.
2304    #[derive(Debug, Clone, Default, PartialEq, Serialize)]
2305    pub struct TimelinePlaceOptions {
2306        /// When it starts on the timeline's calendar, such as {"year": 97, "day": 210}; required on a dated timeline.
2307        #[serde(skip_serializing_if = "Option::is_none")]
2308        pub start: Option<BTreeMap<String, i64>>,
2309        /// When it ends, in the same form as start; needs a start.
2310        #[serde(skip_serializing_if = "Option::is_none")]
2311        pub end: Option<BTreeMap<String, i64>>,
2312        /// The lane it runs in.
2313        #[serde(skip_serializing_if = "Option::is_none")]
2314        pub lane: Option<String>,
2315        /// A turning point, marked across every lane.
2316        #[serde(skip_serializing_if = "Option::is_none")]
2317        pub milestone: Option<bool>,
2318        /// The timeline's id, from timeline.settings.read; left out, or "main", the main timeline.
2319        #[serde(skip_serializing_if = "Option::is_none")]
2320        pub timeline: Option<String>,
2321    }
2322
2323    /// Place an encyclopedia entry of type event, or a scene, on a project's timeline, main unless timeline names another. Each can be placed once on each timeline, and its name and words come from it. A dated timeline needs a start.
2324    ///
2325    /// Needs `timeline.place` or `content:write` in the manifest's `[permissions]`.
2326    pub fn place(project: &str, kind: TimelineKindDto, subject: i32, options: TimelinePlaceOptions) -> crate::Result<TimelineEntry> {
2327        #[derive(Serialize)]
2328        struct Input<'a> {
2329            project: &'a str,
2330            kind: TimelineKindDto,
2331            subject: i32,
2332            #[serde(flatten)]
2333            options: TimelinePlaceOptions,
2334        }
2335        crate::call("timeline.place", &Input { project, kind, subject, options })
2336    }
2337
2338    /// One timeline event.
2339    ///
2340    /// Needs `timeline.read` or `content:read` in the manifest's `[permissions]`.
2341    pub fn read(project: &str, id: i32) -> crate::Result<TimelineEntry> {
2342        #[derive(Serialize)]
2343        struct Input<'a> {
2344            project: &'a str,
2345            id: i32,
2346        }
2347        crate::call("timeline.read", &Input { project, id })
2348    }
2349
2350    /// The optional inputs of [`set`]; leave any out with `..Default::default()`.
2351    #[derive(Debug, Clone, Default, PartialEq, Serialize)]
2352    pub struct TimelineSetOptions {
2353        /// A plain event's own title.
2354        #[serde(skip_serializing_if = "Option::is_none")]
2355        pub title: Option<String>,
2356        /// The free-text "when", shown on a manual timeline.
2357        #[serde(skip_serializing_if = "Option::is_none")]
2358        pub label: Option<String>,
2359        /// The lane it runs in.
2360        #[serde(skip_serializing_if = "Option::is_none")]
2361        pub lane: Option<String>,
2362        /// A turning point, marked across every lane.
2363        #[serde(skip_serializing_if = "Option::is_none")]
2364        pub milestone: Option<bool>,
2365        /// When it starts on the timeline's calendar, such as {"year": 97, "day": 210}.
2366        #[serde(skip_serializing_if = "Option::is_none")]
2367        pub start: Option<BTreeMap<String, i64>>,
2368        /// When it ends, in the same form as start.
2369        #[serde(skip_serializing_if = "Option::is_none")]
2370        pub end: Option<BTreeMap<String, i64>>,
2371        /// Fields to clear, from title, label, lane, start, and end.
2372        #[serde(skip_serializing_if = "Option::is_none")]
2373        pub clear: Option<Vec<String>>,
2374        /// Moves the event to this timeline, by id, "main" for the main one.
2375        #[serde(skip_serializing_if = "Option::is_none")]
2376        pub timeline: Option<String>,
2377    }
2378
2379    /// Set single fields of any timeline event, or clear them by name, leaving the rest alone. A placement takes only label, lane, milestone, start, and end. This is how a placement is edited. A timeline other than the event's own moves it there, with start and end, when given, as its dates on that timeline's calendar; a dated timeline refuses the move unless the event's start fits or one is given.
2380    ///
2381    /// Needs `timeline.set` or `content:write` in the manifest's `[permissions]`.
2382    pub fn set(project: &str, id: i32, options: TimelineSetOptions) -> crate::Result<TimelineEntry> {
2383        #[derive(Serialize)]
2384        struct Input<'a> {
2385            project: &'a str,
2386            id: i32,
2387            #[serde(flatten)]
2388            options: TimelineSetOptions,
2389        }
2390        crate::call("timeline.set", &Input { project, id, options })
2391    }
2392
2393    /// The optional inputs of [`update`]; leave any out with `..Default::default()`.
2394    #[derive(Debug, Clone, Default, PartialEq, Serialize)]
2395    pub struct TimelineUpdateOptions {
2396        /// Deprecated alias of label; label wins when both are given.
2397        #[serde(skip_serializing_if = "Option::is_none")]
2398        pub date: Option<String>,
2399        #[serde(skip_serializing_if = "Option::is_none")]
2400        pub tags: Option<Vec<String>>,
2401        #[serde(skip_serializing_if = "Option::is_none")]
2402        pub title: Option<String>,
2403        /// Free-text "when" a manual timeline shows.
2404        #[serde(skip_serializing_if = "Option::is_none")]
2405        pub label: Option<String>,
2406        #[serde(skip_serializing_if = "Option::is_none")]
2407        pub lane: Option<String>,
2408        #[serde(skip_serializing_if = "Option::is_none")]
2409        pub milestone: Option<bool>,
2410        /// When it starts on the timeline's calendar, such as {"year": 97, "day": 210}.
2411        #[serde(skip_serializing_if = "Option::is_none")]
2412        pub start: Option<BTreeMap<String, i64>>,
2413        /// When it ends, in the same form as start.
2414        #[serde(skip_serializing_if = "Option::is_none")]
2415        pub end: Option<BTreeMap<String, i64>>,
2416        /// Scene and entry ids it refers to.
2417        #[serde(skip_serializing_if = "Option::is_none")]
2418        pub references: Option<Vec<i32>>,
2419    }
2420
2421    /// Replace a plain event's text, and any other field given; an empty value clears it. The text is always required, so every call replaces it. Edit a placement with timeline.set.
2422    ///
2423    /// Needs `timeline.update` or `content:write` in the manifest's `[permissions]`.
2424    pub fn update(project: &str, id: i32, content: &str, options: TimelineUpdateOptions) -> crate::Result<TimelineEntry> {
2425        #[derive(Serialize)]
2426        struct Input<'a> {
2427            project: &'a str,
2428            id: i32,
2429            content: &'a str,
2430            #[serde(flatten)]
2431            options: TimelineUpdateOptions,
2432        }
2433        crate::call("timeline.update", &Input { project, id, content, options })
2434    }
2435
2436    /// The `timeline.def` operations.
2437    pub mod def {
2438        use super::*;
2439
2440        /// The optional inputs of [`create`]; leave any out with `..Default::default()`.
2441        #[derive(Debug, Clone, Default, PartialEq, Serialize)]
2442        pub struct TimelineDefCreateOptions {
2443            /// Left out, manual.
2444            #[serde(skip_serializing_if = "Option::is_none")]
2445            pub mode: Option<TimelineModeDto>,
2446            /// Required for a dated timeline.
2447            #[serde(skip_serializing_if = "Option::is_none")]
2448            pub calendar: Option<CalendarDto>,
2449            /// Lanes in the order they are drawn.
2450            #[serde(rename = "laneOrder")]
2451            #[serde(skip_serializing_if = "Option::is_none")]
2452            pub lane_order: Option<Vec<String>>,
2453        }
2454
2455        /// Add a timeline to a project, manual unless mode says otherwise; a dated one needs a calendar. Its name is trimmed and no other timeline may have it, ignoring case. Returns it with its id, which the timeline option of other operations takes.
2456        ///
2457        /// Needs `timeline.def.create` or `content:write` in the manifest's `[permissions]`.
2458        pub fn create(project: &str, name: &str, options: TimelineDefCreateOptions) -> crate::Result<TimelineDefDto> {
2459            #[derive(Serialize)]
2460            struct Input<'a> {
2461                project: &'a str,
2462                name: &'a str,
2463                #[serde(flatten)]
2464                options: TimelineDefCreateOptions,
2465            }
2466            crate::call("timeline.def.create", &Input { project, name, options })
2467        }
2468
2469        /// Delete a timeline and every event on it for good; entries and scenes placed there are left alone. The main timeline cannot be deleted.
2470        ///
2471        /// Needs `timeline.def.delete` (by name) in the manifest's `[permissions]`.
2472        pub fn delete(project: &str, timeline: &str) -> crate::Result<TimelineDefDeleted> {
2473            #[derive(Serialize)]
2474            struct Input<'a> {
2475                project: &'a str,
2476                timeline: &'a str,
2477            }
2478            crate::call("timeline.def.delete", &Input { project, timeline })
2479        }
2480
2481    }
2482
2483    /// The `timeline.settings` operations.
2484    pub mod settings {
2485        use super::*;
2486
2487        /// A project's timelines, main first, each with its id, name, mode, calendar, and lane order, and how many events are left on timelines deleted since (see timeline.list orphaned).
2488        ///
2489        /// Needs `timeline.settings.read` or `content:read` in the manifest's `[permissions]`.
2490        pub fn read(project: &str) -> crate::Result<TimelineSettings> {
2491            #[derive(Serialize)]
2492            struct Input<'a> {
2493                project: &'a str,
2494            }
2495            crate::call("timeline.settings.read", &Input { project })
2496        }
2497
2498        /// The optional inputs of [`write`]; leave any out with `..Default::default()`.
2499        #[derive(Debug, Clone, Default, PartialEq, Serialize)]
2500        pub struct TimelineSettingsWriteOptions {
2501            /// A new name, which renames the timeline.
2502            #[serde(skip_serializing_if = "Option::is_none")]
2503            pub name: Option<String>,
2504            /// Switching to dated needs a calendar, here or already set.
2505            #[serde(skip_serializing_if = "Option::is_none")]
2506            pub mode: Option<TimelineModeDto>,
2507            #[serde(skip_serializing_if = "Option::is_none")]
2508            pub calendar: Option<CalendarDto>,
2509            /// Lanes in the order they are drawn.
2510            #[serde(rename = "laneOrder")]
2511            #[serde(skip_serializing_if = "Option::is_none")]
2512            pub lane_order: Option<Vec<String>>,
2513            /// Only when switching to dated; left out, events are one of the calendar's coarsest unit apart.
2514            #[serde(skip_serializing_if = "Option::is_none")]
2515            pub spacing: Option<EvenSpacingDto>,
2516            /// The timeline's id; left out, or "main", the main timeline.
2517            #[serde(skip_serializing_if = "Option::is_none")]
2518            pub timeline: Option<String>,
2519        }
2520
2521        /// Change one timeline's settings, main unless timeline names another; fields left out stay as they are, and name renames it. Switching to dated gives every event without a valid start one, spaced evenly in the current order; switching to manual keeps the date order as the manual order. A new calendar drops dates that do not fit it, keeping the start as the label of an event that has none.
2522        ///
2523        /// Needs `timeline.settings.write` or `content:write` in the manifest's `[permissions]`.
2524        pub fn write(project: &str, options: TimelineSettingsWriteOptions) -> crate::Result<TimelineSettings> {
2525            #[derive(Serialize)]
2526            struct Input<'a> {
2527                project: &'a str,
2528                #[serde(flatten)]
2529                options: TimelineSettingsWriteOptions,
2530            }
2531            crate::call("timeline.settings.write", &Input { project, options })
2532        }
2533
2534    }
2535
2536}