Compare commits
2 Commits
47399c163e
...
f5fe8a90e5
Author | SHA1 | Date |
---|---|---|
Aravinth Manivannan | f5fe8a90e5 | |
Aravinth Manivannan | fa1d7427ab |
44
package.json
44
package.json
|
@ -1,17 +1,47 @@
|
|||
{
|
||||
"author": "Aravinth Manivannan <realaravinth@batsense.net>",
|
||||
"description": "JS library to interact with Forgejo API to work with notification",
|
||||
"version": "0.1.0-alpha-1",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"type": "module",
|
||||
"module": "dist/web.js",
|
||||
"main": "dist/web.js",
|
||||
"keywords": [
|
||||
"Forgejo",
|
||||
"ForgeFlux"
|
||||
],
|
||||
"homepage": "https://forgejo-notifications-core.docs.forgeflux.org/",
|
||||
"files": [
|
||||
"dist/web.js",
|
||||
"dist/web.js.map",
|
||||
"package.json",
|
||||
"pnpm-lock.yaml"
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://git.batsense.net/realaravinth/forgejo-notifications-core/issues",
|
||||
"email": "realaravinth@batsense.net"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "http://batsense.net/donate"
|
||||
},
|
||||
{
|
||||
"type": "liberapay",
|
||||
"url": "https://liberapay.com/realaravinth"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://git.batsense.net/realaravinth/forgejo-notifications-core/"
|
||||
},
|
||||
"name": "forgejo-notifications-core",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "spack",
|
||||
"build": "swc ./src/index.ts -o ./dist/index.js && spack --config ./spack.config.cjs",
|
||||
"lint": "prettier --write ./src/*",
|
||||
"test": "jest",
|
||||
"doc": "typedoc ./src/index.ts"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@jest/globals": "^29.7.0",
|
||||
"@swc/cli": "^0.1.62",
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
module.exports = {
|
||||
entry: {
|
||||
web: __dirname + "/src/index.ts",
|
||||
},
|
||||
output: {
|
||||
path: __dirname + "/dist",
|
||||
},
|
||||
};
|
|
@ -57,6 +57,7 @@ class Forgejo {
|
|||
this.url.pathname = "/api/v1/user";
|
||||
let res = await fetch(this.url, {
|
||||
method: "GET",
|
||||
credentials: "omit",
|
||||
headers: this.getTokenAuthHeader(),
|
||||
});
|
||||
return await res.json();
|
||||
|
@ -67,8 +68,11 @@ class Forgejo {
|
|||
*/
|
||||
async getNotifications(): Promise<Array<Notification>> {
|
||||
this.url.pathname = "/api/v1/notifications";
|
||||
this.url.pathname = "/api/v1/notifications";
|
||||
console.log(this.url);
|
||||
let res = await fetch(this.url, {
|
||||
method: "GET",
|
||||
credentials: "omit",
|
||||
headers: this.getTokenAuthHeader(),
|
||||
});
|
||||
|
||||
|
@ -81,6 +85,7 @@ class Forgejo {
|
|||
this.url.pathname = "/api/v1/notifications/new";
|
||||
let res = await fetch(this.url, {
|
||||
method: "GET",
|
||||
credentials: "omit",
|
||||
headers: this.getTokenAuthHeader(),
|
||||
});
|
||||
|
||||
|
@ -96,6 +101,7 @@ class Forgejo {
|
|||
this.url.pathname = `/api/v1/notifications/threads/${id}`;
|
||||
let res = await fetch(this.url, {
|
||||
method: "GET",
|
||||
credentials: "omit",
|
||||
headers: this.getTokenAuthHeader(),
|
||||
});
|
||||
return await res.json();
|
||||
|
@ -179,6 +185,7 @@ class Forgejo {
|
|||
this.url.pathname = `/api/v1/repos/${owner}/${repo}/issues/${id}`;
|
||||
let res = await fetch(this.url, {
|
||||
method: "GET",
|
||||
credentials: "omit",
|
||||
headers: this.getTokenAuthHeader(),
|
||||
});
|
||||
let issue = await res.json();
|
||||
|
@ -211,6 +218,7 @@ class Forgejo {
|
|||
this.url.pathname = `/api/v1/repos/${issue.repository.owner}/${issue.repository.name}/issues/${issue.number}/comments`;
|
||||
let res = await fetch(this.url, {
|
||||
method: "GET",
|
||||
credentials: "omit",
|
||||
headers: this.getTokenAuthHeader(),
|
||||
});
|
||||
let c: Array<Comment> = await res.json();
|
||||
|
@ -235,3 +243,4 @@ class Forgejo {
|
|||
}
|
||||
|
||||
export default Forgejo;
|
||||
//export { Notification, Issue, Repository, Comment, User };
|
||||
|
|
Loading…
Reference in New Issue