Skip to content

Commit

Permalink
DEL: Remove deprecated packaging option
Browse files Browse the repository at this point in the history
  • Loading branch information
threecgreen committed Dec 12, 2024
1 parent 457289b commit 6357597
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 78 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.17.0 - TBD

### Breaking changes
- Removed deprecated `Packaging` enum and `packaging` field that's no longer supported
by the API

## 0.16.0 - 2024-11-12

#### Enhancements
Expand Down
78 changes: 0 additions & 78 deletions src/historical/batch.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! The historical batch download API.
#![allow(deprecated)] // Packaging

use core::fmt;
use std::{
collections::HashMap,
Expand Down Expand Up @@ -50,12 +48,6 @@ impl BatchClient<'_> {
("map_symbols", params.map_symbols.to_string()),
("split_symbols", params.split_symbols.to_string()),
("split_duration", params.split_duration.to_string()),
(
"packaging",
params
.packaging
.map_or_else(|| "none".to_owned(), |p| p.to_string()),
),
("delivery", params.delivery.to_string()),
("stype_in", params.stype_in.to_string()),
("stype_out", params.stype_out.to_string()),
Expand Down Expand Up @@ -209,20 +201,6 @@ pub enum SplitDuration {
Month,
}

/// How the batch job will be packaged.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[deprecated(
since = "0.16.0",
note = "Use the `download()` method to download the whole job`"
)]
pub enum Packaging {
/// ZIP compressed.
Zip,
/// Tarball.
#[deprecated(since = "0.13.0", note = "Users should use Zip instead")]
Tar,
}

/// How the batch job will be delivered.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum Delivery {
Expand Down Expand Up @@ -295,13 +273,6 @@ pub struct SubmitJobParams {
/// Must be an integer between 1e9 and 10e9 inclusive (1GB - 10GB). Defaults to `None`.
#[builder(default, setter(strip_option))]
pub split_size: Option<NonZeroU64>,
/// The optional archive type to package all batched data files in. Defaults to `None`.
#[builder(default, setter(strip_option))]
#[deprecated(
since = "0.16.0",
note = "Use the `download()` method to download the whole job`"
)]
pub packaging: Option<Packaging>,
/// The delivery mechanism for the batched data files once processed. Defaults to
/// [`Download`](Delivery::Download).
#[builder(default)]
Expand Down Expand Up @@ -366,12 +337,6 @@ pub struct BatchJob {
pub split_duration: SplitDuration,
/// The maximum size for an individual file before splitting into multiple files.
pub split_size: Option<NonZeroU64>,
/// The packaging method of the batch data.
#[deprecated(
since = "0.16.0",
note = "Use the `download()` method to download the whole job`"
)]
pub packaging: Option<Packaging>,
/// The delivery mechanism of the batch data.
pub delivery: Delivery,
/// The number of data records (`None` until the job is processed).
Expand Down Expand Up @@ -485,47 +450,6 @@ impl<'de> Deserialize<'de> for SplitDuration {
}
}

impl Packaging {
/// Converts the enum to its `str` representation.
pub const fn as_str(&self) -> &'static str {
match self {
Packaging::Zip => "zip",
Packaging::Tar => "tar",
}
}
}

impl fmt::Display for Packaging {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.as_str())
}
}

impl FromStr for Packaging {
type Err = crate::Error;

fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"zip" => Ok(Packaging::Zip),
"tar" => Ok(Packaging::Tar),
_ => Err(crate::Error::bad_arg(
"s",
format!(
"{s} does not correspond with any {} variant",
std::any::type_name::<Self>()
),
)),
}
}
}

impl<'de> Deserialize<'de> for Packaging {
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
let str = String::deserialize(deserializer)?;
FromStr::from_str(&str).map_err(de::Error::custom)
}
}

impl Delivery {
/// Converts the enum to its `str` representation.
pub const fn as_str(&self) -> &'static str {
Expand Down Expand Up @@ -689,7 +613,6 @@ mod tests {
"split_symbols": false,
"split_duration": "day",
"split_size": null,
"packaging": null,
"delivery": "download",
"state": "queued",
"ts_received": "2023-07-19T23:00:04.095538123Z",
Expand Down Expand Up @@ -754,7 +677,6 @@ mod tests {
"split_symbols": false,
"split_duration": "day",
"split_size": null,
"packaging": null,
"delivery": "download",
"state": "processing",
"ts_received": "2023-07-19 23:00:04.095538+00:00",
Expand Down

0 comments on commit 6357597

Please sign in to comment.