From e6a58e88da900431506a4cec6554c0a7f55c4358 Mon Sep 17 00:00:00 2001 From: Cass Date: Wed, 14 Apr 2021 17:54:02 -0400 Subject: [PATCH] Update tail endpoint (#140) * Update tail endpoint There's now a V2 implementation of tail that doesn't involve an external URL, so that param should be optional --- cloudflare/src/endpoints/workers/create_tail.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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, }