export interface ApiSdkQueryUpdatePackageInfo { appVersion: string; label?: string; packageHash?: string; } export interface ApiSdkDeployReportPackageInfo { label: string; appVersion: string; } export interface ApiSdkDownloadReportPackageInfo { label: string; } export interface ApiSdkRemotePackage { releaseChannelPublicId: string; label: string; appVersion: string; description: string; isMandatory: boolean; packageSize: number; packageHash: string; downloadUrl: string; } export interface ApiSdkNativeUpdateNotification { updateAppVersion: true; appVersion: string; } export namespace Http { export interface Response { statusCode: number; body?: string; } export interface Requester { request(verb: 'GET' | 'POST', url: string, requestBody?: string | object | null): Promise; } } export interface ApiSdkConfiguration { appVersion: string; clientUniqueId: string; deviceId?: string; releaseChannelPublicId: string; serverUrl: string; dataTransmissionEnabled: boolean; telemetryEnabled: boolean; ignoreAppVersion?: boolean; } /** * Indicates the status of a deployment (after installing and restarting). */ export enum DeploymentStatus { /** * The deployment failed (and was rolled back). */ FAILED = 'DeploymentFailed', /** * The deployment succeeded. */ SUCCEEDED = 'DeploymentSucceeded', } /** * Pipeline phase at which a deployment failure occurred. Internal — not exported * from the package; only used to build the `/report_status/deploy` request body. */ export enum FailedPhase { DOWNLOAD = 'download', INSTALL = 'install', RUNTIME = 'runtime', UNKNOWN = 'unknown', } /** * Recommended error-code dictionary for {@link ReportDeployInput.error_code}. * Server does not enforce this; consistency matters for the (future) Top-N * aggregation view. Internal — not exported from the package. */ export enum FailureErrorCode { NETWORK_ERROR = 'NETWORK_ERROR', HASH_MISMATCH = 'HASH_MISMATCH', UNZIP_FAILED = 'UNZIP_FAILED', SIGNATURE_INVALID = 'SIGNATURE_INVALID', DISK_FULL = 'DISK_FULL', BUNDLE_LOAD_FAILED = 'BUNDLE_LOAD_FAILED', NATIVE_CRASH = 'NATIVE_CRASH', USER_ROLLBACK = 'USER_ROLLBACK', TIMEOUT = 'TIMEOUT', UNKNOWN = 'UNKNOWN', } /** * Optional failure-detail payload supplied to {@link CodePushApiSdk.reportStatusDeploy}. * Only honoured when the report carries `status === DeploymentStatus.FAILED`; * for any other status the SDK drops these fields before sending. */ export interface ReportDeployFailureInfo { /** Recommended: a value from {@link FailureErrorCode}. */ errorCode?: string; /** Free-form error message / exception text. */ errorMessage?: string; /** Recommended: a value from {@link FailedPhase}. */ failedPhase?: string; /** Client binary version (NOT bundle label). Typically `config.appVersion`. */ binaryAppVersion?: string; } export interface ReportDeployInput { deployment_key: string; app_version: string; status?: DeploymentStatus; label?: string; client_unique_id?: string; previous_label_or_app_version?: string; previous_deployment_key?: string; // Failure-detail fields. Only set when status === "DeploymentFailed". // Lengths are capped client-side: 64 / 500 / 20 / 40 chars respectively. error_code?: string; error_message?: string; failed_phase?: string; binary_app_version?: string; } export interface ReportDownloadInput { deployment_key: string; label: string; client_unique_id?: string; } export interface CheckUpdateRequestInput { deployment_key: string; app_version: string; package_hash?: string; label?: string; client_unique_id?: string; deviceId?: string; is_companion?: boolean; previous_label_or_app_version?: string; previous_deployment_key?: string; } export interface CheckUpdateResponse { update_info: | { is_available: true; target_binary_range: string; description: string; is_disabled: boolean; is_mandatory: boolean; rollout: number; download_url: string; package_size: number; package_hash: string; label: string; should_run_binary_version: boolean; update_app_version: boolean; } | { is_available: false; should_run_binary_version: boolean; target_binary_range: string; update_app_version?: boolean; }; }