Files
gitlab/ts/gitlab.interfaces.ts

248 lines
5.8 KiB
TypeScript

// ---------------------------------------------------------------------------
// Common
// ---------------------------------------------------------------------------
export interface ITestConnectionResult {
ok: boolean;
error?: string;
}
export interface IListOptions {
search?: string;
page?: number;
perPage?: number;
}
// ---------------------------------------------------------------------------
// Pipeline / Job list options
// ---------------------------------------------------------------------------
export interface IPipelineListOptions extends IListOptions {
/** Filter by pipeline status */
status?: string;
/** Filter by branch or tag ref */
ref?: string;
/** Filter by trigger source (push, web, trigger, schedule, api, external, pipeline, chat, merge_request_event, …) */
source?: string;
/** Filter by scope (running, pending, finished, branches, tags) */
scope?: string;
/** Filter by the user who triggered the pipeline */
username?: string;
/** Return pipelines updated after this ISO 8601 date */
updatedAfter?: string;
/** Return pipelines updated before this ISO 8601 date */
updatedBefore?: string;
/** Order by field (id, status, ref, updated_at, user_id). Default: id */
orderBy?: string;
/** Sort direction (asc, desc). Default: desc */
sort?: string;
}
export interface IJobListOptions extends IListOptions {
/** Filter by job scope(s) */
scope?: string[];
}
// ---------------------------------------------------------------------------
// Users
// ---------------------------------------------------------------------------
export interface IGitLabUser {
id: number;
username: string;
name: string;
email: string;
avatar_url: string;
web_url: string;
state: string;
}
// ---------------------------------------------------------------------------
// Projects
// ---------------------------------------------------------------------------
export interface IGitLabProject {
id: number;
name: string;
path_with_namespace: string;
description: string;
default_branch: string;
web_url: string;
visibility: string;
topics: string[];
last_activity_at: string;
}
// ---------------------------------------------------------------------------
// Groups
// ---------------------------------------------------------------------------
export interface IGitLabGroup {
id: number;
name: string;
full_path: string;
description: string;
web_url: string;
visibility: string;
}
// ---------------------------------------------------------------------------
// Variables
// ---------------------------------------------------------------------------
export interface IGitLabVariable {
key: string;
value: string;
variable_type: string;
protected: boolean;
masked: boolean;
environment_scope: string;
}
export interface IVariableOptions {
protected?: boolean;
masked?: boolean;
environment_scope?: string;
}
// ---------------------------------------------------------------------------
// Protected Branches
// ---------------------------------------------------------------------------
export interface IGitLabProtectedBranch {
id: number;
name: string;
allow_force_push: boolean;
}
// ---------------------------------------------------------------------------
// Pipelines
// ---------------------------------------------------------------------------
export interface IGitLabPipeline {
id: number;
iid: number;
project_id: number;
status: string;
ref: string;
sha: string;
before_sha: string;
tag: boolean;
web_url: string;
duration: number;
queued_duration: number;
created_at: string;
updated_at: string;
started_at: string;
finished_at: string;
source: string;
coverage: string;
user: IGitLabUser;
detailed_status: {
icon: string;
text: string;
label: string;
group: string;
tooltip: string;
has_details: boolean;
details_path: string;
favicon: string;
};
yaml_errors: string;
}
export interface IGitLabPipelineVariable {
key: string;
value: string;
variable_type: string;
}
export interface IGitLabTestReport {
total_time: number;
total_count: number;
success_count: number;
failed_count: number;
skipped_count: number;
error_count: number;
test_suites: IGitLabTestSuite[];
}
export interface IGitLabTestSuite {
name: string;
total_time: number;
total_count: number;
success_count: number;
failed_count: number;
skipped_count: number;
error_count: number;
test_cases: IGitLabTestCase[];
}
export interface IGitLabTestCase {
status: string;
name: string;
classname: string;
execution_time: number;
system_output: string;
stack_trace: string;
}
// ---------------------------------------------------------------------------
// Jobs
// ---------------------------------------------------------------------------
export interface IGitLabJob {
id: number;
name: string;
stage: string;
status: string;
ref: string;
tag: boolean;
web_url: string;
created_at: string;
started_at: string;
finished_at: string;
duration: number;
queued_duration: number;
coverage: number;
allow_failure: boolean;
failure_reason: string;
pipeline: {
id: number;
project_id: number;
ref: string;
sha: string;
status: string;
};
user: IGitLabUser;
runner: {
id: number;
description: string;
active: boolean;
is_shared: boolean;
};
artifacts: {
filename: string;
size: number;
}[];
artifacts_expire_at: string;
}
// ---------------------------------------------------------------------------
// Branches & Tags
// ---------------------------------------------------------------------------
export interface IGitLabBranch {
name: string;
commit: {
id: string;
};
}
export interface IGitLabTag {
name: string;
commit: {
id: string;
};
}