Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NOISSUE - Add channel role management #130

Merged
merged 3 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/purple-rats-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@absmach/magistrala-sdk": patch
---

Add channel level role management
6 changes: 3 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<!-- Copyright (c) Abstract Machines
SPDX-License-Identifier: Apache-2.0 -->

Pull request title should be `TSSDK-XXX - description` or `NOISSUE - description` where XXX is ID of issue that this PR relate to.
Please review the [CONTRIBUTING.md](./CONTRIBUTING.md) file for detailed contributing guidelines.
<!-- Pull request title should be `TSSDK-XXX - description` or `NOISSUE - description` where XXX is ID of issue that this PR relate to.
Please review the [CONTRIBUTING.md](./CONTRIBUTING.md) file for detailed contributing guidelines. -->

### What does this do?

### Which issue(s) does this PR fix/relate to?

Put here `Resolves #XXX` to auto-close the issue that your PR fixes (if such)
<!-- Put here `Resolves #XXX` to auto-close the issue that your PR fixes (if such) -->

### List any changes that modify/break current functionality

Expand Down
182 changes: 173 additions & 9 deletions examples/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ mySdk.channels
.CreateChannels(
[{ name: "<channelName1>" }, { name: "<channelName2>" }],
domainId,
token,
token
)
.then((response: any) => {
console.log("response:", response);
Expand All @@ -56,7 +56,7 @@ mySdk.channels
.UpdateChannelNameAndMetadata(
{ id: "<channelId>", name: "<channelName>", metadata: { key: "value" } },
domainId,
token,
token
)
.then((response: any) => {
console.log("response:", response);
Expand All @@ -69,7 +69,7 @@ mySdk.channels
.UpdateChannelTags(
{ id: "<channelId>", tags: ["tag1", "tag2"] },
domainId,
token,
token
)
.then((response: any) => {
console.log("response:", response);
Expand Down Expand Up @@ -102,7 +102,7 @@ mySdk.channels
"<channelId>",
["publish"],
domainId,
token,
token
)
.then((response: any) => {
console.log("response: ", response);
Expand All @@ -117,7 +117,7 @@ mySdk.channels
"<channelId>",
["publish"],
domainId,
token,
token
)
.then((response: any) => {
console.log("response: ", response);
Expand All @@ -132,7 +132,7 @@ mySdk.channels
["<channelId1>", "<channelId1>"],
["publish"],
domainId,
token,
token
)
.then((response: any) => {
console.log("response:", response);
Expand All @@ -147,7 +147,7 @@ mySdk.channels
["<channelId1>", "<channelId1>"],
["publish"],
domainId,
token,
token
)
.then((response: any) => {
console.log("response: ", response);
Expand All @@ -156,15 +156,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 @@ -180,3 +182,165 @@ mySdk.channels
.catch((error) => {
console.error(error);
});

mySdk.channels
ianmuchyri marked this conversation as resolved.
Show resolved Hide resolved
.ListChannelActions(domainId, token)
.then((response: any) => {
console.log("response: ", response);
})
.catch((error) => {
console.error(error);
});

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

mySdk.channels
.ListChannelRoles("<channelId>", domainId, { offset: 0, limit: 10 }, token)
.then((response) => {
console.log("response: ", response);
})
.catch((error) => {
console.error(error);
});

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

mySdk.channels
.UpdateChannelRole(
"<channelId>",
domainId,
"<roleId>",
{ name: "<updatedRoleName>" },
token
)
.then((response) => {
console.log("response: ", response);
})
.catch((error) => {
console.error(error);
});

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

mySdk.channels
.AddChannelRoleActions(
"<channelId>",
domainId,
"<roleId>",
["<action>", "<action>"],
token
)
.then((response) => {
console.log("response: ", response);
})
.catch((error) => {
console.error(error);
});

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

mySdk.channels
.DeleteChannelRoleActions(
"<channelId>",
domainId,
"<roleId>",
["<action>", "<action>"],
token
)
.then((response) => {
console.log("response: ", response);
})
.catch((error) => {
console.error(error);
});

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

mySdk.channels
.AddChannelRoleMembers(
"<channelId>",
domainId,
"<roleId>",
["<userId>", "<userId>"],
token
)
.then((response) => {
console.log("response: ", response);
})
.catch((error) => {
console.error(error);
});

mySdk.channels
.ListChannelRoleMembers(
"<channelId>",
domainId,
"<roleId>",
{ offset: 0, limit: 10 },
token
)
.then((response) => {
console.log("response: ", response);
})
.catch((error) => {
console.error(error);
});

mySdk.channels
.DeleteChannelRoleMembers(
"<channelId>",
domainId,
"<roleId>",
["<userId>", "<userId>"],
token
)
.then((response) => {
console.log("response: ", response);
})
.catch((error) => {
console.error(error);
});

mySdk.channels
.DeleteAllChannelRoleMembers("<channelId>", domainId, "<roleId>", token)
.then((response) => {
console.log("response: ", response);
})
.catch((error) => {
console.error(error);
});
Loading
Loading