shared/api/endpoints/
search.rs

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