Skip to content

Commit 616206e

Browse files
feat: sns (#147)
* feat: sns
1 parent d214044 commit 616206e

File tree

5 files changed

+35
-1
lines changed

5 files changed

+35
-1
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
fetch-depth: 0 # gives the commit message linter access to all previous commits
2626

2727
- name: Commit lint
28-
if: ${{ matrix.python == '3.7' }}
28+
if: ${{ matrix.python == '3.7' && github.ref == 'refs/heads/master' }}
2929
uses: wagoid/commitlint-github-action@v4
3030

3131
- uses: actions/setup-python@v3

stream_chat/async_chat/client.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,16 @@ async def check_sqs(
496496
data = {"sqs_key": sqs_key, "sqs_secret": sqs_secret, "sqs_url": sqs_url}
497497
return await self.post("check_sqs", data=data)
498498

499+
async def check_sns(
500+
self, sns_key: str = None, sns_secret: str = None, sns_topic_arn: str = None
501+
) -> StreamResponse:
502+
data = {
503+
"sns_key": sns_key,
504+
"sns_secret": sns_secret,
505+
"sns_topic_arn": sns_topic_arn,
506+
}
507+
return await self.post("check_sns", data=data)
508+
499509
async def set_guest_user(self, guest_user: Dict) -> StreamResponse:
500510
return await self.post("guest", data=dict(user=guest_user))
501511

stream_chat/client.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,16 @@ def check_sqs(
480480
data = {"sqs_key": sqs_key, "sqs_secret": sqs_secret, "sqs_url": sqs_url}
481481
return self.post("check_sqs", data=data)
482482

483+
def check_sns(
484+
self, sns_key: str = None, sns_secret: str = None, sns_topic_arn: str = None
485+
) -> StreamResponse:
486+
data = {
487+
"sns_key": sns_key,
488+
"sns_secret": sns_secret,
489+
"sns_topic_arn": sns_topic_arn,
490+
}
491+
return self.post("check_sns", data=data)
492+
483493
def get_permission(self, id: str) -> StreamResponse:
484494
return self.get(f"permissions/{id}")
485495

stream_chat/tests/async_chat/test_client.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,13 @@ async def test_check_sqs(self, client: StreamChatAsync):
621621
assert response["status"] == "error"
622622
assert "invalid SQS url" in response["error"]
623623

624+
async def test_check_sns(self, client: StreamChatAsync):
625+
response = await client.check_sns(
626+
"key", "secret", "arn:aws:sns:us-east-1:123456789012:sns-topic"
627+
)
628+
assert response["status"] == "error"
629+
assert "publishing the message failed." in response["error"]
630+
624631
async def test_guest_user(self, client: StreamChatAsync, random_user: Dict):
625632
try:
626633
response = await client.set_guest_user({"user": {"id": str(uuid.uuid4())}})

stream_chat/tests/test_client.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,13 @@ def test_check_sqs(self, client: StreamChat):
588588
assert response["status"] == "error"
589589
assert "invalid SQS url" in response["error"]
590590

591+
def test_check_sns(self, client: StreamChat):
592+
response = client.check_sns(
593+
"key", "secret", "arn:aws:sns:us-east-1:123456789012:sns-topic"
594+
)
595+
assert response["status"] == "error"
596+
assert "publishing the message failed." in response["error"]
597+
591598
def test_guest_user(self, client: StreamChat, random_user: Dict):
592599
try:
593600
response = client.set_guest_user({"user": {"id": str(uuid.uuid4())}})

0 commit comments

Comments
 (0)