UNPKG

@voyo/ali-cdn

Version:

阿里云cdn sdk。 包含:预热、刷新等功能。

105 lines (104 loc) 2.65 kB
export * from "../http"; export interface CDNParameters { Format: string; Version: string; AccessKeyId: string; SignatureVersion: string; SignatureMethod: string; SignatureNonce: string; Signature?: string; Timestamp: string; } export interface CDNCtor { cdnKey: string; cdnSecret: string; cdnVersion?: string; } declare class CDN { cdnKey: string; cdnSecret: string; cdnServer: string; cdnVersion: string; constructor({ cdnKey, cdnSecret, cdnVersion }: CDNCtor); percentEncode(str: string): string; computeSignature(parameters: Record<string, any>, method: string): string; resolveParams(method: string, requestParams: { Action: string; } & Record<string, any>): { Action: string; Format: string; Version: string; AccessKeyId: string; SignatureVersion: string; SignatureMethod: string; SignatureNonce: string; Signature?: string | undefined; Timestamp: string; }; req(method: string, requestParams: { Action: string; } & Record<string, any>): Promise<{ statusCode: number; data: any; headers: Record<string, string>; }>; } export declare class AliYoCDN extends CDN { combineUrl(url: string | string[]): string | string[]; /** * 刷新url * @param url */ refreshUrl(url: string | string[]): Promise<{ statusCode: number; data: any; headers: Record<string, string>; }>; /** * 刷新目录 * @param dir */ refreshDir(dir: string | string[]): Promise<{ statusCode: number; data: any; headers: Record<string, string>; }>; /** * 预热url * @param url * @param area */ pushUrl(url: string | string[], area?: string): Promise<{ statusCode: number; data: any; headers: Record<string, string>; }>; /** * 查询配额信息 */ describeQuota(): Promise<{ statusCode: number; data: any; headers: Record<string, string>; }>; /** * 查询刷新预热信息 * @param params */ describeTasks(params?: { TaskId?: string; ObjectPath?: string; PageNumber?: number; ObjectType?: "file" | "directory" | "preload"; DomainName?: string; Status?: string; PageSize?: string; StartTime?: string; EndTime?: string; ResourceGroupId?: string; }): Promise<{ statusCode: number; data: any; headers: Record<string, string>; }>; }