Skip to content

Commit

Permalink
🚧 Introduce SearchRequest for Marktplaats
Browse files Browse the repository at this point in the history
  • Loading branch information
eigenein committed Sep 4, 2024
1 parent c857d65 commit ff91591
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ async fn fallible_main(cli: Cli) -> Result {
.limit(limit)
.sort_by(SortBy::SortIndex)
.sort_order(SortOrder::Decreasing)
.search_in_title_and_description(true)
.build();
let listings: Listings = serde_json::from_str(&marktplaats.search(&request).await?)?;
for listing in listings {
Expand All @@ -67,11 +68,9 @@ async fn fallible_main(cli: Cli) -> Result {
chat_id: ChatId::Integer(chat_id),
parse_mode: Some(ParseMode::Html),
text: &listing.render().into_string(),
link_preview_options: Some(LinkPreviewOptions {
is_disabled: Some(true),
url: None,
show_above_text: None,
}),
link_preview_options: Some(
LinkPreviewOptions::builder().is_disabled(true).build(),
),
};
let message = telegram.call(request).await?;
info!(message.id);
Expand Down
2 changes: 2 additions & 0 deletions src/telegram/methods.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::time::Duration;

use bon::builder;
use serde::Serialize;

use crate::{
Expand Down Expand Up @@ -90,6 +91,7 @@ pub enum ParseMode {
/// [1]: https://core.telegram.org/bots/api#linkpreviewoptions
#[derive(Default, Serialize)]
#[must_use]
#[builder]
pub struct LinkPreviewOptions {
/// `true`, if the link preview is disabled
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down

0 comments on commit ff91591

Please sign in to comment.