Skip to content

Commit

Permalink
Remove deprecated TuyaAPI openapi (#16)
Browse files Browse the repository at this point in the history
Co-authored-by: Andreas Botsikas <[email protected]>
  • Loading branch information
andreasbotsikas and andreasbotsikas authored Jan 1, 2022
1 parent d7839b1 commit 25507ea
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,33 @@ class TuyaLinkWizard {
throw error;
}
}

async getLinkedDevices({ ids, pageNumber = 0, pageSize = 100 } = { pageNumber: 0, pageSize: 100 }){

const searchParameters = {
schema: this.schema,
page_no: pageNumber,
page_size: pageSize
};
if (ids) {
searchParameters.device_ids = ids.toString();
}

const response = await this.api.request({
path: '/v1.0/devices',
method: 'GET',
query: searchParameters
});

if (!response.success) {
throw new Error(response.msg);
}

const batchDevices = response.result;
debug('Retrieved device(s)!', batchDevices);

return batchDevices
}
}

module.exports = {wizard: TuyaLinkWizard, manual: TuyaLink};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tuyapi/link",
"version": "0.3.4",
"version": "0.4.0",
"description": "📡 Effortlessly connect devices to WiFi and the cloud",
"main": "index.js",
"files": [
Expand Down

0 comments on commit 25507ea

Please sign in to comment.