From 9a4bdfb68424cc02083c1e05f8512900696c0efc Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Mon, 16 Oct 2023 11:03:59 +0200 Subject: [PATCH] feat: support for SNS (#1185) --- src/client.ts | 16 ++++++++++++++++ src/types.ts | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/client.ts b/src/client.ts index a5226a20f..cae3abe8a 100644 --- a/src/client.ts +++ b/src/client.ts @@ -51,6 +51,7 @@ import { ChannelSort, ChannelStateOptions, CheckPushResponse, + CheckSNSResponse, CheckSQSResponse, Configs, ConnectAPIResponse, @@ -147,6 +148,7 @@ import { TaskStatus, TestCampaignResponse, TestPushDataInput, + TestSNSDataInput, TestSQSDataInput, TokenOrProvider, UnBanUserOptions, @@ -715,6 +717,20 @@ export class StreamChat(this.baseURL + '/check_sqs', data); } + /** + * testSNSSettings - Tests that the given or configured SNS configuration is valid + * + * @param {TestSNSDataInput} [data] Overrides SNS settings for testing if needed + * IE: { + sns_key: 'auth_key', + sns_secret: 'auth_secret', + sns_topic_arn: 'topic_to_publish_to', + } + */ + async testSNSSettings(data: TestSNSDataInput = {}) { + return await this.post(this.baseURL + '/check_sns', data); + } + /** * Disconnects the websocket and removes the user from client. * diff --git a/src/types.ts b/src/types.ts index 3e64a33da..00065c5f9 100644 --- a/src/types.ts +++ b/src/types.ts @@ -144,6 +144,9 @@ export type AppSettingsAPIResponse = Partial & { @@ -1617,6 +1626,9 @@ export type AppSettings = { }; reminders_interval?: number; revoke_tokens_issued_before?: string | null; + sns_key?: string; + sns_secret?: string; + sns_topic_arn?: string; sqs_key?: string; sqs_secret?: string; sqs_url?: string; @@ -2240,6 +2252,12 @@ export type TestSQSDataInput = { sqs_url?: string; }; +export type TestSNSDataInput = { + sns_key?: string; + sns_secret?: string; + sns_topic_arn?: string; +}; + export type TokenOrProvider = null | string | TokenProvider | undefined; export type TokenProvider = () => Promise;