mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-16 02:36:19 +00:00
updated delete scene
This commit is contained in:
@ -52,4 +52,38 @@ export class TuyaService {
|
||||
|
||||
return response.result;
|
||||
}
|
||||
|
||||
async deleteSceneRule(sceneId: string, spaceId: string) {
|
||||
const path = `/v2.0/cloud/scene/rule?ids=${sceneId}&space_id=${spaceId}`;
|
||||
const response = await this.tuya.request({
|
||||
method: 'DELETE',
|
||||
path,
|
||||
});
|
||||
|
||||
if (response.success) {
|
||||
return response;
|
||||
} else {
|
||||
throw new HttpException(
|
||||
`Error deleting scene rule: ${response.msg}`,
|
||||
HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async getSceneRule(sceneId: string) {
|
||||
const path = `/v2.0/cloud/scene/rule/${sceneId}`;
|
||||
const response = await this.tuya.request({
|
||||
method: 'GET',
|
||||
path,
|
||||
});
|
||||
|
||||
if (response.success) {
|
||||
return response;
|
||||
} else {
|
||||
throw new HttpException(
|
||||
`Error fetching scene rule: ${response.msg}`,
|
||||
HttpStatus.BAD_REQUEST,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user