diff --git a/cloudflare/src/endpoints/workers/create_tail.rs b/cloudflare/src/endpoints/workers/create_tail.rs index 11fb73b3..59624b5b 100644 --- a/cloudflare/src/endpoints/workers/create_tail.rs +++ b/cloudflare/src/endpoints/workers/create_tail.rs @@ -10,7 +10,11 @@ pub struct CreateTail<'a> { pub account_identifier: &'a str, /// The name of the script to tail pub script_name: &'a str, - /// URL to which to send events + /// V1 of tailing involved creating a separate URL, + /// which is still possible. + /// + /// V2 does not involve a separate URL, so it can + /// be omitted. pub params: CreateTailParams, } @@ -25,12 +29,16 @@ impl<'a> Endpoint for CreateTail<'a> { ) } fn body(&self) -> Option { - Some(self.params.clone()) + if self.params.url.is_some() { + Some(self.params.clone()) + } else { + None + } } } -#[derive(Serialize, Clone, Debug)] +#[derive(Serialize, Clone, Debug, Default)] pub struct CreateTailParams { /// URL to which to send events - pub url: String, + pub url: Option, }