Skip to content

bugout-dev/bugout-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

503107b · Mar 15, 2022

History

65 Commits
May 13, 2021
Mar 15, 2022
Jul 7, 2021
May 13, 2021
Jul 19, 2021
Jul 19, 2021
Aug 11, 2021
May 13, 2021
Mar 9, 2022
Mar 15, 2022
Jun 1, 2021

Repository files navigation

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