feat: docs
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Aravinth Manivannan 2023-09-19 02:42:52 +05:30
parent 1fc88f8166
commit 8c5d70a5f7
Signed by: realaravinth
GPG key ID: F8F50389936984FF
7 changed files with 23 additions and 1 deletions

View file

@ -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": "",

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -13,6 +13,9 @@ type Subject = {
state: string;
};
/**
* Subset schema of notification object returned by Forgejo REST API
*/
type Notification = {
id: number;
repository: Repository;

View file

@ -4,6 +4,9 @@
import User from "./user";
/**
* Subset schema of repository object returned by Forgejo REST API
*/
type Repository = {
id: number;
name: string;

View file

@ -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;