MCPcopy Create free account
hub / github.com/acking-you/static_flow / fetch_article_requests

Function fetch_article_requests

crates/frontend/src/api.rs:5606–5648  ·  view source on GitHub ↗
(
    limit: Option<usize>,
    offset: Option<usize>,
)

Source from the content-addressed store, hash-verified

5604}
5605
5606pub async fn fetch_article_requests(
5607 limit: Option<usize>,
5608 offset: Option<usize>,
5609) -> Result<ArticleRequestListResponse, String> {
5610 #[cfg(feature = "mock")]
5611 {
5612 let _ = (limit, offset);
5613 Ok(ArticleRequestListResponse {
5614 requests: vec![],
5615 total: 0,
5616 offset: 0,
5617 has_more: false,
5618 })
5619 }
5620
5621 #[cfg(not(feature = "mock"))]
5622 {
5623 let mut url = format!("{}/article-requests/list", API_BASE);
5624 let mut params = Vec::new();
5625 if let Some(l) = limit {
5626 params.push(format!("limit={l}"));
5627 }
5628 if let Some(o) = offset {
5629 params.push(format!("offset={o}"));
5630 }
5631 if !params.is_empty() {
5632 url.push('?');
5633 url.push_str(&params.join("&"));
5634 }
5635 let response = api_get(&url)
5636 .send()
5637 .await
5638 .map_err(|e| format!("Network error: {:?}", e))?;
5639 if !response.ok() {
5640 return Err(format!("HTTP error: {}", response.status()));
5641 }
5642 let r: ArticleRequestListResponse = response
5643 .json()
5644 .await
5645 .map_err(|e| format!("Parse error: {:?}", e))?;
5646 Ok(r)
5647 }
5648}
5649
5650pub async fn fetch_admin_article_requests(
5651 status: Option<&str>,

Callers 1

latest_articles_pageFunction · 0.85

Calls 4

api_getFunction · 0.85
pushMethod · 0.80
okMethod · 0.80
is_emptyMethod · 0.45

Tested by 1

latest_articles_pageFunction · 0.68