Endpoints
Get a random image
async fn random_image(&self, tag: impl ToString, nsfw: bool) -> HttpResult<Image, ImageError>
if let Ok(res) = client.images.random_image("doge", false).await {
match res {
Ok(image) => {
//do something with the image
},
Err(why) => {
//do something with the <ImageError> struct
}
}
}
Get a random meme
async fn random_meme(&self) -> Result<RedditImage>
if let Ok(meme) = client.images.random_meme().await {
//do something here
}
Get a random cute image
async fn random_aww(&self) -> Result<RedditImage>
if let Ok(aww) = client.images.random_aww().await {
//do something with the image
}
Get a random WikiHow image
async fn random_wikihow(&self, nsfw: bool) -> Result<WikiHowImage>
if let Ok(wiki_image) = client.images.random_wikihow(false).await {
//do something with the image
}
Get a random nsfw image
async fn random_nsfw(&self, gifs: bool) -> Result<RedditImage>
if let Ok(nsfw) = client.images.random_nsfw(false).await {
//do something with the image
}
Get a random image from a given subreddit
async fn random_reddit(&self, subreddit: impl ToString, remove_nsfw: bool, span: SpanType) -> HttpResult<RedditImage, ImageError>
if let Ok(res) = client.images.random_reddit("Technology", true, SpanType::Day).await {
match res {
Ok(red) => {
//do something with the reddit image
},
Err(why) => {
//do something with the <ImageError> struct
}
}
}
Get an image using its Snowflake
async fn get_image(&self, sf: impl AsRef<str>) -> HttpResult<Image, ImageError>
if let Ok(res) = client.images.get_image("i-8ta8p52f-27").await {
match res {
Ok(img) => {
//do something with the image
},
Err(why) => {
//do something with the <ImageError> struct
}
}
}
Get a list of all tags
async fn get_tags(&self) -> Result<TagList>
if let Ok(tags) = client.images.get_tags().await {
//do something with all tags
}
Get specific tag by its name
async fn get_tag(&self, tag: impl AsRef<str>) -> Result<TagList>
if let Ok(tag) = client.images.get_tag("doge").await {
//do something with the tag
}
Last updated