///
import { FetchApi, Response, FetchInit } from './fetch_api';
import { S3Api, S3SignedUploadInfo } from './s3_api';
/**
* Enumeration of some error types server may return.
*/
declare enum ErrorResponseCode {
RESOURCE_NOT_FOUND = "RESOURCE_NOT_FOUND",
UNSUPPORTED_BLOCKS_CLI_VERSION = "UNSUPPORTED_BLOCKS_CLI_VERSION"
}
export declare enum AirtableApiErrorName {
AIRTABLE_API_ERROR_STATUS_AND_MESSAGES = "airtableApiErrorStatusAndMessages",
AIRTABLE_API_KEY_MALFORMED = "airtableApiKeyMalformed",
AIRTABLE_API_KEY_NAME_INVALID = "airtableApiKeyNameInvalid",
AIRTABLE_API_MULTIPLE_ERRORS = "airtableApiMultipleErrors",
AIRTABLE_API_WITH_INVALID_API_KEY = "airtableApiWithInvalidApiKey",
AIRTABLE_API_BASE_NOT_FOUND = "airtableApiBaseNotFound",
AIRTABLE_API_UNSUPPORTED_BLOCKS_CLI_VERSION = "airtableApiUnsupportedBlocksCliVersion",
AIRTABLE_API_UNEXPECTED_ERROR = "airtableApiUnexpectedError"
}
export interface AirtableApiErrorStatusAndMessages {
type: AirtableApiErrorName.AIRTABLE_API_ERROR_STATUS_AND_MESSAGES;
status: number;
errors: Exclude;
}
export interface AirtableApiErrorKeyMalformed {
type: AirtableApiErrorName.AIRTABLE_API_KEY_MALFORMED;
}
export interface AirtableApiErrorKeyNameInvalid {
type: AirtableApiErrorName.AIRTABLE_API_KEY_NAME_INVALID;
name: string;
}
export interface AirtableApiErrorMultiple {
type: AirtableApiErrorName.AIRTABLE_API_MULTIPLE_ERRORS;
errors: AirtableApiErrorInfo[];
}
export interface AirtableApiErrorInvalidApiKey {
type: AirtableApiErrorName.AIRTABLE_API_WITH_INVALID_API_KEY;
}
export interface AirtableApiErrorBaseNotFound {
type: AirtableApiErrorName.AIRTABLE_API_BASE_NOT_FOUND;
}
export interface AirtableApiErrorUnsupportedBlocksCliVersion {
type: AirtableApiErrorName.AIRTABLE_API_UNSUPPORTED_BLOCKS_CLI_VERSION;
serverMessage: string;
}
export interface AirtableApiErrorUnexpected {
type: AirtableApiErrorName.AIRTABLE_API_UNEXPECTED_ERROR;
serverMessage: string;
}
export declare type AirtableApiErrorInfo = AirtableApiErrorStatusAndMessages | AirtableApiErrorKeyMalformed | AirtableApiErrorKeyNameInvalid | AirtableApiErrorMultiple | AirtableApiErrorInvalidApiKey | AirtableApiErrorBaseNotFound | AirtableApiErrorUnsupportedBlocksCliVersion | AirtableApiErrorUnexpected;
interface ErrorResponseJson {
error?: {
code?: ErrorResponseCode | string;
message: string;
};
errors?: {
code?: ErrorResponseCode | string;
message: string;
}[];
}
export interface AirtableApiOptions {
blockId: string;
apiKey: string;
userAgent: string;
apiBaseUrl: string;
}
export interface CreateBuildOptions {
s3: S3Api;
frontendBundle: Buffer;
backendBundle: Buffer | null;
}
export interface CreateReleaseOptions {
buildId: string;
deployId?: string;
developerComment?: string;
}
export interface CodeUploadOptions {
codeUploadId: string;
status: 'uploaded' | 'failed';
}
export interface CodeUploadResponse {
codeUploadId: string;
presignedUploadUrl: string;
}
export interface FinalizeCodeUploadResponse {
message: string;
}
export interface UploadSubmissionOptions {
archiveBuffer: Buffer;
}
export interface CreateBuildResponseJson {
buildId: string;
frontendBundleUploadUrl: string;
backendDeploymentPackageUploadUrl: string | null;
frontendBundleS3UploadInfo: S3SignedUploadInfo;
backendDeploymentPackageS3UploadInfo: S3SignedUploadInfo | null;
}
export declare abstract class AirtableApi extends FetchApi {
protected blockId: string;
private apiKey;
private userAgent;
private apiBaseUrl;
constructor({ blockId, apiKey, userAgent, apiBaseUrl }: AirtableApiOptions);
airtableFetchInit({ url, ...init }: FetchInit): FetchInit;
abstract createBuildAsync(options: CreateBuildOptions): Promise;
abstract createReleaseAsync(options: CreateReleaseOptions): Promise;
uploadSubmissionAsync({ archiveBuffer }: UploadSubmissionOptions): Promise;
protected abstract _blockCreateCodeUploadAsync(): Promise;
protected abstract _blockFinalizeCodeUploadAsync(options: CodeUploadOptions): Promise;
protected _invariantOkResponseAsync(init: FetchInit, response: Response): Promise;
}
export {};