@omelhorsite/sdk 0.1.0 → 0.3.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.
- package/README.md +1 -0
- package/dist/index.js +4957 -515
- package/dist/types/client.d.ts +75 -3
- package/dist/types/http.d.ts +462 -19
- package/dist/types/index.d.ts +4 -1
- package/dist/types/resources/account.d.ts +72 -6
- package/dist/types/resources/admin.d.ts +1837 -0
- package/dist/types/resources/auth/index.d.ts +39 -0
- package/dist/types/resources/auth/passkeys.d.ts +652 -0
- package/dist/types/resources/auth/sessions.d.ts +847 -0
- package/dist/types/resources/chests.d.ts +54 -3
- package/dist/types/resources/content.d.ts +2970 -0
- package/dist/types/resources/dynamicQrs.d.ts +39 -3
- package/dist/types/resources/forms.d.ts +176 -35
- package/dist/types/resources/index.d.ts +20 -8
- package/dist/types/resources/ipLookup.d.ts +20 -4
- package/dist/types/resources/jobs.d.ts +62 -21
- package/dist/types/resources/library.d.ts +1435 -0
- package/dist/types/resources/linkTrees.d.ts +142 -30
- package/dist/types/resources/media.d.ts +351 -0
- package/dist/types/resources/movies.d.ts +1186 -0
- package/dist/types/resources/music/artists.d.ts +1066 -0
- package/dist/types/resources/music/imports.d.ts +940 -0
- package/dist/types/resources/music/index.d.ts +61 -0
- package/dist/types/resources/music/playlists.d.ts +1026 -0
- package/dist/types/resources/music/social.d.ts +1132 -0
- package/dist/types/resources/music/songs.d.ts +1183 -0
- package/dist/types/resources/notepads.d.ts +4 -1
- package/dist/types/resources/quotas.d.ts +128 -0
- package/dist/types/resources/realtime.d.ts +855 -0
- package/dist/types/resources/shortLinks.d.ts +45 -4
- package/dist/types/resources/social.d.ts +1330 -0
- package/dist/types/resources/storage/upload.d.ts +158 -11
- package/dist/types/resources/storage.d.ts +88 -22
- package/dist/types/resources/tickets.d.ts +82 -3
- package/dist/types/resources/tools/backgroundRemoval.d.ts +18 -3
- package/dist/types/resources/tools/captions.d.ts +448 -21
- package/dist/types/resources/tools/downloader.d.ts +21 -0
- package/dist/types/resources/tools/index.d.ts +60 -16
- package/dist/types/resources/tools/jumpstyle.d.ts +50 -17
- package/dist/types/resources/tools/transcription.d.ts +35 -13
- package/dist/types/resources/tools/upscale.d.ts +23 -3
- package/dist/types/resources/tools/vocalSeparation.d.ts +30 -13
- package/dist/types/types.d.ts +249 -17
- package/package.json +6 -5
|
@@ -27,7 +27,10 @@ import type { RequestOptions, Timestamp } from "../types";
|
|
|
27
27
|
export interface Notepad {
|
|
28
28
|
/** Word-shaped capability, e.g. `"quick-brown-fox"`. Treat it as a secret. */
|
|
29
29
|
readonly slug: string;
|
|
30
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* The whole document. Empty string, never `null`, for a fresh pad: the
|
|
32
|
+
* column is `NOT NULL DEFAULT ''`.
|
|
33
|
+
*/
|
|
31
34
|
readonly content: string;
|
|
32
35
|
readonly created_at: Timestamp;
|
|
33
36
|
readonly updated_at: Timestamp;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `quotas` namespace: every ceiling on the account, in one call.
|
|
3
|
+
*
|
|
4
|
+
* This exists because the question an agent actually asks is "how much is left
|
|
5
|
+
* of everything", and answering it used to mean knowing which four tools were
|
|
6
|
+
* metered, calling four endpoints, and then knowing that neither storage nor
|
|
7
|
+
* music was in any of those answers. `oms.quotas.list()` is one request and
|
|
8
|
+
* returns every resource the server meters, each in the same shape.
|
|
9
|
+
*
|
|
10
|
+
* The per-tool `quota()` calls have NOT gone anywhere and answer exactly what
|
|
11
|
+
* they always answered - they are published API. Use them when you want one
|
|
12
|
+
* tool and nothing else, or when the credential carries `tools:read` but not
|
|
13
|
+
* `profile`; use this when you want the picture.
|
|
14
|
+
*
|
|
15
|
+
* Two things to read before trusting a number:
|
|
16
|
+
*
|
|
17
|
+
* - **`period` is not decoration.** A `"daily"` resource resets at midnight,
|
|
18
|
+
* server time, and `used` is what today has spent. A `"total"` resource is
|
|
19
|
+
* what is stored RIGHT NOW and only falls when something is deleted; waiting
|
|
20
|
+
* does not give it back.
|
|
21
|
+
* - **Anonymous callers get a shorter list.** Without a credential the server
|
|
22
|
+
* answers with the daily resources only, counted per IP, because an
|
|
23
|
+
* anonymous caller has no file tree and no music library. Never index the
|
|
24
|
+
* array by position - look the resource up by name, or use
|
|
25
|
+
* {@link quotaFor}, which returns `undefined` rather than lying.
|
|
26
|
+
*
|
|
27
|
+
* Needs the `profile` scope for an OAuth token, the same scope
|
|
28
|
+
* `account.usage()` needs, because a quota is account state and it spans tools,
|
|
29
|
+
* storage and music at once.
|
|
30
|
+
*
|
|
31
|
+
* ```ts
|
|
32
|
+
* const report = await oms.quotas.list();
|
|
33
|
+
* const music = quotaFor(report, "music_storage_bytes");
|
|
34
|
+
* if (music && !quotaAffords(music, file.size)) throw new Error("no room");
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
import { Resource } from "../http";
|
|
38
|
+
import type { RequestOptions } from "../types";
|
|
39
|
+
/**
|
|
40
|
+
* Every resource the server's catalogue defines today, in the order it answers
|
|
41
|
+
* them: the four metered tools first, then the two storage ceilings.
|
|
42
|
+
*
|
|
43
|
+
* A server that grows a seventh keeps working - {@link QuotaEntry.resource} is
|
|
44
|
+
* widened to `string` on purpose, so an unknown name arrives as data rather
|
|
45
|
+
* than as a type error in a client nobody has rebuilt.
|
|
46
|
+
*/
|
|
47
|
+
export declare const QUOTA_RESOURCES: readonly ["vocal_separation_seconds", "transcription_seconds", "caption_seconds", "jumpstyle_edits", "storage_nodes", "music_storage_bytes"];
|
|
48
|
+
/** One of {@link QUOTA_RESOURCES}. */
|
|
49
|
+
export type QuotaResource = (typeof QUOTA_RESOURCES)[number];
|
|
50
|
+
/**
|
|
51
|
+
* What the numbers count. `"seconds"` of media, `"count"` of whole things
|
|
52
|
+
* (edits, files and folders), `"bytes"` of stored media.
|
|
53
|
+
*/
|
|
54
|
+
export type QuotaUnit = "seconds" | "count" | "bytes";
|
|
55
|
+
/**
|
|
56
|
+
* `"daily"` spends and resets at midnight, server time. `"total"` is what is
|
|
57
|
+
* stored right now and only falls when something is deleted.
|
|
58
|
+
*/
|
|
59
|
+
export type QuotaPeriod = "daily" | "total";
|
|
60
|
+
/**
|
|
61
|
+
* One resource, in the one shape every resource uses.
|
|
62
|
+
*
|
|
63
|
+
* All seven keys are always present. `resource`, `unit` and `period` are Ruby
|
|
64
|
+
* symbols on the server (`:daily`, `:bytes`) and reach the wire as plain
|
|
65
|
+
* strings, so compare them as strings and never against a leading colon.
|
|
66
|
+
*/
|
|
67
|
+
export interface QuotaEntry {
|
|
68
|
+
/** A {@link QuotaResource}, or a name added to the server since this build. */
|
|
69
|
+
readonly resource: QuotaResource | string;
|
|
70
|
+
readonly unit: QuotaUnit | string;
|
|
71
|
+
readonly period: QuotaPeriod | string;
|
|
72
|
+
/** Spent today for a daily resource; stored right now for a total one. */
|
|
73
|
+
readonly used: number;
|
|
74
|
+
/** `null` exactly when {@link unlimited} is `true`. */
|
|
75
|
+
readonly limit: number | null;
|
|
76
|
+
/** `null` exactly when {@link unlimited} is `true`. Never negative. */
|
|
77
|
+
readonly remaining: number | null;
|
|
78
|
+
/** `true` when this account has no ceiling on this resource. */
|
|
79
|
+
readonly unlimited: boolean;
|
|
80
|
+
}
|
|
81
|
+
/** `GET /quotas` in full. */
|
|
82
|
+
export interface QuotaReport {
|
|
83
|
+
/** Whether the caller was recognised. Anonymous callers get a shorter list. */
|
|
84
|
+
readonly authenticated: boolean;
|
|
85
|
+
/** One entry per resource the caller can actually spend. */
|
|
86
|
+
readonly quotas: QuotaEntry[];
|
|
87
|
+
}
|
|
88
|
+
/** The `quotas` namespace, reachable as `oms.quotas`. */
|
|
89
|
+
export declare class QuotasNamespace extends Resource {
|
|
90
|
+
/**
|
|
91
|
+
* `GET /quotas` - every ceiling on the account, in one request.
|
|
92
|
+
*
|
|
93
|
+
* Works anonymously, and then answers with the daily resources only.
|
|
94
|
+
*
|
|
95
|
+
* Every number is computed on the spot - the daily ones are aggregates over
|
|
96
|
+
* today's rows, and the two totals are a subtree row count and a blob-size
|
|
97
|
+
* sum - so this is a call to make BEFORE an expensive upload, not one to
|
|
98
|
+
* poll. The server throttles it at thirty a minute per caller, well above
|
|
99
|
+
* that use and well below a loop.
|
|
100
|
+
*/
|
|
101
|
+
list(options?: RequestOptions): Promise<QuotaReport>;
|
|
102
|
+
/**
|
|
103
|
+
* One resource, or `null` when the caller cannot spend it - which is what an
|
|
104
|
+
* anonymous caller gets for `storage_nodes` and `music_storage_bytes`.
|
|
105
|
+
*
|
|
106
|
+
* Costs the same single request as {@link list}, because the server has no
|
|
107
|
+
* per-resource endpoint. Asking for three resources means calling
|
|
108
|
+
* {@link list} once and using {@link quotaFor} three times, not calling this
|
|
109
|
+
* three times.
|
|
110
|
+
*/
|
|
111
|
+
get(resource: QuotaResource | string, options?: RequestOptions): Promise<QuotaEntry | null>;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Finds one resource in a report. Returns `undefined` when it is not there,
|
|
115
|
+
* which is a real answer and not a failure: an anonymous caller has no storage
|
|
116
|
+
* quota because they have no storage.
|
|
117
|
+
*/
|
|
118
|
+
export declare function quotaFor(report: QuotaReport, resource: QuotaResource | string): QuotaEntry | undefined;
|
|
119
|
+
/** True when there is nothing left to spend. Always false when unlimited. */
|
|
120
|
+
export declare function quotaExhausted(entry: QuotaEntry): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Whether `amount` more fits under the ceiling, in the resource's own unit.
|
|
123
|
+
*
|
|
124
|
+
* Always true when unlimited. Uses `remaining` when the server sent one and
|
|
125
|
+
* falls back to `limit - used` when it did not, so it is honest about a report
|
|
126
|
+
* that is missing a field rather than reading `null` as zero.
|
|
127
|
+
*/
|
|
128
|
+
export declare function quotaAffords(entry: QuotaEntry, amount: number): boolean;
|