Skip to content

Commit

Permalink
Update tail endpoint (#140)
Browse files Browse the repository at this point in the history
* Update tail endpoint

There's now a V2 implementation of tail that doesn't involve an external URL, so that param should be optional
  • Loading branch information
Cass authored Apr 14, 2021
1 parent 4cba97c commit e6a58e8
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions cloudflare/src/endpoints/workers/create_tail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand All @@ -25,12 +29,16 @@ impl<'a> Endpoint<WorkersTail, (), CreateTailParams> for CreateTail<'a> {
)
}
fn body(&self) -> Option<CreateTailParams> {
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<String>,
}

0 comments on commit e6a58e8

Please sign in to comment.