UNPKG

@plasmohq/edge-addons-api

Version:
52 lines (49 loc) 1.4 kB
import { ReadStream } from 'fs'; type Options = { productId: string; clientId: string; apiKey: string; uploadOnly?: boolean; }; type OperationResponse = { id: string; createdTime: string; lastUpdatedTime: string; } & ({ status: "InProgress"; } | { status: "Succeeded"; message: string; } | { status: "Failed"; message?: string; errorCode: string; errors: Array<string>; }); declare const errorMap: { productId: string; clientId: string; apiKey: string; }; declare const requiredFields: Array<keyof typeof errorMap>; declare class EdgeAddonsAPI { options: Options; constructor(options: Options); get productEndpoint(): string; get publishEndpoint(): string; get uploadEndpoint(): string; /** * @returns the publish operation id */ submit({ filePath, notes }: { filePath?: string; notes?: string; }): Promise<string>; publish(notes?: string): Promise<string>; upload(readStream?: ReadStream): Promise<string>; getPublishStatus(operationId: string): Promise<OperationResponse>; waitForUpload(operationId: string, retryCount?: number, pollTime?: number): Promise<string>; handleTempStatus: (statusCode: number, action: "Submit" | "Upload") => void; private getPublishApiDefaultHeaders; } export { EdgeAddonsAPI, type Options, errorMap, requiredFields };