feat: add Forgejo API response type defs
This commit is contained in:
parent
a032bba837
commit
506aaaf16d
6 changed files with 96 additions and 0 deletions
14
src/spec/comments.ts
Normal file
14
src/spec/comments.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import User from "./user";
|
||||
|
||||
type Comment = {
|
||||
id: number;
|
||||
html_url: URL;
|
||||
pull_request_url?: URL;
|
||||
issue_url?: URL;
|
||||
user: User;
|
||||
body: string;
|
||||
created_at: string | Date;
|
||||
updated_at: string | Date;
|
||||
};
|
||||
|
||||
export default Comment;
|
32
src/spec/issue.ts
Normal file
32
src/spec/issue.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
import User from "./user";
|
||||
import Comment from "./comments";
|
||||
|
||||
type Issue = {
|
||||
id: number;
|
||||
url: URL;
|
||||
html_url: URL;
|
||||
number: 1;
|
||||
user: User;
|
||||
title: string;
|
||||
body: string;
|
||||
assignee?: User;
|
||||
assignees?: Array<User>;
|
||||
state: string;
|
||||
is_locked: boolean;
|
||||
comments: number;
|
||||
created_at: string | Date;
|
||||
updated_at: string | Date;
|
||||
closed_at?: string | Date;
|
||||
due_date?: string;
|
||||
repository: MiniRepository;
|
||||
lazy_comments_data?: Array<Comment>;
|
||||
};
|
||||
|
||||
type MiniRepository = {
|
||||
id: number;
|
||||
name: string;
|
||||
owner: string;
|
||||
full_name: string;
|
||||
};
|
||||
|
||||
export default Issue;
|
20
src/spec/notification.ts
Normal file
20
src/spec/notification.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import Repository from "./repository";
|
||||
|
||||
type Subject = {
|
||||
title: string;
|
||||
url: URL;
|
||||
latest_comment_url: string;
|
||||
type: string; // Issue
|
||||
state: string;
|
||||
};
|
||||
|
||||
type Notification = {
|
||||
id: number;
|
||||
repository: Repository;
|
||||
subject: Subject;
|
||||
unread: boolean;
|
||||
pinned: boolean;
|
||||
url: URL;
|
||||
};
|
||||
|
||||
export default Notification;
|
8
src/spec/owner.ts
Normal file
8
src/spec/owner.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
type Repository = {
|
||||
id: number;
|
||||
name: string;
|
||||
full_name: string;
|
||||
html_url: string;
|
||||
};
|
||||
|
||||
export default Repository;
|
11
src/spec/repository.ts
Normal file
11
src/spec/repository.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
import User from "./user";
|
||||
|
||||
type Repository = {
|
||||
id: number;
|
||||
name: string;
|
||||
full_name: string;
|
||||
html_url: string;
|
||||
owner: User;
|
||||
};
|
||||
|
||||
export default Repository;
|
11
src/spec/user.ts
Normal file
11
src/spec/user.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
type User = {
|
||||
id: number;
|
||||
login: string;
|
||||
username: string;
|
||||
email: string;
|
||||
avatar_url: URL;
|
||||
full_name: string;
|
||||
html_url: string;
|
||||
};
|
||||
|
||||
export default User;
|
Loading…
Reference in a new issue