import type { Channel } from './api/channels';
import type { DecryptResult } from './bundle/decryptV2';
import type { EncryptResult } from './bundle/encryptV2';
import type { UploadBundleResult } from './bundle/upload';
import type { ZipResult } from './bundle/zip';
import { getInfo as doctorInternal } from './app/info';
import { checkCompatibilityCommandInternal } from './bundle/compatibility';
export type DoctorInfo = Awaited<ReturnType<typeof doctorInternal>>;
type CompatibilityReport = Awaited<ReturnType<typeof checkCompatibilityCommandInternal>>['finalCompatibility'];
export type BundleCompatibilityEntry = CompatibilityReport[number];
/** Common result wrapper for all SDK operations */
export interface SDKResult<T = void> {
    success: boolean;
    data?: T;
    error?: string;
    warnings?: string[];
}
export interface AddAppOptions {
    /** App ID (e.g., com.example.app) */
    appId: string;
    /** App name for display in Capgo Cloud */
    name?: string;
    /** App icon path for display in Capgo Cloud */
    icon?: string;
    /** API key for authentication */
    apikey?: string;
    /** Custom Supabase host */
    supaHost?: string;
    /** Custom Supabase anon key */
    supaAnon?: string;
}
export interface UpdateAppOptions {
    /** App ID (e.g., com.example.app) */
    appId: string;
    /** Updated app name */
    name?: string;
    /** Updated app icon path */
    icon?: string;
    /** Days to keep old bundles (0 = infinite) */
    retention?: number;
    /** API key for authentication */
    apikey?: string;
    /** Custom Supabase host */
    supaHost?: string;
    /** Custom Supabase anon key */
    supaAnon?: string;
}
export interface AppInfo {
    appId: string;
    name: string;
    iconUrl?: string;
    createdAt: Date;
}
export interface UploadOptions {
    /** App ID (e.g., com.example.app) */
    appId: string;
    /** Path to build folder */
    path: string;
    /** Bundle version */
    bundle?: string;
    /** Channel name */
    channel?: string;
    /** API key for authentication */
    apikey?: string;
    /** External URL instead of upload */
    external?: string;
    /** Enable encryption */
    encrypt?: boolean;
    /** Private key for encryption */
    encryptionKey?: string;
    /** Custom Supabase host */
    supaHost?: string;
    /** Custom Supabase anon key */
    supaAnon?: string;
    /** Timeout in seconds */
    timeout?: number;
    /** Use TUS protocol for upload */
    useTus?: boolean;
    /** Comment for this version */
    comment?: string;
    /** Minimum update version required */
    minUpdateVersion?: string;
    /** Automatically set min-update-version when compatibility fails */
    autoMinUpdateVersion?: boolean;
    /** Allow self-assignment to channel */
    selfAssign?: boolean;
    /** Package.json paths for monorepos */
    packageJsonPaths?: string;
    /** Ignore compatibility checks */
    ignoreCompatibilityCheck?: boolean;
    /** Disable code check for notifyAppReady() */
    disableCodeCheck?: boolean;
    /** Use legacy zip upload instead of TUS */
    useZip?: boolean;
}
export interface UploadResult {
    success: boolean;
    bundleId?: string;
    bundleUrl?: string;
    checksum?: string | null;
    encryptionMethod?: UploadBundleResult['encryptionMethod'];
    sessionKey?: string;
    ivSessionKey?: string | null;
    storageProvider?: string;
    skipped?: boolean;
    reason?: string;
    error?: string;
    warnings?: string[];
}
export interface BundleInfo {
    id: string;
    version: string;
    channel?: string;
    uploadedAt: Date;
    size: number;
    encrypted: boolean;
}
export interface CleanupOptions {
    /** App ID */
    appId: string;
    /** Number of versions to keep */
    keep?: number;
    /** Bundle version pattern */
    bundle?: string;
    /** Force removal without confirmation */
    force?: boolean;
    /** Delete bundles even if linked to channels */
    ignoreChannel?: boolean;
    /** API key for authentication */
    apikey?: string;
    /** Custom Supabase host */
    supaHost?: string;
    /** Custom Supabase anon key */
    supaAnon?: string;
}
export interface GenerateKeyOptions {
    /** Overwrite existing keys if they already exist */
    force?: boolean;
    /** Automatically configure the default encryption channel instead of prompting */
    setupChannel?: boolean;
}
export interface SaveKeyOptions {
    /** Path to the public key file (.pub) */
    keyPath?: string;
    /** Public key contents as string (used if keyPath not provided) */
    keyData?: string;
    /** Automatically configure the default encryption channel instead of prompting */
    setupChannel?: boolean;
}
export interface DeleteOldKeyOptions {
    /** Force deletion if legacy files are present */
    force?: boolean;
    /** Automatically configure the default encryption channel instead of prompting */
    setupChannel?: boolean;
}
export interface AddChannelOptions {
    /** Channel ID/name */
    channelId: string;
    /** App ID */
    appId: string;
    /** Set as default channel */
    default?: boolean;
    /** Allow device self-assignment */
    selfAssign?: boolean;
    /** API key for authentication */
    apikey?: string;
    /** Custom Supabase host */
    supaHost?: string;
    /** Custom Supabase anon key */
    supaAnon?: string;
}
export interface UpdateChannelOptions {
    /** Channel ID/name */
    channelId: string;
    /** App ID */
    appId: string;
    /** Bundle version to link */
    bundle?: string;
    /** Channel state (default or normal) */
    state?: string;
    /** Allow downgrade */
    downgrade?: boolean;
    /** Enable for iOS */
    ios?: boolean;
    /** Enable for Android */
    android?: boolean;
    /** Allow device self-assignment */
    selfAssign?: boolean;
    /** Disable auto update strategy */
    disableAutoUpdate?: string;
    /** Enable for dev builds */
    dev?: boolean;
    /** Enable for emulators */
    emulator?: boolean;
    /** API key for authentication */
    apikey?: string;
    /** Custom Supabase host */
    supaHost?: string;
    /** Custom Supabase anon key */
    supaAnon?: string;
}
export interface AccountIdOptions {
    /** API key for authentication */
    apikey?: string;
    /** Custom Supabase host */
    supaHost?: string;
    /** Custom Supabase anon key */
    supaAnon?: string;
}
export interface ListOrganizationsOptions extends AccountIdOptions {
}
export interface AddOrganizationOptions extends AccountIdOptions {
    /** Organization name */
    name: string;
    /** Management email */
    email: string;
}
export interface UpdateOrganizationOptions extends AccountIdOptions {
    /** Organization ID */
    orgId: string;
    /** Updated name */
    name?: string;
    /** Updated management email */
    email?: string;
}
export interface OrganizationInfo {
    id: string;
    name: string;
    role?: string;
    appCount?: number;
    email?: string;
    createdAt?: Date;
}
export interface DeleteOrganizationOptions extends AccountIdOptions {
    autoConfirm?: boolean;
}
export interface LoginOptions {
    apikey: string;
    local?: boolean;
    supaHost?: string;
    supaAnon?: string;
}
export interface DoctorOptions {
    packageJson?: string;
}
export interface BundleCompatibilityOptions {
    appId: string;
    channel: string;
    packageJson?: string;
    nodeModules?: string;
    textOutput?: boolean;
    apikey?: string;
    supaHost?: string;
    supaAnon?: string;
}
export interface EncryptBundleOptions {
    zipPath: string;
    checksum: string;
    keyPath?: string;
    keyData?: string;
    json?: boolean;
}
export interface DecryptBundleOptions {
    zipPath: string;
    ivSessionKey: string;
    keyPath?: string;
    keyData?: string;
    checksum?: string;
}
export interface ZipBundleOptions {
    appId: string;
    path: string;
    bundle?: string;
    name?: string;
    codeCheck?: boolean;
    json?: boolean;
    keyV2?: boolean;
    packageJson?: string;
}
export interface CurrentBundleOptions extends AccountIdOptions {
}
export interface SetSettingOptions {
    apikey?: string;
    bool?: string;
    string?: string;
}
/**
 * Capgo SDK for programmatic access to all CLI functionality.
 * Use this class to integrate Capgo operations directly into your application.
 *
 * @example
 * ```typescript
 * // Initialize SDK
 * const sdk = new CapgoSDK({ apikey: 'your-api-key' })
 *
 * // Upload a bundle
 * const result = await sdk.uploadBundle({
 *   appId: 'com.example.app',
 *   path: './dist',
 *   bundle: '1.0.0',
 *   channel: 'production'
 * })
 *
 * if (result.success) {
 *   console.log('Upload successful!')
 * }
 * ```
 */
export declare class CapgoSDK {
    private readonly apikey?;
    private readonly supaHost?;
    private readonly supaAnon?;
    constructor(options?: {
        apikey?: string;
        supaHost?: string;
        supaAnon?: string;
    });
    /**
     * Save an API key locally or in the home directory
     */
    login(options: LoginOptions): Promise<SDKResult>;
    /**
     * Run Capgo Doctor diagnostics and return the report
     */
    doctor(options?: DoctorOptions): Promise<SDKResult<DoctorInfo>>;
    /**
     * Add a new app to Capgo Cloud
     *
     * @example
     * ```typescript
     * const result = await sdk.addApp({
     *   appId: 'com.example.app',
     *   name: 'My App',
     *   icon: './icon.png'
     * })
     * ```
     */
    addApp(options: AddAppOptions): Promise<SDKResult>;
    /**
     * Update an existing app in Capgo Cloud
     *
     * Note: This method requires CLI function refactoring to work without exit().
     * Currently it will throw an error.
     *
     * @example
     * ```typescript
     * const result = await sdk.updateApp({
     *   appId: 'com.example.app',
     *   name: 'Updated App Name',
     *   retention: 30
     * })
     * ```
     */
    updateApp(options: UpdateAppOptions): Promise<SDKResult>;
    /**
     * Delete an app from Capgo Cloud
     *
     * @param appId - The app ID to delete
     * @param skipConfirmation - Skip owner confirmation check (use with caution)
     *
     * @example
     * ```typescript
     * const result = await sdk.deleteApp('com.example.app')
     * ```
     */
    deleteApp(appId: string, skipConfirmation?: boolean): Promise<SDKResult>;
    /**
     * List all apps for the authenticated account
     *
     * @example
     * ```typescript
     * const result = await sdk.listApps()
     * if (result.success) {
     *   result.data?.forEach(app => {
     *     console.log(`${app.name} (${app.appId})`)
     *   })
     * }
     * ```
     */
    listApps(): Promise<SDKResult<AppInfo[]>>;
    /**
     * Retrieve the account ID associated with the configured API key
     */
    getAccountId(options?: AccountIdOptions): Promise<SDKResult<string>>;
    checkBundleCompatibility(options: BundleCompatibilityOptions): Promise<SDKResult<BundleCompatibilityEntry[]>>;
    encryptBundle(options: EncryptBundleOptions): Promise<SDKResult<EncryptResult>>;
    decryptBundle(options: DecryptBundleOptions): Promise<SDKResult<DecryptResult>>;
    zipBundle(options: ZipBundleOptions): Promise<SDKResult<ZipResult>>;
    /**
     * Upload a bundle to Capgo Cloud
     *
     * @example
     * ```typescript
     * const result = await sdk.uploadBundle({
     *   appId: 'com.example.app',
     *   path: './dist',
     *   bundle: '1.0.0',
     *   channel: 'production',
     *   comment: 'New features added'
     * })
     * ```
     */
    uploadBundle(options: UploadOptions): Promise<UploadResult>;
    /**
     * List bundles for an app
     *
     * @example
     * ```typescript
     * const result = await sdk.listBundles('com.example.app')
     * if (result.success) {
     *   result.data?.forEach(bundle => {
     *     console.log(`${bundle.version} - ${bundle.uploadedAt}`)
     *   })
     * }
     * ```
     */
    listBundles(appId: string): Promise<SDKResult<BundleInfo[]>>;
    /**
     * Delete a specific bundle
     *
     * Note: This method requires CLI function refactoring to work without exit().
     *
     * @example
     * ```typescript
     * const result = await sdk.deleteBundle('com.example.app', '1.0.0')
     * ```
     */
    deleteBundle(appId: string, bundleId: string): Promise<SDKResult>;
    /**
     * Cleanup old bundles, keeping only recent versions
     *
     * @example
     * ```typescript
     * const result = await sdk.cleanupBundles({
     *   appId: 'com.example.app',
     *   keep: 5,
     *   force: true
     * })
     * ```
     */
    cleanupBundles(options: CleanupOptions): Promise<SDKResult<{
        removed: number;
        kept: number;
    }>>;
    getCurrentBundle(appId: string, channelId: string, options?: CurrentBundleOptions): Promise<SDKResult<string>>;
    /**
     * Create a new channel for app distribution
     *
     * @example
     * ```typescript
     * const result = await sdk.addChannel({
     *   channelId: 'production',
     *   appId: 'com.example.app',
     *   default: true
     * })
     * ```
     */
    addChannel(options: AddChannelOptions): Promise<SDKResult>;
    /**
     * Update channel settings
     *
     * @example
     * ```typescript
     * const result = await sdk.updateChannel({
     *   channelId: 'production',
     *   appId: 'com.example.app',
     *   bundle: '1.0.0'
     * })
     * ```
     */
    updateChannel(options: UpdateChannelOptions): Promise<SDKResult>;
    /**
     * Delete a channel
     *
     * @example
     * ```typescript
     * const result = await sdk.deleteChannel('staging', 'com.example.app')
     * ```
     */
    deleteChannel(channelId: string, appId: string, deleteBundle?: boolean): Promise<SDKResult>;
    /**
     * List all channels for an app
     *
     * @example
     * ```typescript
     * const result = await sdk.listChannels('com.example.app')
     * if (result.success) {
     *   result.data?.forEach(channel => {
     *     console.log(`${channel.name} - ${channel.isDefault ? 'default' : 'normal'}`)
     *   })
     * }
     * ```
     */
    listChannels(appId: string): Promise<SDKResult<Channel[]>>;
    /**
     * Generate Capgo encryption keys (private/public pair)
     */
    generateEncryptionKeys(options?: GenerateKeyOptions): Promise<SDKResult>;
    /**
     * Save a public encryption key into the Capacitor config
     */
    saveEncryptionKey(options?: SaveKeyOptions): Promise<SDKResult>;
    /**
     * Delete legacy (v1) encryption keys from the project
     */
    deleteLegacyEncryptionKey(options?: DeleteOldKeyOptions): Promise<SDKResult<{
        deleted: boolean;
    }>>;
    listOrganizations(options?: ListOrganizationsOptions): Promise<SDKResult<OrganizationInfo[]>>;
    addOrganization(options: AddOrganizationOptions): Promise<SDKResult<OrganizationInfo>>;
    updateOrganization(options: UpdateOrganizationOptions): Promise<SDKResult<OrganizationInfo>>;
    deleteOrganization(orgId: string, options?: DeleteOrganizationOptions): Promise<SDKResult<{
        deleted: boolean;
    }>>;
    setAppSetting(path: string, options: SetSettingOptions): Promise<SDKResult>;
}
/**
 * Upload a bundle to Capgo Cloud (functional API)
 *
 * @example
 * ```typescript
 * const result = await uploadBundle({
 *   appId: 'com.example.app',
 *   path: './dist',
 *   bundle: '1.0.0',
 *   apikey: 'your-api-key'
 * })
 * ```
 */
export declare function uploadBundle(options: UploadOptions): Promise<UploadResult>;
export declare function login(options: LoginOptions): Promise<SDKResult>;
export declare function doctor(options?: DoctorOptions): Promise<SDKResult<DoctorInfo>>;
export declare function checkBundleCompatibility(options: BundleCompatibilityOptions): Promise<SDKResult<BundleCompatibilityEntry[]>>;
export declare function encryptBundle(options: EncryptBundleOptions): Promise<SDKResult<EncryptResult>>;
export declare function decryptBundle(options: DecryptBundleOptions): Promise<SDKResult<DecryptResult>>;
export declare function zipBundle(options: ZipBundleOptions): Promise<SDKResult<ZipResult>>;
export declare function generateEncryptionKeys(options?: GenerateKeyOptions): Promise<SDKResult>;
export declare function saveEncryptionKey(options?: SaveKeyOptions): Promise<SDKResult>;
export declare function deleteLegacyEncryptionKey(options?: DeleteOldKeyOptions): Promise<SDKResult<{
    deleted: boolean;
}>>;
export declare function getCurrentBundle(appId: string, channelId: string, options?: CurrentBundleOptions): Promise<SDKResult<string>>;
export declare function updateAppSetting(path: string, options: SetSettingOptions): Promise<SDKResult>;
export declare function getAccountId(options?: AccountIdOptions): Promise<SDKResult<string>>;
export declare function listOrganizations(options?: ListOrganizationsOptions): Promise<SDKResult<OrganizationInfo[]>>;
export declare function addOrganization(options: AddOrganizationOptions): Promise<SDKResult<OrganizationInfo>>;
export declare function updateOrganization(options: UpdateOrganizationOptions): Promise<SDKResult<OrganizationInfo>>;
export declare function deleteOrganization(orgId: string, options?: DeleteOrganizationOptions): Promise<SDKResult<{
    deleted: boolean;
}>>;
/**
 * Add a new app to Capgo Cloud (functional API)
 *
 * @example
 * ```typescript
 * const result = await addApp({
 *   appId: 'com.example.app',
 *   name: 'My App',
 *   apikey: 'your-api-key'
 * })
 * ```
 */
export declare function addApp(options: AddAppOptions): Promise<SDKResult>;
/**
 * List bundles for an app (functional API)
 *
 * @example
 * ```typescript
 * const result = await listBundles('com.example.app', { apikey: 'your-api-key' })
 * ```
 */
export declare function listBundles(appId: string, options?: {
    apikey?: string;
    supaHost?: string;
    supaAnon?: string;
}): Promise<SDKResult<BundleInfo[]>>;
/**
 * Add a new channel (functional API)
 *
 * @example
 * ```typescript
 * const result = await addChannel({
 *   channelId: 'production',
 *   appId: 'com.example.app',
 *   apikey: 'your-api-key'
 * })
 * ```
 */
export declare function addChannel(options: AddChannelOptions): Promise<SDKResult>;
/**
 * Get Capacitor configuration
 *
 * @example
 * ```typescript
 * const config = await getCapacitorConfig()
 * if (config) {
 *   console.log(config.appId)
 * }
 * ```
 */
export declare function getCapacitorConfig(): Promise<import("./config").ExtConfigPairs | null>;
export type { CapacitorConfig } from './config';
export type { Database } from './types/supabase.types';
export { createSupabaseClient } from './utils';
//# sourceMappingURL=sdk.d.ts.map