updated delete scene

This commit is contained in:
hannathkadher
2024-10-31 14:39:36 +04:00
parent 403a0174a9
commit 2b6168058a
4 changed files with 133 additions and 10 deletions

View File

@ -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,
);
}
}
}