ruivieira / srhtclient

A Deno client to sourcehut REST API

Home Page:https://deno.land/x/srhtclient

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

builds.sr.ht status test

srht-client

A Deno client to sourcehut REST API.

Usage

  • The client requires an OAuth token.
  • If no base is specified for the REST API endpoints, https://sr.ht is the default.

Imports are available from:

Issue tracker

An example of using the issue tracker's API.

Initialisation of the Todo issue tracker manager:

import {Todo} from "https://deno.land/x/srhtclient/rest/todo.ts";

const token: string = "your token";

const todo = new Todo(token);

Get the name of all trackers associated with this user:

const trackers = await todo.getAllTrackers();

trackers.results
    .forEach((tracker) => console.log(tracker.name));

Create a new ticket called test on the deno tracker.

todo.createTicket("deno", {
    title: "test",
    description: "Just testing the API",
});

List all tickets on a tracker

todo.getAllTrackerTickets("deno")
    .then((r) => console.log(r));

Update a ticket

import {
    TicketStatus,
    TicketUpdate,
} from "https://deno.land/x/srhtclient/rest/todo.ts";

const update: TicketUpdate = {
    comment: "This is a comment from srhtclient",
    status: TicketStatus.CONFIRMED,
};

await todo.updateTrackerTicket("deno", 6, update);

About

A Deno client to sourcehut REST API

https://deno.land/x/srhtclient

License:GNU Affero General Public License v3.0


Languages

Language:TypeScript 100.0%