Files
openstapps/src/types.ts
2019-01-28 16:14:14 +01:00

262 lines
5.1 KiB
TypeScript

/*
* Copyright (C) 2018 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* GitLab label
*/
export interface Label {
color: string;
description?: string;
name: string;
}
/**
* GitLab commit
*/
export interface Commit {
author_email: string;
author_name: string;
authored_date: string;
committed_date: string;
committer_email: string;
committer_name: string;
id: string;
message: string;
parent_ids: string[];
}
/**
* GitLab tag
*/
export interface Tag {
commit: Commit;
message: string | null;
name: string;
release: null;
}
/**
* GitLab namespace
*/
export interface Namespace {
full_path: string;
id: number;
kind: string;
name: string;
path: string;
}
/**
* GitLab project
*/
export interface Project {
archived: boolean;
avatar_url: string;
container_registry_enabled: boolean;
created_at: string;
creator_id: number;
default_branch: string;
description: string;
forks_count: number;
http_url_to_repo: string;
id: number;
issues_enabled: boolean;
jobs_enabled: boolean;
last_activity_at: string;
lfs_enabled: boolean;
merge_requests_enabled: boolean;
name: string;
name_with_namespace: string;
namespace: Namespace;
only_allow_merge_if_all_discussions_are_resolved: boolean;
only_allow_merge_if_pipeline_succeeds: boolean;
open_issues_count: number;
path: string;
path_with_namespace: string;
public_jobs: boolean;
request_access_enabled: boolean;
shared_runners_enabled: boolean;
shared_with_groups: any[];
snippets_enabled: boolean;
ssh_url_to_repo: string;
star_count: number;
tag_list: string[];
visibility: string;
web_url: string;
wiki_enabled: boolean;
}
/**
* GitLab tree file
*/
export interface TreeFile {
id: string;
mode: string;
name: string;
path: string;
type: string;
}
/**
* A member of a group or a project
*/
export interface Member extends User {
access_level: AccessLevel;
expires_at: string;
}
/**
* Available GitLab access levels
*/
export enum AccessLevel {
Guest = 10,
Reporter = 20,
Developer = 30,
Maintainer = 40,
Owner = 50,
}
/**
* A GitLab milestone
*/
export interface Milestone {
created_at: string;
description: string | null;
due_date: string;
id: number;
iid: number;
project_id: number;
start_date: string;
state: string;
title: string;
updated_at: string;
}
/**
* A GitLab branch
*/
export interface Branch {
commit: Commit;
developers_can_merge: boolean;
developers_can_push: boolean;
merged: boolean;
name: string;
protected: boolean;
}
/**
* A GitLab user
*/
export interface User {
avatar_url: string;
id: number;
name: string;
state: string;
username: string;
web_url: string;
}
/**
* A GitLab issue
*/
export interface Issue extends ThingWithTimeStats {
assignee: User;
assignees: User[];
author: User;
closed_at: string | null;
confidential: boolean;
created_at: string;
description: string | null;
discussion_locked: boolean | null;
downvotes: number;
due_date: string | null;
id: number;
iid: number;
labels: string[];
milestone: Milestone | null;
project_id: number;
state: string;
title: string;
updated_at: string;
upvotes: number;
user_notes_count: number;
web_url: string;
}
/**
* A GitLab merge request
*/
export interface MergeRequest extends ThingWithTimeStats {
assignee: User;
author: User;
created_at: string;
description: string | null;
discussion_locked: boolean | null;
downvotes: number;
force_remove_source_branch: boolean;
id: number;
iid: number;
labels: Label[];
merge_commit_sha: string;
merge_status: string;
merge_when_pipeline_succeeds: boolean;
milestone: Milestone;
project_id: number;
sha: string;
should_remove_source_branch: boolean;
source_branch: string;
source_project_id: number;
state: string;
target_branch: string;
target_project_id: number;
title: string;
updated_at: string;
upvotes: number;
user_notes_count: number;
web_url: string;
work_in_progress: boolean;
}
/**
* A GitLab thing with time stats
*/
export interface ThingWithTimeStats {
time_stats: {
human_time_estimate: number | null;
human_total_time_spent: number | null;
time_estimate: number;
total_time_spent: number;
};
}
/**
* A GitLab group
*/
export interface Group {
id: number;
web_url: string;
name: string;
path: string;
description: string;
visibility: string;
lfs_enabled: boolean;
avatar_url: string;
request_access_enabled: boolean;
full_name: string;
full_path: string;
parent_id: number;
ldap_cn: string;
ldap_access: string;
}