Skip to content

Commit 9710a90

Browse files
authored
feat: add provider management (#106)
1 parent c4a5e24 commit 9710a90

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

stream_chat/async_chat/client.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,19 @@ async def get_task(self, task_id: str) -> StreamResponse:
594594
async def send_user_custom_event(self, user_id: str, event: Dict) -> StreamResponse:
595595
return await self.post(f"users/{user_id}/event", data={"event": event})
596596

597+
async def upsert_push_provider(self, push_provider_config: Dict) -> StreamResponse:
598+
return await self.post(
599+
"push_providers", data={"push_provider": push_provider_config}
600+
)
601+
602+
async def delete_push_provider(
603+
self, provider_type: str, name: str
604+
) -> StreamResponse:
605+
return await self.delete(f"push_providers/{provider_type}/{name}")
606+
607+
async def list_push_providers(self) -> StreamResponse:
608+
return await self.get("push_providers")
609+
597610
async def close(self) -> None:
598611
await self.session.close()
599612

stream_chat/base/client.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,31 @@ def send_user_custom_event(
866866
"""
867867
pass
868868

869+
@abc.abstractmethod
870+
def upsert_push_provider(
871+
self, push_provider_config: Dict
872+
) -> Union[StreamResponse, Awaitable[StreamResponse]]:
873+
"""
874+
Create or update a push provider.
875+
"""
876+
pass
877+
878+
@abc.abstractmethod
879+
def delete_push_provider(
880+
self, provider_type: str, name: str
881+
) -> Union[StreamResponse, Awaitable[StreamResponse]]:
882+
"""
883+
Delete a push provider.
884+
"""
885+
pass
886+
887+
@abc.abstractmethod
888+
def list_push_providers(self) -> Union[StreamResponse, Awaitable[StreamResponse]]:
889+
"""
890+
Get all push providers in the app.
891+
"""
892+
pass
893+
869894
#####################
870895
# Private methods #
871896
#####################

stream_chat/client.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,3 +563,12 @@ def get_task(self, task_id: str) -> StreamResponse:
563563

564564
def send_user_custom_event(self, user_id: str, event: Dict) -> StreamResponse:
565565
return self.post(f"users/{user_id}/event", data={"event": event})
566+
567+
def upsert_push_provider(self, push_provider_config: Dict) -> StreamResponse:
568+
return self.post("push_providers", data={"push_provider": push_provider_config})
569+
570+
def delete_push_provider(self, provider_type: str, name: str) -> StreamResponse:
571+
return self.delete(f"push_providers/{provider_type}/{name}")
572+
573+
def list_push_providers(self) -> StreamResponse:
574+
return self.get("push_providers")

0 commit comments

Comments
 (0)