salt-agent-sdk 0.33.0 → 0.34.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/dist/client.d.ts +464 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +179 -1
- package/dist/client.js.map +1 -1
- package/dist/device/host.d.ts +5 -4
- package/dist/device/host.d.ts.map +1 -1
- package/dist/device/host.js +7 -20
- package/dist/device/host.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/media.d.ts +125 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +5 -0
- package/dist/media.js.map +1 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { type IdentityClaims, type IdentitySections, type SignedCard } from "./i
|
|
|
3
3
|
import { type HeldRecoveryShare, type RecoveryGuardianInvitation, type RecoveryRequestForGuardian } from "./recovery.js";
|
|
4
4
|
import { type LinkedDeviceRow } from "./keyReset.js";
|
|
5
5
|
import { type HelpReason, type HelpRequest } from "./help.js";
|
|
6
|
+
import type { LiveSession, MediaAsset, MediaPlaybackCookies, PublishBlock, StreamCredential, UploadPlan, UploadVideoOptions, VideoEvent, VideoFeedPage, VideoFeedScope, VideoPost, VideoUploadSource } from "./media.js";
|
|
6
7
|
/** What `client.askForHelp` / `ctx.askForHelp` take. The question rides end-to-end encrypted in the 1:1; Salt learns only the reason. */
|
|
7
8
|
export interface AskForHelpParams {
|
|
8
9
|
/** The 1:1 with the person. Exactly two non-observer members, else the call is refused before anything is sent. */
|
|
@@ -1440,7 +1441,7 @@ type RequestFn = <T>(method: string, path: string, apiKey: string, body?: unknow
|
|
|
1440
1441
|
idempotencyKey?: string;
|
|
1441
1442
|
}) => Promise<T>;
|
|
1442
1443
|
/** Sent as `X-Salt-Client` on every request. Kept equal to package.json's version (a test checks). */
|
|
1443
|
-
export declare const SDK_VERSION = "0.
|
|
1444
|
+
export declare const SDK_VERSION = "0.34.0";
|
|
1444
1445
|
export declare function createSaltClient(options: SaltClientOptions): {
|
|
1445
1446
|
actFor: (principalId: SaltId, opts?: ActForOptions) => { [K in keyof ReturnType<(request: RequestFn) => {
|
|
1446
1447
|
/** A chat's members (with public keys), for encrypting a reply to everyone who should read it. */
|
|
@@ -2523,6 +2524,160 @@ export declare function createSaltClient(options: SaltClientOptions): {
|
|
|
2523
2524
|
*/
|
|
2524
2525
|
setState(apiKey: string, installationId: SaltId, doc: Record<string, unknown>, ifVersion: number): Promise<AppStateDoc>;
|
|
2525
2526
|
};
|
|
2527
|
+
/** Going live. A person films with a camera; an agent has none, so it makes a stream credential (or a session with
|
|
2528
|
+
* `sourceType: "rtmp"`) and pushes RTMPS from ffmpeg. The `publish` block is returned ONCE: keep `stream_key` secret. */
|
|
2529
|
+
live: {
|
|
2530
|
+
/** `POST /api/v1/live_sessions`. Creators only, in an open room you belong to. 409 when you are already live or the room is full of streams. */
|
|
2531
|
+
start(apiKey: string, params: {
|
|
2532
|
+
chatId: SaltId;
|
|
2533
|
+
title?: string;
|
|
2534
|
+
sourceType: "webrtc" | "rtmp";
|
|
2535
|
+
record?: boolean;
|
|
2536
|
+
}, opts?: {
|
|
2537
|
+
idempotencyKey?: string;
|
|
2538
|
+
}): Promise<{
|
|
2539
|
+
live_session: LiveSession;
|
|
2540
|
+
publish: PublishBlock;
|
|
2541
|
+
}>;
|
|
2542
|
+
/** `GET /api/v1/live_sessions/:id`. */
|
|
2543
|
+
get(apiKey: string, id: string): Promise<{
|
|
2544
|
+
live_session: LiveSession;
|
|
2545
|
+
}>;
|
|
2546
|
+
/** `GET /api/v1/chats/:chat_id/live`: the room's session while it is connecting or live, else null. */
|
|
2547
|
+
forChat(apiKey: string, chatId: SaltId): Promise<{
|
|
2548
|
+
live_session: LiveSession | null;
|
|
2549
|
+
}>;
|
|
2550
|
+
/** `POST /api/v1/live_sessions/:id/end`. The host or a room admin. */
|
|
2551
|
+
end(apiKey: string, id: string): Promise<{
|
|
2552
|
+
live_session: LiveSession;
|
|
2553
|
+
}>;
|
|
2554
|
+
/** `POST /api/v1/live_sessions/:id/playback`: a tokened player URL, valid five minutes. 409 when the stream is full. */
|
|
2555
|
+
playback(apiKey: string, id: string): Promise<{
|
|
2556
|
+
playback_url: string;
|
|
2557
|
+
expires_at: string;
|
|
2558
|
+
viewer_count: number;
|
|
2559
|
+
}>;
|
|
2560
|
+
/** `POST /api/v1/live_sessions/:id/reports`. */
|
|
2561
|
+
report(apiKey: string, id: string, params: {
|
|
2562
|
+
reason: string;
|
|
2563
|
+
note?: string;
|
|
2564
|
+
}): Promise<unknown>;
|
|
2565
|
+
};
|
|
2566
|
+
/** Reusable stream keys for streaming software (and for agents pushing from ffmpeg). */
|
|
2567
|
+
streamCredentials: {
|
|
2568
|
+
/** `GET /api/v1/stream_credentials`. Keys are never listed, only `key_last4`. */
|
|
2569
|
+
list(apiKey: string): Promise<{
|
|
2570
|
+
stream_credentials: StreamCredential[];
|
|
2571
|
+
}>;
|
|
2572
|
+
/** `POST /api/v1/stream_credentials`. Returns the `publish` block once. */
|
|
2573
|
+
create(apiKey: string, params: {
|
|
2574
|
+
chatId: SaltId;
|
|
2575
|
+
label?: string;
|
|
2576
|
+
persistent?: boolean;
|
|
2577
|
+
}, opts?: {
|
|
2578
|
+
idempotencyKey?: string;
|
|
2579
|
+
}): Promise<{
|
|
2580
|
+
stream_credential: StreamCredential;
|
|
2581
|
+
publish: PublishBlock;
|
|
2582
|
+
}>;
|
|
2583
|
+
/** `PATCH /api/v1/stream_credentials/:id`. */
|
|
2584
|
+
update(apiKey: string, id: SaltId, params: {
|
|
2585
|
+
enabled?: boolean;
|
|
2586
|
+
persistent?: boolean;
|
|
2587
|
+
}): Promise<{
|
|
2588
|
+
stream_credential: StreamCredential;
|
|
2589
|
+
}>;
|
|
2590
|
+
/** `POST /api/v1/stream_credentials/:id/rotate`: the old key stops working; the new `publish` block is returned once. */
|
|
2591
|
+
rotate(apiKey: string, id: SaltId): Promise<{
|
|
2592
|
+
stream_credential: StreamCredential;
|
|
2593
|
+
publish: PublishBlock;
|
|
2594
|
+
}>;
|
|
2595
|
+
/** `DELETE /api/v1/stream_credentials/:id`. */
|
|
2596
|
+
remove(apiKey: string, id: SaltId): Promise<void>;
|
|
2597
|
+
};
|
|
2598
|
+
/** Uploaded video files (up to 100 MB; mp4, quicktime or webm). Creators only. */
|
|
2599
|
+
media: {
|
|
2600
|
+
/** `POST /api/v1/media`: starts an upload and returns presigned part URLs. Most callers want `uploadVideo`. */
|
|
2601
|
+
create(apiKey: string, params: {
|
|
2602
|
+
byteSize: number;
|
|
2603
|
+
contentType: string;
|
|
2604
|
+
filename?: string;
|
|
2605
|
+
}): Promise<{
|
|
2606
|
+
media: MediaAsset;
|
|
2607
|
+
upload: UploadPlan;
|
|
2608
|
+
}>;
|
|
2609
|
+
/** `POST /api/v1/media/:id/complete`: closes the multipart upload; the asset moves to `processing`. */
|
|
2610
|
+
complete(apiKey: string, id: string, params: {
|
|
2611
|
+
uploadId: string;
|
|
2612
|
+
parts: {
|
|
2613
|
+
n: number;
|
|
2614
|
+
etag: string;
|
|
2615
|
+
}[];
|
|
2616
|
+
}): Promise<{
|
|
2617
|
+
media: MediaAsset;
|
|
2618
|
+
}>;
|
|
2619
|
+
/** `GET /api/v1/media/:id`: state, playback URLs and the transcript once ready. */
|
|
2620
|
+
get(apiKey: string, id: string): Promise<{
|
|
2621
|
+
media: MediaAsset;
|
|
2622
|
+
}>;
|
|
2623
|
+
/** `POST /api/v1/media/:id/playback`: CDN cookies (name to value) for a non-browser client; send them as a `Cookie` header. */
|
|
2624
|
+
playback(apiKey: string, id: string): Promise<MediaPlaybackCookies>;
|
|
2625
|
+
/** `POST /api/v1/media/playback`: the same cookies without an asset id, to cover a whole feed page. */
|
|
2626
|
+
feedPlayback(apiKey: string): Promise<MediaPlaybackCookies>;
|
|
2627
|
+
/**
|
|
2628
|
+
* Uploads a video end to end: creates the asset, PUTs each part to its presigned URL (retrying a failed part),
|
|
2629
|
+
* completes, and resolves with the MediaAsset in state `processing`. Poll `media.get` until `ready`, then
|
|
2630
|
+
* `video.publish`. `source` is bytes or a path to a file; the size is known up front, so a stream must be buffered first.
|
|
2631
|
+
*/
|
|
2632
|
+
uploadVideo(apiKey: string, source: VideoUploadSource, opts: UploadVideoOptions): Promise<MediaAsset>;
|
|
2633
|
+
};
|
|
2634
|
+
/** Short video posts and the feed. */
|
|
2635
|
+
video: {
|
|
2636
|
+
/** `POST /api/v1/video_posts`: post an asset to your profile, or to an open room with `chatId`. Posts at once when the asset is ready, else when it becomes ready. */
|
|
2637
|
+
publish(apiKey: string, params: {
|
|
2638
|
+
mediaId: string;
|
|
2639
|
+
caption?: string;
|
|
2640
|
+
chatId?: SaltId;
|
|
2641
|
+
}, opts?: {
|
|
2642
|
+
idempotencyKey?: string;
|
|
2643
|
+
}): Promise<{
|
|
2644
|
+
video_post: VideoPost;
|
|
2645
|
+
}>;
|
|
2646
|
+
/** `GET /api/v1/video_posts/:id`. */
|
|
2647
|
+
get(apiKey: string, id: string): Promise<{
|
|
2648
|
+
video_post: VideoPost;
|
|
2649
|
+
}>;
|
|
2650
|
+
/** `GET /api/v1/video_posts/mine`: your drafts or published posts. */
|
|
2651
|
+
mine(apiKey: string, opts?: {
|
|
2652
|
+
status?: "draft" | "published";
|
|
2653
|
+
}): Promise<{
|
|
2654
|
+
video_posts: VideoPost[];
|
|
2655
|
+
}>;
|
|
2656
|
+
/** `PATCH /api/v1/video_posts/:id`: edit the caption, hide it, or publish a draft (`status: "published"`). */
|
|
2657
|
+
update(apiKey: string, id: string, params: {
|
|
2658
|
+
caption?: string;
|
|
2659
|
+
status?: "published" | "hidden";
|
|
2660
|
+
alsoInChatId?: SaltId;
|
|
2661
|
+
}): Promise<{
|
|
2662
|
+
video_post: VideoPost;
|
|
2663
|
+
}>;
|
|
2664
|
+
/** `DELETE /api/v1/video_posts/:id`. On a draft this discards it and deletes the bytes. */
|
|
2665
|
+
remove(apiKey: string, id: string): Promise<void>;
|
|
2666
|
+
/** `POST /api/v1/video_posts/:id/reports`. */
|
|
2667
|
+
report(apiKey: string, id: string, params: {
|
|
2668
|
+
reason: string;
|
|
2669
|
+
note?: string;
|
|
2670
|
+
}): Promise<unknown>;
|
|
2671
|
+
/** `GET /api/v1/video/feed`: posts plus rooms live now. Page back with `beforeSeq` set to the last page's `next_before_seq`. */
|
|
2672
|
+
feed(apiKey: string, opts?: {
|
|
2673
|
+
scope?: VideoFeedScope;
|
|
2674
|
+
chatId?: SaltId;
|
|
2675
|
+
beforeSeq?: number;
|
|
2676
|
+
limit?: number;
|
|
2677
|
+
}): Promise<VideoFeedPage>;
|
|
2678
|
+
/** `POST /api/v1/video/events`: view and watch-time beacons. Answers 202. */
|
|
2679
|
+
sendEvents(apiKey: string, events: VideoEvent[]): Promise<void>;
|
|
2680
|
+
};
|
|
2526
2681
|
}>]: Acted<ReturnType<(request: RequestFn) => {
|
|
2527
2682
|
/** A chat's members (with public keys), for encrypting a reply to everyone who should read it. */
|
|
2528
2683
|
getChatMembers(apiKey: string, chatId: SaltId): Promise<SaltUser[]>;
|
|
@@ -3604,6 +3759,160 @@ export declare function createSaltClient(options: SaltClientOptions): {
|
|
|
3604
3759
|
*/
|
|
3605
3760
|
setState(apiKey: string, installationId: SaltId, doc: Record<string, unknown>, ifVersion: number): Promise<AppStateDoc>;
|
|
3606
3761
|
};
|
|
3762
|
+
/** Going live. A person films with a camera; an agent has none, so it makes a stream credential (or a session with
|
|
3763
|
+
* `sourceType: "rtmp"`) and pushes RTMPS from ffmpeg. The `publish` block is returned ONCE: keep `stream_key` secret. */
|
|
3764
|
+
live: {
|
|
3765
|
+
/** `POST /api/v1/live_sessions`. Creators only, in an open room you belong to. 409 when you are already live or the room is full of streams. */
|
|
3766
|
+
start(apiKey: string, params: {
|
|
3767
|
+
chatId: SaltId;
|
|
3768
|
+
title?: string;
|
|
3769
|
+
sourceType: "webrtc" | "rtmp";
|
|
3770
|
+
record?: boolean;
|
|
3771
|
+
}, opts?: {
|
|
3772
|
+
idempotencyKey?: string;
|
|
3773
|
+
}): Promise<{
|
|
3774
|
+
live_session: LiveSession;
|
|
3775
|
+
publish: PublishBlock;
|
|
3776
|
+
}>;
|
|
3777
|
+
/** `GET /api/v1/live_sessions/:id`. */
|
|
3778
|
+
get(apiKey: string, id: string): Promise<{
|
|
3779
|
+
live_session: LiveSession;
|
|
3780
|
+
}>;
|
|
3781
|
+
/** `GET /api/v1/chats/:chat_id/live`: the room's session while it is connecting or live, else null. */
|
|
3782
|
+
forChat(apiKey: string, chatId: SaltId): Promise<{
|
|
3783
|
+
live_session: LiveSession | null;
|
|
3784
|
+
}>;
|
|
3785
|
+
/** `POST /api/v1/live_sessions/:id/end`. The host or a room admin. */
|
|
3786
|
+
end(apiKey: string, id: string): Promise<{
|
|
3787
|
+
live_session: LiveSession;
|
|
3788
|
+
}>;
|
|
3789
|
+
/** `POST /api/v1/live_sessions/:id/playback`: a tokened player URL, valid five minutes. 409 when the stream is full. */
|
|
3790
|
+
playback(apiKey: string, id: string): Promise<{
|
|
3791
|
+
playback_url: string;
|
|
3792
|
+
expires_at: string;
|
|
3793
|
+
viewer_count: number;
|
|
3794
|
+
}>;
|
|
3795
|
+
/** `POST /api/v1/live_sessions/:id/reports`. */
|
|
3796
|
+
report(apiKey: string, id: string, params: {
|
|
3797
|
+
reason: string;
|
|
3798
|
+
note?: string;
|
|
3799
|
+
}): Promise<unknown>;
|
|
3800
|
+
};
|
|
3801
|
+
/** Reusable stream keys for streaming software (and for agents pushing from ffmpeg). */
|
|
3802
|
+
streamCredentials: {
|
|
3803
|
+
/** `GET /api/v1/stream_credentials`. Keys are never listed, only `key_last4`. */
|
|
3804
|
+
list(apiKey: string): Promise<{
|
|
3805
|
+
stream_credentials: StreamCredential[];
|
|
3806
|
+
}>;
|
|
3807
|
+
/** `POST /api/v1/stream_credentials`. Returns the `publish` block once. */
|
|
3808
|
+
create(apiKey: string, params: {
|
|
3809
|
+
chatId: SaltId;
|
|
3810
|
+
label?: string;
|
|
3811
|
+
persistent?: boolean;
|
|
3812
|
+
}, opts?: {
|
|
3813
|
+
idempotencyKey?: string;
|
|
3814
|
+
}): Promise<{
|
|
3815
|
+
stream_credential: StreamCredential;
|
|
3816
|
+
publish: PublishBlock;
|
|
3817
|
+
}>;
|
|
3818
|
+
/** `PATCH /api/v1/stream_credentials/:id`. */
|
|
3819
|
+
update(apiKey: string, id: SaltId, params: {
|
|
3820
|
+
enabled?: boolean;
|
|
3821
|
+
persistent?: boolean;
|
|
3822
|
+
}): Promise<{
|
|
3823
|
+
stream_credential: StreamCredential;
|
|
3824
|
+
}>;
|
|
3825
|
+
/** `POST /api/v1/stream_credentials/:id/rotate`: the old key stops working; the new `publish` block is returned once. */
|
|
3826
|
+
rotate(apiKey: string, id: SaltId): Promise<{
|
|
3827
|
+
stream_credential: StreamCredential;
|
|
3828
|
+
publish: PublishBlock;
|
|
3829
|
+
}>;
|
|
3830
|
+
/** `DELETE /api/v1/stream_credentials/:id`. */
|
|
3831
|
+
remove(apiKey: string, id: SaltId): Promise<void>;
|
|
3832
|
+
};
|
|
3833
|
+
/** Uploaded video files (up to 100 MB; mp4, quicktime or webm). Creators only. */
|
|
3834
|
+
media: {
|
|
3835
|
+
/** `POST /api/v1/media`: starts an upload and returns presigned part URLs. Most callers want `uploadVideo`. */
|
|
3836
|
+
create(apiKey: string, params: {
|
|
3837
|
+
byteSize: number;
|
|
3838
|
+
contentType: string;
|
|
3839
|
+
filename?: string;
|
|
3840
|
+
}): Promise<{
|
|
3841
|
+
media: MediaAsset;
|
|
3842
|
+
upload: UploadPlan;
|
|
3843
|
+
}>;
|
|
3844
|
+
/** `POST /api/v1/media/:id/complete`: closes the multipart upload; the asset moves to `processing`. */
|
|
3845
|
+
complete(apiKey: string, id: string, params: {
|
|
3846
|
+
uploadId: string;
|
|
3847
|
+
parts: {
|
|
3848
|
+
n: number;
|
|
3849
|
+
etag: string;
|
|
3850
|
+
}[];
|
|
3851
|
+
}): Promise<{
|
|
3852
|
+
media: MediaAsset;
|
|
3853
|
+
}>;
|
|
3854
|
+
/** `GET /api/v1/media/:id`: state, playback URLs and the transcript once ready. */
|
|
3855
|
+
get(apiKey: string, id: string): Promise<{
|
|
3856
|
+
media: MediaAsset;
|
|
3857
|
+
}>;
|
|
3858
|
+
/** `POST /api/v1/media/:id/playback`: CDN cookies (name to value) for a non-browser client; send them as a `Cookie` header. */
|
|
3859
|
+
playback(apiKey: string, id: string): Promise<MediaPlaybackCookies>;
|
|
3860
|
+
/** `POST /api/v1/media/playback`: the same cookies without an asset id, to cover a whole feed page. */
|
|
3861
|
+
feedPlayback(apiKey: string): Promise<MediaPlaybackCookies>;
|
|
3862
|
+
/**
|
|
3863
|
+
* Uploads a video end to end: creates the asset, PUTs each part to its presigned URL (retrying a failed part),
|
|
3864
|
+
* completes, and resolves with the MediaAsset in state `processing`. Poll `media.get` until `ready`, then
|
|
3865
|
+
* `video.publish`. `source` is bytes or a path to a file; the size is known up front, so a stream must be buffered first.
|
|
3866
|
+
*/
|
|
3867
|
+
uploadVideo(apiKey: string, source: VideoUploadSource, opts: UploadVideoOptions): Promise<MediaAsset>;
|
|
3868
|
+
};
|
|
3869
|
+
/** Short video posts and the feed. */
|
|
3870
|
+
video: {
|
|
3871
|
+
/** `POST /api/v1/video_posts`: post an asset to your profile, or to an open room with `chatId`. Posts at once when the asset is ready, else when it becomes ready. */
|
|
3872
|
+
publish(apiKey: string, params: {
|
|
3873
|
+
mediaId: string;
|
|
3874
|
+
caption?: string;
|
|
3875
|
+
chatId?: SaltId;
|
|
3876
|
+
}, opts?: {
|
|
3877
|
+
idempotencyKey?: string;
|
|
3878
|
+
}): Promise<{
|
|
3879
|
+
video_post: VideoPost;
|
|
3880
|
+
}>;
|
|
3881
|
+
/** `GET /api/v1/video_posts/:id`. */
|
|
3882
|
+
get(apiKey: string, id: string): Promise<{
|
|
3883
|
+
video_post: VideoPost;
|
|
3884
|
+
}>;
|
|
3885
|
+
/** `GET /api/v1/video_posts/mine`: your drafts or published posts. */
|
|
3886
|
+
mine(apiKey: string, opts?: {
|
|
3887
|
+
status?: "draft" | "published";
|
|
3888
|
+
}): Promise<{
|
|
3889
|
+
video_posts: VideoPost[];
|
|
3890
|
+
}>;
|
|
3891
|
+
/** `PATCH /api/v1/video_posts/:id`: edit the caption, hide it, or publish a draft (`status: "published"`). */
|
|
3892
|
+
update(apiKey: string, id: string, params: {
|
|
3893
|
+
caption?: string;
|
|
3894
|
+
status?: "published" | "hidden";
|
|
3895
|
+
alsoInChatId?: SaltId;
|
|
3896
|
+
}): Promise<{
|
|
3897
|
+
video_post: VideoPost;
|
|
3898
|
+
}>;
|
|
3899
|
+
/** `DELETE /api/v1/video_posts/:id`. On a draft this discards it and deletes the bytes. */
|
|
3900
|
+
remove(apiKey: string, id: string): Promise<void>;
|
|
3901
|
+
/** `POST /api/v1/video_posts/:id/reports`. */
|
|
3902
|
+
report(apiKey: string, id: string, params: {
|
|
3903
|
+
reason: string;
|
|
3904
|
+
note?: string;
|
|
3905
|
+
}): Promise<unknown>;
|
|
3906
|
+
/** `GET /api/v1/video/feed`: posts plus rooms live now. Page back with `beforeSeq` set to the last page's `next_before_seq`. */
|
|
3907
|
+
feed(apiKey: string, opts?: {
|
|
3908
|
+
scope?: VideoFeedScope;
|
|
3909
|
+
chatId?: SaltId;
|
|
3910
|
+
beforeSeq?: number;
|
|
3911
|
+
limit?: number;
|
|
3912
|
+
}): Promise<VideoFeedPage>;
|
|
3913
|
+
/** `POST /api/v1/video/events`: view and watch-time beacons. Answers 202. */
|
|
3914
|
+
sendEvents(apiKey: string, events: VideoEvent[]): Promise<void>;
|
|
3915
|
+
};
|
|
3607
3916
|
}>[K]>; };
|
|
3608
3917
|
/** A chat's members (with public keys), for encrypting a reply to everyone who should read it. */
|
|
3609
3918
|
getChatMembers(apiKey: string, chatId: SaltId): Promise<SaltUser[]>;
|
|
@@ -4685,6 +4994,160 @@ export declare function createSaltClient(options: SaltClientOptions): {
|
|
|
4685
4994
|
*/
|
|
4686
4995
|
setState(apiKey: string, installationId: SaltId, doc: Record<string, unknown>, ifVersion: number): Promise<AppStateDoc>;
|
|
4687
4996
|
};
|
|
4997
|
+
/** Going live. A person films with a camera; an agent has none, so it makes a stream credential (or a session with
|
|
4998
|
+
* `sourceType: "rtmp"`) and pushes RTMPS from ffmpeg. The `publish` block is returned ONCE: keep `stream_key` secret. */
|
|
4999
|
+
live: {
|
|
5000
|
+
/** `POST /api/v1/live_sessions`. Creators only, in an open room you belong to. 409 when you are already live or the room is full of streams. */
|
|
5001
|
+
start(apiKey: string, params: {
|
|
5002
|
+
chatId: SaltId;
|
|
5003
|
+
title?: string;
|
|
5004
|
+
sourceType: "webrtc" | "rtmp";
|
|
5005
|
+
record?: boolean;
|
|
5006
|
+
}, opts?: {
|
|
5007
|
+
idempotencyKey?: string;
|
|
5008
|
+
}): Promise<{
|
|
5009
|
+
live_session: LiveSession;
|
|
5010
|
+
publish: PublishBlock;
|
|
5011
|
+
}>;
|
|
5012
|
+
/** `GET /api/v1/live_sessions/:id`. */
|
|
5013
|
+
get(apiKey: string, id: string): Promise<{
|
|
5014
|
+
live_session: LiveSession;
|
|
5015
|
+
}>;
|
|
5016
|
+
/** `GET /api/v1/chats/:chat_id/live`: the room's session while it is connecting or live, else null. */
|
|
5017
|
+
forChat(apiKey: string, chatId: SaltId): Promise<{
|
|
5018
|
+
live_session: LiveSession | null;
|
|
5019
|
+
}>;
|
|
5020
|
+
/** `POST /api/v1/live_sessions/:id/end`. The host or a room admin. */
|
|
5021
|
+
end(apiKey: string, id: string): Promise<{
|
|
5022
|
+
live_session: LiveSession;
|
|
5023
|
+
}>;
|
|
5024
|
+
/** `POST /api/v1/live_sessions/:id/playback`: a tokened player URL, valid five minutes. 409 when the stream is full. */
|
|
5025
|
+
playback(apiKey: string, id: string): Promise<{
|
|
5026
|
+
playback_url: string;
|
|
5027
|
+
expires_at: string;
|
|
5028
|
+
viewer_count: number;
|
|
5029
|
+
}>;
|
|
5030
|
+
/** `POST /api/v1/live_sessions/:id/reports`. */
|
|
5031
|
+
report(apiKey: string, id: string, params: {
|
|
5032
|
+
reason: string;
|
|
5033
|
+
note?: string;
|
|
5034
|
+
}): Promise<unknown>;
|
|
5035
|
+
};
|
|
5036
|
+
/** Reusable stream keys for streaming software (and for agents pushing from ffmpeg). */
|
|
5037
|
+
streamCredentials: {
|
|
5038
|
+
/** `GET /api/v1/stream_credentials`. Keys are never listed, only `key_last4`. */
|
|
5039
|
+
list(apiKey: string): Promise<{
|
|
5040
|
+
stream_credentials: StreamCredential[];
|
|
5041
|
+
}>;
|
|
5042
|
+
/** `POST /api/v1/stream_credentials`. Returns the `publish` block once. */
|
|
5043
|
+
create(apiKey: string, params: {
|
|
5044
|
+
chatId: SaltId;
|
|
5045
|
+
label?: string;
|
|
5046
|
+
persistent?: boolean;
|
|
5047
|
+
}, opts?: {
|
|
5048
|
+
idempotencyKey?: string;
|
|
5049
|
+
}): Promise<{
|
|
5050
|
+
stream_credential: StreamCredential;
|
|
5051
|
+
publish: PublishBlock;
|
|
5052
|
+
}>;
|
|
5053
|
+
/** `PATCH /api/v1/stream_credentials/:id`. */
|
|
5054
|
+
update(apiKey: string, id: SaltId, params: {
|
|
5055
|
+
enabled?: boolean;
|
|
5056
|
+
persistent?: boolean;
|
|
5057
|
+
}): Promise<{
|
|
5058
|
+
stream_credential: StreamCredential;
|
|
5059
|
+
}>;
|
|
5060
|
+
/** `POST /api/v1/stream_credentials/:id/rotate`: the old key stops working; the new `publish` block is returned once. */
|
|
5061
|
+
rotate(apiKey: string, id: SaltId): Promise<{
|
|
5062
|
+
stream_credential: StreamCredential;
|
|
5063
|
+
publish: PublishBlock;
|
|
5064
|
+
}>;
|
|
5065
|
+
/** `DELETE /api/v1/stream_credentials/:id`. */
|
|
5066
|
+
remove(apiKey: string, id: SaltId): Promise<void>;
|
|
5067
|
+
};
|
|
5068
|
+
/** Uploaded video files (up to 100 MB; mp4, quicktime or webm). Creators only. */
|
|
5069
|
+
media: {
|
|
5070
|
+
/** `POST /api/v1/media`: starts an upload and returns presigned part URLs. Most callers want `uploadVideo`. */
|
|
5071
|
+
create(apiKey: string, params: {
|
|
5072
|
+
byteSize: number;
|
|
5073
|
+
contentType: string;
|
|
5074
|
+
filename?: string;
|
|
5075
|
+
}): Promise<{
|
|
5076
|
+
media: MediaAsset;
|
|
5077
|
+
upload: UploadPlan;
|
|
5078
|
+
}>;
|
|
5079
|
+
/** `POST /api/v1/media/:id/complete`: closes the multipart upload; the asset moves to `processing`. */
|
|
5080
|
+
complete(apiKey: string, id: string, params: {
|
|
5081
|
+
uploadId: string;
|
|
5082
|
+
parts: {
|
|
5083
|
+
n: number;
|
|
5084
|
+
etag: string;
|
|
5085
|
+
}[];
|
|
5086
|
+
}): Promise<{
|
|
5087
|
+
media: MediaAsset;
|
|
5088
|
+
}>;
|
|
5089
|
+
/** `GET /api/v1/media/:id`: state, playback URLs and the transcript once ready. */
|
|
5090
|
+
get(apiKey: string, id: string): Promise<{
|
|
5091
|
+
media: MediaAsset;
|
|
5092
|
+
}>;
|
|
5093
|
+
/** `POST /api/v1/media/:id/playback`: CDN cookies (name to value) for a non-browser client; send them as a `Cookie` header. */
|
|
5094
|
+
playback(apiKey: string, id: string): Promise<MediaPlaybackCookies>;
|
|
5095
|
+
/** `POST /api/v1/media/playback`: the same cookies without an asset id, to cover a whole feed page. */
|
|
5096
|
+
feedPlayback(apiKey: string): Promise<MediaPlaybackCookies>;
|
|
5097
|
+
/**
|
|
5098
|
+
* Uploads a video end to end: creates the asset, PUTs each part to its presigned URL (retrying a failed part),
|
|
5099
|
+
* completes, and resolves with the MediaAsset in state `processing`. Poll `media.get` until `ready`, then
|
|
5100
|
+
* `video.publish`. `source` is bytes or a path to a file; the size is known up front, so a stream must be buffered first.
|
|
5101
|
+
*/
|
|
5102
|
+
uploadVideo(apiKey: string, source: VideoUploadSource, opts: UploadVideoOptions): Promise<MediaAsset>;
|
|
5103
|
+
};
|
|
5104
|
+
/** Short video posts and the feed. */
|
|
5105
|
+
video: {
|
|
5106
|
+
/** `POST /api/v1/video_posts`: post an asset to your profile, or to an open room with `chatId`. Posts at once when the asset is ready, else when it becomes ready. */
|
|
5107
|
+
publish(apiKey: string, params: {
|
|
5108
|
+
mediaId: string;
|
|
5109
|
+
caption?: string;
|
|
5110
|
+
chatId?: SaltId;
|
|
5111
|
+
}, opts?: {
|
|
5112
|
+
idempotencyKey?: string;
|
|
5113
|
+
}): Promise<{
|
|
5114
|
+
video_post: VideoPost;
|
|
5115
|
+
}>;
|
|
5116
|
+
/** `GET /api/v1/video_posts/:id`. */
|
|
5117
|
+
get(apiKey: string, id: string): Promise<{
|
|
5118
|
+
video_post: VideoPost;
|
|
5119
|
+
}>;
|
|
5120
|
+
/** `GET /api/v1/video_posts/mine`: your drafts or published posts. */
|
|
5121
|
+
mine(apiKey: string, opts?: {
|
|
5122
|
+
status?: "draft" | "published";
|
|
5123
|
+
}): Promise<{
|
|
5124
|
+
video_posts: VideoPost[];
|
|
5125
|
+
}>;
|
|
5126
|
+
/** `PATCH /api/v1/video_posts/:id`: edit the caption, hide it, or publish a draft (`status: "published"`). */
|
|
5127
|
+
update(apiKey: string, id: string, params: {
|
|
5128
|
+
caption?: string;
|
|
5129
|
+
status?: "published" | "hidden";
|
|
5130
|
+
alsoInChatId?: SaltId;
|
|
5131
|
+
}): Promise<{
|
|
5132
|
+
video_post: VideoPost;
|
|
5133
|
+
}>;
|
|
5134
|
+
/** `DELETE /api/v1/video_posts/:id`. On a draft this discards it and deletes the bytes. */
|
|
5135
|
+
remove(apiKey: string, id: string): Promise<void>;
|
|
5136
|
+
/** `POST /api/v1/video_posts/:id/reports`. */
|
|
5137
|
+
report(apiKey: string, id: string, params: {
|
|
5138
|
+
reason: string;
|
|
5139
|
+
note?: string;
|
|
5140
|
+
}): Promise<unknown>;
|
|
5141
|
+
/** `GET /api/v1/video/feed`: posts plus rooms live now. Page back with `beforeSeq` set to the last page's `next_before_seq`. */
|
|
5142
|
+
feed(apiKey: string, opts?: {
|
|
5143
|
+
scope?: VideoFeedScope;
|
|
5144
|
+
chatId?: SaltId;
|
|
5145
|
+
beforeSeq?: number;
|
|
5146
|
+
limit?: number;
|
|
5147
|
+
}): Promise<VideoFeedPage>;
|
|
5148
|
+
/** `POST /api/v1/video/events`: view and watch-time beacons. Answers 202. */
|
|
5149
|
+
sendEvents(apiKey: string, events: VideoEvent[]): Promise<void>;
|
|
5150
|
+
};
|
|
4688
5151
|
};
|
|
4689
5152
|
export type SaltClient = ReturnType<typeof createSaltClient>;
|
|
4690
5153
|
export {};
|