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.
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)