Skip to content

Commit

Permalink
Adding Linter
Browse files Browse the repository at this point in the history
Signed-off-by: wambuipixel <[email protected]>
  • Loading branch information
wambui-pixel committed Apr 3, 2024
1 parent dd9be19 commit 5544659
Show file tree
Hide file tree
Showing 7 changed files with 1,152 additions and 1,178 deletions.
24 changes: 12 additions & 12 deletions examples/channels.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Import the SDK class from the mainflux-sdk package
import SDK from "../src/sdk";
import SDK from '../src/sdk'

const defaultUrl = "http://localhost";
const defaultUrl = 'http://localhost'

const mySdk = new SDK({
channelsUrl: defaultUrl + ":9000",
});
channelsUrl: defaultUrl + ':9000'
})

const token =

Check failure on line 10 in examples/channels.ts

View workflow job for this annotation

GitHub Actions / Testing

'token' is assigned a value but never used
"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJkb21haW4iOiIzZTlkMTNiMy1lMTgxLTQwNjktODdjNS0yMGQ3MmJlY2M4M2YiLCJleHAiOjE3MTIwMzk5MzMsImlhdCI6MTcxMjAzNjMzMywiaXNzIjoibWFnaXN0cmFsYS5hdXRoIiwic3ViIjoiYjJmZTZhZmUtOGYwNS00NDgzLWFhY2QtN2QyMGVhMjVkOWE1IiwidHlwZSI6MCwidXNlciI6ImIyZmU2YWZlLThmMDUtNDQ4My1hYWNkLTdkMjBlYTI1ZDlhNSJ9.tA_2fGtYlT-zn316AwX_wtw0uXgE7DYFUA_ZvXKCvm1Pofl_WiAWMRt5YcqU_TbGDXmrgJxUd-Ifa9aSYMaFKA";
'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJkb21haW4iOiIzZTlkMTNiMy1lMTgxLTQwNjktODdjNS0yMGQ3MmJlY2M4M2YiLCJleHAiOjE3MTIwMzk5MzMsImlhdCI6MTcxMjAzNjMzMywiaXNzIjoibWFnaXN0cmFsYS5hdXRoIiwic3ViIjoiYjJmZTZhZmUtOGYwNS00NDgzLWFhY2QtN2QyMGVhMjVkOWE1IiwidHlwZSI6MCwidXNlciI6ImIyZmU2YWZlLThmMDUtNDQ4My1hYWNkLTdkMjBlYTI1ZDlhNSJ9.tA_2fGtYlT-zn316AwX_wtw0uXgE7DYFUA_ZvXKCvm1Pofl_WiAWMRt5YcqU_TbGDXmrgJxUd-Ifa9aSYMaFKA'

// mySdk.channels
// .CreateChannel({ name: "Bees" }, token)
Expand Down Expand Up @@ -132,17 +132,17 @@ const token =

mySdk.channels
.Disconnect(
["thing1", "thing2"],
["channel1", "channel2"],
["m_read", "m_write"],
"token",
['thing1', 'thing2'],
['channel1', 'channel2'],
['m_read', 'm_write'],
'token'
)
.then((response: any) => {
console.log("response: ", response);
console.log('response: ', response)
})
.catch((error) => {
console.log(error);
});
console.log(error)
})

// mySdk.channels
// .ListChannelUsers(
Expand Down
16 changes: 8 additions & 8 deletions examples/examples.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
// Import the SDK class from the mainflux-sdk package
import SDK from "../src/sdk";
import SDK from '../src/sdk'

const defaultUrl = "http://localhost";
const defaultUrl = 'http://localhost'

const mySdk = new SDK({
usersUrl: defaultUrl + ":9002",
usersUrl: defaultUrl + ':9002'
// groupsUrl: defaultUrl + ":9002",
// thingsUrl: defaultUrl + ":9000",
// channelsUrl: defaultUrl + ":9000",
// httpadapterUrl: defaultUrl,
// readersUrl: defaultUrl + ":9011",
// certsUrl: defaultUrl + ":9019",
// bootstrapsUrl: defaultUrl + ":9013",
});
})

mySdk.users
.CreateToken({ identity: "[email protected]", secret: "12345678" })
.CreateToken({ identity: '[email protected]', secret: '12345678' })
.then((response: any) => {
console.log("response: ", response);
console.log('response: ', response)
})
.catch((error) => {
console.log(error);
});
console.log(error)
})

// //Things.js examples.

Expand Down
190 changes: 85 additions & 105 deletions examples/things.ts
Original file line number Diff line number Diff line change
@@ -1,208 +1,188 @@
// Import the SDK class from the mainflux-sdk package
import SDK from "../src/sdk";
import SDK from '../src/sdk'

const defaultUrl = "http://localhost";
const defaultUrl = 'http://localhost'

const mySdk = new SDK({
thingsUrl: defaultUrl + ":9000",
});
thingsUrl: defaultUrl + ':9000'
})

const token =
"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJkb21haW4iOiIzZTlkMTNiMy1lMTgxLTQwNjktODdjNS0yMGQ3MmJlY2M4M2YiLCJleHAiOjE3MTIwMzk5MzMsImlhdCI6MTcxMjAzNjMzMywiaXNzIjoibWFnaXN0cmFsYS5hdXRoIiwic3ViIjoiYjJmZTZhZmUtOGYwNS00NDgzLWFhY2QtN2QyMGVhMjVkOWE1IiwidHlwZSI6MCwidXNlciI6ImIyZmU2YWZlLThmMDUtNDQ4My1hYWNkLTdkMjBlYTI1ZDlhNSJ9.tA_2fGtYlT-zn316AwX_wtw0uXgE7DYFUA_ZvXKCvm1Pofl_WiAWMRt5YcqU_TbGDXmrgJxUd-Ifa9aSYMaFKA";
// //Things.js examples.
// // //Things.js examples.

mySdk.things
.Create(
{
name: "thing_name",
},
<"token">
{ name: 'thing_name' }, '<token>'
)
.then((response: any) => {
console.log("response: ", response);
console.log('response:', response)
})
.catch((error) => {
console.log(error);
});
console.log(error)
})

mySdk.things
.GetAll({ offset: 0, limit: 10 }, "<token>")
.GetAll({ offset: 0, limit: 10 }, '<token>')

.then((response: any) => {
console.log("response:", response);
console.log('response:', response)
})

.catch((error) => {
console.log(error);
});
console.log(error)
})

mySdk.things
.Disable({ id: "<thing_id>" }, "<token>")
.Disable({ id: 'thing_id' }, '<token>')
.then((response: any) => {
console.log("response:", response);
console.log('response:', response)
})
.catch((error) => {
console.error(error);
});
console.error(error)
})

mySdk.things
.Enable({ id: "<thing_id>" }, "<token>")
.Enable({ id: 'thing_id' }, '<token>')
.then((response: any) => {
console.log("response:", response);
console.log('response:', response)
})
.catch((error) => {
console.error(error);
});
console.error(error)
})

mySdk.things
.Update(
{ id: "thing_id", name: "thing_name" },
"<token>",
)
{ id: 'thing_id', name: 'thing_name' }, '<token>')
.then((response: any) => {
console.log("response:", response);
console.log('response:', response)
})
.catch((error) => {
console.log(error);
});
console.log(error)
})

mySdk.things
.UpdateThingSecret(
{
id: "thing_id",
credentials: { secret: "new_secret" },
},
"<token>",
.UpdateThingSecret({ id: 'thing_id', credentials: { secret: 'new_secret' } }, '<token>'
)
.then((response: any) => {
console.log(response);
console.log(response)
})
.catch((error) => {
console.log(error);
});
console.log(error)
})

mySdk.things
.UpdateThingTags(
{ id: "<thing_id>", tags: ["<tag1>", "<tag2>"] },
"<token>",
{ id: 'thing_id', tags: ['<tag1>', '<tag2>'] },
'<token>'
)
.then((response: any) => {
console.log(response);
console.log(response)
})
.catch((error) => {
console.log(error);
});
console.log(error)
})

mySdk.things
.ThingsByChannel({ id: "thing_id" }, { offset: 0, limit: 5 }, "<token>")
.ThingsByChannel({ id: 'thing_id' }, { offset: 0, limit: 5 }, '<token>')
.then((response: any) => {
console.log(response);
console.log(response)
})
.catch((error) => {
console.log(error);
});
console.log(error)
})

mySdk.things
.Things({ offset: 0, limit: 10 }, "<token>")
.Things({ offset: 0, limit: 10 }, '<token>')
.then((response: any) => {
console.log("response: ", response);
console.log('response:', response)
})
.catch((error) => {
console.log(error);
});
console.log(error)
})

mySdk.things
.Thing("thing_id", "<token>")
.Thing('thing_id', '<token>')
.then((response: any) => {
console.log("response: ", response);
console.log('response: ', response)
})
.catch((error) => {
console.log(error);
});
console.log(error)
})

mySdk.things
.ThingsPermissions("thing_id", "<token>")
.ThingsPermissions('thing_id', '<token>')
.then((response: any) => {
console.log("response: ", response);
console.log('response: ', response)
})
.catch((error) => {
console.log(error);
});
console.log(error)
})

mySdk.things
.IdentifyThing({ id: "thing_id" })
.IdentifyThing('thing_key')
.then((response: any) => {
console.log("response: ", response);
console.log('response: ', response)
})
.catch((error) => {
console.log(error);
});
console.log(error)
})

mySdk.things
.ShareThing(
"thing_id",
{
Relation: "relation",
UserID: [
"user_id1",
"user_id2",
],
},
"<token>",
)
'thing_id',

'administrator',
[
'user_id1', 'user_id2'
], '<token>')
.then((response: any) => {
console.log("response: ", response);
console.log('response: ', response)
})
.catch((error) => {
console.log(error);
});
console.log(error)
})

mySdk.things
.UnShareThing(
"thing_id",
{
Relation: "admin",
UserID: [
"user_id1",
"user_id2",
],
},
"<token>",
)
'thing_id',
'administrator',

[
'user_id1', 'user_id2'
], '<token>')
.then((response: any) => {
console.log("response: ", response);
console.log('response:', response)
})
.catch((error) => {
console.log(error);
});
console.log(error)
})

mySdk.things
.ListThingUsers(
"thing_id",
'thing_id',
{ offset: 0, limit: 10 },
"<token>",
'<token>'
)
.then((response: any) => {
console.log("response: ", response);
console.log('response:', response)
})
.catch((error) => {
console.log(error);
});
console.log(error)
})

mySdk.things
.DeleteThing({ id: "thing_id" }, "<token>")
.DeleteThing({ id: 'thing_id' }, '<token>')
.then((response: any) => {
console.log("response: ", response);
console.log('response: ', response)
})
.catch((error) => {
console.log(error);
});
console.log(error)
})

mySdk.things
.CreateThings([{ name: "thing_name" }, { name: "thing_name" }], "<token>")
.CreateThings([{ name: 'thing_name' }, { name: 'thing_name' }], '<token>')
.then((response: any) => {
console.log("response: ", response);
console.log('response:', response)
})
.catch((error) => {
console.log(error);
});
console.log(error)
})
Loading

0 comments on commit 5544659

Please sign in to comment.