@etherna/sdk-js
Version:
Etherna SDKs for operations on the network
120 lines • 4.2 kB
TypeScript
import type { EthernaIndexClient } from ".";
import type { IndexVideo, IndexVideoComment, IndexVideoManifest, IndexVideoValidation, PaginatedResult, RequestOptions, VoteValue } from "..";
import type { IndexVideoPreview } from "./types";
export declare class IndexVideos {
private instance;
abortController?: AbortController;
constructor(instance: EthernaIndexClient);
/**
* Create a new video on the index
*
* @param hash Hash of the manifest/feed with the video metadata
* @param encryptionKey Encryption key
* @param opts Request options
* @returns Video id
*/
createVideo(hash: string, encryptionKey?: string, opts?: RequestOptions): Promise<string>;
/**
* Get video information by id
*
* @param id Video id on Index
* @param opts Request options
* @returns The video object
*/
fetchVideoFromId(id: string, opts?: RequestOptions): Promise<IndexVideo>;
/**
* Get video information
*
* @param hash Video hash on Swarm
* @param opts Request options
* @returns Video information
*/
fetchVideoFromHash(hash: string, opts?: RequestOptions): Promise<IndexVideo>;
/**
* Get a list of recent videos uploaded on the platform
*
* @param page Page offset (default = 0)
* @param take Number of videos to fetch (default = 25)
* @param opts Request options
* @returns The list of videos
*/
fetchLatestVideos(page?: number, take?: number, opts?: RequestOptions): Promise<PaginatedResult<IndexVideoPreview>>;
/**
* Get video validations list
*
* @param id Video id on Index
* @param opts Request options
* @returns List of validations
*/
fetchValidations(id: string, opts?: RequestOptions): Promise<never>;
/**
* Get video hash validation status
*
* @param hash Video hash on Swarm
* @param opts Request options
* @returns Validation status
*/
fetchHashValidation(hash: string, opts?: RequestOptions): Promise<IndexVideoValidation>;
/**
* Get videos validation status
*
* @param hashes Video hash on Swarm
* @param opts Request options
* @returns Validation status
*/
fetchBulkValidation(hashes: string[], opts?: RequestOptions): Promise<IndexVideoValidation[]>;
/**
* Update a video information
*
* @param id Id of the video on Index
* @param newHash New manifest hash with video metadata
* @param opts Request options
* @returns Video id
*/
updateVideo(id: string, newHash: string, opts?: RequestOptions): Promise<IndexVideoManifest>;
/**
* Delete a video from the index
*
* @param id Id of the video
* @param opts Request options
* @returns Success state
*/
deleteVideo(id: string, opts?: RequestOptions): Promise<boolean>;
/**
* Fetch the video comments
*
* @param id Id of the video
* @param page Page offset (default = 0)
* @param take Number of comments to fetch (default = 25)
* @param opts Request options
* @returns The list of comments
*/
fetchComments(id: string, page?: number, take?: number, opts?: RequestOptions): Promise<IndexVideoComment[]>;
/**
* Post a new comment to a video
*
* @param id Id of the video
* @param message Message string with markdown
* @param opts Request options
* @returns The comment object
*/
postComment(id: string, message: string, opts?: RequestOptions): Promise<IndexVideoComment>;
/**
* Give a up/down vote to the video
*
* @param id Id of the video
* @param vote Up / Down / Neutral vote
* @param opts Request options
*/
vote(id: string, vote: VoteValue, opts?: RequestOptions): Promise<IndexVideoComment>;
/**
* Report a video
*
* @param id Id of the video
* @param manifestReference Reference of the manifest to report
* @param code Report code
* @param opts Request options
*/
reportVideo(id: string, manifestReference: string, code: string, opts?: RequestOptions): Promise<any>;
}
//# sourceMappingURL=videos.d.ts.map