Skip to content

Commit

Permalink
NOISSUE - Rename things to clients (#108)
Browse files Browse the repository at this point in the history
* rename things to clients

Signed-off-by: wambuipixel <[email protected]>

* fix: replace console log with console error

Signed-off-by: wambuipixel <[email protected]>

* add changeset

Signed-off-by: wambuipixel <[email protected]>

* fix: add tests

Signed-off-by: wambuipixel <[email protected]>

* fix: address requested changes

Signed-off-by: wambuipixel <[email protected]>

---------

Signed-off-by: wambuipixel <[email protected]>
  • Loading branch information
wambui-pixel authored Nov 26, 2024
1 parent 8e6cff2 commit 7c6dcd1
Show file tree
Hide file tree
Showing 16 changed files with 321 additions and 354 deletions.
5 changes: 5 additions & 0 deletions .changeset/lazy-windows-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@absmach/magistrala-sdk": patch
---

rename things to clients
38 changes: 19 additions & 19 deletions examples/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ mySdk.bootstrap.AddBootstrap(
{
external_id: "<externalId>",
external_key: "externalKey",
thing_id: "<thingId>",
client_id: "<clientId>",
name: "<bootstrapName>",
},
domainId,
Expand All @@ -23,14 +23,14 @@ mySdk.bootstrap.AddBootstrap(
console.log("response:", response);
})
.catch((error) => {
console.log(error);
console.error(error);
});

mySdk.bootstrap.Whitelist(
{
external_id: "<externalId>",
external_key: "<externalKey>",
thing_id: "<thingId>",
client_id: "<clientId>",
name: "<bootstrapName>",
},
domainId,
Expand All @@ -40,13 +40,13 @@ mySdk.bootstrap.Whitelist(
console.log("response:", response);
})
.catch((error) => {
console.log(error);
console.error(error);
});

mySdk.bootstrap.UpdateBootstrap(
{
name: "Bootstrap1",
thing_id: "<thingId>",
name: "<updatedBootstrapName>",
client_id: "<clientId>",
},
domainId,
token,
Expand All @@ -55,24 +55,24 @@ mySdk.bootstrap.UpdateBootstrap(
console.log("response:", response);
})
.catch((error) => {
console.log(error);
console.error(error);
});

mySdk.bootstrap.ViewBootstrap(
"<thingId>",
"<clientId>",
domainId,
token,
)
.then((response: any) => {
console.log("response:", response);
})
.catch((error) => {
console.log(error);
console.error(error);
});

mySdk.bootstrap.UpdateBootstrapCerts(
{
thing_id: "<thingId>",
client_id: "<clientId>",
client_cert: "<clientCert>",
client_key: "<clientKey>",
ca_cert: "<caCert>",
Expand All @@ -84,19 +84,19 @@ mySdk.bootstrap.UpdateBootstrapCerts(
console.log("response:", response);
})
.catch((error) => {
console.log(error);
console.error(error);
});

mySdk.bootstrap.RemoveBootstrap(
"<thingId>",
mySdk.bootstrap.DeleteBootstrap(
"<clientId>",
domainId,
token,
)
.then((response: any) => {
console.log("response:", response);
})
.catch((error) => {
console.log(error);
console.error(error);
});

mySdk.bootstrap.Bootstrap(
Expand All @@ -107,7 +107,7 @@ mySdk.bootstrap.Bootstrap(
console.log("response:", response);
})
.catch((error) => {
console.log(error);
console.error(error);
});

mySdk.bootstrap.Bootstraps(
Expand All @@ -119,11 +119,11 @@ mySdk.bootstrap.Bootstraps(
console.log("response:", response);
})
.catch((error) => {
console.log(error);
console.error(error);
});

mySdk.bootstrap.UpdateBootstrapConnection(
"<thingId>",
"<clientId>",
domainId,
["<channelId>", "<channelId2>"],
token,
Expand All @@ -132,7 +132,7 @@ mySdk.bootstrap.UpdateBootstrapConnection(
console.log("response:", response);
})
.catch((error) => {
console.log(error);
console.error(error);
});

mySdk.bootstrap.SecureBootstrap(
Expand All @@ -144,5 +144,5 @@ mySdk.bootstrap.SecureBootstrap(
console.log("response:", response);
})
.catch((error) => {
console.log(error);
console.error(error);
});
16 changes: 8 additions & 8 deletions examples/certs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const domainId = "<domainId>";

mySdk.certs
.IssueCert(
"<thingID>",
"<clientId>",
"<valid>",
domainId,
token,
Expand All @@ -20,20 +20,20 @@ mySdk.certs
console.log("response: ", response);
})
.catch((error) => {
console.log(error);
console.error(error);
});

mySdk.certs
.ViewCertByThing(
"<thingID>",
.ViewCertByClient(
"<clientId>",
domainId,
token,
)
.then((response: any) => {
console.log("response: ", response);
})
.catch((error) => {
console.log(error);
console.error(error);
});

mySdk.certs
Expand All @@ -46,18 +46,18 @@ mySdk.certs
console.log("response: ", response);
})
.catch((error) => {
console.log(error);
console.error(error);
});

mySdk.certs
.RevokeCert(
"<thingID>",
"<clientId>",
domainId,
token,
)
.then((response: any) => {
console.log("response: ", response);
})
.catch((error) => {
console.log(error);
console.error(error);
});
12 changes: 6 additions & 6 deletions examples/invitations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ mySdk.invitations.SendInvitation(
console.log("response: ", response);
})
.catch((error) => {
console.log(error);
console.error(error);
});

mySdk.invitations.Invitation(
Expand All @@ -35,7 +35,7 @@ mySdk.invitations.Invitation(
console.log("response: ", response);
})
.catch((error) => {
console.log(error);
console.error(error);
});

mySdk.invitations.Invitations(
Expand All @@ -49,7 +49,7 @@ mySdk.invitations.Invitations(
console.log("response: ", response);
})
.catch((error) => {
console.log(error);
console.error(error);
});

mySdk.invitations.AcceptInvitation(
Expand All @@ -60,7 +60,7 @@ mySdk.invitations.AcceptInvitation(
console.log("response: ", response);
})
.catch((error) => {
console.log(error);
console.error(error);
});

mySdk.invitations.RejectInvitation(
Expand All @@ -71,7 +71,7 @@ mySdk.invitations.RejectInvitation(
console.log("response: ", response);
})
.catch((error) => {
console.log(error);
console.error(error);
});

mySdk.invitations.DeleteInvitation(
Expand All @@ -83,5 +83,5 @@ mySdk.invitations.DeleteInvitation(
console.log("response: ", response);
})
.catch((error) => {
console.log(error);
console.error(error);
});
10 changes: 5 additions & 5 deletions examples/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ const mySdk = new SDK({
const token = "<token>";

mySdk.messages
.Send("<channelId>", "<message>", "<thingKey>")
.Send("<channelId>", "<message>", "<clientKey>")
.then((response: any) => {
console.log("response: ", response);
})
.catch((error: unknown) => {
console.log(error);
.catch((error) => {
console.error(error);
});

mySdk.messages
.Read({ offset: 0, limit: 10 }, "<channelId>", token, "<domainId>")
.then((response: any) => {
console.log("response: ", response);
})
.catch((error: unknown) => {
console.log(error);
.catch((error) => {
console.error(error);
});
Loading

0 comments on commit 7c6dcd1

Please sign in to comment.