0.0.32 • Published 4 years ago

edgecaas v0.0.32

Weekly downloads
2
License
MIT
Repository
-
Last release
4 years ago

Edge CaaS

A javascript library for Edge CaaS API

https://developer.ibm.com/edge/caas

How to install it

Install

npm i edgecaas

Upgrade to latest version

npm outdated
npm i edgecaas@latest

How to use it

React

import caas from 'edgecaas'

function App() {
	
	caas.ensureW3idLogin('demo')
	
	caas.get('catalogs').then((result) => {
		console.log(result)
	}).catch((error) => {
		console.error(error);
	});
...

Node

const caas = require('edgecaas')

caas.basicAuth('demo', 'demo')

let catalogs = await caas.getCatalogs()

let document = await caas.getDocument('ARZdzxFe', 'html')

HTML

 <script src="https://unpkg.com/edgecaas@0.0.29/EdgeCaaS.js"></script> 

Auth functions

  • basicAuth(id, secret)
  • bearerAuth(token)
  • getTokenCookie(token)
  • setTokenCookie(token)
  • deleteTokenCookie()

w3id functions

  • async ensureW3idLogin(libraryId) - if user is not logged in, redirects to w3id SSO login with the current url as redirect param
  • async doW3idLoginCallback() - gets the token based on the code received in query params, sets the caasToken cookie and the bearer authorization, and redirects to original url
  • getW3idSSOLoginUrl(libraryId, queryString)
  • async getW3idToken(code)

IBMid functions

  • async ensureIBMidLogin(libraryId) - if user is not logged in, redirects to IBMid SSO login with the current url as redirect param
  • async doIBMidLoginCallback() - gets the token based on the code received in query params, sets the caasToken cookie and the bearer authorization, and redirects to original url
  • getIBMidSSOLoginUrl(libraryId, queryString)
  • async getIBMidToken(code)

Generic API functions

  • async get(path)
  • async post(path, body)
  • async put(path, body)
  • async delete(path)

Content functions

  • async getCatalogs()
  • async getCatalog(catalogId)
  • async getDocuments(catalogId)
  • async getDocument(catalogId, documentId, language)
  • async addDocument(catalogId, documentId, language, jsonBody)
  • async updateDocument(catalogId, documentId, language, jsonBody)
  • async deleteDocument(catalogId, documentId, language)
  • async getDocumentContents(catalogId, documentId, language)
  • async getDocumentContentsByIndex(catalogId, documentId, language, index)
  • async getDocumentFile(catalogId, documentId, language, filePath)
0.0.32

4 years ago

0.0.31

4 years ago

0.0.30

4 years ago

0.0.25

4 years ago

0.0.26

4 years ago

0.0.27

4 years ago

0.0.28

4 years ago

0.0.29

4 years ago

0.0.24

4 years ago

0.0.23

4 years ago

0.0.22

4 years ago

0.0.21

4 years ago

0.0.20

4 years ago

0.0.19

4 years ago

0.0.16

4 years ago

0.0.17

4 years ago

0.0.18

4 years ago

0.0.10

4 years ago

0.0.11

4 years ago

0.0.12

4 years ago

0.0.13

4 years ago

0.0.14

4 years ago

0.0.15

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago