@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,97 @@
1
+ /** `oms.admin.jobs` - every background job on the server. Administrators only. */
2
+ import type { Job } from "../jobs";
3
+ import { Resource } from "../../http";
4
+ import type { ListParams } from "../../listing";
5
+ import type { Id, Paginated, RequestOptions } from "../../types";
6
+ /**
7
+ * A job row, as `/admin/jobs` renders it.
8
+ *
9
+ * Identical to the {@link Job} an ordinary caller reads through `oms.jobs`: the
10
+ * only difference is the SCOPE, since an administrator sees every row and
11
+ * everybody else only their own.
12
+ */
13
+ export type AdminJob = Job;
14
+ /** Filter columns of `GET /admin/jobs`. */
15
+ export declare const ADMIN_JOB_FILTER_COLUMNS: readonly ["id", "job_type", "status", "created_at", "updated_at", "finished_at"];
16
+ /** Filters for {@link AdminJobsNamespace.list}. */
17
+ export interface ListAdminJobsParams extends ListParams<(typeof ADMIN_JOB_FILTER_COLUMNS)[number]> {
18
+ /** Exact status. An array becomes an `IN`. */
19
+ readonly status?: string | readonly string[];
20
+ /** Exact job type. An array becomes an `IN`. */
21
+ readonly jobType?: string | readonly string[];
22
+ /** Defaults to `"created_at:desc"`. */
23
+ readonly order?: string;
24
+ }
25
+ /** What {@link AdminJobsNamespace.cleanupStuck} answers with. */
26
+ export interface AdminStuckJobCleanup {
27
+ /** Ids of the jobs that were canceled. String ids: `jobs` is one of the string-keyed tables. */
28
+ readonly canceled_job_ids: Id[];
29
+ /** `canceled_job_ids.length`. `0` when there was nothing stuck. */
30
+ readonly count: number;
31
+ }
32
+ /**
33
+ * `oms.admin.jobs` - **administrators only**. Every background job on the
34
+ * server.
35
+ *
36
+ * The unprivileged half of this is `oms.jobs`, which is the same endpoints
37
+ * narrowed to the caller's own jobs. What an administrator gains is the scope,
38
+ * plus {@link cancel} and {@link cleanupStuck}.
39
+ */
40
+ export declare class AdminJobsNamespace extends Resource {
41
+ /**
42
+ * `GET /admin/jobs` - every job, newest first.
43
+ *
44
+ * A bare JSON array through the generic list DSL: it paginates (a default
45
+ * page size is forced even when you do not ask, so this can never enumerate
46
+ * the whole table) and it answers ETag and `304`.
47
+ *
48
+ * **The filters have to go inside the filter buckets, and the failure mode if
49
+ * they do not is silent.** `status` and `job_type` are declared as search
50
+ * columns, which means `exact_search[status]`; a plain top-level
51
+ * `?status=pending` is read by nothing and you get the unfiltered first page
52
+ * back, with no error to tell you the narrowing was dropped. This method
53
+ * builds the buckets for you.
54
+ *
55
+ * Unknown filter keys inside a bucket DO fail, with a `400`, on purpose: a
56
+ * dropped filter is a wider result nobody notices.
57
+ *
58
+ * @throws {OmsAuthError} 403 for a non-admin.
59
+ */
60
+ list(params?: ListAdminJobsParams, options?: RequestOptions): Promise<Paginated<AdminJob>>;
61
+ /**
62
+ * `POST /admin/jobs/:id/cancel` - stops a job.
63
+ *
64
+ * The row lands on `status: "canceled"` with `error: "Canceled by admin"` and
65
+ * a `finished_at`, and the change is broadcast over the job channel, so
66
+ * anything watching that job sees it immediately.
67
+ *
68
+ * **This marks the row, it does not reach into the worker.** A job that is
69
+ * already executing keeps executing until it next looks at its own status;
70
+ * cancelling is a request, not a kill signal.
71
+ *
72
+ * @throws {OmsApiError} 400 `"Already terminal"` for a job that is complete,
73
+ * failed or already canceled. Idempotency has to be your side: check
74
+ * `isJobTerminal(job.status)` first rather than swallowing the 400. 404
75
+ * `"Resource not found"`.
76
+ * @throws {OmsAuthError} 403 for a non-admin.
77
+ */
78
+ cancel(id: Id, options?: RequestOptions): Promise<AdminJob>;
79
+ /**
80
+ * `POST /admin/jobs/cleanup_stuck` - cancels every job the server considers
81
+ * stuck.
82
+ *
83
+ * A sweep with NO arguments and no dry run: it decides what is stuck and acts
84
+ * on all of it in one request. There is no preview and no undo. Read
85
+ * {@link list} filtered to `"processing"` first if you want to know what you
86
+ * are about to hit.
87
+ *
88
+ * Answers `{ canceled_job_ids, count }`. `count: 0` is the normal, healthy
89
+ * answer and is not an error.
90
+ *
91
+ * Retries are disabled: the sweep is not free, and a replay after a lost
92
+ * response reports a second, smaller set as if it were the whole answer.
93
+ *
94
+ * @throws {OmsAuthError} 403 for a non-admin.
95
+ */
96
+ cleanupStuck(options?: RequestOptions): Promise<AdminStuckJobCleanup>;
97
+ }
@@ -0,0 +1,282 @@
1
+ /** `oms.admin.myApplications` - the OAuth clients you registered. */
2
+ import type { OmsScope } from "../../auth/tokens";
3
+ import { Resource } from "../../http";
4
+ import type { RequestOptions } from "../../types";
5
+ import type { OauthApplicationSummary } from "./types";
6
+ /**
7
+ * A client YOU registered, as {@link MyOauthApplicationsNamespace} renders it.
8
+ *
9
+ * A distinct name from {@link AdminOauthApplication} even though the keys are
10
+ * identical, so that a function taking one cannot be handed the other by
11
+ * accident. They come from different endpoints with different blast radii.
12
+ */
13
+ export interface OwnedOauthApplication extends OauthApplicationSummary {
14
+ /** Always `null` here. The owner routes never disclose the reviewer. */
15
+ readonly approved_by: null;
16
+ }
17
+ /**
18
+ * The response of the two calls that MINT a client secret:
19
+ * {@link MyOauthApplicationsNamespace.create} and
20
+ * {@link MyOauthApplicationsNamespace.rotateSecret}.
21
+ *
22
+ * `client_secret` is the only value in this whole API you cannot ask for twice.
23
+ * The server stores only a hash of it, so there is nothing to read back: losing
24
+ * the string means rotating, and rotating breaks whatever was using the old
25
+ * one. Capture it in the same expression that made the call.
26
+ */
27
+ export interface OwnedOauthApplicationWithSecret {
28
+ readonly application: OwnedOauthApplication;
29
+ /**
30
+ * The plaintext secret, ONCE. `null` for a public client, which is most of
31
+ * them: a public client has no secret by design, and `confidential: false`
32
+ * is the normal choice for anything that ships to end users.
33
+ */
34
+ readonly client_secret: string | null;
35
+ }
36
+ /**
37
+ * What {@link MyOauthApplicationsNamespace.destroy} answers with.
38
+ *
39
+ * Note the key: **`client_id`**. The administrator's delete answers the same
40
+ * three values under the key `uid` instead
41
+ * ({@link AdminOauthApplicationDeletion}). Two routes, two spellings of one
42
+ * value, and nothing normalises them - a shared renderer reading `client_id`
43
+ * shows `undefined` for half the app.
44
+ */
45
+ export interface OwnedOauthApplicationDeletion {
46
+ readonly id: number;
47
+ readonly client_id: string;
48
+ /** Access tokens that were alive and are not any more. `0` is normal. */
49
+ readonly revoked_tokens: number;
50
+ }
51
+ /** Arguments for {@link MyOauthApplicationsNamespace.create}. */
52
+ export interface CreateOauthApplicationInput {
53
+ /**
54
+ * At most 60 characters AFTER normalisation, and normalisation is not a
55
+ * `trim`: the server strips zero-width and bidi characters first, so 60
56
+ * characters of padding is not a 60 character name and a name made only of
57
+ * bidi overrides is refused as blank (`name_required`).
58
+ */
59
+ readonly name: string;
60
+ /**
61
+ * At least one scope the server knows. An unknown scope is **dropped, not
62
+ * refused**, so a typo quietly narrows the client instead of registering
63
+ * something nobody asked for - but if EVERY scope you sent was unknown the
64
+ * result is `400 unknown_scope`.
65
+ *
66
+ * A string is accepted too and is split on whitespace or commas, but pass the
67
+ * array: it is the shape that cannot be misread.
68
+ */
69
+ readonly scopes: readonly (OmsScope | string)[] | string;
70
+ /**
71
+ * `true` to mint a client secret. Defaults to `false`.
72
+ *
73
+ * **This is the only chance you get.** The flag is frozen after registration
74
+ * (see {@link MyOauthApplicationsNamespace.update}), so a client that changes
75
+ * its mind has to be registered again from scratch. Choose `false` for
76
+ * anything that ships to end users - a secret inside a distributed binary is
77
+ * not a secret - and `true` only for something running on a server you
78
+ * control.
79
+ */
80
+ readonly confidential?: boolean;
81
+ /**
82
+ * Every redirect URI, space separated, or omitted.
83
+ *
84
+ * **Omitting it is the right answer for a CLI or a native app**: blank
85
+ * registers the RFC 8252 loopback pair
86
+ * ({@link NATIVE_LOOPBACK_REDIRECT_VALUE}), which is the only shape whose
87
+ * authorization code cannot land anywhere but the requester's own machine.
88
+ *
89
+ * It is otherwise the most dangerous field on the form. Matching is exact,
90
+ * and a redirect URI pointing at something an attacker controls IS account
91
+ * takeover - PKCE does not help, it binds the code to the client that started
92
+ * the flow, not to where the code is delivered. The server refuses anything
93
+ * that is not `https`, not loopback `http`, carries userinfo, carries a
94
+ * wildcard host or has no host at all, and it does so with a `422`
95
+ * (`validation_failed`) rather than by quietly rewriting your value.
96
+ */
97
+ readonly redirect_uri?: string;
98
+ }
99
+ /**
100
+ * Arguments for {@link MyOauthApplicationsNamespace.update}.
101
+ *
102
+ * **An absent key means "leave it alone"; a present key means "write this".**
103
+ * The server branches on whether the key is present, so sending a field at all
104
+ * is asking for it to be written, and writing the same value it already had
105
+ * still counts as a write for the purposes of the requeue rule below.
106
+ *
107
+ * Never send `null`. The transport encodes `null` in a query as the backend's
108
+ * null sentinel, and in a JSON body it reaches the column as a blanking of a
109
+ * `NOT NULL` field: a `422`, at best.
110
+ */
111
+ export interface UpdateOauthApplicationInput {
112
+ readonly name?: string;
113
+ readonly scopes?: readonly (OmsScope | string)[] | string;
114
+ readonly redirect_uri?: string;
115
+ }
116
+ /**
117
+ * `oms.admin.myApplications` - the OAuth clients **you registered**.
118
+ *
119
+ * Needs an ordinary authenticated session and nothing more. Every action starts
120
+ * from a relation already narrowed to the caller, so another person's id and an
121
+ * id that was never issued produce the identical `404` and there is no way to
122
+ * probe whether a client exists.
123
+ *
124
+ * **This is not `/oauth/*`.** There is no client management under `/oauth/*`
125
+ * at all (`/oauth/applications` is a hard 404); `/oauth_applications` is this
126
+ * API's own and is authenticated the same way every other endpoint here is.
127
+ * Authentication is by SESSION, deliberately: you do not manage the keys to the
128
+ * house with a key to the house, and an OAuth token cannot reach these routes.
129
+ *
130
+ * Remember the product rule: what you register here does not work until an
131
+ * administrator approves it. See the namespace documentation.
132
+ *
133
+ * Every error on this surface carries a STRUCTURED body -
134
+ * `{ "error": "<code>", "message": "<PT-PT sentence>" }`, plus an `errors`
135
+ * array of model messages on a `422`. That is unusual in this API, where an
136
+ * error is normally a bare JSON string, and it is worth using: read
137
+ * `OmsApiError.body.error` for the code and branch on that. The `message` is
138
+ * written in one language.
139
+ */
140
+ export declare class MyOauthApplicationsNamespace extends Resource {
141
+ /**
142
+ * `GET /oauth_applications` - every client you registered, newest first.
143
+ *
144
+ * Whatever their approval state, on purpose: a pending client has to stay
145
+ * visible to the person waiting on it. There is no pagination, no state
146
+ * filter and no ETag on this route - one person's list has units in it, not
147
+ * pages, and {@link OAUTH_APP_MAX_PENDING} plus the registration throttle
148
+ * keep it that way.
149
+ *
150
+ * The response is enveloped (`{ applications: [...] }`); this method unwraps
151
+ * it. An empty list is `[]`, never `null`.
152
+ *
153
+ * A `client_secret` never appears here.
154
+ */
155
+ list(options?: RequestOptions): Promise<OwnedOauthApplication[]>;
156
+ /**
157
+ * `GET /oauth_applications/:id` - one of your clients.
158
+ *
159
+ * @throws {OmsApiError} 404 `not_found` for an id that is not yours, which is
160
+ * byte for byte the answer for an id that never existed. The primary key is
161
+ * a walkable integer sequence, so the absence of a `403` here is the point:
162
+ * there is no existence oracle to walk.
163
+ */
164
+ get(id: number | string, options?: RequestOptions): Promise<OwnedOauthApplication>;
165
+ /**
166
+ * `POST /oauth_applications` - registers a client. Answers `201`.
167
+ *
168
+ * The client lands as `pending` and **cannot mint a single token until an
169
+ * administrator approves it**. It does get a real `client_id` immediately,
170
+ * and it appears in {@link list} straight away, so "I have a client_id" is
171
+ * not the same as "I have a working client". Registering also rings a Discord
172
+ * alert on the review queue, because a review gate nobody is told about is a
173
+ * feature that quietly does not work.
174
+ *
175
+ * **The response is the only place `client_secret` will ever exist.** Capture
176
+ * it now; see {@link OwnedOauthApplicationWithSecret}. It is `null` for a
177
+ * public client.
178
+ *
179
+ * **Two different `429`s guard this endpoint and they need opposite
180
+ * reactions:**
181
+ *
182
+ * - the server allows **10 registrations per hour and 20 per day, keyed by
183
+ * the OWNER** (not the session, so logging in again does not buy a fresh
184
+ * budget). It answers `{"error":"rate_limited","retry_after":N}` WITH a
185
+ * `Retry-After` header, so the {@link OmsQuotaError} carries
186
+ * `retryAfterMs`. Waiting fixes it.
187
+ * - the server refuses a sixth PENDING client with
188
+ * `{"error":"too_many_pending", ...}` and **no** `Retry-After`, so
189
+ * `retryAfterMs` is `undefined`. Waiting does NOT fix that one: a human has
190
+ * to decide on one of the five, or you have to delete one. Read
191
+ * `OmsApiError.body.error` to tell them apart, not the status.
192
+ *
193
+ * Retries are disabled. Both reasons matter: a replay after a lost response
194
+ * mints a SECOND client with a different `client_id`, leaving an orphan in a
195
+ * queue a person has to work through; and the transport retries `429` for
196
+ * every method, which on the `too_many_pending` branch would burn three of
197
+ * the ten hourly registrations on an answer that cannot change.
198
+ *
199
+ * @throws {OmsQuotaError} 429, from either producer above.
200
+ * @throws {OmsApiError} 400 `name_required`, `name_too_long`,
201
+ * `scopes_required`, `unknown_scope` or `redirect_uri_excessive`; 422
202
+ * `validation_failed` with an `errors` array when the redirect URI is a
203
+ * shape this server will not register.
204
+ */
205
+ create(input: CreateOauthApplicationInput, options?: RequestOptions): Promise<OwnedOauthApplicationWithSecret>;
206
+ /**
207
+ * `PATCH /oauth_applications/:id` - edits name, scopes or redirect URIs.
208
+ *
209
+ * **Read {@link editWouldRequeue} before calling this on an approved
210
+ * client.** Renaming it, widening its scopes or moving its redirect URI
211
+ * returns it to `pending`, clears the approval stamps, and stops it resolving
212
+ * on the very next request. That is the anti-phishing rule working, not a
213
+ * bug: without it you could get "A Minha Appzinha" approved and rename it to
214
+ * "omelhorsite Oficial" a minute later, or get a loopback client approved and
215
+ * repoint it at your own server, which since `authorization_code` is enabled
216
+ * means the authorization code itself is delivered to you. The
217
+ * `approval_status` on the response is the authoritative answer.
218
+ *
219
+ * **What is NOT editable, and why the omissions are deliberate:**
220
+ *
221
+ * - `confidential`. Flipping it `true -> false` downgrades authentication for
222
+ * an already-approved client: the server authenticates a public client on
223
+ * its `client_id` alone, and a `client_id` is not a secret - it travels in
224
+ * the clear in every device authorization request. The reverse direction is
225
+ * merely broken: secrets are minted on create only, so `false -> true`
226
+ * would 422 on a missing secret. One direction is a security downgrade and
227
+ * the other is a dead end, so the field is frozen; a client that changes its
228
+ * mind registers a new one.
229
+ * - `client_id`. It is the identity the approval was granted to. Editable, it
230
+ * would move an approval onto a different client.
231
+ * - anything approval-shaped. The owner never writes their own verdict.
232
+ *
233
+ * An edit that requeues an approved client SPENDS a slot against
234
+ * {@link OAUTH_APP_MAX_PENDING} and can therefore answer `429
235
+ * too_many_pending`. Editing a client that is already pending, or narrowing
236
+ * an approved client's scopes, costs nothing and keeps working with a full
237
+ * queue - otherwise the ceiling would trap you into being unable to fix the
238
+ * very clients that are waiting.
239
+ *
240
+ * @throws {OmsApiError} 409 `first_party_immutable` for `oms-cli` or
241
+ * `oms-mcp`; 404 `not_found`; 400 for the name and scope codes; 422
242
+ * `validation_failed` for a refused redirect URI.
243
+ * @throws {OmsQuotaError} 429 `too_many_pending`, with no `Retry-After`.
244
+ */
245
+ update(id: number | string, input: UpdateOauthApplicationInput, options?: RequestOptions): Promise<OwnedOauthApplication>;
246
+ /**
247
+ * `DELETE /oauth_applications/:id` - deletes one of your clients.
248
+ *
249
+ * Answers **`200` with a body**, not the `204` most destroys in this API
250
+ * answer, because the count of tokens it just killed is worth reporting. Live
251
+ * tokens, access grants and pending device grants are revoked first and the
252
+ * row goes afterwards.
253
+ *
254
+ * Deleting a pending client frees its queue slot immediately, which is the
255
+ * cure for `too_many_pending`.
256
+ *
257
+ * The body's key is **`client_id`**. The administrator's delete spells the
258
+ * same value `uid`. See {@link OwnedOauthApplicationDeletion}.
259
+ *
260
+ * @throws {OmsApiError} 409 `first_party_immutable` for a shipped client; 404
261
+ * `not_found` otherwise.
262
+ */
263
+ destroy(id: number | string, options?: RequestOptions): Promise<OwnedOauthApplicationDeletion>;
264
+ /**
265
+ * `POST /oauth_applications/:id/rotate_secret` - mints a new client secret.
266
+ *
267
+ * `POST` rather than `PATCH` because it MINTS a value: the response is the
268
+ * only place the new secret ever appears, and the old one stops working the
269
+ * instant this returns.
270
+ *
271
+ * Confidential clients only. It does NOT touch approval (nothing an
272
+ * administrator reviewed has changed, so the anti-phishing rule correctly
273
+ * does not fire) and it does NOT touch live tokens - killing those is a
274
+ * louder, separate decision and it belongs to an administrator
275
+ * ({@link AdminOauthApplicationsNamespace.revokeTokens}).
276
+ *
277
+ * @throws {OmsApiError} 400 `not_confidential` for a public client, which has
278
+ * no secret to rotate; 409 `first_party_immutable` for a shipped client;
279
+ * 404 `not_found`.
280
+ */
281
+ rotateSecret(id: number | string, options?: RequestOptions): Promise<OwnedOauthApplicationWithSecret>;
282
+ }
@@ -0,0 +1,49 @@
1
+ /** `oms.admin.notepads` - aggregate notepad statistics. Administrators only. */
2
+ import { Resource } from "../../http";
3
+ import type { RequestOptions } from "../../types";
4
+ import type { AdminDailyCount } from "./types";
5
+ /** Content length distribution, in characters. */
6
+ export interface AdminNotepadContentSize {
7
+ /** Rounded to a whole number. `0` when there are no pads. */
8
+ readonly avg: number;
9
+ /** Median. Nearest-rank, not interpolated. */
10
+ readonly p50: number;
11
+ readonly p95: number;
12
+ }
13
+ /** What {@link AdminNotepadsNamespace.stats} answers with. Counts only, never content. */
14
+ export interface AdminNotepadStats {
15
+ readonly total: number;
16
+ /** Pads whose content starts with the client-side encryption marker. */
17
+ readonly encrypted_count: number;
18
+ /** Already a percentage, `0` to `100`, one decimal. */
19
+ readonly encrypted_percent: number;
20
+ /** Pads longer than 256 characters, i.e. probably not a stray keystroke. */
21
+ readonly meaningful_count: number;
22
+ readonly meaningful_percent: number;
23
+ readonly created_last_24h: number;
24
+ readonly created_last_7d: number;
25
+ readonly created_last_30d: number;
26
+ readonly content_size: AdminNotepadContentSize;
27
+ /** Clicks on every `n/` short link, i.e. how often pads were opened through their link. */
28
+ readonly short_link_clicks_total: number;
29
+ readonly creations_daily: AdminDailyCount[];
30
+ }
31
+ /**
32
+ * `oms.admin.notepads` - **administrators only**. Aggregate notepad statistics.
33
+ *
34
+ * `stats` is the ONLY route, for the same reason as
35
+ * {@link AdminChestsNamespace}: a pad's slug IS its authorisation, so there is
36
+ * no admin listing that would hand out slugs, and no content crosses the wire
37
+ * here. Only lengths are measured.
38
+ */
39
+ export declare class AdminNotepadsNamespace extends Resource {
40
+ /**
41
+ * `GET /admin/notepads/stats`.
42
+ *
43
+ * The length distribution is computed over every pad, so this request grows
44
+ * linearly with the number of pads. It is a dashboard call, not a poll.
45
+ *
46
+ * @throws {OmsAuthError} 403 for a non-admin.
47
+ */
48
+ stats(options?: RequestOptions): Promise<AdminNotepadStats>;
49
+ }