forgejo-js
v9.0.1
Published
[![NPM Version](https://img.shields.io/npm/v/forgejo-js)](https://www.npmjs.com/package/forgejo-js) [![NPM Types](https://img.shields.io/npm/types/forgejo-js)](https://www.npmjs.com/package/forgejo-js/) [![NPM license](https://img.shields.io/npm/l/forgejo
Downloads
76
Readme
Forgejo-js api client with Typescript support
Forgejo-js is an api client automatically created from the official Open api definition of Forgejo. The client uses the Fetch Api (native browser support) to make requests. For node you can use cross-fetch to polyfill the Fetch Api.
Version mapping
The major and minor version of this library is mapped to the version of the Forgejo api. The patch version of this library is incremented for every release and uses the latest patch version of Forgejo.
| Forgejo-js | Forgejo | | ---------- | ---------- | | 1.21.x | 1.21 (dev) | | 9.0.x | 9.0 |
Examples
Browser
import { forgejoApi } from 'forgejo-js';
const api = forgejoApi('https://codeberg.org/', {
token: 'access-token', // generate one at https://forgejo.example.com/user/settings/applications
});
const repo = api.repos.repoGet('anbraten', 'forgejo-js');
console.log(repo);
Node.js
const { forgejoApi } = require('forgejo-js');
const fetch = require('cross-fetch'); // You have to use a fetch compatible polyfill like cross-fetch for Node.JS
const api = forgejoApi('https://codeberg.org/', {
token: 'access-token', // generate one at https://forgejo.example.com/user/settings/applications
customFetch: fetch,
});
const repo = api.repos.repoGet('anbraten', 'forgejo-js');
console.log(repo);