Skip to content

Commit

Permalink
add list entity users
Browse files Browse the repository at this point in the history
Signed-off-by: ianmuchyri <[email protected]>
  • Loading branch information
ianmuchyri committed Jan 27, 2025
1 parent 406b357 commit 4955d5f
Show file tree
Hide file tree
Showing 9 changed files with 365 additions and 161 deletions.
5 changes: 5 additions & 0 deletions .changeset/selfish-days-promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@absmach/magistrala-sdk": patch
---

add list entity users
30 changes: 21 additions & 9 deletions examples/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const defaultUrl = "http://localhost";

const mySdk = new SDK({
channelsUrl: `${defaultUrl}:9005`,
usersUrl: `${defaultUrl}:9002`,
});

const token = "<token>";
Expand Down Expand Up @@ -31,7 +32,7 @@ mySdk.channels
.CreateChannels(
[{ name: "<channelName1>" }, { name: "<channelName2>" }],
domainId,
token,
token
)
.then((response: any) => {
console.log("response:", response);
Expand All @@ -53,7 +54,7 @@ mySdk.channels
.UpdateChannelNameAndMetadata(
{ id: "<channelId>", name: "<channelName>", metadata: { key: "value" } },
domainId,
token,
token
)
.then((response: any) => {
console.log("response:", response);
Expand All @@ -66,7 +67,7 @@ mySdk.channels
.UpdateChannelTags(
{ id: "<channelId>", tags: ["tag1", "tag2"] },
domainId,
token,
token
)
.then((response: any) => {
console.log("response:", response);
Expand Down Expand Up @@ -99,7 +100,7 @@ mySdk.channels
"<channelId>",
["publish"],
domainId,
token,
token
)
.then((response: any) => {
console.log("response: ", response);
Expand All @@ -114,7 +115,7 @@ mySdk.channels
"<channelId>",
["publish"],
domainId,
token,
token
)
.then((response: any) => {
console.log("response: ", response);
Expand All @@ -129,7 +130,7 @@ mySdk.channels
["<channelId1>", "<channelId1>"],
["publish"],
domainId,
token,
token
)
.then((response: any) => {
console.log("response:", response);
Expand All @@ -144,7 +145,7 @@ mySdk.channels
["<channelId1>", "<channelId1>"],
["publish"],
domainId,
token,
token
)
.then((response: any) => {
console.log("response: ", response);
Expand All @@ -153,15 +154,17 @@ mySdk.channels
console.error(error);
});

mySdk.channels.SetChannelParentGroup(domainId, "<channelId>", "<parentGroupId>", token)
mySdk.channels
.SetChannelParentGroup(domainId, "<channelId>", "<parentGroupId>", token)
.then((response: any) => {
console.log("response: ", response);
})
.catch((error) => {
console.error(error);
});

mySdk.channels.DeleteChannelParentGroup(domainId, "<channelId>", token)
mySdk.channels
.DeleteChannelParentGroup(domainId, "<channelId>", token)
.then((response: any) => {
console.log("response: ", response);
})
Expand All @@ -177,3 +180,12 @@ mySdk.channels
.catch((error) => {
console.error(error);
});

mySdk.channels
.ListChannelUsers("<channelId>", { offset: 0, limit: 10 }, domainId, token)
.then((response: any) => {
console.log("response:", response);
})
.catch((error) => {
console.log(error);
});
3 changes: 2 additions & 1 deletion examples/clients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const defaultUrl = "http://localhost";

const mySdk = new SDK({
clientsUrl: `${defaultUrl}:9006`,
usersUrl: `${defaultUrl}:9002`,
});

const token = "<token>";
Expand Down Expand Up @@ -99,7 +100,7 @@ mySdk.clients
});

mySdk.clients
.ListUserClients("<userId>", { offset: 0, limit: 10 }, domainId, token)
.ListClientUsers("<clientId>", { offset: 0, limit: 10 }, domainId, token)
.then((response: any) => {
console.log("response:", response);
})
Expand Down
10 changes: 10 additions & 0 deletions examples/groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const defaultUrl = "http://localhost";

const mySdk = new SDK({
groupsUrl: `${defaultUrl}:9004`,
usersUrl: `${defaultUrl}:9002`,
});

const token = "<token>";
Expand Down Expand Up @@ -153,6 +154,15 @@ mySdk.groups
console.error(error);
});

mySdk.groups
.ListGroupUsers("<groupId>", { offset: 0, limit: 10 }, domainId, token)
.then((response: any) => {
console.log("response:", response);
})
.catch((error) => {
console.log(error);
});

mySdk.groups
.ListGroupActions(domainId, token)
.then((response: any) => {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4955d5f

Please sign in to comment.