-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(fragments-endpoints): Add /fragments and /fragments/statuses com…
…patibility endpoints
- Loading branch information
Felipe Rosa
committed
Nov 1, 2023
1 parent
9674ce4
commit c6eda2f
Showing
5 changed files
with
86 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//! Implementation of the GET /fragments endpoint | ||
use poem_extensions::response; | ||
use poem_extensions::UniResponse::T204; | ||
|
||
use crate::service::common::responses::resp_2xx::NoContent; | ||
use crate::service::common::responses::resp_5xx::{ServerError, ServiceUnavailable}; | ||
|
||
/// All responses | ||
pub(crate) type AllResponses = response! { | ||
204: NoContent, | ||
500: ServerError, | ||
503: ServiceUnavailable, | ||
}; | ||
|
||
/// # GET /fragments | ||
/// | ||
/// TODO | ||
/// | ||
/// ## Responses | ||
/// | ||
/// * 204 No Content - Service is OK and can keep running. | ||
/// * 500 Server Error - If anything within this function fails unexpectedly. (Possible but unlikely) | ||
/// * 503 Service Unavailable - Service is possibly not running reliably. | ||
pub(crate) async fn endpoint() -> AllResponses { | ||
T204(NoContent) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//! Fragment endpoints | ||
mod index; | ||
mod statuses; | ||
|
||
use crate::service::common::tags::ApiTags; | ||
use poem_openapi::OpenApi; | ||
|
||
/// All Responses | ||
pub(crate) struct FragmentsApi; | ||
|
||
#[OpenApi(prefix_path = "/fragments", tag = "ApiTags::Fragments")] | ||
impl FragmentsApi { | ||
#[oai(path = "/", method = "get", operation_id = "fragments")] | ||
async fn index(&self) -> index::AllResponses { | ||
index::endpoint().await | ||
} | ||
|
||
#[oai(path = "/statuses", method = "get", operation_id = "fragmentsStatuses")] | ||
async fn statuses(&self) -> statuses::AllResponses { | ||
statuses::endpoint().await | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
catalyst-gateway/bin/src/service/api/fragments/statuses.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//! Implementation of the GET /fragments/statuses endpoint | ||
use poem_extensions::response; | ||
use poem_extensions::UniResponse::T204; | ||
|
||
use crate::service::common::responses::resp_2xx::NoContent; | ||
use crate::service::common::responses::resp_5xx::{ServerError, ServiceUnavailable}; | ||
|
||
/// All responses | ||
pub(crate) type AllResponses = response! { | ||
204: NoContent, | ||
500: ServerError, | ||
503: ServiceUnavailable, | ||
}; | ||
|
||
/// # GET /fragments/statuses | ||
/// | ||
/// TODO | ||
/// | ||
/// ## Responses | ||
/// | ||
/// * 204 No Content - Service is OK and can keep running. | ||
/// * 500 Server Error - If anything within this function fails unexpectedly. (Possible but unlikely) | ||
/// * 503 Service Unavailable - Service is possibly not running reliably. | ||
pub(crate) async fn endpoint() -> AllResponses { | ||
T204(NoContent) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters