0.1.0 • Published 3 years ago

tripsit-api v0.1.0

Weekly downloads
-
License
WTFPL
Repository
github
Last release
3 years ago

license npm version

tripsit-api

A Node.js wrapper for tripsit.me's API <3

Getting Started

Install the package

npm install tripsit-api

Try it out!

const tripsitAPI = require('tripsit-api');

tripsitAPI.getInteraction("lsd", "mdma")
.then( (data) => {
  console.log(data);
});

This will print:

{
    status: 'Low Risk & Synergy',
    interactionCategoryA: 'lsd',
    interactionCategoryB: 'mdma'
}

Documentation

Some information about this package and tripsit.me's API!

getInteraction(drugA, drugB)

Returns the interaction between drugA and drugB.

status will be one of the following:

  • "Low Risk & Synergy"
  • "Low Risk & No Synergy"
  • "Low Risk & Decrease"
  • "Caution"
  • "Unsafe"
  • "Dangerous"
  • "Unknown"

Information about what these statuses mean can be found here.

{
    status: "status",
    interactionCategoryA: "drugA category name",
    interactionCategoryB: "drugB category name"
}

getDrug(drugName)

Returns information for the given drug.

This returns a lot of information and some of the properties vary depending on the drug! But it'll look something like this:

{
  name: "drug name",
  properties: {
    summary: "description of the drug",
    dose: "all dose types, doses, and dose note",
    effects: "effect, effect, ...",
    aliases: [ "alias", ... ],
    categories: [ "category name", ... ],
    duration: "formatted duration",
    onset: "formatted onset",
    half-life: "formatted half life",
    after-effects: "formatted after effects",
    wiki: "url"
  },
  aliases: [ "alias", ... ],
  categories: [ "category name", ... ],
  formatted_dose: {
    "Dose Type": {
      Light: "int-int unit",
      Common: "int-int unit",
      Strong: "int-int unit",
      Heavy: "int unit+",
    },
    ...
  },
  formatted_duration: {
    value: "int-int",
    _unit: "unit"
  },
  formatted_onset: {
    value: "int-int",
    _unit: "unit"
  },
  formatted_aftereffects: {
    value: "int-int",
    _unit: "unit"
  },
  formatted_effects: [ "effect name", ... ],
  pretty_name: "Pretty Capitalized Drug Name",
  dose_note: "Important note regarding the dose"
  links: {
    "link title": "url",
    ...
  },
  sources: {
    _general: [
      "brief description of the source - url",
      ...
    ]
  },
  pweffects: {
    "effect name": "url to psychonautwiki page for effect",
    ...
  }
}

getAllDrugNames()

Returns an array of strings. This array includes every drug name.

[
  "name",
  ...
]

getAllDrugNamesByCategory(category)

Returns an array of strings. This array includes every drug name that fits the given category, not including aliases.

[
  "name",
  ...
]

getAllDrugs()

Returns an array of every single drug. Each drug is in the same format as getDrug().

[
  {drug object},
  ...
]

getAllCategories()

Returns a list of all categories.

[
  {
    name: "category name",
    description: "description",
    wiki: "url"
  },
  ...
]

getAllDrugAliases()

Returns an array of strings. This array includes all drug names and aliases. Aliases are valid inputs for getDrug() and getInteraction().

[
  "name",
  "alias",
  ...
]

Errors

Any errors, like an invalid drug or category name, will return the following:

{
  err: true,
  msg: "some error message"
}