import * as openapi_fetch from 'openapi-fetch';

/**
 * This file was auto-generated by openapi-typescript.
 * Do not make direct changes to the file.
 */
interface paths {
    "/builds": {
        parameters: {
            query?: never;
            header?: never;
            path?: never;
            cookie?: never;
        };
        get?: never;
        put?: never;
        post: operations["createBuild"];
        delete?: never;
        options?: never;
        head?: never;
        patch?: never;
        trace?: never;
    };
    "/builds/finalize": {
        parameters: {
            query?: never;
            header?: never;
            path?: never;
            cookie?: never;
        };
        get?: never;
        put?: never;
        post: operations["finalizeBuilds"];
        delete?: never;
        options?: never;
        head?: never;
        patch?: never;
        trace?: never;
    };
    "/builds/{buildId}": {
        parameters: {
            query?: never;
            header?: never;
            path?: never;
            cookie?: never;
        };
        get?: never;
        put: operations["updateBuild"];
        post?: never;
        delete?: never;
        options?: never;
        head?: never;
        patch?: never;
        trace?: never;
    };
    "/project": {
        parameters: {
            query?: never;
            header?: never;
            path?: never;
            cookie?: never;
        };
        get: operations["getAuthProject"];
        put?: never;
        post?: never;
        delete?: never;
        options?: never;
        head?: never;
        patch?: never;
        trace?: never;
    };
    "/project/builds": {
        parameters: {
            query?: never;
            header?: never;
            path?: never;
            cookie?: never;
        };
        get: operations["getAuthProjectBuilds"];
        put?: never;
        post?: never;
        delete?: never;
        options?: never;
        head?: never;
        patch?: never;
        trace?: never;
    };
}
type webhooks = Record<string, never>;
interface components {
    schemas: {
        /** @description SHA1 hash */
        Sha1Hash: string;
        /** @description SHA256 hash */
        Sha256Hash: string;
        /** @description Build */
        Build: {
            id: components["schemas"]["BuildId"];
            /** @description The build number */
            number: number;
            /** @description The status of the build */
            status: ("accepted" | "rejected") | ("no-changes" | "changes-detected") | ("expired" | "pending" | "progress" | "error" | "aborted");
            /**
             * Format: uri
             * @description The URL of the build
             */
            url: string;
            /** @description The notification payload for the build */
            notification: {
                description: string;
                context: string;
                github: {
                    /** @enum {string} */
                    state: "pending" | "success" | "error" | "failure";
                };
                gitlab: {
                    /** @enum {string} */
                    state: "pending" | "running" | "success" | "failed" | "canceled";
                };
            } | null;
        };
        /**
         * @description A unique identifier for the build
         * @example 12345
         */
        BuildId: string;
        /** @description Error response */
        Error: {
            error: string;
            details?: {
                message: string;
            }[];
        };
        /**
         * @description A unique identifier for the build
         * @example 12345
         */
        buildId: string;
        /** @description Screenshot input */
        ScreenshotInput: {
            key: string;
            name: string;
            baseName?: string | null;
            metadata?: {
                url?: string;
                previewUrl?: string;
                viewport?: {
                    width: number;
                    height: number;
                };
                /** @enum {string} */
                colorScheme?: "light" | "dark";
                /** @enum {string} */
                mediaType?: "screen" | "print";
                test?: {
                    id?: string;
                    title: string;
                    titlePath: string[];
                    retries?: number;
                    retry?: number;
                    repeat?: number;
                    location?: {
                        file: string;
                        line: number;
                        column: number;
                    };
                } | null;
                browser?: {
                    name: string;
                    version: string;
                };
                automationLibrary: {
                    name: string;
                    version: string;
                };
                sdk: {
                    name: string;
                    version: string;
                };
            } | null;
            pwTraceKey?: string | null;
            threshold?: number | null;
        };
        /** @description Build metadata */
        BuildMetadata: {
            testReport?: {
                /** @enum {string} */
                status: "passed" | "failed" | "timedout" | "interrupted";
                stats?: {
                    startTime?: string;
                    duration?: number;
                };
            };
        };
        /** @description Project */
        Project: {
            id: string;
            defaultBaseBranch: string;
            hasRemoteContentAccess: boolean;
        };
        /** @description Page information */
        PageInfo: {
            /** @description Total number of items */
            total: number;
            /** @description Current page number */
            page: number;
            /** @description Number of items per page */
            perPage: number;
        };
    };
    responses: never;
    parameters: never;
    requestBodies: never;
    headers: never;
    pathItems: never;
}
type $defs = Record<string, never>;
interface operations {
    createBuild: {
        parameters: {
            query?: never;
            header?: never;
            path?: never;
            cookie?: never;
        };
        requestBody?: {
            content: {
                "application/json": {
                    commit: components["schemas"]["Sha1Hash"];
                    branch: string;
                    screenshotKeys: components["schemas"]["Sha256Hash"][];
                    pwTraceKeys?: components["schemas"]["Sha256Hash"][];
                    name?: string | null;
                    parallel?: boolean | null;
                    parallelNonce?: string | null;
                    prNumber?: number | null;
                    prHeadCommit?: string | null;
                    referenceCommit?: string | null;
                    referenceBranch?: string | null;
                    parentCommits?: components["schemas"]["Sha1Hash"][] | null;
                    /** @enum {string|null} */
                    mode?: "ci" | "monitoring" | null;
                    ciProvider?: string | null;
                    argosSdk?: string | null;
                    runId?: string | null;
                    runAttempt?: number | null;
                };
            };
        };
        responses: {
            /** @description Result of build creation */
            201: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": {
                        build: components["schemas"]["Build"];
                        screenshots: {
                            key: string;
                            /** Format: uri */
                            putUrl: string;
                        }[];
                        pwTraces: {
                            key: string;
                            /** Format: uri */
                            putUrl: string;
                        }[];
                    };
                };
            };
            /** @description Invalid parameters */
            400: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["Error"];
                };
            };
            /** @description Unauthorized */
            401: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["Error"];
                };
            };
            /** @description Conflict */
            409: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["Error"];
                };
            };
            /** @description Server error */
            500: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["Error"];
                };
            };
        };
    };
    finalizeBuilds: {
        parameters: {
            query?: never;
            header?: never;
            path?: never;
            cookie?: never;
        };
        requestBody?: {
            content: {
                "application/json": {
                    parallelNonce: string;
                };
            };
        };
        responses: {
            /** @description Result of build finalization */
            200: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": {
                        builds: components["schemas"]["Build"][];
                    };
                };
            };
            /** @description Invalid parameters */
            400: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["Error"];
                };
            };
            /** @description Unauthorized */
            401: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["Error"];
                };
            };
            /** @description Forbidden */
            403: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["Error"];
                };
            };
            /** @description Not found */
            404: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["Error"];
                };
            };
            /** @description Conflict */
            409: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["Error"];
                };
            };
            /** @description Server error */
            500: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["Error"];
                };
            };
        };
    };
    updateBuild: {
        parameters: {
            query?: never;
            header?: never;
            path: {
                /** @description A unique identifier for the build */
                buildId: components["schemas"]["buildId"];
            };
            cookie?: never;
        };
        requestBody?: {
            content: {
                "application/json": {
                    screenshots: components["schemas"]["ScreenshotInput"][];
                    parallel?: boolean | null;
                    parallelTotal?: number | null;
                    parallelIndex?: number | null;
                    metadata?: components["schemas"]["BuildMetadata"];
                };
            };
        };
        responses: {
            /** @description Result of build update */
            200: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": {
                        build: components["schemas"]["Build"];
                    };
                };
            };
            /** @description Invalid parameters */
            400: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["Error"];
                };
            };
            /** @description Unauthorized */
            401: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["Error"];
                };
            };
            /** @description Forbidden */
            403: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["Error"];
                };
            };
            /** @description Not found */
            404: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["Error"];
                };
            };
            /** @description Conflict */
            409: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["Error"];
                };
            };
            /** @description Server error */
            500: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["Error"];
                };
            };
        };
    };
    getAuthProject: {
        parameters: {
            query?: never;
            header?: never;
            path?: never;
            cookie?: never;
        };
        requestBody?: never;
        responses: {
            /** @description Project */
            200: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["Project"];
                };
            };
            /** @description Unauthorized */
            401: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["Error"];
                };
            };
            /** @description Server error */
            500: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["Error"];
                };
            };
        };
    };
    getAuthProjectBuilds: {
        parameters: {
            query?: {
                /** @description Number of items per page (max 100) */
                perPage?: string;
                /** @description Page number */
                page?: string;
                commit?: components["schemas"]["Sha1Hash"];
                /** @description Only return the latest builds created, unique by name and commit. */
                distinctName?: string;
            };
            header?: never;
            path?: never;
            cookie?: never;
        };
        requestBody?: never;
        responses: {
            /** @description List of builds */
            200: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": {
                        pageInfo: components["schemas"]["PageInfo"];
                        results: components["schemas"]["Build"][];
                    };
                };
            };
            /** @description Invalid parameters */
            400: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["Error"];
                };
            };
            /** @description Unauthorized */
            401: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["Error"];
                };
            };
            /** @description Server error */
            500: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": components["schemas"]["Error"];
                };
            };
        };
    };
}

type schema_$defs = $defs;
type schema_components = components;
type schema_operations = operations;
type schema_paths = paths;
type schema_webhooks = webhooks;
declare namespace schema {
  export type { schema_$defs as $defs, schema_components as components, schema_operations as operations, schema_paths as paths, schema_webhooks as webhooks };
}

type ArgosAPIClient = ReturnType<typeof createClient>;
/**
 * Create Argos API client.
 */
declare function createClient(options: {
    baseUrl?: string;
    authToken: string;
}): openapi_fetch.Client<paths, `${string}/${string}`>;
declare class APIError extends Error {
    constructor(message: string);
}
/**
 * Handle API errors.
 */
declare function throwAPIError(error: {
    error: string;
    details?: {
        message: string;
    }[];
}): never;

export { APIError, type ArgosAPIClient, schema as ArgosAPISchema, createClient, throwAPIError };
