You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use lemmy_api_common::post::{GetPosts,GetPostsResponse};use lemmy_db_schema::{ListingType,SortType};use ureq::Agent;pubfnlist_posts() -> GetPostsResponse{let params = GetPosts{type_:Some(ListingType::Local),sort:Some(SortType::New),
..Default::default()};Agent::new().get("https://lemmy.ml/api/v3/post/list").send_json(¶ms).unwrap().into_json().unwrap()}
It's a get request that sends a json body. If users try this example it won't fail, but they will find that changing sort and type does not work. An example that could be included for get requests:
use lemmy_api_common::post::{GetPostsResponse};pubfnlist_posts() -> GetPostsResponse{Agent::new().get("https://lemmy.ml/api/v3/post/list").query("sort","Hot").call().unwrap().into_json().unwrap()}
This one will work, and users are able to play around with it.
But might be a bit underwhelming as an example for those trying to learn.
The text was updated successfully, but these errors were encountered:
Hi!
The example included for contributers is wrong:
It's a get request that sends a json body. If users try this example it won't fail, but they will find that changing sort and type does not work. An example that could be included for get requests:
This one will work, and users are able to play around with it.
But might be a bit underwhelming as an example for those trying to learn.
The text was updated successfully, but these errors were encountered: