Skip to content

Commit 91375c5

Browse files
authored
CLI: add support for Polling Endpoint Consumers (#1833)
Adds support for using `v1.events-public.consumer` and `v1.events-public.consumer-seek`, but gated behind a `svix_beta` cargo feature.
2 parents 55a729d + d8ec72e commit 91375c5

File tree

5 files changed

+17
-2
lines changed

5 files changed

+17
-2
lines changed

codegen.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ extra_codegen_args = ["--include-mode=public-and-hidden"]
4949
template_dir = "svix-cli/templates"
5050
extra_mounts = { "svix-cli/.rustfmt.toml" = "/app/.rustfmt.toml" }
5151
extra_shell_commands = [
52-
"cargo fix --manifest-path svix-cli/Cargo.toml --allow-dirty --allow-staged",
52+
"cargo fix --all-targets --all-features --manifest-path svix-cli/Cargo.toml --allow-dirty --allow-staged",
5353
"cargo fmt --manifest-path svix-cli/Cargo.toml",
5454
"rm svix-cli/src/cmds/api/{ingest,ingest_source,operational_webhook,background_task,health,operational_webhook_endpoint,statistics}.rs",
5555
]

svix-cli/Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ tokio-tungstenite = { version = "0.26.0", features = ["rustls-tls-native-roots"]
5252
toml = "0.8.19"
5353
url = "2.5.4"
5454

55+
[features]
56+
default = []
57+
svix_beta = ["svix/svix_beta"]
58+
5559
# The profile that 'dist' will build with
5660
[profile.dist]
5761
inherits = "release"

svix-cli/src/cmds/api/events_public.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use chrono::{DateTime, Utc};
21
use clap::{Args, Subcommand};
32
use svix::api::*;
43

svix-cli/src/cmds/api/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ pub mod authentication;
33
pub mod endpoint;
44
pub mod environment;
55
pub mod event_type;
6+
#[cfg(feature = "svix_beta")]
7+
pub mod events_public;
68
pub mod integration;
79
pub mod message;
810
pub mod message_attempt;

svix-cli/src/main.rs

+10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ use colored_json::{ColorMode, Output};
55
use concolor_clap::{Color, ColorChoice};
66
use svix::api::SvixOptions;
77

8+
#[cfg(feature = "svix_beta")]
9+
use crate::cmds::api::events_public::EventsPublicArgs;
810
use crate::{
911
cmds::{
1012
api::{
@@ -65,6 +67,9 @@ enum RootCommands {
6567
Endpoint(EndpointArgs),
6668
/// Import or export environments
6769
Environment(EnvironmentArgs),
70+
#[cfg(feature = "svix_beta")]
71+
/// Iterate over messages for a Polling Endpoint
72+
EventsPublic(EventsPublicArgs),
6873
/// List, create & modify event types
6974
EventType(EventTypeArgs),
7075
/// List integrations by app id
@@ -109,6 +114,11 @@ async fn main() -> Result<()> {
109114
let client = get_client(&cfg)?;
110115
args.command.exec(&client, color_mode).await?;
111116
}
117+
#[cfg(feature = "svix_beta")]
118+
RootCommands::EventsPublic(args) => {
119+
let client = get_client(&cfg?)?;
120+
args.command.exec(&client, color_mode).await?;
121+
}
112122
RootCommands::EventType(args) => {
113123
let client = get_client(&cfg?)?;
114124
args.command.exec(&client, color_mode).await?;

0 commit comments

Comments
 (0)