Skip to content

Commit

Permalink
feat: add device fields (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdeme committed Mar 28, 2022
1 parent 9710a90 commit 3b582f5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
13 changes: 11 additions & 2 deletions stream_chat/async_chat/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,20 @@ async def update_command(self, name: str, **settings: Any) -> StreamResponse:
return await self.put(f"commands/{name}", data=settings)

async def add_device(
self, device_id: str, push_provider: str, user_id: str
self,
device_id: str,
push_provider: str,
user_id: str,
push_provider_name: str = None,
) -> StreamResponse:
return await self.post(
"devices",
data={"id": device_id, "push_provider": push_provider, "user_id": user_id},
data={
"id": device_id,
"push_provider": push_provider,
"user_id": user_id,
"push_provider_name": push_provider_name,
},
)

async def delete_device(self, device_id: str, user_id: str) -> StreamResponse:
Expand Down
6 changes: 5 additions & 1 deletion stream_chat/base/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,11 @@ def update_command(

@abc.abstractmethod
def add_device(
self, device_id: str, push_provider: str, user_id: str
self,
device_id: str,
push_provider: str,
user_id: str,
push_provider_name: str = None,
) -> Union[StreamResponse, Awaitable[StreamResponse]]:
"""
Add a device to a user
Expand Down
13 changes: 11 additions & 2 deletions stream_chat/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,20 @@ def update_command(self, name: str, **settings: Any) -> StreamResponse:
return self.put(f"commands/{name}", data=settings)

def add_device(
self, device_id: str, push_provider: str, user_id: str
self,
device_id: str,
push_provider: str,
user_id: str,
push_provider_name: str = None,
) -> StreamResponse:
return self.post(
"devices",
data={"id": device_id, "push_provider": push_provider, "user_id": user_id},
data={
"id": device_id,
"push_provider": push_provider,
"user_id": user_id,
"push_provider_name": push_provider_name,
},
)

def delete_device(self, device_id: str, user_id: str) -> StreamResponse:
Expand Down

0 comments on commit 3b582f5

Please sign in to comment.