oak-external-sdk/lib/service/qiniu/QiniuCloud.d.ts

165 lines
5.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { QiniuZone } from '../../types/Qiniu';
export declare class QiniuCloudInstance {
private accessKey;
private secretKey;
constructor(accessKey: string, secretKey: string);
/**
* 计算客户端上传七牛需要的凭证
* https://developer.qiniu.com/kodo/1312/upload
* @param bucket
* @param zone
* @param key
* @returns
*/
getKodoUploadInfo(bucket: string, zone: QiniuZone, key?: string): {
key: string | undefined;
uploadToken: string;
uploadHost: string;
bucket: string;
};
/**
* 计算直播需要的token
* @param method
* @param path
* @param host
* @param rawQuery
* @param contentType
* @param bodyStr
* @returns
*/
getLiveToken(method: 'GET' | 'POST' | 'PUT' | 'DELETE', path: string, host: string, rawQuery?: string, contentType?: string, bodyStr?: string): string;
/**
* 创建直播流
* @param hub
* @param streamTitle
* @param host
* @param publishDomain
* @param playDomainType
* @param playDomain
* @param expireAt
* @param publishSecurity
* @param publishKey
* @param playKey
* @returns
*/
getLiveStream(hub: string, streamTitle: string, host: string, publishDomain: string, playDomainType: 'rtmp' | 'hls' | 'flv', playDomain: string, expireAt: number, publishSecurity: 'none' | 'static' | 'expiry' | 'expiry_sk', publishKey: string, playKey: string): Promise<{
streamTitle: string;
hub: string;
rtmpPushUrl: string;
playUrl: string;
pcPushUrl: string;
streamKey: string;
expireAt: number;
}>;
/**
* https://developer.qiniu.com/kodo/1308/stat
* 文档里写的是GET方法从nodejs-sdk里看是POST方法
*/
getKodoFileStat(bucket: string, zone: QiniuZone, key: string, mockData?: any): Promise<{
fsize: number;
hash: string;
mimeType: string;
type: 0 | 1 | 2 | 3;
putTime: number;
}>;
/**
* https://developer.qiniu.com/kodo/1257/delete
* @param bucket
* @param key
* @param mockData
* @returns
*/
removeKodoFile(bucket: string, zone: QiniuZone, key: string, mockData?: any): Promise<boolean>;
/**
* 列举kodo资源列表
* https://developer.qiniu.com/kodo/1284/list
* @param bucket
* @param marker
* @param limit
* @param prefix
* @param delimiter
* @param mockData
* @returns
*/
getKodoFileList(bucket: string, zone: QiniuZone, marker?: string, limit?: number, prefix?: string, delimiter?: string, mockData?: any): Promise<{
marker?: string | undefined;
items: Array<{
key: string;
hash: string;
fsize: number;
mimeType: string;
putTime: number;
type: number;
status: number;
}>;
}>;
moveKodoFile(srcBucket: string, zone: QiniuZone, srcKey: string, destBucket: string, destKey: string, force?: boolean, mockData?: any): Promise<void>;
copyKodoFile(srcBucket: string, zone: QiniuZone, srcKey: string, destBucket: string, destKey: string, force?: boolean, mockData?: any): Promise<void>;
/**
* 计算直播流地址相关信息
* @param hub
* @param streamTitle
* @param expireAt
* @param publishDomain
* @param playDomainType
* @param playDomain
* @param publishSecurity
* @param publishKey
* @param playKey
* @returns
*/
getStreamObj(hub: string, streamTitle: string, expireAt: number, publishDomain: string, playDomainType: 'rtmp' | 'hls' | 'flv', playDomain: string, publishSecurity: 'none' | 'static' | 'expiry' | 'expiry_sk', publishKey: string, playKey: string): {
streamTitle: string;
hub: string;
rtmpPushUrl: string;
playUrl: string;
pcPushUrl: string;
streamKey: string;
expireAt: number;
};
getPlayBackUrl(hub: string, playBackDomain: string, streamTitle: string, start: number, end: number, method: 'GET' | 'POST' | 'PUT' | 'DELETE', host: string, rawQuery?: string): Promise<string>;
/**
* 禁用直播流
* @param hub
* @param streamTitle
* @param host
* @param disabledTill
* @param disablePeriodSecond
*/
disabledStream(hub: string, streamTitle: string, host: string, disabledTill: number, //禁播结束时间 -1永久禁播0解除禁播
disablePeriodSecond?: number): Promise<void>;
/**
* 查询直播流列表
* @param hub
* @param host
* @param liveOnly
* @param prefix
* @param limit
* @param marker
* @returns 直播流名称
*/
getLiveStreamList(hub: string, host: string, liveOnly?: boolean, prefix?: string, limit?: number, //取值范围0~5000
marker?: string): Promise<any>;
/**
* 管理端访问七牛云服务器
* @param path
* @param method
* @param headers
* @param body
*/
private access;
/**
* https://developer.qiniu.com/kodo/1208/upload-token
* @param scope
* @returns
*/
private generateKodoUploadToken;
/**
* https://developer.qiniu.com/kodo/1201/access-token
*/
private generateKodoAccessToken;
private base64ToUrlSafe;
private hmacSha1;
private urlSafeBase64Encode;
}