From 15d4db7ab909ab3d3ac14cb96ac032b86509a0e7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Sep 2023 05:11:42 +0000 Subject: [PATCH 1/7] ci(actions): bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/rust.yml | 4 ++-- .github/workflows/style.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f0fb333..72831c5 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -34,7 +34,7 @@ jobs: --health-retries 5 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Rust uses: actions-rs/toolchain@v1 @@ -71,7 +71,7 @@ jobs: needs: test steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Rust uses: actions-rs/toolchain@v1 diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index 7dbd6f5..de787d5 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -10,7 +10,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Check code formatting run: cargo fmt -- --check --verbose From 07d4dc55e9df95a535e59e0ba8ed052fcbf247f1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 Oct 2023 07:10:13 +0000 Subject: [PATCH 2/7] chore(cargo): update typed-builder requirement from 0.16 to 0.18 Updates the requirements on [typed-builder](https://github.com/idanarye/rust-typed-builder) to permit the latest version. - [Changelog](https://github.com/idanarye/rust-typed-builder/blob/master/CHANGELOG.md) - [Commits](https://github.com/idanarye/rust-typed-builder/commits) --- updated-dependencies: - dependency-name: typed-builder dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 6b3a509..2a0f36a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ serde = { version = "1.0", features = ["serde_derive"] } thiserror = "1.0" rand = "0.8" reqwest_cookie_store = "0.6" -typed-builder = "0.16" +typed-builder = "0.18" fang = { version = "0.10.3", features = ["asynk"], default-features = false } redis-macros = { version = "0.2.1", optional = true } redis = { version = "0.23.2", optional = true } From 0379d5f03ed7bfc1c982e929526b9a1e70f4d5ca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Dec 2023 07:07:39 +0000 Subject: [PATCH 3/7] chore(cargo): update redis requirement from 0.23.2 to 0.24.0 Updates the requirements on [redis](https://github.com/redis-rs/redis-rs) to permit the latest version. - [Release notes](https://github.com/redis-rs/redis-rs/releases) - [Commits](https://github.com/redis-rs/redis-rs/compare/redis-0.23.2...redis-0.24.0) --- updated-dependencies: - dependency-name: redis dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6b3a509..888ec2c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,13 +34,13 @@ reqwest_cookie_store = "0.6" typed-builder = "0.16" fang = { version = "0.10.3", features = ["asynk"], default-features = false } redis-macros = { version = "0.2.1", optional = true } -redis = { version = "0.23.2", optional = true } +redis = { version = "0.24.0", optional = true } serde_json = { version = "1.0.91" } log = "0.4.20" lazy_static = "1.4.0" [dev-dependencies] redis-macros = { version = "0.2.1" } -redis = { version = "0.23.2" } +redis = { version = "0.24.0" } [dependencies.bb8-postgres] version = "0.8" From 40b8084ab1e56bfbd8e80fe8195fec6a51102dbf Mon Sep 17 00:00:00 2001 From: Alvaro Cabo Date: Tue, 2 Apr 2024 20:58:08 +0200 Subject: [PATCH 4/7] Ft/Made model's field public (#81) * Made public all model's fields * Fixed clippy * Added docs * Small changes in docs for queries.rs --- src/model/filter.rs | 2 +- src/model/item.rs | 21 +++++++++++-- src/model/payment_method.rs | 21 +++++++------ src/model/user.rs | 59 +++++++++++++++++++++---------------- src/queries.rs | 6 ++-- src/tests/queries.rs | 2 +- 6 files changed, 68 insertions(+), 43 deletions(-) diff --git a/src/model/filter.rs b/src/model/filter.rs index 3f9fee0..f77685a 100644 --- a/src/model/filter.rs +++ b/src/model/filter.rs @@ -36,7 +36,7 @@ pub mod size; /// let filter: Filter = Filter::builder() /// .catalog_ids(Some(String::from("4,16"))) /// .brand_ids(Some(String::from("14,53"))) -/// .build(); +/// .build(); /// /// // Women shoes and Women clothes that are only from brands Adidas and Nike. /// diff --git a/src/model/item.rs b/src/model/item.rs index a710151..a9ff4e2 100644 --- a/src/model/item.rs +++ b/src/model/item.rs @@ -44,24 +44,31 @@ impl fmt::Display for Item { #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Hash, Eq)] #[cfg_attr(feature = "redis", derive(FromRedisValue, ToRedisArgs,))] pub struct AdvancedItem { - // Products filter info + /// Vinted item ID pub id: i64, + /// Item title pub title: String, + /// Item description pub description: String, + /// See [`Size`](crate::model::filter::size::Size) #[serde(rename = "size")] pub size_title: String, + /// See [`Brand`](crate::model::filter::brand::Brand) #[serde(rename = "brand")] pub brand_title: String, #[serde(skip_serializing_if = "Option::is_none")] pub composition: Option, #[serde(skip_serializing_if = "Option::is_none")] pub extra_conditions: Option, + /// See [`Brand`](crate::model::filter::brand::Brand) #[serde(skip_serializing_if = "Option::is_none")] pub brand_id: Option, #[serde(skip_serializing_if = "Option::is_none")] pub size_id: Option, + /// See [`ArticleStatus`](crate::model::filter::ArticleStatus) #[serde(skip_serializing_if = "Option::is_none")] pub status_id: Option, + /// Status of the item in French 🇫🇷 #[serde(rename = "status")] #[serde(skip_serializing_if = "Option::is_none")] pub status_fr: Option, @@ -78,7 +85,7 @@ pub struct AdvancedItem { #[serde(skip_serializing_if = "Option::is_none")] pub color2: Option, pub package_size_id: i32, - //Location + /// See [`Country`](crate::model::filter::country::Country) pub country_id: i32, #[serde(skip_serializing_if = "Option::is_none")] pub city_id: Option, @@ -86,17 +93,25 @@ pub struct AdvancedItem { pub city: Option, //Stats + /// Number of bids on the item pub active_bid_count: i32, + /// Number of times the item was added to favourites pub favourite_count: i32, + /// Number of times the item was viewed pub view_count: i32, + /// Moderation status of the item (Vinted internal use only) pub moderation_status: i32, #[serde(skip_serializing_if = "Option::is_none")] pub last_push_up_at: Option, + /// Related ['Brand'](crate::model::filter::brand::Brand) IDs pub related_catalog_ids: Vec, // Pricing + /// Original price of the item pub original_price_numeric: String, + /// Currency the item was posted with. See [`Currency`](crate::model::filter::Currency) for valid currencies on Vinted pub currency: String, + /// Current valid price of the item pub price_numeric: String, // Order by stats @@ -106,7 +121,7 @@ pub struct AdvancedItem { #[serde(skip_serializing_if = "Option::is_none")] pub user_updated_at_ts: Option, - // Asets + // Assets pub photos: Vec, pub url: String, pub user: AdvancedUser, diff --git a/src/model/payment_method.rs b/src/model/payment_method.rs index 828c3ee..058fd92 100644 --- a/src/model/payment_method.rs +++ b/src/model/payment_method.rs @@ -8,19 +8,22 @@ use redis_macros::{FromRedisValue, ToRedisArgs}; #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Hash, Eq)] #[cfg_attr(feature = "redis", derive(FromRedisValue, ToRedisArgs,))] pub struct PayInMethod { - id: i32, - code: String, - requires_credit_card: bool, + pub id: i32, + /// Code of the payment method given by Vinted + pub code: String, + /// If the payment method requires a credit card + pub requires_credit_card: bool, #[serde(skip_serializing_if = "Option::is_none")] - event_tracking_code: Option, + pub event_tracking_code: Option, + /// Icon of the payment method #[serde(skip_serializing_if = "Option::is_none")] - icon: Option, - enabled: bool, + pub icon: Option, + pub enabled: bool, #[serde(skip_serializing_if = "Option::is_none")] - translated_name: Option, + pub translated_name: Option, #[serde(skip_serializing_if = "Option::is_none")] - note: Option, - method_change_possible: bool, + pub note: Option, + pub method_change_possible: bool, } impl fmt::Display for PayInMethod { diff --git a/src/model/user.rs b/src/model/user.rs index ead468b..5d80f3b 100644 --- a/src/model/user.rs +++ b/src/model/user.rs @@ -1,51 +1,60 @@ -use std::fmt; - use crate::model::{Deserialize, Serialize}; #[cfg(feature = "redis")] use crate::model::{FromRedisValue, ToRedisArgs}; +use std::fmt; use super::{payment_method::PayInMethod, photo::Photo}; #[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, Hash)] #[cfg_attr(feature = "redis", derive(FromRedisValue, ToRedisArgs,))] pub struct User { - id: i64, - login: String, //usernameredis_macros - photo: Photo, + /// Vinted user ID + pub id: i64, + // Username + pub login: String, + /// User's profile picture URL + pub photo: Photo, } - +/// All avalible fields for a user #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Hash, Eq)] #[cfg_attr(feature = "redis", derive(FromRedisValue, ToRedisArgs,))] pub struct AdvancedUser { - id: i64, - login: String, //username + /// Vinted user ID + pub id: i64, + /// Username + pub login: String, + /// User's profile picture URL #[serde(skip_serializing_if = "Option::is_none")] - photo: Option, - + pub photo: Option, + /// User's real name #[serde(skip_serializing_if = "Option::is_none")] - real_name: Option, + pub real_name: Option, + /// User's email #[serde(skip_serializing_if = "Option::is_none")] - email: Option, + pub email: Option, + /// User's birthday #[serde(skip_serializing_if = "Option::is_none")] - birthday: Option, + pub birthday: Option, #[serde(skip_serializing_if = "Option::is_none")] - gender: Option, - + pub gender: Option, + /// Last time the user logged in #[serde(skip_serializing_if = "Option::is_none")] - last_loged_on_ts: Option, - expose_location: bool, - country_id: i32, + pub last_loged_on_ts: Option, + /// If the user wants to expose his location + pub expose_location: bool, + /// See [`Country`](crate::model::filter::country::Country) + pub country_id: i32, #[serde(skip_serializing_if = "Option::is_none")] - city_id: Option, + pub city_id: Option, + /// City name #[serde(skip_serializing_if = "Option::is_none")] - city: Option, - + pub city: Option, #[serde(skip_serializing_if = "Option::is_none")] - path: Option, + pub path: Option, #[serde(skip_serializing_if = "Option::is_none")] - about: Option, - - accepted_pay_in_methods: Vec, + pub about: Option, + /// Payment methods accepted by the user + pub accepted_pay_in_methods: Vec, } impl fmt::Display for AdvancedUser { diff --git a/src/queries.rs b/src/queries.rs index 7476183..c7051ed 100644 --- a/src/queries.rs +++ b/src/queries.rs @@ -425,14 +425,12 @@ impl<'a> VintedWrapper<'a> { pub fn get_id(&self) -> &usize { &self.id } - /** - - After changing host is always necessary to refresh cookies - */ + /// After changing host is always necessary to refresh cookies pub fn set_new_random_host(&mut self) { self.host = random_host(); } + /// After changing host is always necessary to refresh cookies pub fn set_new_host(&mut self, host: Host) { self.host = host.into(); } diff --git a/src/tests/queries.rs b/src/tests/queries.rs index f2fdd31..b806efa 100644 --- a/src/tests/queries.rs +++ b/src/tests/queries.rs @@ -61,7 +61,7 @@ async fn test_get_item_brands() { match vinted.get_items(&filter, 1, None, None, None).await { // Limitado el numero de elementos a 1 Ok(items) => { - assert_eq!(items.items.get(0).unwrap().brand_title, brand.title); + assert_eq!(items.items.first().unwrap().brand_title, brand.title); } Err(err) => match err { VintedWrapperError::ItemNumberError => unreachable!(), From 6c6b97733abdfaf066e980631c43f4c5796863c2 Mon Sep 17 00:00:00 2001 From: Alvaro Date: Tue, 2 Apr 2024 21:07:00 +0200 Subject: [PATCH 5/7] Added workflow --- .github/workflows/cargo_publish.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/cargo_publish.yml diff --git a/.github/workflows/cargo_publish.yml b/.github/workflows/cargo_publish.yml new file mode 100644 index 0000000..498c758 --- /dev/null +++ b/.github/workflows/cargo_publish.yml @@ -0,0 +1,22 @@ +name: Publish to crates registry + +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + name: Publish to crates registry + steps: + - name: Checkout sources + uses: actions/checkout@v2 + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - run: cargo publish -p vinted-rs --token ${CARGO_REGISTRY_TOKEN} + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} From ebddf173fbfb4561bacf826d03f6f6562c5051bd Mon Sep 17 00:00:00 2001 From: Alvaro Date: Tue, 2 Apr 2024 21:17:36 +0200 Subject: [PATCH 6/7] Bumping to v0.8.7 --- CHANGELOG.md | 15 +++++++++++++-- Cargo.toml | 2 +- README.md | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c577fd4..e968886 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,17 @@ # Changelog -# 0.8.5 (2023-09-4) [#74](https://github.com/TuTarea/vinted-rs/pull/74/) +# 0.8.7 (2024-04-3) [#82](https://github.com/TuTarea/vinted-rs/pull/82/) + +## Improved + +- Made all fields in the `filter::models` crates _pub_ [#81](https://github.com/TuTarea/vinted-rs/pull/81/) +- Added `cargo_publish` workflow + +## Fixes + +- Added more documentation on `filter::models` crates fields + +# 0.8.6 (2023-09-4) [#74](https://github.com/TuTarea/vinted-rs/pull/74/) ## Improved @@ -9,7 +20,7 @@ # 0.8.5 (2023-09-3) [#72](https://github.com/TuTarea/vinted-rs/pull/72/) -## Improved +## Fixes - Fixed clients treatment diff --git a/Cargo.toml b/Cargo.toml index d44eac2..867dd41 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "vinted-rs" -version = "0.8.6" +version = "0.8.7" edition = "2021" repository = "https://github.com/TuTarea/vinted-rs" authors = [ diff --git a/README.md b/README.md index 272808e..ec1b7c5 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Via `cargo` you can add the library to your project's `Cargo.toml` ```toml [dependencies] -vinted-rs = "0.8.5" +vinted-rs = "0.8.7" ``` ## DB setup From 82a625594605b138bccf5b54641bd8ae4dee2239 Mon Sep 17 00:00:00 2001 From: Alvaro Date: Tue, 2 Apr 2024 23:20:25 +0200 Subject: [PATCH 7/7] removed the -p option from cargo publish --- .github/workflows/cargo_publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cargo_publish.yml b/.github/workflows/cargo_publish.yml index 498c758..41773e4 100644 --- a/.github/workflows/cargo_publish.yml +++ b/.github/workflows/cargo_publish.yml @@ -17,6 +17,6 @@ jobs: profile: minimal toolchain: stable override: true - - run: cargo publish -p vinted-rs --token ${CARGO_REGISTRY_TOKEN} + - run: cargo publish --token ${CARGO_REGISTRY_TOKEN} env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}