@winm2m/argos-api

0.3.1 • Public • Published

@winm2m/argos-api

Description

An API for the Argos project, and also could be used as a library as general CRUD purposes.

Installation

npm install --save @winm2m/argos-api

Usage

const { API } = require('@winm2m/argos-api')

const API_PREFIX = 'https://wherever.you.host'
const API_VERSION = '0.3.1' // current version of this package

const api = new API(API_PREFIX, API_VERSION)

var result

// login
result = await api.login({ email: 'admin', password: 'admin' })
const token = result.token

// upsert ( insert or update )
result = await api.upsert({
  entity: 'sample',
  body: {
    name: 'sample',
    description: 'sample'
  }
})
console.log(`id of new content : ${result.id}`)

// find
const results = await api.find({
  entity: 'sample',
  contains: {
    name: 'sample'
  }
})

// delete
result = await api.delete(result.id)

Readme

Keywords

Package Sidebar

Install

npm i @winm2m/argos-api

Weekly Downloads

0

Version

0.3.1

License

MIT

Unpacked Size

5.1 kB

Total Files

7

Last publish

Collaborators

  • youngjunekwon