abigor
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

Abigor

npm version codecov Greenkeeper badge

Work with Loop users in Node.js

Getting Started

Follow these simple instructions to get set up and ready to use abigor.

Via npm 📦

npm is the package manager for javascript

Read about npm here 💩

(I personally like using yarn 🙉 )

View the npm page for abigor here 📄

Installing

Install abigor just like any other package: 📦

With npm:

npm i -s abigor

With Yarn:

yarn add abigor

And use it:

const abigor = require('abigor');

Or, with TypeScript

import * as abigor from 'abigor'

or commands individually

import { User, Wallet } from 'abigor'

Usage

Assuming that abigor is assigned to the abigor variables 🙊

abigor.getDay

Gets the current day 📆

abigor.getDay()Promise<number>

abigor.today

Alias of getDay

abigor.today()Promise<number>

abigor.clauneck

This is clauneck 🍦

abigor.Request

A class for a Request

new abigor.Request({
  wallet?: string | Wallet,
  walletPassword?: string,
  // Pending request ID
  id?: string,
  to?: string | User,
  from?: string | User,
  fromPassword?: string 
})

abigor.Request Variables

Variables you might want

declare class abigor.Request {
  wallet?: Wallet
  id?: string
  to?: User
  from?: User
  invalid?: string
}

abigor.Request.create

This creates the request. Don't do this if the request has already been created.

abigor.Request.create()Promise<Request>

abigor.Request.get

Get the request details

abigor.Request.get()Promise<{
  creatednumber
  forUser
  fromUser
  idstring
  wallet?: {
    contents{
      chipsnumber
      itemsany[]
    }
    historyArray<{
      actionstring
      amountnumber
      usernumber | User
    }>
    idstring
  }
  invalid?: string
}>

abigor.Request.deny

Deny a request

abigor.Request.deny(
  userUser | string,
  password?: string
)Promise<true>

abigor.Request.accept

Accept a request

abigor.Request.accept(
  userUser | string,
  password?: string
)Promise<true>

abigor.request

Sends a request to Bifrons' abigor.

abigor.request(
  pathstring,
  parameters?: object
)Promise<any>

abigor.Wallet

A class for wallets

new abigor.Wallet(id?: string, password?: string)

abigor.Wallet Variables

Variables you might use

declare class abigor.Wallet {
  id?: string,
  password?: string
}

abigor.Wallet.open

Opens a new wallet

abigor.Wallet.open()Promise<Wallet>

abigor.Wallet.close

Closes a wallet

abigor.Wallet.close()Promise<void>

abigor.Wallet.get

Get wallet details

abigor.Wallet.get()Promise<{
  contents{
    chipsnumber
    itemsany[]
  }
  historyArray<{
    actionstring
    amountnumber
    usernumber | User
  }>
  idstring
}>

abigor.Wallet.chips

Get a wallet's chips

abigor.Wallet.chips()Promise<number>

abigor.Wallet.historyWithIDs

Get a wallet's history

abigor.Wallet.historyWithIDs()Promise<{
  historyArray<{
    actionstring
    amountnumber
    usernumber
  }
}>

abigor.Wallet.history

Get a wallet's history

abigor.Wallet.history()Promise<{
  historyArray<{
    actionstring
    amountnumber
    userUser
  }
}>

abigor.Wallet.add

Adds chips to a wallet

abigor.Wallet.add(
  amountnumber,
  userstring | User,
  password?: string
)Promise<Wallet>

abigor.Wallet.take

Removes chips to a wallet

abigor.Wallet.add(
  amountnumber,
  userstring | User,
  password?: string
)Promise<Wallet>

abigor.getChips

Get chips information.

abigor.getChips(
  handle?: string | User,
  day?: number
)Promise<number | {
    [idstring]{
        valuenumber;
    };
}>

abigor.User

A class for users

new abigor.User(handle?: string, password?: string)

abigor.User Variables

Variables you might use

declare class abigor.User {
  handle?: string,
  password?: string
}

abigor.User.chips

Get a user's chips

abigor.User.chips(day?: number)Promise<number>

abigor.User.id

Get a user's ID

abigor.User.chips()Promise<number>

abigor.User.name

Get a user's name

abigor.User.name()Promise<string>

abigor.User.fullName

Get a user's full name

abigor.User.fullName()Promise<string>

abigor.User.setFullName

Ser a user's full name

abigor.User.setFullName(
  fullName?: string
)Promise<any>

abigor.getLoggedInUser

Get the user that is currently logged in

abigor.getLoggedInUser()Promise<undefined | User>

abigor.logged

Alias of abigor.getLoggedInUser

abigor.logged()Promise<undefined | User>

abigor.sessionInfo

Gets the current session's info

abigor.sessionInfo()Promise<{
  session{
    idstring;
    pskstring;
  };
  userUser;
} | undefined>

abigor.sessionMatch

Checks if a session's information is correct (you can use this to make sure people aren't faking identity!)

abigor.sessionMatch(
  id?: number,
  sessionID?: string,
  sessionPsk?: string
)Promise<any>

abigor.sessionClose

Closes a session, non-current sessions shouldn't be open!

abigor.sessionClose(
  id?: number,
  sessionID?: string,
  sessionPsk?: string
)Promise<any>

Wrapping Up

If you catch something or want to work on abigor, it is open-sourced on GitHub!

Thanks for reading!

Questions? Comments? Concerns? email nullaeus@gmail.com or join Loop's Discord server

Readme

Keywords

none

Package Sidebar

Install

npm i abigor

Weekly Downloads

1

Version

0.1.4

License

MIT

Unpacked Size

42.9 kB

Total Files

15

Last publish

Collaborators

  • nilaeus