shared/api/endpoints/search.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
//! routes for the global animation library
use crate::{
api::{ApiEndpoint, Method},
domain::search::{
CreateSearchKeyPath, CreateSearchKeyResponse, WebImageSearchPath, WebImageSearchQuery,
WebImageSearchResponse,
},
error::EmptyError,
};
/// Create a search key.
///
/// # Authorization
///
/// standard
///
/// # Errors
///
/// * [`401 - Unauthorized`](http::StatusCode::UNAUTHORIZED) if missing/invalid auth was provided.
/// * [`501 - NotImplemented`](http::StatusCode::NOT_IMPLEMENTED) if the route is not configured.
pub struct CreateKey;
impl ApiEndpoint for CreateKey {
type Path = CreateSearchKeyPath;
type Req = ();
type Res = CreateSearchKeyResponse;
type Err = EmptyError;
const METHOD: Method = Method::Post;
}
/// Search for images over the web.
///
/// # Authorization
///
/// standard
///
/// # Errors
///
/// * [`400 - BadRequest`](http::StatusCode::BAD_REQUEST) if the request was not provided in a proper format
/// * [`401 - Unauthorized`](http::StatusCode::UNAUTHORIZED) if missing/invalid auth was provided.
pub struct WebImageSearch;
impl ApiEndpoint for WebImageSearch {
type Path = WebImageSearchPath;
type Req = WebImageSearchQuery;
type Res = WebImageSearchResponse;
type Err = EmptyError;
const METHOD: Method = Method::Get;
}