-
Notifications
You must be signed in to change notification settings - Fork 0
Snet.organization
James Chong edited this page Mar 21, 2019
·
1 revision
Model for organization. Organization object can be retrieved from the Snet
model with either listOrganization
or getOrganization
method.
const orgs = await snet.listOrganizations();
console.log(orgs[0]);
// {id: 'snet'}
const org = await snet.getOrganization('snet');
console.log(org);
// { id: 'snet',
// name: 'snet',
// owner: '0xFF2a327ed1Ca40CE93F116C5d6646b56991c0ddE',
// members:
// [ '0x4b4546ce47089925E5792E0a6d085BfB876cE621',... ]}
Get all available services from the organization.
const services = await organization.getServices();
const services = await organization.getServices({init:true});
-
InitOptions Options for initialising a model.
- init: default to false. Only id is retrieve.
- Service[] Service Object.
const service = await organization.getService('example-service');
// { id: 'example-service',
// organizationId: 'snet',
// metadata:
// { version: 1,
// display_name: 'SingularityNET Example Service',
// encoding: 'proto',
// service_type: 'grpc', ... } },
// tags: [ 'Service', 'Example', 'Arithmetic' ] }
const service = await organization.getService('example-service', {init:false});
console.log(service.data);
// {id: 'example-service', organizationId: 'snet'}
- serviceId string
-
InitOptions object (optional) Options for initialising a model.
- init: default to false. Only id is retrieve.
- Service Service object.
const org = await snet.getOrganization('snet', {init:false});
console.log(org.isInit);
// false
console.log(org.data);
// {id: 'snet'}
await org.init();
console.log(orgservice.isInit);
// true
console.log(org.data);
// { id: 'snet',
// name: 'snet',
// owner: '0xFF2a327ed1Ca40CE93F116C5d6646b56991c0ddE',
// members:
// [ '0x4b4546ce47089925E5792E0a6d085BfB876cE621',... ]}
none
- Organization Initialized Organization object.
console.log(organization.data);
none
- id string
- name string
- owner string
- members string[]