UNPKG

@argos-ci/api-client

Version:
664 lines (659 loc) 23 kB
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 A unique identifier for the build * @example 12345 */ BuildId: string; /** @description Screenshot input */ ScreenshotInput: { key: string; name: string; baseName?: string | null; parentName?: string | null; metadata?: { /** * @description Ignored. Can be set to get completions, validations and documentation in some editors. * @example https://api.argos-ci.com/v2/screenshot-metadata.json */ $schema?: string; /** @description The URL of the page that was screenshotted */ url?: string | null; /** @description An URL to an accessible preview of the screenshot */ previewUrl?: string | null; viewport?: { /** @description The width of the viewport */ width: number; /** @description The height of the viewport */ height: number; } | null; /** @description The color scheme when the screenshot was taken */ colorScheme?: ("light" | "dark") | null; /** @description The media type when the screenshot was taken */ mediaType?: ("screen" | "print") | null; test?: ({ /** @description The unique identifier of the test */ id?: string | null; /** @description The title of the test */ title: string; /** @description The path of titles leading to the test */ titlePath: string[]; /** @description The number of retries for the test */ retries?: number | null; /** @description The current retry count */ retry?: number | null; /** @description The repeat count for the test */ repeat?: number | null; /** @description The location of the test in the source code */ location?: { /** @description The located file */ file: string; /** @description The line number in the file */ line: number; /** @description The column number in the file */ column: number; }; /** @description Annotations associated to the test */ annotations?: { /** @description The type of annotation */ type: string; /** @description The description of the annotation */ description?: string; /** @description The location of the annotation in the source code */ location?: { /** @description The located file */ file: string; /** @description The line number in the file */ line: number; /** @description The column number in the file */ column: number; }; }[]; } | null) | null; browser?: { /** @description The name of the browser */ name: string; /** @description The version of the browser */ version: string; } | null; /** @description The automation library that generated the screenshot */ automationLibrary: { /** @description The name of the automation library */ name: string; /** @description The version of the automation library */ version: string; }; /** @description The Argos SDK that generated the screenshot */ sdk: { /** @description The name of the Argos SDK */ name: string; /** @description The version of the Argos SDK */ version: string; }; } | null; pwTraceKey?: string | null; threshold?: number | null; /** @default image/png */ contentType: string; }; /** @description Build metadata */ BuildMetadata: { testReport?: { /** @enum {string} */ status: "passed" | "failed" | "timedout" | "interrupted"; stats?: { startTime?: string; duration?: number; }; }; }; /** @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 Error response */ Error: { error: string; details?: { message: string; }[]; }; /** @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": { /** @description The commit the build is running on */ commit: components["schemas"]["Sha1Hash"]; /** @description The branch the build is running on */ branch: string; /** @description Keys of screenshot files */ screenshotKeys: components["schemas"]["Sha256Hash"][]; /** @description Keys of Playwright trace files */ pwTraceKeys?: components["schemas"]["Sha256Hash"][]; /** @description The name of the build (for multi-build setups) */ name?: string | null; /** @description Whether to run the build in parallel */ parallel?: boolean | null; /** @description A unique nonce for the parallel build */ parallelNonce?: string | null; /** @description The pull request number */ prNumber?: number | null; /** @description The head commit of the pull request */ prHeadCommit?: components["schemas"]["Sha1Hash"] | null; /** @description The commit to use as a reference for the build */ referenceCommit?: components["schemas"]["Sha1Hash"] | null; /** @description The branch to use as a reference for the build */ referenceBranch?: string | null; /** @description The parent commits of the build */ parentCommits?: components["schemas"]["Sha1Hash"][] | null; /** @description The mode in which the build is running */ mode?: ("ci" | "monitoring") | null; /** @description The CI provider being used */ ciProvider?: string | null; /** @description The version of the Argos SDK being used */ argosSdk?: string | null; /** @description The ID of the current run */ runId?: string | null; /** @description The attempt number of the current run */ runAttempt?: number | null; /** @description Whether the build was skipped, not comparing anything and always succeeding */ skipped?: boolean | 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: components["schemas"]["Error"]): never; export { APIError, type ArgosAPIClient, schema as ArgosAPISchema, createClient, throwAPIError };