Giter Site home page Giter Site logo

nocloud.js-rest's Introduction

noCloudJSREST

axios-based api for noCloud.

Instalation

yarn install nocloudjsrest

//or

npm install nocloudjsrest
  • auth
  • applyToken
  • health
    • probe
  • accounts
    • create
    • get
    • list
    • update
    • creditials
    • delete
  • namespaces
    • create
    • list
    • join
    • link
    • delete

auth

This method will authorize you by username/password pair and will add gotten token at default header 'Authorization'. So all next requests doesn't need addictional auth info.

const api = new Api();
api.auth('username', 'password');

applyToken

You can apply saved token by using following method. So all next requests doesn't need addictional auth info.

const api = new Api();
api.applyToken('token');

health probe

It's a way to check is all systems works correctly. It must return 'PONG' as correct answer.

const api = new Api();
api.health.probe();

accounts module

create

Used for create account. Returns uuid of created account.

const api = new Api();
api.accounts.create({
    "title": "account title",
    "auth": {
        "type": "standard",
        "data": ["username", "password"]
    },
    "namespace": "namespace uuid",
    "access": 3 // 1-3
});

get

get account info by uuid.

const api = new Api();
api.account.get('account uuid')

list

get list of accounts.

const api = new Api();
api.account.list()

update

update account title.

const api = new Api();
api.account.update('account uuid', {
    "title": "new accout title"
})

creditials

update account creditials.

const api = new Api();
api.account.creditials('account uuid', {
    "auth": {
        "type": "standard",
        "data": [
            "new username",
            "new password"
        ]
    }
})

delete

delete account by uuid.

const api = new Api();
api.account.delete('account uuid')

namespaces

create

Used for create namespace. Returns uuid of created namespace.

const api = new Api();
api.namespaces.create({
    "title": "namespace title"
});

list

Returns list of namespaces.

const api = new Api();
let depth = 4;
api.namespaces.list(depth); // default: 10

join

joins account and namespace

const api = new Api();
api.namespaces.join(namespace, {
    account: "account uuid",
    access: 1, // 1-3
    role: "default" // enum('default', 'owner')
});

link

links account and namespace

const api = new Api();
api.namespaces.link('namespace uuid', 'account uuid');

delete

delete namespaces by uuid.

const api = new Api();
api.namespaces.delete('namespace uuid')

nocloud.js-rest's People

Contributors

639852 avatar dependabot[bot] avatar dowellkin avatar sazukinpavel avatar slntopp avatar va-ovsyanikov avatar

Watchers

 avatar

Forkers

mvpmiami

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.