Client
Client class for WDIA. Token is optional but required for methods with auth.
Kind: global class
-
Client
- new Client([url], [protocol], [host], [port], [token])
-
.commonResources() ⇒
Promise
-
.fieldsList([limit], [offset], [order]) ⇒
Promise
-
.fieldsTemplatesList([limit], [offset], [order]) ⇒
Promise
-
.companiesList([limit], [offset], [order], [updatedAt], [name], [type], [state]) ⇒
Promise
-
.companyServicesList(companyId, [limit], [offset], [order], [state]) ⇒
Promise
-
.servicesList([limit], [offset], [order], [updatedAt], [name], [type], [state]) ⇒
Promise
-
.verfiersList([limit], [offset], [order], [updatedAt], [name], [state]) ⇒
Promise
-
.serviceListVerifiers(hash, [limit], [offset], [order], [updatedAt], [name], [state]) ⇒
Promise
-
.verifierListServices(hash, [limit], [offset], [order], [updatedAt], [name], [type], [state]) ⇒
Promise
-
.getServicePubKeys(hash) ⇒
Promise
-
.getVerfierPubKeys(hash) ⇒
Promise
-
.getProviderPubKeys(hash) ⇒
Promise
-
.checkServiceKey([scriptHash]) ⇒
Promise
-
.checkVerifierKey([scriptHash]) ⇒
Promise
-
.checkProviderKey([scriptHash]) ⇒
Promise
-
.getServiceFields(hash) ⇒
Promise
-
.getVerifierFields(hash) ⇒
Promise
-
.getService(hash, [logo], [fields]) ⇒
Promise
-
.getVerifier(hash, [logo], [fields]) ⇒
Promise
-
.addService(type, name, [description], url, fields) ⇒
Promise
-
.addVerifier(name, [description], url, fields) ⇒
Promise
-
.updateCompany([name], [description], [url], [details], [logo]) ⇒
Promise
-
.getUserRoles([limit], [offset]) ⇒
Promise
-
.addCompanyUser(email, firstname, lastname, role) ⇒
Promise
-
.getCompanyUsers() ⇒
Promise
-
.updateService(hash, [type], [name], [description], [url], [fields]) ⇒
Promise
-
.updateVerifier(hash, [name], [description], [url], [fields]) ⇒
Promise
-
.addServicePubKeys(hash, keys) ⇒
Promise
-
.addVerifierPubKeys(hash, keys) ⇒
Promise
-
.disableServicePubKeys(keys) ⇒
Promise
-
.disableVerifierPubKeys(keys) ⇒
Promise
new Client([url], [protocol], [host], [port], [token])
Param | Type | Default | Description |
---|---|---|---|
[url] | string |
connection url (use other params if not specified) | |
[protocol] | string |
"http" |
connection protocol |
[host] | string |
connection host | |
[port] | string |
connection port | |
[token] | string |
connection token (optional) |
Promise
client.commonResources() ⇒ get common resources (states, types, sources)
Kind: instance method of Client
Returns: Promise
- Promise with {states, types, sources}
Promise
client.fieldsList([limit], [offset], [order]) ⇒ get fields list
Kind: instance method of Client
Returns: Promise
- Promise with array of fields
Param | Type | Description |
---|---|---|
[limit] | number |
limit |
[offset] | number |
offset |
[order] | array |
order array (sequelize order) |
Promise
client.fieldsTemplatesList([limit], [offset], [order]) ⇒ get fieldsTemplates list
Kind: instance method of Client
Returns: Promise
- Promise with array of fieldsTemplates
Param | Type | Description |
---|---|---|
[limit] | number |
limit |
[offset] | number |
offset |
[order] | array |
order array (sequelize order) |
Promise
client.companiesList([limit], [offset], [order], [updatedAt], [name], [type], [state]) ⇒ get companies list
Kind: instance method of Client
Returns: Promise
- Promise with array of companies and count
Param | Type | Description |
---|---|---|
[limit] | number |
limit |
[offset] | number |
offset |
[order] | array |
order array (sequelize order) |
[updatedAt] | date |
companies with updatedAt greater than specified |
[name] | string |
companies with name like specified |
[type] | number |
companies type (1 - service, 2 - verifier) |
[state] | array |
companies states |
Promise
client.companyServicesList(companyId, [limit], [offset], [order], [state]) ⇒ get company services or verifiers
Kind: instance method of Client
Returns: Promise
- Promise with array of services and count
Param | Type | Description |
---|---|---|
companyId | number |
company Id |
[limit] | number |
limit |
[offset] | number |
offset |
[order] | array |
order array (sequelize order) |
[state] | array |
services or verifiers states |
Promise
client.servicesList([limit], [offset], [order], [updatedAt], [name], [type], [state]) ⇒ get services list
Kind: instance method of Client
Returns: Promise
- Promise with array of services and count
Param | Type | Description |
---|---|---|
[limit] | number |
limit |
[offset] | number |
offset |
[order] | array |
order array (sequelize order) |
[updatedAt] | date |
services with updatedAt greater than specified |
[name] | string |
services with name like specified |
[type] | number |
services type |
[state] | array |
services states |
Promise
client.verfiersList([limit], [offset], [order], [updatedAt], [name], [state]) ⇒ get verifiers list
Kind: instance method of Client
Returns: Promise
- Promise with array of verifiers and count
Param | Type | Description |
---|---|---|
[limit] | number |
limit |
[offset] | number |
offset |
[order] | array |
order array (sequelize order) |
[updatedAt] | date |
verifiers with updatedAt greater than specified |
[name] | string |
verifiers with name like specified |
[state] | array |
verifiers states |
Promise
client.serviceListVerifiers(hash, [limit], [offset], [order], [updatedAt], [name], [state]) ⇒ get verifiers list for service
Kind: instance method of Client
Returns: Promise
- Promise with array of verifiers and count
Param | Type | Description |
---|---|---|
hash | string |
hash of service |
[limit] | number |
limit |
[offset] | number |
offset |
[order] | array |
order array (sequelize order) |
[updatedAt] | date |
verifiers with updatedAt greater than specified |
[name] | string |
verifiers with name like specified |
[state] | array |
verifiers states |
Promise
client.verifierListServices(hash, [limit], [offset], [order], [updatedAt], [name], [type], [state]) ⇒ get services list for verifier
Kind: instance method of Client
Returns: Promise
- Promise with array of services and count
Param | Type | Description |
---|---|---|
hash | string |
hash of verifier |
[limit] | number |
limit |
[offset] | number |
offset |
[order] | array |
order array (sequelize order) |
[updatedAt] | date |
services with updatedAt greater than specified |
[name] | string |
services with name like specified |
[type] | number |
services type |
[state] | array |
services states |
Promise
client.getServicePubKeys(hash) ⇒ get service`s keys (salts)
Kind: instance method of Client
Returns: Promise
- Promise array of keys
Param | Type | Description |
---|---|---|
hash | string |
hash of service |
Promise
client.getVerfierPubKeys(hash) ⇒ get verifier`s keys (salts)
Kind: instance method of Client
Returns: Promise
- Promise array of keys
Param | Type | Description |
---|---|---|
hash | string |
hash of verifier |
Promise
client.getProviderPubKeys(hash) ⇒ get verifier or service keys (salts)
Kind: instance method of Client
Returns: Promise
- Promise array of keys
Param | Type | Description |
---|---|---|
hash | string |
hash of verifier or service |
Promise
client.checkServiceKey([scriptHash]) ⇒ check service key (salt)
Kind: instance method of Client
Returns: Promise
- Promise object with service object and key state
Param | Type | Description |
---|---|---|
[scriptHash] | string |
scriptHash of service |
Promise
client.checkVerifierKey([scriptHash]) ⇒ check verifier key (salt)
Kind: instance method of Client
Returns: Promise
- Promise object with verifier object and key state
Param | Type | Description |
---|---|---|
[scriptHash] | string |
scriptHash of verifier |
Promise
client.checkProviderKey([scriptHash]) ⇒ check service or verifier key (salt)
Kind: instance method of Client
Returns: Promise
- Promise object with service or verifier object and key state
Param | Type | Description |
---|---|---|
[scriptHash] | string |
scriptHash of verifier |
Promise
client.getServiceFields(hash) ⇒ get service`s fields
Kind: instance method of Client
Returns: Promise
- Promise with array of fields
Param | Type | Description |
---|---|---|
hash | string |
hash of service |
Promise
client.getVerifierFields(hash) ⇒ get verifier`s fields
Kind: instance method of Client
Returns: Promise
- Promise with array of fields
Param | Type | Description |
---|---|---|
hash | string |
hash of verifier |
Promise
client.getService(hash, [logo], [fields]) ⇒ get service
Kind: instance method of Client
Returns: Promise
- Promise with service
Param | Type | Default | Description |
---|---|---|---|
hash | string |
service hash | |
[logo] | boolean |
false |
add company logo to response (default: false) |
[fields] | boolean |
false |
add fields to response (default: false) |
Promise
client.getVerifier(hash, [logo], [fields]) ⇒ get verifier
Kind: instance method of Client
Returns: Promise
- Promise with verifier
Param | Type | Default | Description |
---|---|---|---|
hash | string |
verifier hash | |
[logo] | boolean |
false |
add company logo to response (default: false) |
[fields] | boolean |
false |
add fields to response (default: false) |
Promise
client.addService(type, name, [description], url, fields) ⇒ add service
Kind: instance method of Client
Returns: Promise
- Promise with service
Param | Type | Description |
---|---|---|
type | number |
service type |
name | string |
name |
[description] | string |
description |
url | string |
url |
fields | object |
fields {[fieldId]: true |
Promise
client.addVerifier(name, [description], url, fields) ⇒ add verifier
Kind: instance method of Client
Returns: Promise
- Promise with verifier
Param | Type | Description |
---|---|---|
name | string |
name |
[description] | string |
description |
url | string |
url |
fields | object |
fields {[fieldId]: true |
Promise
client.updateCompany([name], [description], [url], [details], [logo]) ⇒ update company
Kind: instance method of Client
Returns: Promise
- Promise with service
Param | Type | Description |
---|---|---|
[name] | string |
name |
[description] | string |
description |
[url] | string |
url |
[details] | object |
details |
[logo] | string |
logo file in base64 (null - if you want remove previous) |
Promise
client.getUserRoles([limit], [offset]) ⇒ get user roles
Kind: instance method of Client
Returns: Promise
- Promise with roles
Param | Type | Description |
---|---|---|
[limit] | number |
limit |
[offset] | number |
offset |
Promise
client.addCompanyUser(email, firstname, lastname, role) ⇒ add company user
Kind: instance method of Client
Returns: Promise
- Promise with service
Param | Type | Description |
---|---|---|
string |
||
firstname | string |
firstname |
lastname | string |
lastname |
role | number |
role |
Promise
client.getCompanyUsers() ⇒ get company users
Kind: instance method of Client
Returns: Promise
- Promise with service
Promise
client.updateService(hash, [type], [name], [description], [url], [fields]) ⇒ update service
Kind: instance method of Client
Returns: Promise
- Promise with service
Param | Type | Description |
---|---|---|
hash | string |
hash |
[type] | number |
service type |
[name] | string |
name |
[description] | string |
description |
[url] | string |
url |
[fields] | object |
fields {[fieldId]: true |
Promise
client.updateVerifier(hash, [name], [description], [url], [fields]) ⇒ update verifier
Kind: instance method of Client
Returns: Promise
- Promise with verifier
Param | Type | Description |
---|---|---|
hash | string |
hash |
[name] | string |
name |
[description] | string |
description |
[url] | string |
url |
[fields] | object |
fields {[fieldId]: true |
Promise
client.addServicePubKeys(hash, keys) ⇒ add service keys (salts)
Kind: instance method of Client
Returns: Promise
- Promise with keys and status
Param | Type | Description |
---|---|---|
hash | string |
hash |
keys | array |
keys [scriptHash] |
Promise
client.addVerifierPubKeys(hash, keys) ⇒ add verifier keys (salts)
Kind: instance method of Client
Returns: Promise
- Promise with keys and status
Param | Type | Description |
---|---|---|
hash | string |
hash |
keys | array |
keys [scriptHash] |
Promise
client.disableServicePubKeys(keys) ⇒ disable service keys (salts)
Kind: instance method of Client
Returns: Promise
- Promise with result
Param | Type | Description |
---|---|---|
keys | array |
keys [scriptHash] |
Promise
client.disableVerifierPubKeys(keys) ⇒ disable verifier keys (salts)
Kind: instance method of Client
Returns: Promise
- Promise with result
Param | Type | Description |
---|---|---|
keys | array |
keys [scriptHash] |