This commit is contained in:
parent
1fc88f8166
commit
8c5d70a5f7
7 changed files with 23 additions and 1 deletions
|
@ -7,7 +7,7 @@
|
|||
"build": "swc ./src/index.ts -o dist/index.js",
|
||||
"lint": "prettier --write ./src/*",
|
||||
"test": "jest",
|
||||
"doc": "typedoc ./src/index.ts"
|
||||
"doc": "typedoc ./src/index.ts ./src/auth.ts ./src/spec/**"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
|
|
|
@ -32,6 +32,9 @@ class Forgejo {
|
|||
this.token = new Auth(token);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get access token
|
||||
*/
|
||||
getTokenAuth(): Auth {
|
||||
if (this.token) {
|
||||
return this.token;
|
||||
|
@ -40,6 +43,9 @@ class Forgejo {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get access token in header format for the fetch API
|
||||
*/
|
||||
getTokenAuthHeader() {
|
||||
return { Authorization: `token ${this.getTokenAuth().getToken()}` };
|
||||
}
|
||||
|
@ -201,6 +207,9 @@ class Forgejo {
|
|||
return issue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch and save comments for the issue objects
|
||||
*/
|
||||
async getCommentsForIssue(issue: Issue): Promise<Issue> {
|
||||
// TODO: check if issue.number != issue.id causes problems. I'm assuming
|
||||
// Issue.number is the local repository issue ID and issue.id is DB ID
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
|
||||
import User from "./user";
|
||||
|
||||
/**
|
||||
* Subset schema of comment object returned by Forgejo REST API
|
||||
*/
|
||||
type Comment = {
|
||||
id: number;
|
||||
html_url: URL;
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
import User from "./user";
|
||||
import Comment from "./comments";
|
||||
|
||||
/**
|
||||
* Subset schema of issue object returned by Forgejo REST API
|
||||
*/
|
||||
type Issue = {
|
||||
id: number;
|
||||
url: URL;
|
||||
|
|
|
@ -13,6 +13,9 @@ type Subject = {
|
|||
state: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Subset schema of notification object returned by Forgejo REST API
|
||||
*/
|
||||
type Notification = {
|
||||
id: number;
|
||||
repository: Repository;
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
|
||||
import User from "./user";
|
||||
|
||||
/**
|
||||
* Subset schema of repository object returned by Forgejo REST API
|
||||
*/
|
||||
type Repository = {
|
||||
id: number;
|
||||
name: string;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/** Subset schema of user object returned by Forgejo REST API. */
|
||||
type User = {
|
||||
id: number;
|
||||
login: string;
|
||||
|
|
Loading…
Reference in a new issue