-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi_doc.rs
More file actions
81 lines (69 loc) · 2.34 KB
/
api_doc.rs
File metadata and controls
81 lines (69 loc) · 2.34 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
use common::api_response::ErrorResponse;
use utoipa::OpenApi;
use crate::api::*;
#[derive(OpenApi)]
#[openapi(
// API Metadata
info(
title = "Url Finder",
description = r#"
This is the API documentation for the Url Finder micro-service.
The Url Finder service is responsible for finding the URL of a miner given its address.
The service is using [CID Contact](https://cid.contact) as source of HTTP entry point for any given miner address.
### Result Codes
- **NoCidContactData** - No entry in cid contact
- **MissingAddrFromCidContact** - No entry point found in cid contact
- **MissingHttpAddrFromCidContact** - No HTTP entry point in cid contact (taken from ExtendedProviders)
- **FailedToGetWorkingUrl** - None of tested URLs is working and can be downloaded
- **NoDealsFound** - No deals found for given miner (should not happen, unless miner address is invalid)
- **TimedOut** - Searching for working URL is taking too long - probably there is no working URL
- **JobCreated** - Asynchronous job was created
- **Success** - Found working URL
- **Error** - (async only) Error occurred, check error field
"#,
version = "1.0.0"
),
// API Handler Functions
paths(
handle_find_url_sp,
handle_find_url_sp_client,
handle_find_retri_by_client_and_sp,
handle_find_retri_by_sp,
handle_find_client,
handle_create_job,
handle_get_job,
handle_healthcheck,
),
components(
schemas(
// URL
FindUrlSpPath,
FindUrlSpResponse,
FindUrlSpClientPath,
FindUrlSpClientResponse,
// Retri
FindRetriByClientAndSpPath,
FindRetriByClientAndSpResponse,
// Client
FindByClientPath,
FindByClientResponse,
// Job
CreateJobPayload,
CreateJobResponse,
GetJobPath,
GetJobResponse,
// misc
HealthcheckResponse,
// common
ErrorCode,
ErrorResponse,
),
),
tags(
// API Categories
(name = "JOB", description = "Async Url Finder APIs"),
(name = "URL", description = "Url Finder APIs"),
(name = "Healthcheck", description = "Url Finder Misc APIs"),
)
)]
pub struct ApiDoc;