@adelin-io/cli 0.0.0-stage → 0.1.1
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 +76 -2
- package/authoring-release.json +174 -0
- package/package.json +30 -4
- package/runtime-integrity.json +9 -0
- package/scripts/adelin.mjs +7768 -0
- package/scripts/assemble-checkout.mjs +93 -0
- package/scripts/local-save.mjs +513 -0
- package/scripts/materialize.mjs +319 -0
- package/scripts/runtime.mjs +8950 -0
- package/scripts/typecheck.mjs +72 -0
- package/scripts/workspace-state.mjs +183 -0
- package/skill/README.md +77 -0
- package/skill/SKILL.md +100 -0
- package/skill/authoring/access.md +193 -0
- package/skill/authoring/analytics.md +20 -0
- package/skill/authoring/app-memory.md +128 -0
- package/skill/authoring/app-requirements.md +99 -0
- package/skill/authoring/app-structure.md +265 -0
- package/skill/authoring/assets.md +117 -0
- package/skill/authoring/auth.md +263 -0
- package/skill/authoring/content-binding.md +26 -0
- package/skill/authoring/i18n.md +184 -0
- package/skill/authoring/language.md +503 -0
- package/skill/authoring/local-workflow.md +1667 -0
- package/skill/authoring/offline/connectivity.md +50 -0
- package/skill/authoring/offline/example.md +102 -0
- package/skill/authoring/offline/history-sync.md +39 -0
- package/skill/authoring/offline/index.md +29 -0
- package/skill/authoring/offline/package-storage.md +37 -0
- package/skill/authoring/offline/platforms.md +35 -0
- package/skill/authoring/offline/startup-navigation.md +53 -0
- package/skill/authoring/platform-files.md +616 -0
- package/skill/authoring/player/casting.md +47 -0
- package/skill/authoring/player/controls.md +95 -0
- package/skill/authoring/player/downloads.md +90 -0
- package/skill/authoring/player/drm.md +31 -0
- package/skill/authoring/player/index.md +39 -0
- package/skill/authoring/player/live-dvr.md +74 -0
- package/skill/authoring/player/platforms.md +47 -0
- package/skill/authoring/player/playback.md +43 -0
- package/skill/authoring/player/tracks-subtitles.md +32 -0
- package/skill/authoring/profiles.md +213 -0
- package/skill/authoring/remote-keys.md +139 -0
- package/skill/authoring/search.md +27 -0
- package/skill/authoring/store.md +85 -0
- package/skill/authoring/tv-text-entry.md +146 -0
- package/skill/design/approved/README.md +14 -0
- package/skill/design/approved/vesper-phone-home.jpg +0 -0
- package/skill/design/approved/vesper-tv-detail.jpg +0 -0
- package/skill/design/approved/vesper-tv-home.jpg +0 -0
- package/skill/design/design-guide.md +610 -0
- package/skill/design/edge-to-edge.md +66 -0
- package/skill/design/icons.md +50 -0
- package/skill/design/responsive-layout.md +175 -0
- package/skill/design/safe-area.md +221 -0
- package/skill/design/streaming-playbook.md +131 -0
- package/skill/design/visual-review.md +150 -0
- package/skill/examples/README.md +24 -0
- package/skill/examples/cinema/DESIGN.md +58 -0
- package/skill/examples/cinema/app.tsx +17 -0
- package/skill/examples/cinema/assets/logo.png +0 -0
- package/skill/examples/cinema/components/Action.tsx +40 -0
- package/skill/examples/cinema/components/Action.tv.tsx +44 -0
- package/skill/examples/cinema/components/CatalogGrid.tsx +31 -0
- package/skill/examples/cinema/components/ContinueRail.tsx +98 -0
- package/skill/examples/cinema/components/Feedback.tsx +28 -0
- package/skill/examples/cinema/components/Field.tsx +41 -0
- package/skill/examples/cinema/components/LibraryRail.tsx +46 -0
- package/skill/examples/cinema/components/PlayAction.tsx +29 -0
- package/skill/examples/cinema/components/Root.tsx +59 -0
- package/skill/examples/cinema/components/Shell.tsx +70 -0
- package/skill/examples/cinema/components/Tab.tsx +22 -0
- package/skill/examples/cinema/components/TitleCard.tsx +68 -0
- package/skill/examples/cinema/components/TitleMeta.tsx +36 -0
- package/skill/examples/cinema/locales/en.ts +211 -0
- package/skill/examples/cinema/locales/lt.ts +211 -0
- package/skill/examples/cinema/preview/phone-home.jpg +0 -0
- package/skill/examples/cinema/preview/tv-detail.jpg +0 -0
- package/skill/examples/cinema/preview/tv-home.jpg +0 -0
- package/skill/examples/cinema/screens/portrait/Account.tsx +110 -0
- package/skill/examples/cinema/screens/portrait/Browse.tsx +73 -0
- package/skill/examples/cinema/screens/portrait/Detail.tsx +159 -0
- package/skill/examples/cinema/screens/portrait/Home.tsx +196 -0
- package/skill/examples/cinema/screens/portrait/Player.tsx +299 -0
- package/skill/examples/cinema/screens/portrait/Search.tsx +46 -0
- package/skill/examples/cinema/screens/portrait/Search.tv.tsx +55 -0
- package/skill/examples/cinema/screens/portrait/SignIn.tsx +101 -0
- package/skill/examples/cinema/screens/portrait/SignUp.tsx +106 -0
- package/skill/examples/cinema/store.tsx +132 -0
- package/skill/examples/cinema/theme.ts +32 -0
- package/skill/examples/documentary/DESIGN.md +33 -0
- package/skill/examples/documentary/app.tsx +17 -0
- package/skill/examples/documentary/components/Action.tsx +43 -0
- package/skill/examples/documentary/components/CatalogGrid.tsx +47 -0
- package/skill/examples/documentary/components/Feedback.tsx +27 -0
- package/skill/examples/documentary/components/Field.tsx +33 -0
- package/skill/examples/documentary/components/LibraryRail.tsx +47 -0
- package/skill/examples/documentary/components/Root.tsx +62 -0
- package/skill/examples/documentary/components/Shell.tsx +93 -0
- package/skill/examples/documentary/components/StoryCard.tsx +53 -0
- package/skill/examples/documentary/components/StoryMeta.tsx +22 -0
- package/skill/examples/documentary/preview/phone-home.jpg +0 -0
- package/skill/examples/documentary/preview/tv-detail.jpg +0 -0
- package/skill/examples/documentary/preview/tv-home.jpg +0 -0
- package/skill/examples/documentary/screens/portrait/Account.tsx +97 -0
- package/skill/examples/documentary/screens/portrait/Browse.tsx +71 -0
- package/skill/examples/documentary/screens/portrait/Detail.tsx +133 -0
- package/skill/examples/documentary/screens/portrait/Home.tsx +89 -0
- package/skill/examples/documentary/screens/portrait/Player.tsx +116 -0
- package/skill/examples/documentary/screens/portrait/Search.tsx +48 -0
- package/skill/examples/documentary/screens/portrait/SignIn.tsx +96 -0
- package/skill/examples/documentary/screens/portrait/SignUp.tsx +101 -0
- package/skill/examples/documentary/store.tsx +115 -0
- package/skill/examples/documentary/theme.ts +20 -0
- package/skill/examples/series/DESIGN.md +55 -0
- package/skill/examples/series/app.tsx +17 -0
- package/skill/examples/series/components/Action.tsx +42 -0
- package/skill/examples/series/components/CatalogGrid.tsx +43 -0
- package/skill/examples/series/components/ContinueRail.tsx +78 -0
- package/skill/examples/series/components/Feedback.tsx +26 -0
- package/skill/examples/series/components/Field.tsx +34 -0
- package/skill/examples/series/components/LibraryRail.tsx +38 -0
- package/skill/examples/series/components/OutcomeNote.tsx +28 -0
- package/skill/examples/series/components/PlayAction.tsx +29 -0
- package/skill/examples/series/components/RestoreAction.tsx +33 -0
- package/skill/examples/series/components/Root.tsx +75 -0
- package/skill/examples/series/components/SaveTitle.tsx +34 -0
- package/skill/examples/series/components/Shell.tsx +75 -0
- package/skill/examples/series/components/TitleCard.tsx +62 -0
- package/skill/examples/series/components/UnlockAction.tsx +10 -0
- package/skill/examples/series/preview/phone-home.jpg +0 -0
- package/skill/examples/series/preview/tv-detail.jpg +0 -0
- package/skill/examples/series/preview/tv-home.jpg +0 -0
- package/skill/examples/series/screens/portrait/Account.tsx +125 -0
- package/skill/examples/series/screens/portrait/Browse.tsx +61 -0
- package/skill/examples/series/screens/portrait/Detail.tsx +231 -0
- package/skill/examples/series/screens/portrait/Home.tsx +109 -0
- package/skill/examples/series/screens/portrait/MyList.tsx +44 -0
- package/skill/examples/series/screens/portrait/Plans.tsx +131 -0
- package/skill/examples/series/screens/portrait/Player.tsx +138 -0
- package/skill/examples/series/screens/portrait/Profiles.tsx +103 -0
- package/skill/examples/series/screens/portrait/Search.tsx +50 -0
- package/skill/examples/series/screens/portrait/SignIn.tsx +94 -0
- package/skill/examples/series/screens/portrait/SignUp.tsx +100 -0
- package/skill/examples/series/store.tsx +192 -0
- package/skill/examples/series/theme.ts +32 -0
- package/skill/guides/final-pricing-capabilities.md +13 -0
- package/skill/reference/api.md +842 -0
- package/skill/reference/components.md +1782 -0
- package/skill/reference/packages.md +24 -0
- package/skill/scripts/assemble-checkout.mjs +93 -0
- package/skill/scripts/local-save.mjs +513 -0
- package/skill/scripts/materialize.mjs +319 -0
- package/skill/scripts/workspace-state.mjs +183 -0
- package/types/adelin-access.d.ts +70 -0
- package/types/adelin-analytics.d.ts +5 -0
- package/types/adelin-assets.d.ts +26 -0
- package/types/adelin-auth.d.ts +37 -0
- package/types/adelin-content.d.ts +120 -0
- package/types/adelin-device.d.ts +195 -0
- package/types/adelin-downloads.d.ts +47 -0
- package/types/adelin-env.d.ts +8 -0
- package/types/adelin-globals.d.ts +19 -0
- package/types/adelin-i18n.d.ts +31 -0
- package/types/adelin-native-stack.d.ts +178 -0
- package/types/adelin-navigation.d.ts +264 -0
- package/types/adelin-profiles.d.ts +51 -0
- package/types/adelin-react.d.ts +49 -0
- package/types/adelin-reanimated.d.ts +376 -0
- package/types/adelin-storage.d.ts +9 -0
- package/types/adelin-store.d.ts +74 -0
- package/types/adelin-ui.d.ts +1518 -0
- package/types/adelin-utils.d.ts +7 -0
- package/types/adelin-worklets.d.ts +15 -0
- package/workspace-tsconfig.json +53 -0
|
@@ -0,0 +1,842 @@
|
|
|
1
|
+
# App-User REST API Reference
|
|
2
|
+
|
|
3
|
+
REST knowledge for the existing app-user services; this does not authorize arbitrary fetch actions in the portable workspace grammar. All paths are written in their full app-scoped form. Every endpoint requires an app-user Bearer token. Apps reach profiles and saved titles through @adelin/profiles, never through these endpoints.
|
|
4
|
+
|
|
5
|
+
## Portable workspace APIs
|
|
6
|
+
|
|
7
|
+
Use @adelin/auth operations inside async thunks and await dispatch(thunk()).unwrap() before success navigation. Keep passwords component-local; useAuth exposes only readonly safe session and provider policy/device availability. An operation may reject with { code, message }: show message as it is, since the runtime already wrote it in the viewer’s language, and never write your own copy for auth errors. A fulfilled controlled client test is not deployed provider acceptance.
|
|
8
|
+
|
|
9
|
+
Account operations reauthenticate an existing method before adding a password or provider. Await the safe result: completed, cancelled, unavailable and pending-deletion are distinct. Keep current/new passwords local and clear on settlement. Confirm permanent deletion explicitly with reauthentication inside the confirmation dialog; pending-deletion means signed out with cleanup pending, not restored. Provider server policy and device availability remain independent. Follow the account flow in authoring/auth.md.
|
|
10
|
+
|
|
11
|
+
@adelin/profiles profiles, favorites and progress calls also run inside async thunks, and only for a signed-in viewer.
|
|
12
|
+
|
|
13
|
+
@adelin/access actions also run inside async thunks and resolve { outcome }; follow authoring/access.md.
|
|
14
|
+
|
|
15
|
+
@adelin/downloads commands and @adelin/device appMode.switchTo run directly in event handlers, or are awaited inside async thunks to use their { outcome } result.
|
|
16
|
+
|
|
17
|
+
@adelin/device useBackHandler automatically registers through the runtime useFocusEffect for its foreground screen. It needs no wiring. useFocusEffect from @adelin/navigation is available for the app’s own focus work. The ordinary chain runs in reverse registration order: true consumes Back, false continues to older handlers and navigation.
|
|
18
|
+
|
|
19
|
+
### @adelin/auth
|
|
20
|
+
```ts
|
|
21
|
+
declare module "@adelin/auth" {
|
|
22
|
+
export interface AuthState {
|
|
23
|
+
readonly status: "loading" | "signed-out" | "signed-in";
|
|
24
|
+
// True when the builder requires viewers to sign in before they see content.
|
|
25
|
+
readonly signInRequired: boolean;
|
|
26
|
+
readonly currentuser: Readonly<{ id: string }> | null;
|
|
27
|
+
readonly providers: Readonly<{ google: Readonly<{ enabled: boolean | null; available: boolean }>; apple: Readonly<{ enabled: boolean | null; available: boolean }> }>;
|
|
28
|
+
// The platform's marketing sentence, shown verbatim, and the viewer's choice (null signed out); null while loading.
|
|
29
|
+
readonly marketingConsent: Readonly<{ text: string; subscribed: boolean | null }> | null;
|
|
30
|
+
}
|
|
31
|
+
export function useAuth(): AuthState;
|
|
32
|
+
export type AuthErrorCode = "AUTH_INVALID_CREDENTIALS" | "AUTH_ACCOUNT_EXISTS" | "AUTH_EMAIL_UNVERIFIED" | "AUTH_EMAIL_DELIVERY_UNAVAILABLE" | "AUTH_RATE_LIMITED" | "AUTH_ACCOUNT_UNAVAILABLE" | "AUTH_REAUTH_REQUIRED" | "AUTH_LINK_CONFLICT" | "AUTH_EMAIL_INVALID" | "AUTH_PASSWORD_REQUIRED" | "AUTH_PASSWORD_TOO_SHORT" | "AUTH_PASSWORDS_DIFFER" | "AUTH_UNAVAILABLE" | "AUTH_OPERATION_FAILED" | "AUTH_DISPOSED";
|
|
33
|
+
// What every operation rejects with: show `message` as is; it is already in the viewer's language.
|
|
34
|
+
export type AuthError = Readonly<{ code: AuthErrorCode; message: string }>;
|
|
35
|
+
// Rejects with AUTH_EMAIL_INVALID or AUTH_PASSWORD_REQUIRED before contacting the server.
|
|
36
|
+
export function signIn(input: Readonly<{ email: string; password: string }>): Promise<void>;
|
|
37
|
+
// Checks email, an 8-character password and, when given, confirmPassword before contacting the server.
|
|
38
|
+
export function signUp(input: Readonly<{ email: string; password: string; confirmPassword?: string; marketingOptIn?: boolean }>): Promise<void>;
|
|
39
|
+
// Changes the signed-in viewer's marketing choice from the account screen.
|
|
40
|
+
export function setMarketingConsent(input: Readonly<{ subscribed: boolean }>): Promise<void>;
|
|
41
|
+
export function signOut(): Promise<void>;
|
|
42
|
+
export function requestPasswordRecovery(input: Readonly<{ email: string }>): Promise<void>;
|
|
43
|
+
export function completePasswordRecovery(input: Readonly<{ password: string; confirmPassword?: string }>): Promise<void>;
|
|
44
|
+
export type Provider = "google" | "apple";
|
|
45
|
+
export type AccountReauth = Readonly<{ method: "password"; password: string }> | Readonly<{ method: Provider }>;
|
|
46
|
+
export type AccountResult = Readonly<{ status: "completed" }> | Readonly<{ status: "cancelled" }> | Readonly<{ status: "unavailable" }>;
|
|
47
|
+
export type DeleteAccountResult = Readonly<{ status: "pending-deletion" }> | Readonly<{ status: "cancelled" }> | Readonly<{ status: "unavailable" }>;
|
|
48
|
+
export type ProviderSignInResult = Readonly<{ status: "signed-in" }> | Readonly<{ status: "cancelled" }> | Readonly<{ status: "unavailable" }>;
|
|
49
|
+
// Signs in or up with Google or Apple; marketingOptIn counts only when this creates the account.
|
|
50
|
+
export function signInWithProvider(input: Readonly<{ provider: Provider; marketingOptIn?: boolean }>): Promise<ProviderSignInResult>;
|
|
51
|
+
// Adds password login after reauthentication of the current app account.
|
|
52
|
+
export function addPasswordLoginMethod(input: Readonly<{ reauth: AccountReauth; password: string }>): Promise<AccountResult>;
|
|
53
|
+
// Adds provider login through scoped reauthentication and presentation.
|
|
54
|
+
export function addProviderLoginMethod(input: Readonly<{ reauth: AccountReauth; provider: Provider }>): Promise<AccountResult>;
|
|
55
|
+
// Requests irreversible deletion; worker completion remains pending.
|
|
56
|
+
export function deleteAccount(input: Readonly<{ reauth: AccountReauth }>): Promise<DeleteAccountResult>;
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### @adelin/access
|
|
61
|
+
```ts
|
|
62
|
+
// Viewer access: offers with ready-to-show prices, current holdings, per-title access, and purchase actions.
|
|
63
|
+
declare module "@adelin/access" {
|
|
64
|
+
// One price of an offer; show `priceLabel` as written, never format `amountMinor` yourself.
|
|
65
|
+
export interface OfferPrice {
|
|
66
|
+
readonly period: "month" | "year" | "once";
|
|
67
|
+
readonly priceLabel: string;
|
|
68
|
+
readonly amountMinor: number;
|
|
69
|
+
readonly currency: string;
|
|
70
|
+
}
|
|
71
|
+
// Something the viewer can get: a plan (subscription), a purchase or a rental.
|
|
72
|
+
export interface Offer {
|
|
73
|
+
readonly id: string;
|
|
74
|
+
readonly kind: "plan" | "purchase" | "rental";
|
|
75
|
+
readonly name: string;
|
|
76
|
+
readonly description: string;
|
|
77
|
+
readonly trialDays: number | null;
|
|
78
|
+
// Whether this viewer may still start this offer's trial; the server decides.
|
|
79
|
+
readonly trialAvailable: boolean;
|
|
80
|
+
// The plan's periods this device can sell: those with a price on the web, those the store sells on phones and TVs.
|
|
81
|
+
readonly billingPeriods: readonly ("month" | "year")[] | null;
|
|
82
|
+
// Web prices; empty on phones and TVs, where `storePrices` holds the store's own.
|
|
83
|
+
readonly prices: readonly OfferPrice[];
|
|
84
|
+
// Phones and TVs only, once the store answers: the store's price for each period it sells; show `priceLabel` as written.
|
|
85
|
+
readonly storePrices?: readonly Readonly<{ period: "month" | "year" | "once"; priceLabel: string }>[];
|
|
86
|
+
readonly covers: Readonly<{ wholeLibrary: boolean; titles: number; collections: number }>;
|
|
87
|
+
// Hours a rental may wait before the first play.
|
|
88
|
+
readonly rentalStartHours: number | null;
|
|
89
|
+
// Hours a rental stays open once playback starts.
|
|
90
|
+
readonly rentalViewHours: number | null;
|
|
91
|
+
// False when no payment channel can sell it on this device; actions then resolve `unavailable`.
|
|
92
|
+
readonly purchasable: boolean;
|
|
93
|
+
// The app-store products that sell this offer on this device; the runtime uses them, apps do not.
|
|
94
|
+
readonly storeProducts: readonly Readonly<{ store: "apple" | "google"; period: "month" | "year" | "once"; productId: string; basePlanId: string | null }>[];
|
|
95
|
+
}
|
|
96
|
+
// Something the viewer has right now.
|
|
97
|
+
export interface Holding {
|
|
98
|
+
readonly kind: "subscription" | "purchase" | "rental" | "comp";
|
|
99
|
+
readonly status: "trial" | "active" | "past_due" | "cancelled";
|
|
100
|
+
readonly offerId: string | null;
|
|
101
|
+
// The offer's name, even when that offer is no longer sold.
|
|
102
|
+
readonly offerName: string | null;
|
|
103
|
+
readonly entryId: string | null;
|
|
104
|
+
readonly collectionId: string | null;
|
|
105
|
+
readonly endsAt: string | null;
|
|
106
|
+
}
|
|
107
|
+
// One title's access, decided by the server; also each content row's `access`, which is open when absent.
|
|
108
|
+
export interface ContentItemAccess {
|
|
109
|
+
readonly open: boolean;
|
|
110
|
+
readonly level: "free" | "sign_in" | "paid";
|
|
111
|
+
readonly reason: "sign_in" | "paid" | "rental_expired" | null;
|
|
112
|
+
// Offers that would open it.
|
|
113
|
+
readonly offerIds: readonly string[];
|
|
114
|
+
// When a rental or plan that opens it ends.
|
|
115
|
+
readonly endsAt: string | null;
|
|
116
|
+
}
|
|
117
|
+
export interface AccessState {
|
|
118
|
+
readonly status: "loading" | "ready";
|
|
119
|
+
readonly offers: readonly Offer[];
|
|
120
|
+
readonly holdings: readonly Holding[];
|
|
121
|
+
// The access of the content row with this id; null when the app has not loaded that title.
|
|
122
|
+
item(id: string): ContentItemAccess | null;
|
|
123
|
+
}
|
|
124
|
+
// `reason` says why, when the app can tell the viewer more; `"other_account"`: the purchase belongs to another account.
|
|
125
|
+
export type AccessOutcome = Readonly<{
|
|
126
|
+
outcome: "completed" | "cancelled" | "pending" | "unavailable" | "failed";
|
|
127
|
+
reason?: "other_account" | "revoked" | "payment_issue";
|
|
128
|
+
}>;
|
|
129
|
+
|
|
130
|
+
export function useAccess(): AccessState;
|
|
131
|
+
export function subscribe(input: Readonly<{ offerId: string; period: "month" | "year" }>): Promise<AccessOutcome>;
|
|
132
|
+
export function startTrial(input: Readonly<{ offerId: string; period: "month" | "year" }>): Promise<AccessOutcome>;
|
|
133
|
+
export function buy(input: Readonly<{ offerId: string }>): Promise<AccessOutcome>;
|
|
134
|
+
// `entryId` is the title's id, required unless the rental offer covers exactly one title.
|
|
135
|
+
export function rent(input: Readonly<{ offerId: string; entryId?: string }>): Promise<AccessOutcome>;
|
|
136
|
+
export function restorePurchases(): Promise<AccessOutcome>;
|
|
137
|
+
// Opens the payment channel's subscription management page.
|
|
138
|
+
export function manageSubscription(): Promise<AccessOutcome>;
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### @adelin/store
|
|
143
|
+
```ts
|
|
144
|
+
// The Redux-shaped app store; `RootState` is filled in by the workspace's `adelin-env.d.ts`.
|
|
145
|
+
declare module "@adelin/store" {
|
|
146
|
+
// The whole store's state, augmented per workspace from `store.tsx`.
|
|
147
|
+
export interface RootState {}
|
|
148
|
+
|
|
149
|
+
export interface PayloadAction<P = unknown> {
|
|
150
|
+
type: string;
|
|
151
|
+
payload: P;
|
|
152
|
+
}
|
|
153
|
+
// A creator for one action type.
|
|
154
|
+
export interface ActionCreator<P> {
|
|
155
|
+
(payload?: P): PayloadAction<P>;
|
|
156
|
+
type: string;
|
|
157
|
+
}
|
|
158
|
+
export type CaseReducer<S> = (state: S, action: PayloadAction<any>) => S | void;
|
|
159
|
+
|
|
160
|
+
type PayloadOf<F> = F extends (state: any, action: infer A) => any
|
|
161
|
+
? A extends { payload: infer P } ? P : unknown
|
|
162
|
+
: unknown;
|
|
163
|
+
|
|
164
|
+
// A thunk lifecycle creator; its actions carry the thunk's argument as `meta.arg`.
|
|
165
|
+
export interface ThunkCaseCreator<P, A> extends ActionCreator<P> {
|
|
166
|
+
readonly __arg: A;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface ActionReducerMapBuilder<S> {
|
|
170
|
+
addCase<P, A>(
|
|
171
|
+
action: ThunkCaseCreator<P, A>,
|
|
172
|
+
reducer: (state: S, action: PayloadAction<P> & { meta: { arg: A } }) => S | void,
|
|
173
|
+
): ActionReducerMapBuilder<S>;
|
|
174
|
+
addCase<P>(
|
|
175
|
+
action: ActionCreator<P>,
|
|
176
|
+
reducer: (state: S, action: PayloadAction<P>) => S | void,
|
|
177
|
+
): ActionReducerMapBuilder<S>;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export interface Slice<N extends string, S, R> {
|
|
181
|
+
name: N;
|
|
182
|
+
reducer: (state: S | undefined, action: { type: string }) => S;
|
|
183
|
+
actions: { [K in keyof R]: (payload?: PayloadOf<R[K]>) => unknown };
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export function createSlice<N extends string, S, R extends Record<string, CaseReducer<S>>>(options: {
|
|
187
|
+
name: N;
|
|
188
|
+
initialState: S;
|
|
189
|
+
reducers: R;
|
|
190
|
+
extraReducers?: (builder: ActionReducerMapBuilder<S>) => void;
|
|
191
|
+
}): Slice<N, S, R>;
|
|
192
|
+
|
|
193
|
+
// An async action: call it to dispatch, match its lifecycle with the three creators.
|
|
194
|
+
export interface AsyncThunk<T, A> {
|
|
195
|
+
(...args: undefined extends A ? [arg?: A] : [arg: A]): ThunkAction<T>;
|
|
196
|
+
pending: ThunkCaseCreator<undefined, A>;
|
|
197
|
+
fulfilled: ThunkCaseCreator<T, A>;
|
|
198
|
+
rejected: ThunkCaseCreator<unknown, A>;
|
|
199
|
+
}
|
|
200
|
+
export function createAsyncThunk<T, A = void>(type: string, payload: (arg: A) => Promise<T>): AsyncThunk<T, A>;
|
|
201
|
+
|
|
202
|
+
// Maps a store module's exported slices to their state, keyed by slice name.
|
|
203
|
+
export type SliceStates<M> = {
|
|
204
|
+
[K in keyof M as M[K] extends { name: infer N extends string; reducer: (...a: any[]) => unknown }
|
|
205
|
+
? N
|
|
206
|
+
: never]: M[K] extends { reducer: (...a: any[]) => infer S } ? S : never;
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
export function useSelector<T>(select: (s: RootState) => T): T;
|
|
210
|
+
export interface ThunkAction<T> { readonly result?: T }
|
|
211
|
+
export interface Dispatch {
|
|
212
|
+
<T>(action: ThunkAction<T>): Promise<PayloadAction<T>> & { unwrap(): Promise<T> };
|
|
213
|
+
(action: unknown): void;
|
|
214
|
+
}
|
|
215
|
+
export function useDispatch(): Dispatch;
|
|
216
|
+
export const appDispatch: ReturnType<typeof useDispatch>;
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### @adelin/device
|
|
221
|
+
```ts
|
|
222
|
+
// Remote keys, the back button and the device for an Adelin workspace.
|
|
223
|
+
declare module "@adelin/device" {
|
|
224
|
+
export interface ConnectivityState { readonly state:'online'|'offline'|'unknown' }
|
|
225
|
+
export interface AppModeState { readonly mode:'online'|'offline'; readonly offlineAvailable:boolean }
|
|
226
|
+
export interface AppModeResult { readonly outcome:'switched'|'unavailable'|'failed' }
|
|
227
|
+
// Observes the connection without adding UI or changing navigation.
|
|
228
|
+
export function useConnectivity():ConnectivityState;
|
|
229
|
+
export function useAppMode():AppModeState;
|
|
230
|
+
export const appMode:{switchTo(mode:'online'|'offline'):Promise<AppModeResult>};
|
|
231
|
+
// Platform limits; false where the platform cannot change playback speed or video fit.
|
|
232
|
+
export const capabilities: { readonly player: { readonly rate: boolean; readonly resizeMode: boolean } };
|
|
233
|
+
export const Platform: {
|
|
234
|
+
select<T>(cases: { android?: T; ios?: T; web?: T; webTV?: T; webBased?: T; tv?: T; native?: T; default?: T }): T;
|
|
235
|
+
};
|
|
236
|
+
export type KeyName =
|
|
237
|
+
| "left"
|
|
238
|
+
| "right"
|
|
239
|
+
| "up"
|
|
240
|
+
| "down"
|
|
241
|
+
| "select"
|
|
242
|
+
| "back"
|
|
243
|
+
| "menu"
|
|
244
|
+
| "playPause"
|
|
245
|
+
| "play"
|
|
246
|
+
| "pause"
|
|
247
|
+
| "stop"
|
|
248
|
+
| "record"
|
|
249
|
+
| "fastForward"
|
|
250
|
+
| "rewind"
|
|
251
|
+
| "volumeUp"
|
|
252
|
+
| "volumeDown"
|
|
253
|
+
| "mute"
|
|
254
|
+
| "channelUp"
|
|
255
|
+
| "channelDown"
|
|
256
|
+
| "channelList"
|
|
257
|
+
| "previousChannel"
|
|
258
|
+
| "previous"
|
|
259
|
+
| "next"
|
|
260
|
+
| "info"
|
|
261
|
+
| "captions"
|
|
262
|
+
| "bookmark"
|
|
263
|
+
| "colorRed"
|
|
264
|
+
| "colorGreen"
|
|
265
|
+
| "colorYellow"
|
|
266
|
+
| "colorBlue"
|
|
267
|
+
| "guide"
|
|
268
|
+
| "exit"
|
|
269
|
+
| "search"
|
|
270
|
+
| "backspace"
|
|
271
|
+
| "0"
|
|
272
|
+
| "1"
|
|
273
|
+
| "2"
|
|
274
|
+
| "3"
|
|
275
|
+
| "4"
|
|
276
|
+
| "5"
|
|
277
|
+
| "6"
|
|
278
|
+
| "7"
|
|
279
|
+
| "8"
|
|
280
|
+
| "9";
|
|
281
|
+
// down on key-down, longPress once after a short hold, up on key-up.
|
|
282
|
+
export type KeyAction = "down" | "up" | "longPress";
|
|
283
|
+
export interface TVKeyEvent {
|
|
284
|
+
readonly eventType: KeyName;
|
|
285
|
+
readonly eventKeyAction: KeyAction;
|
|
286
|
+
readonly velocity: number;
|
|
287
|
+
}
|
|
288
|
+
// Every remote key, for comparing with `event.eventType`.
|
|
289
|
+
export const Keys: {
|
|
290
|
+
readonly Left: "left";
|
|
291
|
+
readonly Right: "right";
|
|
292
|
+
readonly Up: "up";
|
|
293
|
+
readonly Down: "down";
|
|
294
|
+
readonly Select: "select";
|
|
295
|
+
readonly Back: "back";
|
|
296
|
+
readonly Menu: "menu";
|
|
297
|
+
readonly PlayPause: "playPause";
|
|
298
|
+
readonly Play: "play";
|
|
299
|
+
readonly Pause: "pause";
|
|
300
|
+
readonly Stop: "stop";
|
|
301
|
+
readonly Record: "record";
|
|
302
|
+
readonly FastForward: "fastForward";
|
|
303
|
+
readonly Rewind: "rewind";
|
|
304
|
+
readonly VolumeUp: "volumeUp";
|
|
305
|
+
readonly VolumeDown: "volumeDown";
|
|
306
|
+
readonly Mute: "mute";
|
|
307
|
+
readonly ChannelUp: "channelUp";
|
|
308
|
+
readonly ChannelDown: "channelDown";
|
|
309
|
+
readonly ChannelList: "channelList";
|
|
310
|
+
readonly PreviousChannel: "previousChannel";
|
|
311
|
+
readonly Previous: "previous";
|
|
312
|
+
readonly Next: "next";
|
|
313
|
+
readonly Info: "info";
|
|
314
|
+
readonly Captions: "captions";
|
|
315
|
+
readonly Bookmark: "bookmark";
|
|
316
|
+
readonly ColorRed: "colorRed";
|
|
317
|
+
readonly ColorGreen: "colorGreen";
|
|
318
|
+
readonly ColorYellow: "colorYellow";
|
|
319
|
+
readonly ColorBlue: "colorBlue";
|
|
320
|
+
readonly Guide: "guide";
|
|
321
|
+
readonly Exit: "exit";
|
|
322
|
+
readonly Search: "search";
|
|
323
|
+
readonly Backspace: "backspace";
|
|
324
|
+
readonly Digit0: "0";
|
|
325
|
+
readonly Digit1: "1";
|
|
326
|
+
readonly Digit2: "2";
|
|
327
|
+
readonly Digit3: "3";
|
|
328
|
+
readonly Digit4: "4";
|
|
329
|
+
readonly Digit5: "5";
|
|
330
|
+
readonly Digit6: "6";
|
|
331
|
+
readonly Digit7: "7";
|
|
332
|
+
readonly Digit8: "8";
|
|
333
|
+
readonly Digit9: "9";
|
|
334
|
+
};
|
|
335
|
+
// Runs on every remote key; returning `true` stops the default focus move or select for that press.
|
|
336
|
+
export function useTVEventHandler(handler: (event: TVKeyEvent) => boolean | void): void;
|
|
337
|
+
// Automatically foreground-scoped; newest registration runs first. True consumes Back; false continues.
|
|
338
|
+
export function useBackHandler(handler: () => boolean | void): void;
|
|
339
|
+
// Closes the app; call it in a handler.
|
|
340
|
+
export function exitApp(): void;
|
|
341
|
+
export const BackHandler: {
|
|
342
|
+
exitApp(): void;
|
|
343
|
+
};
|
|
344
|
+
// tvOS: while enabled, Menu at the root reaches your Back handling instead of going Home; call it in a handler or effect.
|
|
345
|
+
export const TVEventControl: {
|
|
346
|
+
enableTVMenuKey(): void;
|
|
347
|
+
disableTVMenuKey(): void;
|
|
348
|
+
};
|
|
349
|
+
// react-native-device-info's result shape for the hooks that load their value.
|
|
350
|
+
export interface DeviceInfoHookResult<T> {
|
|
351
|
+
readonly loading: boolean;
|
|
352
|
+
readonly result: T;
|
|
353
|
+
}
|
|
354
|
+
export interface DevicePowerState {
|
|
355
|
+
batteryLevel?: number;
|
|
356
|
+
batteryState?: string;
|
|
357
|
+
lowPowerMode?: boolean;
|
|
358
|
+
}
|
|
359
|
+
// The device: plain members return the value, promise members resolve it, and `use*` hooks run at the top of a component.
|
|
360
|
+
export const DeviceInfo: {
|
|
361
|
+
getApplicationName(): string;
|
|
362
|
+
getBrand(): string;
|
|
363
|
+
getManufacturerSync(): string;
|
|
364
|
+
getBuildNumber(): string;
|
|
365
|
+
getBundleId(): string;
|
|
366
|
+
getDeviceId(): string;
|
|
367
|
+
getDeviceType(): string;
|
|
368
|
+
getModel(): Promise<string>;
|
|
369
|
+
getPowerState(): Promise<DevicePowerState>;
|
|
370
|
+
getPowerStateSync(): DevicePowerState;
|
|
371
|
+
getReadableVersion(): Promise<string>;
|
|
372
|
+
getSystemName(): string;
|
|
373
|
+
getSystemVersion(): string;
|
|
374
|
+
getSerialNumberSync(): string;
|
|
375
|
+
getUniqueId(): Promise<string>;
|
|
376
|
+
getUniqueIdSync(): string;
|
|
377
|
+
getVersion(): string;
|
|
378
|
+
getMacAddressSync(): string;
|
|
379
|
+
getTypeSync(): string;
|
|
380
|
+
getIpAddress(): string;
|
|
381
|
+
hasNotch(): boolean;
|
|
382
|
+
hasDynamicIsland(): boolean;
|
|
383
|
+
hasSystemFeature(feature: string): Promise<boolean>;
|
|
384
|
+
hasSystemFeatureSync(feature: string): boolean;
|
|
385
|
+
isLandscape(): Promise<boolean>;
|
|
386
|
+
isLandscapeSync(): boolean;
|
|
387
|
+
isTablet(): boolean;
|
|
388
|
+
isLowRamDevice(): boolean;
|
|
389
|
+
isDisplayZoomed(): boolean;
|
|
390
|
+
supported32BitAbis(): Promise<string[]>;
|
|
391
|
+
supported32BitAbisSync(): string[];
|
|
392
|
+
supported64BitAbis(): Promise<string[]>;
|
|
393
|
+
supported64BitAbisSync(): string[];
|
|
394
|
+
supportedAbis(): Promise<string[]>;
|
|
395
|
+
supportedAbisSync(): string[];
|
|
396
|
+
useBatteryLevel(): number | null;
|
|
397
|
+
useBatteryLevelIsLow(): number | null;
|
|
398
|
+
useDeviceName(): DeviceInfoHookResult<string>;
|
|
399
|
+
useFirstInstallTime(): DeviceInfoHookResult<number>;
|
|
400
|
+
useHasSystemFeature(feature: string): DeviceInfoHookResult<boolean>;
|
|
401
|
+
useIsEmulator(): DeviceInfoHookResult<boolean>;
|
|
402
|
+
usePowerState(): DevicePowerState;
|
|
403
|
+
useIsHeadphonesConnected(): DeviceInfoHookResult<boolean>;
|
|
404
|
+
useIsWiredHeadphonesConnected(): DeviceInfoHookResult<boolean>;
|
|
405
|
+
useIsBluetoothHeadphonesConnected(): DeviceInfoHookResult<boolean>;
|
|
406
|
+
useBrightness(): number | null;
|
|
407
|
+
getFontScale(): number;
|
|
408
|
+
getFontScaleSync(): number;
|
|
409
|
+
getTotalMemorySync(): number;
|
|
410
|
+
getBaseOs(): string;
|
|
411
|
+
getTotalMemory(): Promise<number>;
|
|
412
|
+
getUsedMemory(): Promise<number>;
|
|
413
|
+
getTotalDiskCapacity(): Promise<number>;
|
|
414
|
+
getFreeDiskStorage(): Promise<number>;
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
### @adelin/downloads
|
|
420
|
+
```ts
|
|
421
|
+
declare module "@adelin/downloads" {
|
|
422
|
+
import type { VideoSource } from "@adelin/ui";
|
|
423
|
+
export type MediaOperationResult = { outcome: 'completed' } | MediaOperationFailure;
|
|
424
|
+
export type MediaOperationFailure = | { outcome: 'unsupported'; reason: 'platform' | 'capability' }
|
|
425
|
+
| { outcome: 'unavailable'; reason: MediaUnavailableReason }
|
|
426
|
+
| { outcome: 'pending' }
|
|
427
|
+
| { outcome: 'failed'; error: MediaOperationError };
|
|
428
|
+
export type MediaOperationError = Readonly<{
|
|
429
|
+
code: 'network' | 'storage-full' | 'permission' | 'license' | 'picker' | 'connection' | 'receiver' | 'backend';
|
|
430
|
+
message: string;
|
|
431
|
+
}>;
|
|
432
|
+
export type MediaUnavailableReason = 'not-configured' | 'no-source' | 'source-ineligible' | 'no-receiver' | 'not-authorized' | 'not-found' | 'not-completed' | 'license-expired' | 'online-required';
|
|
433
|
+
export type DownloadStartResult = { outcome: 'completed'; taskId: string } | MediaOperationFailure;
|
|
434
|
+
export interface DownloadStartOptions {
|
|
435
|
+
entryId: string;
|
|
436
|
+
quality?: { maxHeight?: number; maxBitrate?: number };
|
|
437
|
+
audioTracks?: 'all' | 'none' | readonly string[];
|
|
438
|
+
textTracks?: 'all' | 'none' | readonly string[];
|
|
439
|
+
}
|
|
440
|
+
export interface DownloadTask {
|
|
441
|
+
readonly id: string;
|
|
442
|
+
readonly entryId: string;
|
|
443
|
+
readonly status: 'idle' | 'downloading' | 'paused' | 'completed' | 'failed' | 'removing';
|
|
444
|
+
readonly progress: number;
|
|
445
|
+
readonly downloadedBytes: number;
|
|
446
|
+
readonly totalBytes: number | null;
|
|
447
|
+
readonly quality: { readonly maxHeight?: number; readonly maxBitrate?: number } | null;
|
|
448
|
+
readonly audioTracks: 'all' | 'none' | readonly string[];
|
|
449
|
+
readonly textTracks: 'all' | 'none' | readonly string[];
|
|
450
|
+
readonly licenseExpiresAt: number | null;
|
|
451
|
+
readonly error: MediaOperationError | null;
|
|
452
|
+
readonly playable: boolean;
|
|
453
|
+
readonly playbackSource?: VideoSource;
|
|
454
|
+
}
|
|
455
|
+
export interface DownloadsState {
|
|
456
|
+
readonly supported: boolean;
|
|
457
|
+
readonly loading: boolean;
|
|
458
|
+
readonly tasks: readonly DownloadTask[];
|
|
459
|
+
readonly storageBytes: number;
|
|
460
|
+
readonly pending: boolean;
|
|
461
|
+
readonly lastResult: MediaOperationResult | null;
|
|
462
|
+
}
|
|
463
|
+
export interface DownloadsApi {
|
|
464
|
+
start(options: DownloadStartOptions): Promise<DownloadStartResult>;
|
|
465
|
+
pause(id: string): Promise<MediaOperationResult>;
|
|
466
|
+
resume(id: string): Promise<MediaOperationResult>;
|
|
467
|
+
remove(id: string): Promise<MediaOperationResult>;
|
|
468
|
+
refresh(): Promise<MediaOperationResult>;
|
|
469
|
+
refreshLicense(id: string): Promise<MediaOperationResult>;
|
|
470
|
+
}
|
|
471
|
+
export function useDownloads(): DownloadsState;
|
|
472
|
+
export const downloads: DownloadsApi;
|
|
473
|
+
}
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
### @adelin/profiles
|
|
477
|
+
```ts
|
|
478
|
+
// Viewer profiles, each profile's saved titles and watch progress; call them inside createAsyncThunk.
|
|
479
|
+
declare module "@adelin/profiles" {
|
|
480
|
+
// One profile of the signed-in viewer.
|
|
481
|
+
export interface Profile {
|
|
482
|
+
readonly id: string;
|
|
483
|
+
readonly name: string;
|
|
484
|
+
readonly avatar: string | null;
|
|
485
|
+
readonly isDefault: boolean;
|
|
486
|
+
// The profile's language, or null to follow the device.
|
|
487
|
+
readonly language: string | null;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
// The signed-in viewer's profiles and the one chosen on this device.
|
|
491
|
+
export const profiles: {
|
|
492
|
+
list(): Promise<Profile[]>;
|
|
493
|
+
create(input: Readonly<{ name: string; avatar?: string; language?: string | null }>): Promise<Profile>;
|
|
494
|
+
update(id: string, input: Readonly<{ name?: string; avatar?: string; language?: string | null }>): Promise<Profile>;
|
|
495
|
+
remove(id: string): Promise<void>;
|
|
496
|
+
select(id: string): Promise<void>;
|
|
497
|
+
active(): Promise<string | null>;
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
// The content entry ids a profile saved.
|
|
501
|
+
export const favorites: {
|
|
502
|
+
list(profileId: string): Promise<string[]>;
|
|
503
|
+
add(profileId: string, entryId: string): Promise<void>;
|
|
504
|
+
remove(profileId: string, entryId: string): Promise<void>;
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
// A profile's place in one title, in seconds.
|
|
508
|
+
export interface Progress {
|
|
509
|
+
readonly entryId: string;
|
|
510
|
+
readonly position: number;
|
|
511
|
+
readonly duration: number;
|
|
512
|
+
readonly finished: boolean;
|
|
513
|
+
readonly watched: boolean;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// Where a profile stopped watching; the player saves it by itself.
|
|
517
|
+
export const progress: {
|
|
518
|
+
list(profileId: string): Promise<Progress[]>;
|
|
519
|
+
get(profileId: string, entryId: string): Promise<Progress | null>;
|
|
520
|
+
clear(profileId: string, entryId: string): Promise<void>;
|
|
521
|
+
// The ids watched within this title: the entry itself and its episodes.
|
|
522
|
+
watched(profileId: string, entryId: string): Promise<string[]>;
|
|
523
|
+
// Which of these entry ids are watched, in the order given: exact ids only (a title does not count its episodes), at most 100.
|
|
524
|
+
watchedAmong(profileId: string, entryIds: readonly string[]): Promise<string[]>;
|
|
525
|
+
markWatched(profileId: string, entryId: string): Promise<void>;
|
|
526
|
+
markUnwatched(profileId: string, entryId: string): Promise<void>;
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
### @adelin/i18n
|
|
532
|
+
```ts
|
|
533
|
+
// UI text in the viewer's language, shaped like react-i18next.
|
|
534
|
+
declare module "@adelin/i18n" {
|
|
535
|
+
// Values for `{{placeholders}}` (`count` is an ordinary value, it selects no key), plus `keyPrefix` and `defaultValue`.
|
|
536
|
+
export type TOptions = Readonly<Record<string, string | number | boolean | null | undefined>> & {
|
|
537
|
+
keyPrefix?: string;
|
|
538
|
+
defaultValue?: string;
|
|
539
|
+
};
|
|
540
|
+
// The text for exactly the key named, in the current language; for a list of keys, the first one that exists.
|
|
541
|
+
export interface TFunction {
|
|
542
|
+
(key: string | readonly string[], options?: TOptions): string;
|
|
543
|
+
(key: string | readonly string[], defaultValue: string, options?: TOptions): string;
|
|
544
|
+
}
|
|
545
|
+
// The app's language: read it, list the app's languages, switch it.
|
|
546
|
+
export interface I18n {
|
|
547
|
+
// The current language code, e.g. `"lt"`.
|
|
548
|
+
readonly language: string;
|
|
549
|
+
// The language the text is shown in after falling back.
|
|
550
|
+
readonly resolvedLanguage: string;
|
|
551
|
+
// The app's languages, in picker order.
|
|
552
|
+
readonly options: { readonly supportedLngs: readonly string[] };
|
|
553
|
+
// Switches the app's text and content to `lng`; resolves once the text has switched.
|
|
554
|
+
changeLanguage(lng: string, callback?: (error: unknown, t: TFunction) => void): Promise<TFunction>;
|
|
555
|
+
}
|
|
556
|
+
// `const { t, i18n } = useTranslation()` or `const [t, i18n, ready] = useTranslation()`.
|
|
557
|
+
export function useTranslation(
|
|
558
|
+
ns?: "translation",
|
|
559
|
+
options?: { keyPrefix?: string },
|
|
560
|
+
): { t: TFunction; i18n: I18n; ready: boolean } & readonly [TFunction, I18n, boolean];
|
|
561
|
+
// The language's own name for itself, e.g. `languageName("lt")` is `"Lietuvių"`.
|
|
562
|
+
export function languageName(code: string): string;
|
|
563
|
+
}
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
### @adelin/analytics
|
|
567
|
+
```ts
|
|
568
|
+
// Measurement is the platform's; an app only offers the visitor a way back to their privacy choice.
|
|
569
|
+
declare module "@adelin/analytics" {
|
|
570
|
+
// Reopens the visitor's measurement choice on the web and does nothing elsewhere; call it in a handler.
|
|
571
|
+
export function openPrivacyChoices(): void;
|
|
572
|
+
}
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
## Index
|
|
576
|
+
|
|
577
|
+
- GET /apps/{appId}/profile — List the viewer's profiles, oldest first
|
|
578
|
+
- POST /apps/{appId}/profile — Create a profile for the signed-in viewer; the first one becomes the default
|
|
579
|
+
- GET /apps/{appId}/profile/{profileId} — Get a profile by id
|
|
580
|
+
- PATCH /apps/{appId}/profile/{profileId} — Rename a profile, change its avatar or language, or make it the default
|
|
581
|
+
- DELETE /apps/{appId}/profile/{profileId} — Delete a profile other than the default
|
|
582
|
+
- GET /apps/{appId}/profile/{profileId}/favorite — List the profile's favorite library entries
|
|
583
|
+
- POST /apps/{appId}/profile/{profileId}/favorite — Favorite a published library entry
|
|
584
|
+
- DELETE /apps/{appId}/profile/{profileId}/favorite/{entryId} — Remove a favorite
|
|
585
|
+
- POST /apps/{appId}/profile/{profileId}/parental-control — Set, replace or disable a profile's parental-control PIN
|
|
586
|
+
- POST /apps/{appId}/profile/{profileId}/parental-pin/verify — Verify a profile's parental-control PIN
|
|
587
|
+
- GET /apps/{appId}/profile/{profileId}/progress — Continue Watching: up to 20 titles, newest first; a finished episode is replaced by the next one at 0
|
|
588
|
+
- GET /apps/{appId}/profile/{profileId}/progress/{entryId} — Where the profile stopped in one entry
|
|
589
|
+
- PUT /apps/{appId}/profile/{profileId}/progress/{entryId} — Save the player position (the player calls this on pause, exit, end and every 5 minutes); the server decides finished
|
|
590
|
+
- DELETE /apps/{appId}/profile/{profileId}/progress/{entryId} — Remove the entry's whole title from Continue Watching
|
|
591
|
+
- GET /apps/{appId}/profile/{profileId}/progress/{entryId}/watched — Entry ids the profile has watched within this title: the entry itself and its descendants (episodes), newest first
|
|
592
|
+
- PUT /apps/{appId}/profile/{profileId}/progress/{entryId}/watched — Mark a film or episode watched; Continue Watching moves a series on to the next episode
|
|
593
|
+
- DELETE /apps/{appId}/profile/{profileId}/progress/{entryId}/watched — Unmark an entry watched; its finished progress goes too, so Continue Watching does not skip past it
|
|
594
|
+
- GET /apps/{appId}/profile/{profileId}/watched — Which of up to 100 entries the profile has marked watched: exact ids, no descendants, in request order
|
|
595
|
+
|
|
596
|
+
## GET /apps/{appId}/profile
|
|
597
|
+
|
|
598
|
+
List the viewer's profiles, oldest first
|
|
599
|
+
|
|
600
|
+
**Auth:** Bearer (app-user) required
|
|
601
|
+
|
|
602
|
+
**Responses:**
|
|
603
|
+
|
|
604
|
+
- `200` — The profiles, each with language (a canonical tag, or null)
|
|
605
|
+
- `500` — Server error
|
|
606
|
+
|
|
607
|
+
## POST /apps/{appId}/profile
|
|
608
|
+
|
|
609
|
+
Create a profile for the signed-in viewer; the first one becomes the default
|
|
610
|
+
|
|
611
|
+
**Auth:** Bearer (app-user) required
|
|
612
|
+
|
|
613
|
+
**Responses:**
|
|
614
|
+
|
|
615
|
+
- `200` — Created
|
|
616
|
+
- `400` — PROFILE_NAME_INVALID, PROFILE_AVATAR_INVALID or PROFILE_LANGUAGE_INVALID
|
|
617
|
+
- `401` — No signed-in viewer
|
|
618
|
+
- `409` — PROFILE_LIMIT: the viewer already has 5 profiles
|
|
619
|
+
- `500` — Server error
|
|
620
|
+
|
|
621
|
+
## GET /apps/{appId}/profile/{profileId}
|
|
622
|
+
|
|
623
|
+
Get a profile by id
|
|
624
|
+
|
|
625
|
+
**Auth:** Bearer (app-user) required
|
|
626
|
+
|
|
627
|
+
**Parameters:**
|
|
628
|
+
|
|
629
|
+
- `profileId` (path) `string` required — The id of the profile to get
|
|
630
|
+
|
|
631
|
+
**Responses:**
|
|
632
|
+
|
|
633
|
+
- `200` — The profile; language is a canonical tag, or null to follow the device
|
|
634
|
+
- `404` — Profile not found
|
|
635
|
+
- `500` — Server error
|
|
636
|
+
|
|
637
|
+
## PATCH /apps/{appId}/profile/{profileId}
|
|
638
|
+
|
|
639
|
+
Rename a profile, change its avatar or language, or make it the default
|
|
640
|
+
|
|
641
|
+
**Auth:** Bearer (app-user) required
|
|
642
|
+
|
|
643
|
+
**Parameters:**
|
|
644
|
+
|
|
645
|
+
- `profileId` (path) `string` required
|
|
646
|
+
|
|
647
|
+
**Responses:**
|
|
648
|
+
|
|
649
|
+
- `200` — Updated
|
|
650
|
+
- `400` — PROFILE_NAME_INVALID, PROFILE_AVATAR_INVALID, PROFILE_LANGUAGE_INVALID, PROFILE_DEFAULT_INVALID (is_default other than true), or a parental lock change (use /parental-control)
|
|
651
|
+
- `404` — Profile not found
|
|
652
|
+
- `500` — Server error
|
|
653
|
+
|
|
654
|
+
## DELETE /apps/{appId}/profile/{profileId}
|
|
655
|
+
|
|
656
|
+
Delete a profile other than the default
|
|
657
|
+
|
|
658
|
+
**Auth:** Bearer (app-user) required
|
|
659
|
+
|
|
660
|
+
**Parameters:**
|
|
661
|
+
|
|
662
|
+
- `profileId` (path) `string` required
|
|
663
|
+
|
|
664
|
+
**Responses:**
|
|
665
|
+
|
|
666
|
+
- `204` — Deleted
|
|
667
|
+
- `404` — Profile not found
|
|
668
|
+
- `409` — PROFILE_DEFAULT: the default profile cannot be deleted
|
|
669
|
+
- `500` — Server error
|
|
670
|
+
|
|
671
|
+
## GET /apps/{appId}/profile/{profileId}/favorite
|
|
672
|
+
|
|
673
|
+
List the profile's favorite library entries
|
|
674
|
+
|
|
675
|
+
**Auth:** Bearer (app-user) required
|
|
676
|
+
|
|
677
|
+
**Parameters:**
|
|
678
|
+
|
|
679
|
+
- `lang` (query) `string` optional — Comma-separated language preference list; each tag in turn is matched exactly, by its regional parent (es-MX to es-419), by script (zh-TW to zh-Hant), by base language, then by another variant of that language; the first match is served, else the primary (locales[0])
|
|
680
|
+
|
|
681
|
+
**Responses:**
|
|
682
|
+
|
|
683
|
+
- `200` — Array of {entryId, title, createdAt} for entries the viewer can see; title is plain text in the served language, falling back through every app language in order; Content-Language names the served language
|
|
684
|
+
- `400` — INVALID_LANG for a repeated or over-long lang
|
|
685
|
+
- `404` — Profile not found
|
|
686
|
+
|
|
687
|
+
## POST /apps/{appId}/profile/{profileId}/favorite
|
|
688
|
+
|
|
689
|
+
Favorite a published library entry
|
|
690
|
+
|
|
691
|
+
**Auth:** Bearer (app-user) required
|
|
692
|
+
|
|
693
|
+
**Responses:**
|
|
694
|
+
|
|
695
|
+
- `200` — Already a favorite
|
|
696
|
+
- `201` — Created {entryId, createdAt}
|
|
697
|
+
- `400` — entryId is not a UUID
|
|
698
|
+
- `404` — Entry or profile not found
|
|
699
|
+
|
|
700
|
+
## DELETE /apps/{appId}/profile/{profileId}/favorite/{entryId}
|
|
701
|
+
|
|
702
|
+
Remove a favorite
|
|
703
|
+
|
|
704
|
+
**Auth:** Bearer (app-user) required
|
|
705
|
+
|
|
706
|
+
**Responses:**
|
|
707
|
+
|
|
708
|
+
- `204` — Removed
|
|
709
|
+
- `404` — Not a favorite
|
|
710
|
+
|
|
711
|
+
## POST /apps/{appId}/profile/{profileId}/parental-control
|
|
712
|
+
|
|
713
|
+
Set, replace or disable a profile's parental-control PIN
|
|
714
|
+
|
|
715
|
+
**Auth:** Bearer (app-user) required
|
|
716
|
+
|
|
717
|
+
**Parameters:**
|
|
718
|
+
|
|
719
|
+
- `profileId` (path) `string` required
|
|
720
|
+
|
|
721
|
+
**Responses:**
|
|
722
|
+
|
|
723
|
+
- `200` — { ok: boolean }
|
|
724
|
+
- `500` — Server error
|
|
725
|
+
|
|
726
|
+
## POST /apps/{appId}/profile/{profileId}/parental-pin/verify
|
|
727
|
+
|
|
728
|
+
Verify a profile's parental-control PIN
|
|
729
|
+
|
|
730
|
+
**Auth:** Bearer (app-user) required
|
|
731
|
+
|
|
732
|
+
**Parameters:**
|
|
733
|
+
|
|
734
|
+
- `profileId` (path) `string` required
|
|
735
|
+
|
|
736
|
+
**Responses:**
|
|
737
|
+
|
|
738
|
+
- `200` — { ok: boolean } — true for a correct PIN, false otherwise
|
|
739
|
+
- `429` — Too many attempts
|
|
740
|
+
|
|
741
|
+
## GET /apps/{appId}/profile/{profileId}/progress
|
|
742
|
+
|
|
743
|
+
Continue Watching: up to 20 titles, newest first; a finished episode is replaced by the next one at 0
|
|
744
|
+
|
|
745
|
+
**Auth:** Bearer (app-user) required
|
|
746
|
+
|
|
747
|
+
**Responses:**
|
|
748
|
+
|
|
749
|
+
- `200` — Array of {entryId, position, duration, finished, watched, updatedAt}; seconds
|
|
750
|
+
- `404` — Profile not found
|
|
751
|
+
|
|
752
|
+
## GET /apps/{appId}/profile/{profileId}/progress/{entryId}
|
|
753
|
+
|
|
754
|
+
Where the profile stopped in one entry
|
|
755
|
+
|
|
756
|
+
**Auth:** Bearer (app-user) required
|
|
757
|
+
|
|
758
|
+
**Responses:**
|
|
759
|
+
|
|
760
|
+
- `200` — {entryId, position, duration, finished, watched, updatedAt}; seconds
|
|
761
|
+
- `400` — entryId is not a UUID
|
|
762
|
+
- `404` — No progress saved
|
|
763
|
+
|
|
764
|
+
## PUT /apps/{appId}/profile/{profileId}/progress/{entryId}
|
|
765
|
+
|
|
766
|
+
Save the player position (the player calls this on pause, exit, end and every 5 minutes); the server decides finished
|
|
767
|
+
|
|
768
|
+
**Auth:** Bearer (app-user) required
|
|
769
|
+
|
|
770
|
+
**Responses:**
|
|
771
|
+
|
|
772
|
+
- `204` — Saved; or skipped, when under 10 s into an entry with no saved progress
|
|
773
|
+
- `400` — Invalid entryId, position or duration
|
|
774
|
+
- `404` — Entry or profile not found
|
|
775
|
+
- `429` — Too many saves for this profile
|
|
776
|
+
|
|
777
|
+
## DELETE /apps/{appId}/profile/{profileId}/progress/{entryId}
|
|
778
|
+
|
|
779
|
+
Remove the entry's whole title from Continue Watching
|
|
780
|
+
|
|
781
|
+
**Auth:** Bearer (app-user) required
|
|
782
|
+
|
|
783
|
+
**Responses:**
|
|
784
|
+
|
|
785
|
+
- `204` — Removed
|
|
786
|
+
- `400` — entryId is not a UUID
|
|
787
|
+
- `404` — Nothing to remove
|
|
788
|
+
|
|
789
|
+
## GET /apps/{appId}/profile/{profileId}/progress/{entryId}/watched
|
|
790
|
+
|
|
791
|
+
Entry ids the profile has watched within this title: the entry itself and its descendants (episodes), newest first
|
|
792
|
+
|
|
793
|
+
**Auth:** Bearer (app-user) required
|
|
794
|
+
|
|
795
|
+
**Responses:**
|
|
796
|
+
|
|
797
|
+
- `200` — Array of entry ids
|
|
798
|
+
- `400` — entryId is not a UUID
|
|
799
|
+
- `404` — Profile not found
|
|
800
|
+
|
|
801
|
+
## PUT /apps/{appId}/profile/{profileId}/progress/{entryId}/watched
|
|
802
|
+
|
|
803
|
+
Mark a film or episode watched; Continue Watching moves a series on to the next episode
|
|
804
|
+
|
|
805
|
+
**Auth:** Bearer (app-user) required
|
|
806
|
+
|
|
807
|
+
**Responses:**
|
|
808
|
+
|
|
809
|
+
- `204` — Marked
|
|
810
|
+
- `400` — entryId is not a UUID, or the entry is a folder or live channel
|
|
811
|
+
- `404` — Entry or profile not found
|
|
812
|
+
- `429` — Too many saves for this profile
|
|
813
|
+
|
|
814
|
+
## DELETE /apps/{appId}/profile/{profileId}/progress/{entryId}/watched
|
|
815
|
+
|
|
816
|
+
Unmark an entry watched; its finished progress goes too, so Continue Watching does not skip past it
|
|
817
|
+
|
|
818
|
+
**Auth:** Bearer (app-user) required
|
|
819
|
+
|
|
820
|
+
**Responses:**
|
|
821
|
+
|
|
822
|
+
- `204` — Unmarked
|
|
823
|
+
- `400` — entryId is not a UUID
|
|
824
|
+
- `404` — The entry was not watched
|
|
825
|
+
- `429` — Too many saves for this profile
|
|
826
|
+
|
|
827
|
+
## GET /apps/{appId}/profile/{profileId}/watched
|
|
828
|
+
|
|
829
|
+
Which of up to 100 entries the profile has marked watched: exact ids, no descendants, in request order
|
|
830
|
+
|
|
831
|
+
**Auth:** Bearer (app-user) required
|
|
832
|
+
|
|
833
|
+
**Parameters:**
|
|
834
|
+
|
|
835
|
+
- `entryIds` (query) `string` required — 1 to 100 comma-separated entry UUIDs
|
|
836
|
+
|
|
837
|
+
**Responses:**
|
|
838
|
+
|
|
839
|
+
- `200` — Array of the watched entry ids among those asked; hidden entries never count
|
|
840
|
+
- `400` — entryIds is missing, holds more than 100 ids or a non-UUID
|
|
841
|
+
- `404` — Profile not found
|
|
842
|
+
|