Skip to content

Commit b3eace4

Browse files
committed
feat(stream): support delete_all query for stream rules
1 parent 689353f commit b3eace4

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

doc/streaming.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ const deleteRules = await client.v2.updateStreamRules({
216216
ids: ['281646', '1534843'],
217217
},
218218
});
219+
220+
// Delete all rules
221+
await client.v2.updateStreamRules({}, { delete_all: true });
219222
```
220223

221224
### Sample endpoint

src/types/v2/streaming.v2.types.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,25 @@ export interface StreamingV2DeleteRulesParams {
5252
};
5353
}
5454

55-
export type StreamingV2UpdateRulesParams = StreamingV2AddRulesParams | StreamingV2DeleteRulesParams;
55+
/** Empty body used when deleting all rules through the `delete_all` query parameter. */
56+
export type StreamingV2DeleteAllRulesParams = Record<string, never>;
57+
58+
export type StreamingV2UpdateRulesParams =
59+
| StreamingV2AddRulesParams
60+
| StreamingV2DeleteRulesParams
61+
| StreamingV2DeleteAllRulesParams;
5662

5763
export interface StreamingV2UpdateRulesQuery {
5864
/**
5965
* Set to true to test a the syntax of your rule without submitting it.
6066
* This is useful if you want to check the syntax of a rule before removing one or more of your existing rules.
6167
*/
6268
dry_run: boolean;
69+
/**
70+
* Delete all of the rules associated with this client app. It should be specified with no other parameters.
71+
* Once deleted, rules cannot be recovered.
72+
*/
73+
delete_all?: boolean;
6374
}
6475

6576
export type StreamingV2UpdateRulesAddResult = DataAndMetaV2<StreamingV2Rule[], {

0 commit comments

Comments
 (0)