@bugout/bugout-js
TypeScript icon, indicating that this package has built-in type declarations

0.0.16 • Public • Published

bugout-js

JavaScript client library for Bugout API

Setup

  • Install package with npm
npm install --save @bugout/bugout-js
  • Example of usage, just fill token, journal_id and entry_id with proper values from your account. Or remove unnecessary variables and API calls.
import BugoutClient, { BugoutTypes } from "@bugout/bugout-js"

const bugout = new BugoutClient()

bugout.pingBrood().then((response: BugoutTypes.BugoutPing) => console.log(response))

const token: string = ""
const journalId: string = ""
const entryId: string = ""

bugout
	.getUser(token)
	.then((response: BugoutTypes.BugoutUser) => {
		const user = response
		console.log(`User name is ${user.username}`)
	})
	.catch(() => console.log("An error occurred"))

bugout
	.getEntry(token, journalId, entryId)
	.then((response: BugoutTypes.BugoutJournalEntry) => console.log(JSON.stringify(response, null, 2)))
	.catch(() => console.log("An error occurred"))

bugout
	.search(token, journalId, "your query")
	.then((response: BugoutTypes.BugoutSearchResults) => console.log(JSON.stringify(response, null, 2)))
	.catch(() => console.log("An error occurred"))

Readme

Keywords

Package Sidebar

Install

npm i @bugout/bugout-js

Weekly Downloads

13

Version

0.0.16

License

ISC

Unpacked Size

78.4 kB

Total Files

16

Last publish

Collaborators

  • bugout-sergei
  • nkashy1