forked from ramosbugs/openapi-lambda-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi_lambda_test__tests__bar_handler.rs.snap
More file actions
58 lines (49 loc) · 1.67 KB
/
openapi_lambda_test__tests__bar_handler.rs.snap
File metadata and controls
58 lines (49 loc) · 1.67 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
---
source: openapi-lambda-test/src/lib.rs
expression: bar_handler_contents
---
#![allow(unused_imports)]
use crate::bar::{Api, CreateBarResponse};
use openapi_lambda::__private::anyhow;
use openapi_lambda::__private::aws_lambda_events::encodings::Body;
use openapi_lambda::async_trait::async_trait;
use openapi_lambda::{
ApiGatewayProxyRequestContext, HeaderMap, HttpResponse, LambdaContext, StatusCode,
};
pub struct BarApiHandler {
// Store any handler state (e.g., DB client) here.
state: (),
}
impl BarApiHandler {
pub fn new(state: ()) -> Self {
Self { state }
}
}
#[async_trait]
impl Api for BarApiHandler {
// Define a type here to represent a successfully authenticated user.
type AuthOk = ();
// Define an error type to capture the errors produced by your API handler methods.
type HandlerError = ();
// Return an error response depending on the nature of the error (e.g., 400 Bad Request for
// errors caused by a client sending an invalid request, or 500 Internal Server Error for
// internal errors such as failing to connect to a database).
async fn respond_to_handler_error(&self, _err: Self::HandlerError) -> HttpResponse {
todo!()
}
async fn create_bar(
&self,
bar_id: crate::types::BarId,
sort_by: Option<crate::models::SortBy>,
r#type: Option<crate::models::CreateBarTypeParam>,
type_array: Option<Vec<crate::models::CreateBarTypeArrayParamItem>>,
x_bar: Option<String>,
request_body: Vec<u8>,
headers: HeaderMap,
request_context: ApiGatewayProxyRequestContext,
lambda_context: LambdaContext,
auth_ok: Self::AuthOk,
) -> Result<(CreateBarResponse, HeaderMap), Self::HandlerError> {
todo!()
}
}