From b3eace4776c65d85cdd988a3f9a3808a42cb69eb Mon Sep 17 00:00:00 2001 From: Paul-Louis HERY Date: Thu, 4 Sep 2025 22:50:03 +0200 Subject: [PATCH] feat(stream): support delete_all query for stream rules --- doc/streaming.md | 3 +++ src/types/v2/streaming.v2.types.ts | 13 ++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/streaming.md b/doc/streaming.md index 7b8f1758..0a2a5649 100644 --- a/doc/streaming.md +++ b/doc/streaming.md @@ -216,6 +216,9 @@ const deleteRules = await client.v2.updateStreamRules({ ids: ['281646', '1534843'], }, }); + +// Delete all rules +await client.v2.updateStreamRules({}, { delete_all: true }); ``` ### Sample endpoint diff --git a/src/types/v2/streaming.v2.types.ts b/src/types/v2/streaming.v2.types.ts index b63c9e48..1fd9d79c 100644 --- a/src/types/v2/streaming.v2.types.ts +++ b/src/types/v2/streaming.v2.types.ts @@ -52,7 +52,13 @@ export interface StreamingV2DeleteRulesParams { }; } -export type StreamingV2UpdateRulesParams = StreamingV2AddRulesParams | StreamingV2DeleteRulesParams; +/** Empty body used when deleting all rules through the `delete_all` query parameter. */ +export type StreamingV2DeleteAllRulesParams = Record; + +export type StreamingV2UpdateRulesParams = + | StreamingV2AddRulesParams + | StreamingV2DeleteRulesParams + | StreamingV2DeleteAllRulesParams; export interface StreamingV2UpdateRulesQuery { /** @@ -60,6 +66,11 @@ export interface StreamingV2UpdateRulesQuery { * This is useful if you want to check the syntax of a rule before removing one or more of your existing rules. */ dry_run: boolean; + /** + * Delete all of the rules associated with this client app. It should be specified with no other parameters. + * Once deleted, rules cannot be recovered. + */ + delete_all?: boolean; } export type StreamingV2UpdateRulesAddResult = DataAndMetaV2