File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change 2
2
from typing import TYPE_CHECKING , List
3
3
4
4
from swibots .api .community .models import Channel
5
-
5
+ from swibots . errors import SwitchError
6
6
7
7
if TYPE_CHECKING :
8
8
from swibots .api .community import CommunityClient
@@ -25,14 +25,14 @@ async def create_channel(self, channel: Channel) -> str:
25
25
response = await self .client .post (BASE_PATH , data = channel .to_json_request ())
26
26
return response .data .get ("result" , {}).get ("channelId" )
27
27
28
- async def delete_channel (self , channel_id : str ) -> str :
28
+ async def delete_channel (self , channel_id : str ) -> bool :
29
29
response = await self .client .delete (f"{ BASE_PATH } /{ channel_id } " )
30
- # return response.data.get("result", {}).get("channelId")
31
- return (
32
- "Successfully deleted the channel."
33
- if response . status_code == 200
34
- else response . data . get ( "errorMessage" )
35
- )
30
+ if response .status_code == 200 :
31
+ return True
32
+ logging . debug ( response . data )
33
+ if err := response . data . get ( "errorMessage" ):
34
+ raise SwitchError ( err )
35
+ return False
36
36
37
37
async def update_channel (self , channel : Channel ) -> str :
38
38
response = await self .client .put (BASE_PATH , data = channel .to_json_request ())
You can’t perform that action at this time.
0 commit comments