export type Method = 'GET' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'POST' | 'PUT' | 'PATCH'; export type UserState = 'active' | 'blocked'; export type IFileEncoding = 'text' | 'base64'; export enum AccessLevel { GUEST = 10, FOLLOWER = 15, REPORTER = 20, DEVELOPER = 30, MASTER = 40, OWNER = 50, } // project id could be string like 'orange-ci/orangeci' or a number like 7171 export type ProjectId = string | number; // user id could be string like 'maplemiao' or a number like 2020 export type UserId = string | number; export interface IPerPageParams { /** 分页(默认值:1) */ page?: number; /** 默认页面大小(默认值: 20,最大值: 100) */ per_page?: number; } export interface IProject { id: number; description: string; public: boolean; archived: boolean; visibility_level: number; namespace: { id: number; name: string; path: string; web_url: string; description: string; avatar_url: string | null; access_level?: number; }; name: string; name_with_namespace: string; path: string; path_with_namespace: string; default_branch: string; ssh_url_to_repo: string; http_url_to_repo: string; https_url_to_repo: string; web_url: string; tag_list: string[]; issues_enabled: boolean; merge_requests_enabled: boolean; wiki_enabled: boolean; snippets_enabled: boolean; review_enabled: boolean; fork_enabled: boolean; tag_name_regex: string | null; tag_create_push_level: number; created_at: string; last_activity_at: string; creator_id: number; avatar_url: string | null; watchs_count: number; stars_count: number; forks_count: number; config_storage: { limit_lfs_file_size: number; limit_size: number; limit_file_size: number; limit_lfs_size: number; }; forked_from_project: | string | { path: string; path_with_namespace: string; name: string; id: number; name_with_namespace: string; }; statistics: { commit_count: number; repository_size: number; }; owner?: IUser; branch_name_regex: string | null; } export interface IUser { id: number; username: string; web_url: string; name: string; state: UserState; avatar_url: string | null; access_level?: number; } export interface IGroupUser extends IUser { access_level: AccessLevel; } export interface IReviewer extends IUser { type: string; review_state: string; created_at: string; updated_at: string; } export interface IMilestone { id: number; project_id: number; title: string; state: string; iid: number; due_date: string | null; created_at: string; updated_at: string; description: string; } export interface IFileDiff { old_path: string; new_path: string; a_mode: number; b_mode: number; diff: string; new_file: boolean; renamed_file: boolean; deleted_file: boolean; is_too_large: boolean; is_collapse: boolean; } export type ITreeNodeType = 'blob' | 'tree'; export interface ITreeNode { id: string; name: string; type: ITreeNodeType; mode: string; } export interface IFile { file_name: string; file_path: string; size: number; ref: string; blob_id: string; commit_id: string; content: string; encoding: 'base64'; } export interface ICommit { id: string; short_id: string; title: string | null; author_name: string; author_email: string; created_at: string; message: string; parent_ids?: string[]; authored_date?: string; committed_date?: string; committer_name?: string; committer_email?: string; } export type ICommitStatus = 'pending' | 'success' | 'error' | 'failure'; export interface IBranch { name: string; protected: boolean; developers_can_push: boolean; developers_can_merge: boolean; commit: ICommit; description: string; branch_type: { name: string; color: string; }; } export interface ITag { name: string; message: string; commit: ICommit; } export type IReleaseType = 'release'; export interface IRelease { ref: { name: string; message: string; commit: ICommit; }; id: number; project_id: number; tag: string; title: string; type: IReleaseType; attachments: IReleaseAttachment[]; description: string | null; created_at: string; updated_at: string | null; author: string | null; } export interface IReleaseAttachment { name: string; type: string; size: number; created_at: string; } export interface IShareGroup { project_id: number; group_id: number; group_access: AccessLevel; created_at: string; updated_at: string; } export interface INote { id: number; body: string; attachment: null | any; author: IUser; created_at: string; system: boolean; file_path: string; noteCommentList: IComment[]; } export interface IComment { comment: number; created_at: string; author: IUser; }