@omelhorsite/sdk 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/README.md +112 -130
  2. package/dist/index.js +4800 -610
  3. package/dist/types/client.d.ts +60 -3
  4. package/dist/types/http.d.ts +444 -19
  5. package/dist/types/index.d.ts +5 -1
  6. package/dist/types/internal/attachments.d.ts +17 -0
  7. package/dist/types/internal/helpers.d.ts +9 -0
  8. package/dist/types/listing.d.ts +90 -0
  9. package/dist/types/resources/account.d.ts +71 -5
  10. package/dist/types/resources/admin/authorizedApplications.d.ts +133 -0
  11. package/dist/types/resources/admin/chests.d.ts +51 -0
  12. package/dist/types/resources/admin/eventAlerts.d.ts +60 -0
  13. package/dist/types/resources/admin/identities.d.ts +99 -0
  14. package/dist/types/resources/admin/index.d.ts +77 -0
  15. package/dist/types/resources/admin/jobs.d.ts +97 -0
  16. package/dist/types/resources/admin/myOauthApplications.d.ts +282 -0
  17. package/dist/types/resources/admin/notepads.d.ts +49 -0
  18. package/dist/types/resources/admin/oauthApplications.d.ts +309 -0
  19. package/dist/types/resources/admin/quotas.d.ts +114 -0
  20. package/dist/types/resources/admin/shortLinks.d.ts +201 -0
  21. package/dist/types/resources/admin/types.d.ts +222 -0
  22. package/dist/types/resources/admin/vocalSeparations.d.ts +98 -0
  23. package/dist/types/resources/admin.d.ts +1841 -0
  24. package/dist/types/resources/auth/index.d.ts +39 -0
  25. package/dist/types/resources/auth/passkeys.d.ts +652 -0
  26. package/dist/types/resources/auth/sessions.d.ts +844 -0
  27. package/dist/types/resources/chests.d.ts +54 -3
  28. package/dist/types/resources/content/analysis.d.ts +62 -0
  29. package/dist/types/resources/content/blogs.d.ts +471 -0
  30. package/dist/types/resources/content/feedbacks.d.ts +263 -0
  31. package/dist/types/resources/content/index.d.ts +52 -0
  32. package/dist/types/resources/content/intel/articles.d.ts +230 -0
  33. package/dist/types/resources/content/intel/config.d.ts +135 -0
  34. package/dist/types/resources/content/intel/index.d.ts +53 -0
  35. package/dist/types/resources/content/intel/items.d.ts +91 -0
  36. package/dist/types/resources/content/intel/reports.d.ts +108 -0
  37. package/dist/types/resources/content/intel/scripts.d.ts +152 -0
  38. package/dist/types/resources/content/intel/sources.d.ts +236 -0
  39. package/dist/types/resources/content/intel/stats.d.ts +105 -0
  40. package/dist/types/resources/content/intel/types.d.ts +86 -0
  41. package/dist/types/resources/content/jokes.d.ts +93 -0
  42. package/dist/types/resources/content/notifications.d.ts +147 -0
  43. package/dist/types/resources/content/serviceUsages.d.ts +73 -0
  44. package/dist/types/resources/content/servicesStatus.d.ts +194 -0
  45. package/dist/types/resources/content/siteConfig.d.ts +43 -0
  46. package/dist/types/resources/content/spaceInvaders.d.ts +154 -0
  47. package/dist/types/resources/content.d.ts +2775 -0
  48. package/dist/types/resources/dynamicQrs.d.ts +39 -3
  49. package/dist/types/resources/forms.d.ts +176 -35
  50. package/dist/types/resources/index.d.ts +19 -8
  51. package/dist/types/resources/ipLookup.d.ts +20 -4
  52. package/dist/types/resources/jobs.d.ts +69 -25
  53. package/dist/types/resources/library/annotations.d.ts +162 -0
  54. package/dist/types/resources/library/books.d.ts +534 -0
  55. package/dist/types/resources/library/chat.d.ts +259 -0
  56. package/dist/types/resources/library/index.d.ts +39 -0
  57. package/dist/types/resources/library/shelves.d.ts +237 -0
  58. package/dist/types/resources/library/types.d.ts +120 -0
  59. package/dist/types/resources/library.d.ts +1433 -0
  60. package/dist/types/resources/linkTrees.d.ts +142 -30
  61. package/dist/types/resources/media.d.ts +351 -0
  62. package/dist/types/resources/movies/addons.d.ts +388 -0
  63. package/dist/types/resources/movies/collections.d.ts +352 -0
  64. package/dist/types/resources/movies/index.d.ts +29 -0
  65. package/dist/types/resources/movies/types.d.ts +50 -0
  66. package/dist/types/resources/movies/watchProgress.d.ts +277 -0
  67. package/dist/types/resources/movies.d.ts +1160 -0
  68. package/dist/types/resources/music/artists.d.ts +1068 -0
  69. package/dist/types/resources/music/imports.d.ts +941 -0
  70. package/dist/types/resources/music/index.d.ts +61 -0
  71. package/dist/types/resources/music/playlists.d.ts +1027 -0
  72. package/dist/types/resources/music/social.d.ts +1132 -0
  73. package/dist/types/resources/music/songs.d.ts +1167 -0
  74. package/dist/types/resources/notepads.d.ts +4 -1
  75. package/dist/types/resources/quotas.d.ts +7 -1
  76. package/dist/types/resources/realtime.d.ts +855 -0
  77. package/dist/types/resources/shortLinks.d.ts +49 -5
  78. package/dist/types/resources/social/groupChats.d.ts +458 -0
  79. package/dist/types/resources/social/index.d.ts +19 -0
  80. package/dist/types/resources/social/messages.d.ts +424 -0
  81. package/dist/types/resources/social/relationships.d.ts +322 -0
  82. package/dist/types/resources/social/types.d.ts +37 -0
  83. package/dist/types/resources/social.d.ts +1348 -0
  84. package/dist/types/resources/storage/upload.d.ts +158 -11
  85. package/dist/types/resources/storage.d.ts +111 -27
  86. package/dist/types/resources/tickets.d.ts +101 -13
  87. package/dist/types/resources/tools/backgroundRemoval.d.ts +18 -3
  88. package/dist/types/resources/tools/captions.d.ts +448 -21
  89. package/dist/types/resources/tools/downloader.d.ts +21 -0
  90. package/dist/types/resources/tools/index.d.ts +57 -15
  91. package/dist/types/resources/tools/jumpstyle.d.ts +50 -17
  92. package/dist/types/resources/tools/transcription.d.ts +35 -13
  93. package/dist/types/resources/tools/upscale.d.ts +23 -3
  94. package/dist/types/resources/tools/vocalSeparation.d.ts +30 -13
  95. package/dist/types/types.d.ts +249 -17
  96. package/package.json +2 -1
@@ -0,0 +1,162 @@
1
+ /** The `library.annotations` namespace, with the inputs and limits only it uses. */
2
+ import { Resource } from "../../http";
3
+ import type { ListParams } from "../../listing";
4
+ import type { Paginated, RequestOptions } from "../../types";
5
+ import type { BookAnnotation, BookAnnotationId, BookAnnotationKind, BookAnnotationLocation, BookId } from "./types";
6
+ /** Longest note accepted. */
7
+ export declare const BOOK_ANNOTATION_NOTE_MAX_LENGTH = 5000;
8
+ /** Longest selected text accepted. */
9
+ export declare const BOOK_ANNOTATION_SELECTED_TEXT_MAX_LENGTH = 8000;
10
+ /** Filter columns of `GET /book_annotations`, on top of {@link BASE_FILTER_COLUMNS}. */
11
+ export declare const BOOK_ANNOTATION_FILTER_COLUMNS: readonly ["book_id", "kind"];
12
+ /** Arguments for {@link LibraryAnnotationsNamespace.list}. */
13
+ export interface ListBookAnnotationsParams extends ListParams<(typeof BOOK_ANNOTATION_FILTER_COLUMNS)[number]> {
14
+ /** Exact book id. The filter every reader screen uses. */
15
+ readonly bookId?: BookId;
16
+ /** Exact kind, or an array of kinds (which becomes `IN (...)`). */
17
+ readonly kind?: BookAnnotationKind | readonly BookAnnotationKind[];
18
+ /** `"column:asc"` / `"column:desc"`. Defaults to `created_at:asc`. */
19
+ readonly order?: string;
20
+ }
21
+ /** Arguments for {@link LibraryAnnotationsNamespace.create}. */
22
+ export interface CreateBookAnnotationInput {
23
+ readonly bookId: BookId;
24
+ readonly kind: BookAnnotationKind;
25
+ /** Omitted or empty becomes `{}`, which is a valid annotation with no anchor. */
26
+ readonly location?: BookAnnotationLocation;
27
+ readonly color?: string | null;
28
+ readonly note?: string | null;
29
+ readonly selectedText?: string | null;
30
+ }
31
+ /**
32
+ * Arguments for {@link LibraryAnnotationsNamespace.update}.
33
+ *
34
+ * `kind`, `book_id` and `selected_text` are NOT updatable: only `color`,
35
+ * `note` and `location` are read. Anything else is dropped in silence - a 200
36
+ * with an unchanged row.
37
+ */
38
+ export interface UpdateBookAnnotationInput {
39
+ readonly color?: string | null;
40
+ readonly note?: string | null;
41
+ /**
42
+ * Only sent when the key is present, because the server tests for the key
43
+ * rather than for a value. Passing `{}` therefore CLEARS the anchor rather
44
+ * than leaving it alone.
45
+ */
46
+ readonly location?: BookAnnotationLocation;
47
+ }
48
+ /** The `library.annotations` namespace, reachable as `oms.library.annotations`. */
49
+ export declare class LibraryAnnotationsNamespace extends Resource {
50
+ /**
51
+ * `GET /book_annotations` - the caller's own highlights, notes, bookmarks and
52
+ * progress markers.
53
+ *
54
+ * There is no owner filter and there does not need to be one: a caller can
55
+ * only ever see its own rows - even on a book a thousand people have public
56
+ * access to.
57
+ *
58
+ * Unlike every read in the other two namespaces, this one needs a session,
59
+ * so an anonymous call is a `401`, not an empty list.
60
+ *
61
+ * Ordered by `created_at` ascending by default (the controller adds the
62
+ * `order(:created_at)` itself), which is reading order for a set of
63
+ * highlights. Override it with `order` for a "recently annotated" view.
64
+ *
65
+ * Filtering by `bookId` is the normal call, and it is what opens a reader:
66
+ * one request per book, not one per highlight.
67
+ *
68
+ * @throws {OmsApiError} 400 naming the offending key when a filter is not
69
+ * one of `book_id`, `kind`, `id`, `created_at`, `updated_at`.
70
+ */
71
+ list(params?: ListBookAnnotationsParams, options?: RequestOptions): Promise<Paginated<BookAnnotation>>;
72
+ /**
73
+ * Every annotation on one book, in reading order, following pages until the
74
+ * book is exhausted.
75
+ *
76
+ * A convenience over {@link list} because this is what a reader does on open
77
+ * and because a heavily annotated book genuinely passes 500 rows - the point
78
+ * at which one page stops being enough and a naive caller silently loses the
79
+ * rest.
80
+ *
81
+ * `kinds` narrows to, say, highlights only. It becomes an `IN (...)`.
82
+ */
83
+ forBook(bookId: BookId, params?: {
84
+ kinds?: readonly BookAnnotationKind[];
85
+ pageSize?: number;
86
+ }, options?: RequestOptions): Promise<BookAnnotation[]>;
87
+ /**
88
+ * The reader's "where I left off" marker for one book, or `null` when they
89
+ * have never opened it.
90
+ *
91
+ * There is at most one, because
92
+ * {@link LibraryBooksNamespace.saveProgress} upserts on
93
+ * `(book, user, kind: "progress")`. This reads it back; that writes it.
94
+ */
95
+ progressFor(bookId: BookId, options?: RequestOptions): Promise<BookAnnotation | null>;
96
+ /**
97
+ * "What am I in the middle of?" - the reader's most recently touched progress
98
+ * markers, newest first.
99
+ *
100
+ * One request for the whole continue-reading shelf, which is the point: the
101
+ * alternative is one request per cover. The rows carry `book_id` and nothing
102
+ * about the book, so pair it with
103
+ * {@link LibraryBooksNamespace.list} filtered by `ids` to get the titles in a
104
+ * second request rather than in N.
105
+ *
106
+ * @param limit rows to return. Clamped to 500 by the server like any page.
107
+ */
108
+ continueReading(limit?: number, options?: RequestOptions): Promise<BookAnnotation[]>;
109
+ /**
110
+ * `POST /book_annotations` - records a highlight, a note or a bookmark.
111
+ *
112
+ * The author is taken from the session, so `user_id` is not sendable. The
113
+ * book additionally has to be visible to the caller, which is what lets a
114
+ * reader annotate somebody else's public book while keeping the annotation
115
+ * entirely private to them.
116
+ *
117
+ * Do NOT use this for reading progress. It would create a SECOND `progress`
118
+ * row - nothing here de-duplicates by kind - and the reader would then have
119
+ * two conflicting "where I left off" markers with no way to tell which is
120
+ * live. {@link LibraryBooksNamespace.saveProgress} upserts; this does not.
121
+ *
122
+ * Not retried by default: a replay after a lost answer duplicates the
123
+ * highlight.
124
+ *
125
+ * @throws {OmsAuthError} 401 twice over, with different bodies: `"Session
126
+ * required to access this resource."` when anonymous, and `"You are not
127
+ * authorized to create this resource"` when the book is not visible to
128
+ * the caller - a 401 rather than the 404 you might expect.
129
+ * @throws {OmsApiError} 400 for a `kind` outside
130
+ * {@link BOOK_ANNOTATION_KINDS}, or a note or selection over its length
131
+ * cap.
132
+ */
133
+ create(input: CreateBookAnnotationInput, options?: RequestOptions): Promise<BookAnnotation>;
134
+ /**
135
+ * `PATCH /book_annotations/:id` - edits the note or the colour of an existing
136
+ * annotation, and optionally moves it.
137
+ *
138
+ * Only `color`, `note` and `location` are writable. `kind`, `book_id` and
139
+ * `selected_text` are dropped in silence - a `200` with an unchanged row,
140
+ * which is the failure mode worth knowing about here. To change a highlight
141
+ * into a note, delete and recreate.
142
+ *
143
+ * `location` is only sent when you pass one, because the server tests for
144
+ * the key: passing `{}` therefore CLEARS the anchor rather than leaving it
145
+ * alone.
146
+ *
147
+ * @throws {OmsAuthError} 401 when the annotation is not yours.
148
+ * @throws {OmsApiError} 404 for an unknown id - and for anyone else's
149
+ * annotation, since nobody else's are ever visible.
150
+ */
151
+ update(id: BookAnnotationId, input: UpdateBookAnnotationInput, options?: RequestOptions): Promise<BookAnnotation>;
152
+ /**
153
+ * `DELETE /book_annotations/:id` - removes one annotation.
154
+ *
155
+ * Deleting a `progress` row is how a reader is put back at the start of a
156
+ * book; there is no other reset.
157
+ *
158
+ * @throws {OmsAuthError} 401 when the annotation is not yours.
159
+ * @throws {OmsApiError} 404 the second time round.
160
+ */
161
+ delete(id: BookAnnotationId, options?: RequestOptions): Promise<void>;
162
+ }