1.4.8 • Published 2 years ago
ssg-web-sdk v1.4.8
ssg.js - BEET Secure Service Gateway JavaScript SDK
Getting started
npm install --save git+ssh://git@github.com:beetsolutions/ssg-web-sdk.git
- see usage examples below
Run examples
npm install
npm run build
npm start
- navigate to
http://localhost:3000
This is a CommonJS module so you need a module loader solution such as SystemJS, Browserify, or Webpack to use it in a browser.
Plain JavaScript, using fetch() for requests:
var Ssg = require('../ssg-js-sdk').Ssg
var ssg = new Ssg({
adaptor: 'fetch',
baseUrl: 'http://www.ssg-url.com/v1',
configStorageType: 'sessionStorage'
})
function login (email, password, tenantId) {
ssg.auth.loginAdmin(email, password, tenantId)
}
function logout () {
ssg.auth.logoutAdmin()
}
function exampleRequest () {
return ssg.http.request({
urlExtension: '/v1/user',
method: 'GET'
})
}
Node, using "request" module for requests
NOTE: Node support is disabled until forge is proper modules https://github.com/digitalbazaar/forge/pull/357
const SSG = require('../../ssg').Ssg
const request = require('request')
let ssg = new SSG({
adaptor: 'node-request',
environment: 'node',
baseUrl: 'http://www.ssg-url.com/v1',
adaptorDependencies: { request }
})
const email = 'someuser@unwire.dk'
const password = 'secretpassword'
const tenantId = 1000
ssg.auth.loginAdmin(email, password, tenantId)
.then(auth => {
ssg.http.request({
urlExtension: '/v1/user',
method: 'GET'
}, (err, res) => {
if (err) {
console.log(err)
}
console.log(res.body)
})
})
Angular 2
import {Ssg} from 'ssg-secure-service-gateway-js-sdk/ssg'
import {Injectable} from '@angular/core'
import {Http, Request} from '@angular/http'
@Injectable()
export class ApiService {
public ssg
constructor (http:Http) {
this.ssg = new Ssg({
adaptor: 'angular2',
baseUrl: 'http://www.ssg-url.com/v1',
configStorageType: 'sessionStorage',
adaptorDependencies: {
http,
Request
}
})
}
login (email, password, tenantId) {
return this.ssg.auth.loginAdmin(email, password, tenantId)
}
logout () {
return this.ssg.auth.logoutAdmin()
}
exampleRequest () {
return this.ssg.http.request({
urlExtension: '/v1/user',
method: 'GET'
})
}
}
1.4.6
2 years ago
1.4.5
2 years ago
1.4.4
2 years ago
1.4.3
2 years ago
1.4.2
2 years ago
1.4.1
2 years ago
1.4.0
2 years ago
1.4.8
2 years ago
1.4.7
2 years ago
1.3.9
2 years ago
1.3.8
2 years ago
1.3.7
2 years ago
1.3.6
2 years ago
1.3.5
2 years ago
1.3.4
2 years ago
1.3.3
2 years ago
1.3.2
2 years ago
1.3.1
2 years ago
1.3.0
2 years ago
1.2.9
2 years ago
1.2.8
2 years ago
1.2.7
2 years ago
1.2.6
2 years ago
1.2.5
2 years ago
1.2.3
2 years ago
1.2.2
2 years ago
1.2.1
2 years ago
1.2.0
2 years ago
1.2.4
9 years ago