-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add domains Signed-off-by: Musilah <[email protected]> * add eslinter for domains Signed-off-by: Musilah <[email protected]> * update addusersdoamins Signed-off-by: Musilah <[email protected]> * remove undefined type Signed-off-by: Musilah <[email protected]> * add throw error Signed-off-by: Musilah <[email protected]> * fix response to addusers to domains Signed-off-by: Musilah <[email protected]> * add listDomainsUsers fx Signed-off-by: Musilah <[email protected]> * add relation type Signed-off-by: Musilah <[email protected]> --------- Signed-off-by: Musilah <[email protected]>
- Loading branch information
Showing
7 changed files
with
588 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
import SDK from '../src/sdk' | ||
|
||
const defaultUrl = 'http://localhost' | ||
|
||
const mySdk = new SDK({ | ||
domainsUrl: defaultUrl + ':8189', | ||
usersUrl: defaultUrl + ':9002' | ||
}) | ||
|
||
mySdk.domains | ||
.CreateDomain( | ||
{ name: '<domainName>' }, | ||
'<token>' | ||
) | ||
.then((response: any) => { | ||
console.log('response: ', response) | ||
}) | ||
.catch((error) => { | ||
console.log(error) | ||
}) | ||
|
||
mySdk.domains.UpdateDomain( | ||
{ name: '<domainName>', id: '<domainID>' }, | ||
'<token>' | ||
) | ||
.then((response: any) => { | ||
console.log('response: ', response) | ||
}) | ||
.catch((error) => { | ||
console.log(error) | ||
}) | ||
|
||
mySdk.domains.Domain( | ||
'<domainID>', | ||
'<token>' | ||
) | ||
.then((response: any) => { | ||
console.log('response: ', response) | ||
}) | ||
.catch((error) => { | ||
console.log(error) | ||
}) | ||
|
||
mySdk.domains.DomainPermissions( | ||
'<domainID>', | ||
'<token>' | ||
) | ||
.then((response: any) => { | ||
console.log('response: ', response) | ||
}) | ||
.catch((error) => { | ||
console.log(error) | ||
}) | ||
|
||
mySdk.domains.Domains( | ||
{ offset: 0, limit: 10 }, | ||
'<token>' | ||
) | ||
.then((response: any) => { | ||
console.log('response: ', response) | ||
}) | ||
.catch((error) => { | ||
console.log(error) | ||
}) | ||
|
||
mySdk.domains.ListUserDomains( | ||
'<userID>', | ||
{ offset: 0, limit: 10 }, | ||
'<token>' | ||
) | ||
.then((response: any) => { | ||
console.log('response: ', response) | ||
}) | ||
.catch((error) => { | ||
console.log(error) | ||
}) | ||
|
||
mySdk.domains.ListDomainUsers( | ||
'<domainID>', | ||
{ offset: 0, limit: 10 }, | ||
'<token>' | ||
) | ||
.then((response: any) => { | ||
console.log('response: ', response) | ||
}) | ||
.catch((error) => { | ||
console.log(error) | ||
}) | ||
|
||
mySdk.domains.EnableDomain( | ||
'<domainID>', | ||
'<token>' | ||
) | ||
.then((response: any) => { | ||
console.log('response: ', response) | ||
}) | ||
.catch((error) => { | ||
console.log(error) | ||
}) | ||
|
||
mySdk.domains.DisableDomain( | ||
'<domainID>', | ||
'<token>' | ||
) | ||
.then((response: any) => { | ||
console.log('response: ', response) | ||
}) | ||
.catch((error) => { | ||
console.log(error) | ||
}) | ||
|
||
mySdk.domains.AddUsertoDomain( | ||
'<domainID>', | ||
['<userID>', '<userID>'], | ||
'administrator', | ||
'<token>' | ||
) | ||
.then((response: any) => { | ||
console.log('response: ', response) | ||
}) | ||
.catch((error) => { | ||
console.log(error) | ||
}) | ||
|
||
mySdk.domains.RemoveUserfromDomain( | ||
'<domainID>', | ||
['<userID>', '<userID>'], | ||
'administrator', | ||
'<token>' | ||
) | ||
.then((response: any) => { | ||
console.log('response: ', response) | ||
}) | ||
.catch((error) => { | ||
console.log(error) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
"files": [ | ||
"dist", | ||
"sdk.js", | ||
"mainflux", | ||
"src", | ||
"LICENSE" | ||
], | ||
"scripts": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.