From 3a5eacf8bb331c635b894440150113e608d0d291 Mon Sep 17 00:00:00 2001 From: Var Bhat Date: Wed, 11 Dec 2024 15:55:08 +0100 Subject: [PATCH] feat: add translate API support --- src/client.ts | 17 +++++++++++++++++ src/types.ts | 5 +++++ 2 files changed, 22 insertions(+) diff --git a/src/client.ts b/src/client.ts index 4f8ee4dec..402154d2b 100644 --- a/src/client.ts +++ b/src/client.ts @@ -189,6 +189,7 @@ import { TestSNSDataInput, TestSQSDataInput, TokenOrProvider, + TranslateResponse, UnBanUserOptions, UpdateChannelOptions, UpdateChannelResponse, @@ -2516,6 +2517,22 @@ export class StreamChat( + this.baseURL + `/translate`, + { text, source_language, destination_language }, + ); + } + /** * _normalizeExpiration - transforms expiration value into ISO string * @param {undefined|null|number|string|Date} timeoutOrExpirationDate expiration date or timeout. Use number type to set timeout in seconds, string or Date to set exact expiration date diff --git a/src/types.ts b/src/types.ts index 8a7c01e8c..ba294d217 100644 --- a/src/types.ts +++ b/src/types.ts @@ -77,6 +77,11 @@ export type APIResponse = { duration: string; }; +export type TranslateResponse = { + translated_text: string; + language: string; +} + export type AppSettingsAPIResponse = APIResponse & { app?: { // TODO