hugging_face_client/client/
arxiv.rs

1use crate::{
2  api::{ArxivDailyRes, ArxivPaperReq, ArxivPaperRes, ArxivReposReq, ArxivReposRes},
3  client::Client,
4  errors::Result,
5};
6
7impl Client {
8  /// Get the API equivalent of the Paper page, i.e., metadata like authors, summary, and discussion
9  /// comments
10  ///
11  /// Endpoint: ` GET /api/papers/{arxiv_id}`
12  pub async fn arxiv_paper(&self, req: ArxivPaperReq<'_>) -> Result<ArxivPaperRes> {
13    let url = format!("{}/api/papers/{}", &self.api_endpoint, req.paper_id);
14    let req = if true { None } else { Some(&()) };
15    self.get_request(&url, req, false).await
16  }
17
18  /// Get all the models, datasets, and Spaces that refer to a paper
19  ///
20  /// Endpoint: ` GET /api/arxiv/{arxiv_id}/repos`
21  pub async fn arxiv_repos(&self, req: ArxivReposReq<'_>) -> Result<ArxivReposRes> {
22    let url = format!("{}/api/arxiv/{}/repos", &self.api_endpoint, req.paper_id);
23    let req = if true { None } else { Some(&()) };
24    self.get_request(&url, req, true).await
25  }
26
27  /// Get the daily papers curated by AK and the community
28  ///
29  /// Endpoint: `GET /api/daily_papers`
30  ///
31  /// TODO: support filter on date
32  pub async fn arxiv_daily(&self) -> Result<ArxivDailyRes> {
33    let url = format!("{}/api/daily_papers", &self.api_endpoint);
34    let req = if true { None } else { Some(&()) };
35    self.get_request(&url, req, false).await
36  }
37}