Seneca Orbit-Provider is a plugin for Seneca
Provides access to the Orbit API using the Seneca provider convention. Orbit API entities are represented as Seneca entities so that they can be accessed using the Seneca entity API and messages.
See seneca-entity and the Seneca Data Entities Tutorial for more details on the Seneca entity API.
NOTE: underlying third party SDK needs to be replaced as out of date and has a security issue.
This open source module is sponsored and supported by Voxgig. |
---|
// Setup - get the key value (<SECRET>) separately from a vault or
// environment variable.
Seneca()
// Get API keys using the seneca-env plugin
.use('env', {
var: {
$ORBIT_API_TOKEN: String,
$WORKSPACE: String,
}
})
.use('provider', {
provider: {
orbit: {
keys: {
key: { value: '$ORBIT_API_TOKEN' },
workspace: { value: '$WORKSPACE' },
}
}
}
})
.use('orbit-provider')
let listMember = await seneca.entity('provider/orbit/member')
.list$()
Console.log(listMember)
let loadMember = await seneca.entity('provider/orbit/member')
.load$('<member-id>')
Console.log(loadMember)
let body_to_update_member = {
'body': {
"name": "foo",
"bio": "bar"
}
}
let saveMember = await seneca.entity('provider/orbit/member')
.save$({
'idMember': '<member-id>',
'body': body_to_update_member
})
Console.log(saveMember)
let addIndentifyMember = await seneca.entity("provider/orbit/identify_member")
.save$({
'idMember': idMember,
'body': body_to_add_identity
})
Console.log(addIndentifyMember)
let identifyMember = await seneca.entity("provider/orbit/identify_member")
.list$({
'source': 'foo',
'username': 'bar'
})
Console.log(identifyMember)
let list_member_by_organization = await seneca.entity("provider/orbit/list_member_by_organization").list$({'idOrganization': idOrganization})
Console.log(list_member_by_organization)
let body_to_create_member = {
'body': {
"identity": {
"source": "api",
"username": "foo"
}
}
}
const create_or_update_member = await seneca.entity("provider/orbit/create_member").save$({'body': body_to_create_member})
console.log(create_or_update_member)
$ npm install @seneca/orbit-provider @seneca/env
debug
: boolean false
Set plugin options when loading with:
seneca.use('OrbitProvider', { name: value, ... })
Note: foo.bar
in the list above means
{ foo: { bar: ... } }
- role:entity,base:orbit,cmd:load,name:repo,zone:provider
- role:entity,base:orbit,cmd:save,name:repo,zone:provider
- sys:provider,get:info,provider:orbit
Load Orbit repository data into an entity.
Update Orbit repository data from an entity.
Get information about the provider.