Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/streaming.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion src/types/v2/streaming.v2.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,25 @@ 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<string, never>;

export type StreamingV2UpdateRulesParams =
| StreamingV2AddRulesParams
| StreamingV2DeleteRulesParams
| StreamingV2DeleteAllRulesParams;

export interface StreamingV2UpdateRulesQuery {
/**
* Set to true to test a the syntax of your rule without submitting it.
* 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<StreamingV2Rule[], {
Expand Down