Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.8.7 #82

Merged
merged 12 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/cargo_publish.yml
Original file line number Diff line number Diff line change
@@ -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 --token ${CARGO_REGISTRY_TOKEN}
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
needs: test

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Rust
uses: actions-rs/toolchain@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 13 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -9,7 +20,7 @@

# 0.8.5 (2023-09-3) [#72](https://github.com/TuTarea/vinted-rs/pull/72/)

## Improved
## Fixes

- Fixed clients treatment

Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down Expand Up @@ -31,16 +31,16 @@ 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 }
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"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/model/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
21 changes: 18 additions & 3 deletions src/model/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub extra_conditions: Option<String>,
/// See [`Brand`](crate::model::filter::brand::Brand)
#[serde(skip_serializing_if = "Option::is_none")]
pub brand_id: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub size_id: Option<i32>,
/// See [`ArticleStatus`](crate::model::filter::ArticleStatus)
#[serde(skip_serializing_if = "Option::is_none")]
pub status_id: Option<i32>,
/// Status of the item in French 🇫🇷
#[serde(rename = "status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status_fr: Option<String>,
Expand All @@ -78,25 +85,33 @@ pub struct AdvancedItem {
#[serde(skip_serializing_if = "Option::is_none")]
pub color2: Option<String>,
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<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub city: Option<String>,

//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<String>,
/// Related ['Brand'](crate::model::filter::brand::Brand) IDs
pub related_catalog_ids: Vec<i32>,

// 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
Expand All @@ -106,7 +121,7 @@ pub struct AdvancedItem {
#[serde(skip_serializing_if = "Option::is_none")]
pub user_updated_at_ts: Option<String>,

// Asets
// Assets
pub photos: Vec<Photo>,
pub url: String,
pub user: AdvancedUser,
Expand Down
21 changes: 12 additions & 9 deletions src/model/payment_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
pub event_tracking_code: Option<String>,
/// Icon of the payment method
#[serde(skip_serializing_if = "Option::is_none")]
icon: Option<String>,
enabled: bool,
pub icon: Option<String>,
pub enabled: bool,
#[serde(skip_serializing_if = "Option::is_none")]
translated_name: Option<String>,
pub translated_name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
note: Option<String>,
method_change_possible: bool,
pub note: Option<String>,
pub method_change_possible: bool,
}

impl fmt::Display for PayInMethod {
Expand Down
59 changes: 34 additions & 25 deletions src/model/user.rs
Original file line number Diff line number Diff line change
@@ -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<Photo>,

pub photo: Option<Photo>,
/// User's real name
#[serde(skip_serializing_if = "Option::is_none")]
real_name: Option<String>,
pub real_name: Option<String>,
/// User's email
#[serde(skip_serializing_if = "Option::is_none")]
email: Option<String>,
pub email: Option<String>,
/// User's birthday
#[serde(skip_serializing_if = "Option::is_none")]
birthday: Option<String>,
pub birthday: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
gender: Option<String>,

pub gender: Option<String>,
/// Last time the user logged in
#[serde(skip_serializing_if = "Option::is_none")]
last_loged_on_ts: Option<String>,
expose_location: bool,
country_id: i32,
pub last_loged_on_ts: Option<String>,
/// 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<i32>,
pub city_id: Option<i32>,
/// City name
#[serde(skip_serializing_if = "Option::is_none")]
city: Option<String>,

pub city: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
path: Option<String>,
pub path: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
about: Option<String>,

accepted_pay_in_methods: Vec<PayInMethod>,
pub about: Option<String>,
/// Payment methods accepted by the user
pub accepted_pay_in_methods: Vec<PayInMethod>,
}

impl fmt::Display for AdvancedUser {
Expand Down
6 changes: 2 additions & 4 deletions src/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion src/tests/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(),
Expand Down
Loading