From 10b7968e1f63029f807dac7875a1dba074a5721a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Greinhofer?= Date: Sat, 21 Dec 2024 14:36:51 -0600 Subject: [PATCH] Generate OAS3 as code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Leverages `utoipa` to generate the OAS3. Changes: - Splits `/ratings` and `/pipelines`. - Moves schemas to schema.rs. - Adds OAS 3.1 from Axum. - Adds OAS 3.0, down-converted from the OAS 3.1. - Regenerates the bnaclient. - Updates the Justfile. - Makes enums not optional. - Uses APIErrors struct for errors. - Adds ApiError examples for each support HTTP status (400, 401, 403, 404). - Adds ErrorResponses enum to group all errors. - Updates Hurl tests. Signed-off-by: Rémy Greinhofer --- Cargo.toml | 11 +- bnaclient/src/lib.rs | 10540 ++++++++-------- bnaclient/src/progenitor_client.rs | 53 +- entity/src/entities/approval_status.rs | 2 +- entity/src/entities/bna_pipeline.rs | 6 +- entity/src/entities/bna_pipeline_status.rs | 2 +- entity/src/entities/bna_pipeline_step.rs | 2 +- entity/src/entities/bna_region.rs | 2 +- entity/src/entities/census.rs | 2 +- entity/src/entities/city.rs | 2 +- entity/src/entities/core_services.rs | 2 +- entity/src/entities/country.rs | 2 +- entity/src/entities/fargate_price.rs | 2 +- entity/src/entities/infrastructure.rs | 2 +- entity/src/entities/mod.rs | 2 +- entity/src/entities/opportunity.rs | 2 +- entity/src/entities/people.rs | 2 +- entity/src/entities/prelude.rs | 2 +- entity/src/entities/recreation.rs | 2 +- entity/src/entities/retail.rs | 2 +- entity/src/entities/speed_limit.rs | 2 +- entity/src/entities/state_region_crosswalk.rs | 2 +- entity/src/entities/submission.rs | 2 +- entity/src/entities/summary.rs | 2 +- entity/src/entities/transit.rs | 2 +- entity/src/entities/us_state.rs | 2 +- entity/src/wrappers/bna_pipeline.rs | 10 +- justfile | 15 +- lambdas/Cargo.toml | 73 +- lambdas/src/bin/cities/get-cities-census.rs | 78 - lambdas/src/bin/cities/get-cities-ratings.rs | 96 - .../src/bin/cities/get-cities-submissions.rs | 79 - lambdas/src/bin/cities/get-cities.rs | 116 - .../bin/cities/patch-cities-submissions.rs | 73 - .../src/bin/cities/post-cities-submissions.rs | 75 - lambdas/src/bin/cities/post-cities.rs | 55 - .../bin/price-fargate/get-price-fargate.rs | 117 - .../src/bin/ratings/get-ratings-analysis.rs | 64 - lambdas/src/bin/ratings/get-ratings-cities.rs | 47 - .../src/bin/ratings/get-ratings-results.rs | 65 - lambdas/src/bin/ratings/get-ratings.rs | 324 - lambdas/src/bin/ratings/patch-ratings.rs | 102 - .../src/bin/ratings/post-ratings-analysis.rs | 84 - .../src/bin/ratings/post-ratings-enqueue.rs | 79 - lambdas/src/bin/ratings/post-ratings.rs | 201 - lambdas/src/core/resource/cities/adaptor.rs | 86 +- lambdas/src/core/resource/cities/db.rs | 2 +- lambdas/src/core/resource/cities/endpoint.rs | 320 +- lambdas/src/core/resource/cities/mod.rs | 1 + lambdas/src/core/resource/cities/schema.rs | 307 + lambdas/src/core/resource/mod.rs | 2 + .../src/core/resource/pipelines/adaptor.rs | 79 + lambdas/src/core/resource/pipelines/db.rs | 25 + .../src/core/resource/pipelines/endpoint.rs | 123 + lambdas/src/core/resource/pipelines/mod.rs | 5 + lambdas/src/core/resource/pipelines/schema.rs | 161 + lambdas/src/core/resource/price/adaptor.rs | 45 +- lambdas/src/core/resource/price/endpoint.rs | 83 +- lambdas/src/core/resource/price/mod.rs | 1 + lambdas/src/core/resource/price/schema.rs | 42 + lambdas/src/core/resource/ratings/adaptor.rs | 203 +- lambdas/src/core/resource/ratings/db.rs | 540 +- lambdas/src/core/resource/ratings/endpoint.rs | 184 +- lambdas/src/core/resource/ratings/mod.rs | 1 + lambdas/src/core/resource/ratings/schema.rs | 227 + lambdas/src/core/resource/schema.rs | 246 + lambdas/src/lib.rs | 38 +- lambdas/src/main.rs | 103 +- lambdas/tests/endpoints/cities.hurl | 2 +- lambdas/tests/endpoints/ratings.hurl | 1 - lambdas/tests/justfile | 4 +- ...02_004130_brokenspoke_analyzer_pipeline.rs | 8 +- openapi-3.0.yaml | 3610 ++++++ openapi-3.1.yaml | 3344 +++++ openapi.yaml | 1654 --- 75 files changed, 14525 insertions(+), 9329 deletions(-) delete mode 100644 lambdas/src/bin/cities/get-cities-census.rs delete mode 100644 lambdas/src/bin/cities/get-cities-ratings.rs delete mode 100644 lambdas/src/bin/cities/get-cities-submissions.rs delete mode 100644 lambdas/src/bin/cities/get-cities.rs delete mode 100644 lambdas/src/bin/cities/patch-cities-submissions.rs delete mode 100644 lambdas/src/bin/cities/post-cities-submissions.rs delete mode 100644 lambdas/src/bin/cities/post-cities.rs delete mode 100644 lambdas/src/bin/price-fargate/get-price-fargate.rs delete mode 100644 lambdas/src/bin/ratings/get-ratings-analysis.rs delete mode 100644 lambdas/src/bin/ratings/get-ratings-cities.rs delete mode 100644 lambdas/src/bin/ratings/get-ratings-results.rs delete mode 100644 lambdas/src/bin/ratings/get-ratings.rs delete mode 100644 lambdas/src/bin/ratings/patch-ratings.rs delete mode 100644 lambdas/src/bin/ratings/post-ratings-analysis.rs delete mode 100644 lambdas/src/bin/ratings/post-ratings-enqueue.rs delete mode 100644 lambdas/src/bin/ratings/post-ratings.rs create mode 100644 lambdas/src/core/resource/cities/schema.rs create mode 100644 lambdas/src/core/resource/pipelines/adaptor.rs create mode 100644 lambdas/src/core/resource/pipelines/db.rs create mode 100644 lambdas/src/core/resource/pipelines/endpoint.rs create mode 100644 lambdas/src/core/resource/pipelines/mod.rs create mode 100644 lambdas/src/core/resource/pipelines/schema.rs create mode 100644 lambdas/src/core/resource/price/schema.rs create mode 100644 lambdas/src/core/resource/ratings/schema.rs create mode 100644 lambdas/src/core/resource/schema.rs create mode 100644 openapi-3.0.yaml create mode 100644 openapi-3.1.yaml delete mode 100644 openapi.yaml diff --git a/Cargo.toml b/Cargo.toml index bfa7970..b0663a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,13 +33,15 @@ once_cell = "1.20.2" query_map = "0.7.0" reqwest = "0.12.8" rstest = "0.23.0" -sea-orm = "1.1.0" -sea-orm-migration = "1.0.0" +sea-orm = "1.1.1" +sea-orm-macros = "1.1.1" +sea-orm-migration = "1.1.1" +sea-query = "0.32.1" serde = "1.0.214" serde_json = "1.0.132" serde_plain = "1.0.2" serde_with = "3.11.0" -thiserror = "2.0.3" +thiserror = "2.0.9" time = "0.3.37" tokio = "1.41.0" tower-http = "0.6.2" @@ -47,6 +49,9 @@ tracing = "0.1" tracing-subscriber = { version = "0.3", default-features = false } url = "2.3.1" urlencoding = "2.1.3" +utoipa = "5.3.0" +utoipa-axum = "0.1.3" +utoipa-swagger-ui = "8.1.0" uuid = "1.11.0" [dependencies] diff --git a/bnaclient/src/lib.rs b/bnaclient/src/lib.rs index a935b5a..25ee5bc 100644 --- a/bnaclient/src/lib.rs +++ b/bnaclient/src/lib.rs @@ -39,15 +39,208 @@ pub mod types { } } - ///Analysis + ///Single API Error object as described in . /// ///
JSON schema /// /// ```json ///{ + /// "description": "Single API Error object as described in .", /// "type": "object", /// "required": [ - /// "state_machine_id" + /// "details", + /// "source", + /// "status", + /// "title" + /// ], + /// "properties": { + /// "details": { + /// "description": "A human-readable explanation specific to this + /// occurrence of the problem", + /// "examples": [ + /// "the entry was not found" + /// ], + /// "type": "string" + /// }, + /// "id": { + /// "description": "A unique identifier for this particular occurrence + /// of the problem.", + /// "examples": [ + /// "blfwkg8nvHcEJnQ=" + /// ], + /// "type": [ + /// "string", + /// "null" + /// ] + /// }, + /// "source": { + /// "$ref": "#/components/schemas/APIErrorSource" + /// }, + /// "status": { + /// "description": "The HTTP status code applicable to this problem, + /// expressed as a string value.", + /// "examples": [ + /// "404" + /// ], + /// "type": "string" + /// }, + /// "title": { + /// "description": "A short, human-readable summary of the problem", + /// "examples": [ + /// "Item Not Found" + /// ], + /// "type": "string" + /// } + /// } + ///} + /// ``` + ///
+ #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] + pub struct ApiError { + ///A human-readable explanation specific to this occurrence of the + /// problem + pub details: ::std::string::String, + ///A unique identifier for this particular occurrence of the problem. + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub id: ::std::option::Option<::std::string::String>, + pub source: ApiErrorSource, + ///The HTTP status code applicable to this problem, expressed as a + /// string value. + pub status: ::std::string::String, + ///A short, human-readable summary of the problem + pub title: ::std::string::String, + } + + impl ::std::convert::From<&ApiError> for ApiError { + fn from(value: &ApiError) -> Self { + value.clone() + } + } + + impl ApiError { + pub fn builder() -> builder::ApiError { + Default::default() + } + } + + ///An object containing references to the primary source of the error. + /// + ///It SHOULD include one of the following members or be omitted: + /// + /// - pointer: a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901) + /// to the value in the request document that caused the error [e.g. + /// "/data" for a primary data object, or "/data/attributes/title" for a + /// specific attribute]. This MUST point to a value in the request + /// document that exists; if it doesn’t, the client SHOULD simply ignore + /// the pointer. + /// - parameter: a string indicating which URI query parameter caused the + /// error. + /// - header: a string indicating the name of a single request header which + /// caused the error. + /// + ///
JSON schema + /// + /// ```json + ///{ + /// "description": "An object containing references to the primary source of the error.\n\nIt SHOULD include one of the following members or be omitted:\n\n - pointer: a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901) to the\n value in the request document that caused the error [e.g. \"/data\" for a primary\n data object, or \"/data/attributes/title\" for a specific attribute].\n This MUST point to a value in the request document that exists; if it doesn’t,\n the client SHOULD simply ignore the pointer.\n - parameter: a string indicating which URI query parameter caused the error.\n - header: a string indicating the name of a single request header which caused the\n error.", + /// "oneOf": [ + /// { + /// "description": "A JSON Pointer [RFC6901] to the value in the + /// request document that caused the error.", + /// "examples": [ + /// { + /// "pointer": "/data/attributes/title" + /// } + /// ], + /// "type": "object", + /// "required": [ + /// "pointer" + /// ], + /// "properties": { + /// "pointer": { + /// "description": "A JSON Pointer [RFC6901] to the value in the + /// request document that caused the error.", + /// "type": "string" + /// } + /// } + /// }, + /// { + /// "description": "A string indicating which URI query parameter + /// caused the error.", + /// "examples": [ + /// { + /// "parameter": "include" + /// } + /// ], + /// "type": "object", + /// "required": [ + /// "parameter" + /// ], + /// "properties": { + /// "parameter": { + /// "description": "A string indicating which URI query parameter + /// caused the error.", + /// "type": "string" + /// } + /// } + /// }, + /// { + /// "description": "A string indicating the name of a single request + /// header which caused the error.", + /// "examples": [ + /// { + /// "header": "Content-Type" + /// } + /// ], + /// "type": "object", + /// "required": [ + /// "header" + /// ], + /// "properties": { + /// "header": { + /// "description": "A string indicating the name of a single + /// request header which caused the error.", + /// "type": "string" + /// } + /// } + /// } + /// ] + ///} + /// ``` + ///
+ #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] + pub enum ApiErrorSource { + ///A JSON Pointer [RFC6901] to the value in the request document that + /// caused the error. + #[serde(rename = "pointer")] + Pointer(::std::string::String), + ///A string indicating which URI query parameter caused the error. + #[serde(rename = "parameter")] + Parameter(::std::string::String), + ///A string indicating the name of a single request header which caused + /// the error. + #[serde(rename = "header")] + Header(::std::string::String), + } + + impl ::std::convert::From<&ApiErrorSource> for ApiErrorSource { + fn from(value: &ApiErrorSource) -> Self { + value.clone() + } + } + + ///BnaPipeline + /// + ///
JSON schema + /// + /// ```json + ///{ + /// "type": "object", + /// "required": [ + /// "start_time", + /// "state_machine_id", + /// "status", + /// "step" /// ], /// "properties": { /// "cost": { @@ -58,11 +251,10 @@ pub mod types { /// "type": [ /// "string", /// "null" - /// ], - /// "format": "decimal" + /// ] /// }, /// "end_time": { - /// "description": "Date and time", + /// "description": "End time", /// "type": [ /// "string", /// "null" @@ -70,35 +262,27 @@ pub mod types { /// "format": "date-time" /// }, /// "fargate_price_id": { - /// "description": "Fargate price identifier", - /// "examples": [ - /// 1 - /// ], + /// "description": "Fargate price identifier used to compute the cost", /// "type": [ /// "integer", /// "null" - /// ] + /// ], + /// "format": "int32" /// }, /// "fargate_task_arn": { - /// "description": "The ARN of the Fargate task that performed the + /// "description": "ARN of the Fargate task that performed the /// analysis", /// "examples": [ /// "arn:aws:ecs:us-west-2:123456789012:task/bna/ - /// 29f979fc9fca402d94b014aa23d2f6e0\n" + /// 29f979fc9fca402d94b014aa23d2f6e0" /// ], /// "type": [ /// "string", /// "null" /// ] /// }, - /// "results_posted": { - /// "type": [ - /// "boolean", - /// "null" - /// ] - /// }, /// "s3_bucket": { - /// "description": "the path of the S3 bucket where the results were + /// "description": "Path of the S3 bucket where the results were /// stored", /// "examples": [ /// "united states/new mexico/santa rosa/24.05.4" @@ -112,8 +296,12 @@ pub mod types { /// "description": "Copy of the JSON message that was sent for /// processing", /// "examples": [ - /// "{\"country\":\"United States\",\"city\":\"santa - /// rosa\",\"region\":\"new mexico\", \"fips_code\":\"3570670\"}" + /// { + /// "city": "santa rosa", + /// "country": "United States", + /// "fips_code": "3570670", + /// "region": "new mexico" + /// } /// ], /// "type": [ /// "string", @@ -121,129 +309,121 @@ pub mod types { /// ] /// }, /// "start_time": { - /// "description": "Date and time", - /// "type": [ - /// "string", - /// "null" - /// ], + /// "description": "Start time", + /// "type": "string", /// "format": "date-time" /// }, /// "state_machine_id": { - /// "$ref": "#/components/schemas/state_machine_id" + /// "description": "Pipeline identifier\nThis is the ID of the AWS + /// state machine that was used to run the pipeline", + /// "type": "string", + /// "format": "uuid" /// }, /// "status": { - /// "$ref": "#/components/schemas/analysis_status" + /// "$ref": "#/components/schemas/PipelineStatus" /// }, /// "step": { - /// "$ref": "#/components/schemas/step" - /// }, - /// "torn_down": { - /// "description": "Flag indicating wether the resources were torn down - /// or not at the end of the analysis\n", - /// "type": [ - /// "boolean", - /// "null" - /// ] + /// "$ref": "#/components/schemas/BnaPipelineStep" /// } /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct Analysis { + pub struct BnaPipeline { ///Cost of an analysis in USD #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub cost: ::std::option::Option<::std::string::String>, - ///Date and time + ///End time #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub end_time: ::std::option::Option>, - ///Fargate price identifier + ///Fargate price identifier used to compute the cost #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub fargate_price_id: ::std::option::Option, - ///The ARN of the Fargate task that performed the analysis + pub fargate_price_id: ::std::option::Option, + ///ARN of the Fargate task that performed the analysis #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub fargate_task_arn: ::std::option::Option<::std::string::String>, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub results_posted: ::std::option::Option, - ///the path of the S3 bucket where the results were stored + ///Path of the S3 bucket where the results were stored #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub s3_bucket: ::std::option::Option<::std::string::String>, ///Copy of the JSON message that was sent for processing #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub sqs_message: ::std::option::Option<::std::string::String>, - ///Date and time - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub start_time: ::std::option::Option>, - pub state_machine_id: StateMachineId, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub status: ::std::option::Option, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub step: ::std::option::Option, - ///Flag indicating wether the resources were torn down or not at the - /// end of the analysis - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub torn_down: ::std::option::Option, - } - - impl From<&Analysis> for Analysis { - fn from(value: &Analysis) -> Self { + ///Start time + pub start_time: chrono::DateTime, + ///Pipeline identifier + ///This is the ID of the AWS state machine that was used to run the + /// pipeline + pub state_machine_id: uuid::Uuid, + pub status: PipelineStatus, + pub step: BnaPipelineStep, + } + + impl ::std::convert::From<&BnaPipeline> for BnaPipeline { + fn from(value: &BnaPipeline) -> Self { value.clone() } } - impl Analysis { - pub fn builder() -> builder::Analysis { + impl BnaPipeline { + pub fn builder() -> builder::BnaPipeline { Default::default() } } - ///AnalysisPatch + ///BnaPipelinePatch /// ///
JSON schema /// /// ```json ///{ /// "type": "object", + /// "required": [ + /// "start_time", + /// "status", + /// "step" + /// ], /// "properties": { /// "cost": { /// "description": "Cost of an analysis in USD", /// "examples": [ - /// 6.8941 + /// "6.8941" /// ], /// "type": [ - /// "number", + /// "string", /// "null" - /// ], - /// "format": "double" + /// ] /// }, /// "end_time": { - /// "description": "Date and time", + /// "description": "End time", /// "type": [ /// "string", /// "null" /// ], /// "format": "date-time" /// }, + /// "fargate_price_id": { + /// "description": "Fargate price identifier used to compute the cost", + /// "type": [ + /// "integer", + /// "null" + /// ], + /// "format": "int32" + /// }, /// "fargate_task_arn": { - /// "description": "The ARN of the Fargate task that performed the + /// "description": "ARN of the Fargate task that performed the /// analysis", /// "examples": [ /// "arn:aws:ecs:us-west-2:123456789012:task/bna/ - /// 29f979fc9fca402d94b014aa23d2f6e0\n" + /// 29f979fc9fca402d94b014aa23d2f6e0" /// ], /// "type": [ /// "string", /// "null" /// ] /// }, - /// "results_posted": { - /// "type": [ - /// "boolean", - /// "null" - /// ] - /// }, /// "s3_bucket": { - /// "description": "the path of the S3 bucket where the results were + /// "description": "Path of the S3 bucket where the results were /// stored", /// "examples": [ /// "united states/new mexico/santa rosa/24.05.4" @@ -257,8 +437,12 @@ pub mod types { /// "description": "Copy of the JSON message that was sent for /// processing", /// "examples": [ - /// "{\"country\":\"United States\",\"city\":\"santa - /// rosa\",\"region\":\"new mexico\", \"fips_code\":\"3570670\"}" + /// { + /// "city": "santa rosa", + /// "country": "United States", + /// "fips_code": "3570670", + /// "region": "new mexico" + /// } /// ], /// "type": [ /// "string", @@ -266,96 +450,81 @@ pub mod types { /// ] /// }, /// "start_time": { - /// "description": "Date and time", - /// "type": [ - /// "string", - /// "null" - /// ], + /// "description": "Start time", + /// "type": "string", /// "format": "date-time" /// }, /// "status": { - /// "$ref": "#/components/schemas/analysis_status" + /// "$ref": "#/components/schemas/PipelineStatus" /// }, /// "step": { - /// "$ref": "#/components/schemas/step" - /// }, - /// "torn_down": { - /// "description": "Flag indicating wether the resources were torn down - /// or not at the end of the analysis\n", - /// "type": [ - /// "boolean", - /// "null" - /// ] + /// "$ref": "#/components/schemas/BnaPipelineStep" /// } /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct AnalysisPatch { + pub struct BnaPipelinePatch { ///Cost of an analysis in USD #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub cost: ::std::option::Option, - ///Date and time + pub cost: ::std::option::Option<::std::string::String>, + ///End time #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub end_time: ::std::option::Option>, - ///The ARN of the Fargate task that performed the analysis + ///Fargate price identifier used to compute the cost #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub fargate_task_arn: ::std::option::Option<::std::string::String>, + pub fargate_price_id: ::std::option::Option, + ///ARN of the Fargate task that performed the analysis #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub results_posted: ::std::option::Option, - ///the path of the S3 bucket where the results were stored + pub fargate_task_arn: ::std::option::Option<::std::string::String>, + ///Path of the S3 bucket where the results were stored #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub s3_bucket: ::std::option::Option<::std::string::String>, ///Copy of the JSON message that was sent for processing #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub sqs_message: ::std::option::Option<::std::string::String>, - ///Date and time - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub start_time: ::std::option::Option>, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub status: ::std::option::Option, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub step: ::std::option::Option, - ///Flag indicating wether the resources were torn down or not at the - /// end of the analysis - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub torn_down: ::std::option::Option, + ///Start time + pub start_time: chrono::DateTime, + pub status: PipelineStatus, + pub step: BnaPipelineStep, } - impl From<&AnalysisPatch> for AnalysisPatch { - fn from(value: &AnalysisPatch) -> Self { + impl ::std::convert::From<&BnaPipelinePatch> for BnaPipelinePatch { + fn from(value: &BnaPipelinePatch) -> Self { value.clone() } } - impl AnalysisPatch { - pub fn builder() -> builder::AnalysisPatch { + impl BnaPipelinePatch { + pub fn builder() -> builder::BnaPipelinePatch { Default::default() } } - ///AnalysisPost + ///BnaPipelinePost /// ///
JSON schema /// /// ```json ///{ /// "type": "object", + /// "required": [ + /// "step" + /// ], /// "properties": { /// "cost": { /// "description": "Cost of an analysis in USD", /// "examples": [ - /// 6.8941 + /// "6.8941" /// ], /// "type": [ - /// "number", + /// "string", /// "null" - /// ], - /// "format": "double" + /// ] /// }, /// "end_time": { - /// "description": "Date and time", + /// "description": "End time", /// "type": [ /// "string", /// "null" @@ -363,30 +532,27 @@ pub mod types { /// "format": "date-time" /// }, /// "fargate_price_id": { - /// "description": "Identifier of the Fargate Price rate used to - /// compute the cost of the pipeline run.\n", - /// "type": "number" + /// "description": "Fargate price identifier used to compute the cost", + /// "type": [ + /// "integer", + /// "null" + /// ], + /// "format": "int32" /// }, /// "fargate_task_arn": { - /// "description": "The ARN of the Fargate task that performed the + /// "description": "ARN of the Fargate task that performed the /// analysis", /// "examples": [ /// "arn:aws:ecs:us-west-2:123456789012:task/bna/ - /// 29f979fc9fca402d94b014aa23d2f6e0\n" + /// 29f979fc9fca402d94b014aa23d2f6e0" /// ], /// "type": [ /// "string", /// "null" /// ] /// }, - /// "result_posted": { - /// "type": [ - /// "boolean", - /// "null" - /// ] - /// }, /// "s3_bucket": { - /// "description": "the path of the S3 bucket where the results were + /// "description": "Path of the S3 bucket where the results were /// stored", /// "examples": [ /// "united states/new mexico/santa rosa/24.05.4" @@ -400,106 +566,72 @@ pub mod types { /// "description": "Copy of the JSON message that was sent for /// processing", /// "examples": [ - /// "{\"country\":\"United States\",\"city\":\"santa - /// rosa\",\"region\":\"new mexico\", \"fips_code\":\"3570670\"}" + /// { + /// "city": "santa rosa", + /// "country": "United States", + /// "fips_code": "3570670", + /// "region": "new mexico" + /// } /// ], /// "type": [ /// "string", /// "null" /// ] /// }, - /// "start_time": { - /// "description": "Date and time", - /// "type": [ - /// "string", - /// "null" - /// ], - /// "format": "date-time" - /// }, - /// "state_machine_id": { - /// "$ref": "#/components/schemas/state_machine_id" - /// }, - /// "status": { - /// "$ref": "#/components/schemas/analysis_status" - /// }, /// "step": { - /// "$ref": "#/components/schemas/step" - /// }, - /// "torn_down": { - /// "description": "Flag indicating wether the resources were torn down - /// or not at the end of the analysis\n", - /// "type": [ - /// "boolean", - /// "null" - /// ] + /// "$ref": "#/components/schemas/BnaPipelineStep" /// } /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct AnalysisPost { + pub struct BnaPipelinePost { ///Cost of an analysis in USD #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub cost: ::std::option::Option, - ///Date and time + pub cost: ::std::option::Option<::std::string::String>, + ///End time #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub end_time: ::std::option::Option>, + ///Fargate price identifier used to compute the cost #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub fargate_price_id: ::std::option::Option, - ///The ARN of the Fargate task that performed the analysis + pub fargate_price_id: ::std::option::Option, + ///ARN of the Fargate task that performed the analysis #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub fargate_task_arn: ::std::option::Option<::std::string::String>, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub result_posted: ::std::option::Option, - ///the path of the S3 bucket where the results were stored + ///Path of the S3 bucket where the results were stored #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub s3_bucket: ::std::option::Option<::std::string::String>, ///Copy of the JSON message that was sent for processing #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub sqs_message: ::std::option::Option<::std::string::String>, - ///Date and time - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub start_time: ::std::option::Option>, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub state_machine_id: ::std::option::Option, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub status: ::std::option::Option, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub step: ::std::option::Option, - ///Flag indicating wether the resources were torn down or not at the - /// end of the analysis - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub torn_down: ::std::option::Option, + pub step: BnaPipelineStep, } - impl From<&AnalysisPost> for AnalysisPost { - fn from(value: &AnalysisPost) -> Self { + impl ::std::convert::From<&BnaPipelinePost> for BnaPipelinePost { + fn from(value: &BnaPipelinePost) -> Self { value.clone() } } - impl AnalysisPost { - pub fn builder() -> builder::AnalysisPost { + impl BnaPipelinePost { + pub fn builder() -> builder::BnaPipelinePost { Default::default() } } - ///BNA Pipeline status + ///BnaPipelineStep /// ///
JSON schema /// /// ```json ///{ - /// "description": "BNA Pipeline status", - /// "examples": [ - /// "Pending" - /// ], /// "type": "string", /// "enum": [ - /// "Completed", - /// "Pending", - /// "Processing" + /// "SqsMessage", + /// "Setup", + /// "Analysis", + /// "Cleanup" /// ] ///} /// ``` @@ -516,48 +648,51 @@ pub mod types { PartialEq, PartialOrd, )] - pub enum AnalysisStatus { - Completed, - Pending, - Processing, + pub enum BnaPipelineStep { + SqsMessage, + Setup, + Analysis, + Cleanup, } - impl From<&AnalysisStatus> for AnalysisStatus { - fn from(value: &AnalysisStatus) -> Self { + impl ::std::convert::From<&BnaPipelineStep> for BnaPipelineStep { + fn from(value: &BnaPipelineStep) -> Self { value.clone() } } - impl ::std::fmt::Display for AnalysisStatus { + impl ::std::fmt::Display for BnaPipelineStep { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match *self { - Self::Completed => write!(f, "Completed"), - Self::Pending => write!(f, "Pending"), - Self::Processing => write!(f, "Processing"), + Self::SqsMessage => write!(f, "SqsMessage"), + Self::Setup => write!(f, "Setup"), + Self::Analysis => write!(f, "Analysis"), + Self::Cleanup => write!(f, "Cleanup"), } } } - impl std::str::FromStr for AnalysisStatus { + impl ::std::str::FromStr for BnaPipelineStep { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { match value { - "Completed" => Ok(Self::Completed), - "Pending" => Ok(Self::Pending), - "Processing" => Ok(Self::Processing), + "SqsMessage" => Ok(Self::SqsMessage), + "Setup" => Ok(Self::Setup), + "Analysis" => Ok(Self::Analysis), + "Cleanup" => Ok(Self::Cleanup), _ => Err("invalid value".into()), } } } - impl std::convert::TryFrom<&str> for AnalysisStatus { + impl ::std::convert::TryFrom<&str> for BnaPipelineStep { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } - impl std::convert::TryFrom<&::std::string::String> for AnalysisStatus { + impl ::std::convert::TryFrom<&::std::string::String> for BnaPipelineStep { type Error = self::error::ConversionError; fn try_from( value: &::std::string::String, @@ -566,7 +701,7 @@ pub mod types { } } - impl std::convert::TryFrom<::std::string::String> for AnalysisStatus { + impl ::std::convert::TryFrom<::std::string::String> for BnaPipelineStep { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, @@ -575,430 +710,402 @@ pub mod types { } } - ///API Gateway ID associated with the request + ///BnaPipelines /// ///
JSON schema /// /// ```json ///{ - /// "description": "API Gateway ID associated with the request ", - /// "examples": [ - /// "blfwkg8nvHcEJnQ=" - /// ], - /// "type": "string" + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/BnaPipeline" + /// } ///} /// ``` ///
- #[derive( - :: serde :: Deserialize, - :: serde :: Serialize, - Clone, - Debug, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - )] - pub struct ApiGatewayId(pub ::std::string::String); - impl ::std::ops::Deref for ApiGatewayId { - type Target = ::std::string::String; - fn deref(&self) -> &::std::string::String { + #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] + pub struct BnaPipelines(pub ::std::vec::Vec); + impl ::std::ops::Deref for BnaPipelines { + type Target = ::std::vec::Vec; + fn deref(&self) -> &::std::vec::Vec { &self.0 } } - impl From for ::std::string::String { - fn from(value: ApiGatewayId) -> Self { + impl ::std::convert::From for ::std::vec::Vec { + fn from(value: BnaPipelines) -> Self { value.0 } } - impl From<&ApiGatewayId> for ApiGatewayId { - fn from(value: &ApiGatewayId) -> Self { + impl ::std::convert::From<&BnaPipelines> for BnaPipelines { + fn from(value: &BnaPipelines) -> Self { value.clone() } } - impl From<::std::string::String> for ApiGatewayId { - fn from(value: ::std::string::String) -> Self { + impl ::std::convert::From<::std::vec::Vec> for BnaPipelines { + fn from(value: ::std::vec::Vec) -> Self { Self(value) } } - impl ::std::str::FromStr for ApiGatewayId { - type Err = ::std::convert::Infallible; - fn from_str(value: &str) -> ::std::result::Result { - Ok(Self(value.to_string())) - } - } - - impl ::std::fmt::Display for ApiGatewayId { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - self.0.fmt(f) - } - } - - ///Bna + ///Census information of a city /// ///
JSON schema /// /// ```json ///{ + /// "description": "Census information of a city", /// "type": "object", /// "required": [ /// "city_id", + /// "created_at", + /// "fips_code", /// "id", - /// "score", - /// "version" + /// "pop_size", + /// "population" /// ], /// "properties": { /// "city_id": { /// "description": "City identifier", - /// "examples": [ - /// "6d1927b4-3474-4ce0-9b2e-2a1f5a7d91bd" - /// ], /// "type": "string", /// "format": "uuid" /// }, - /// "community_centers": { - /// "description": "BNA category subscore for access to community - /// centers", - /// "examples": [ - /// 70.7 - /// ], - /// "type": [ - /// "number", - /// "null" - /// ] + /// "created_at": { + /// "description": "Creation date", + /// "type": "string", + /// "format": "date-time" /// }, - /// "coreservices_score": { - /// "description": "BNA category score for access to core services", + /// "fips_code": { + /// "description": "Numerical city identifier given by the U.S. census, + /// or 0 for non-US cities", /// "examples": [ - /// 78.15 + /// "4805000" /// ], - /// "type": [ - /// "number", - /// "null" - /// ] + /// "type": "string" /// }, - /// "dentists": { - /// "description": "BNA category subscore for access to dentists", - /// "examples": [ - /// 68.69 - /// ], - /// "type": [ - /// "number", - /// "null" - /// ] + /// "id": { + /// "description": "Census identifier", + /// "type": "integer", + /// "format": "int32" /// }, - /// "doctors": { - /// "description": "BNA category subscore for access to doctors", + /// "pop_size": { + /// "description": "City population size category (small (0), medium + /// (1), large (2))", /// "examples": [ - /// 73.51 + /// "1" /// ], - /// "type": [ - /// "number", - /// "null" - /// ] + /// "type": "integer", + /// "format": "int32" /// }, - /// "employment": { - /// "description": "BNA category subscore for access to job location - /// areas", + /// "population": { + /// "description": "City population", /// "examples": [ - /// 0.0 + /// "907779" /// ], - /// "type": [ - /// "number", - /// "null" - /// ] - /// }, - /// "grocery": { - /// "description": "BNA category subscore for access to grocery - /// stores", + /// "type": "integer", + /// "format": "int32" + /// } + /// } + ///} + /// ``` + ///
+ #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] + pub struct Census { + ///City identifier + pub city_id: uuid::Uuid, + ///Creation date + pub created_at: chrono::DateTime, + ///Numerical city identifier given by the U.S. census, or 0 for non-US + /// cities + pub fips_code: ::std::string::String, + ///Census identifier + pub id: i32, + ///City population size category (small (0), medium (1), large (2)) + pub pop_size: i32, + ///City population + pub population: i32, + } + + impl ::std::convert::From<&Census> for Census { + fn from(value: &Census) -> Self { + value.clone() + } + } + + impl Census { + pub fn builder() -> builder::Census { + Default::default() + } + } + + ///CensusPost + /// + ///
JSON schema + /// + /// ```json + ///{ + /// "type": "object", + /// "required": [ + /// "fips_code", + /// "pop_size", + /// "population" + /// ], + /// "properties": { + /// "fips_code": { + /// "description": "Numerical city identifier given by the U.S. census, + /// or 0 for non-US cities", /// "examples": [ - /// 83.02 + /// "4805000" /// ], - /// "type": [ - /// "number", - /// "null" - /// ] + /// "type": "string" /// }, - /// "high_stress_miles": { - /// "description": "Total miles of high-stress streets in the measured - /// area", + /// "pop_size": { + /// "description": "City population size category (small (0), medium + /// (1), large (2))", /// "examples": [ - /// 437.8 + /// "1" /// ], - /// "type": [ - /// "number", - /// "null" - /// ] + /// "type": "integer", + /// "format": "int32" /// }, - /// "higher_education": { - /// "description": "BNA category subscore for access to universities - /// and colleges", + /// "population": { + /// "description": "City population", /// "examples": [ - /// 84.76 + /// "907779" /// ], - /// "type": [ - /// "number", - /// "null" - /// ] + /// "type": "integer", + /// "format": "int32" + /// } + /// } + ///} + /// ``` + ///
+ #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] + pub struct CensusPost { + ///Numerical city identifier given by the U.S. census, or 0 for non-US + /// cities + pub fips_code: ::std::string::String, + ///City population size category (small (0), medium (1), large (2)) + pub pop_size: i32, + ///City population + pub population: i32, + } + + impl ::std::convert::From<&CensusPost> for CensusPost { + fn from(value: &CensusPost) -> Self { + value.clone() + } + } + + impl CensusPost { + pub fn builder() -> builder::CensusPost { + Default::default() + } + } + + ///Cities + /// + ///
JSON schema + /// + /// ```json + ///{ + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/City" + /// } + ///} + /// ``` + ///
+ #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] + pub struct Cities(pub ::std::vec::Vec); + impl ::std::ops::Deref for Cities { + type Target = ::std::vec::Vec; + fn deref(&self) -> &::std::vec::Vec { + &self.0 + } + } + + impl ::std::convert::From for ::std::vec::Vec { + fn from(value: Cities) -> Self { + value.0 + } + } + + impl ::std::convert::From<&Cities> for Cities { + fn from(value: &Cities) -> Self { + value.clone() + } + } + + impl ::std::convert::From<::std::vec::Vec> for Cities { + fn from(value: ::std::vec::Vec) -> Self { + Self(value) + } + } + + ///Detailed information of a city + /// + ///
JSON schema + /// + /// ```json + ///{ + /// "description": "Detailed information of a city", + /// "type": "object", + /// "required": [ + /// "country", + /// "created_at", + /// "id", + /// "name", + /// "state" + /// ], + /// "properties": { + /// "country": { + /// "$ref": "#/components/schemas/Country" /// }, - /// "hospitals": { - /// "description": "BNA category subscore for access to hospitals", - /// "examples": [ - /// 82.43 - /// ], - /// "type": [ - /// "number", - /// "null" - /// ] + /// "created_at": { + /// "description": "Creation date", + /// "type": "string", + /// "format": "date-time" /// }, /// "id": { - /// "description": "Analysis identifier", - /// "examples": [ - /// "1a759b85-cd87-4bb1-9efa-5789e38e9982" - /// ], + /// "description": "City identifier", /// "type": "string", /// "format": "uuid" /// }, - /// "k12_education": { - /// "description": "BNA category subscore for access to k12 schools", + /// "latitude": { + /// "description": "Geographic coordinate that specifies the + /// north-south position of a point\non the surface of the Earth.", /// "examples": [ - /// 6.63 + /// "51.260197" /// ], /// "type": [ /// "number", /// "null" - /// ] - /// }, - /// "low_stress_miles": { - /// "description": "Total miles of low-stress streets and paths in the - /// measured area", - /// "examples": [ - /// 1862.2 /// ], - /// "type": [ - /// "number", - /// "null" - /// ] + /// "format": "double" /// }, - /// "opportunity_score": { - /// "description": "BNA category score for access to education and - /// jobs\"\"", + /// "longitude": { + /// "description": "Geographic coordinate that specifies the east–west + /// position of a point\non the surface of the Earth.", /// "examples": [ - /// 79.91 + /// "4.402771" /// ], /// "type": [ /// "number", /// "null" - /// ] - /// }, - /// "parks": { - /// "description": "BNA category subscore for access to parks", - /// "examples": [ - /// 78.49 /// ], - /// "type": [ - /// "number", - /// "null" - /// ] + /// "format": "double" /// }, - /// "people": { - /// "description": "BNA category score for access to residential - /// areas", + /// "name": { + /// "description": "City name", /// "examples": [ - /// 75.81 + /// "Antwerp" /// ], - /// "type": [ - /// "number", - /// "null" - /// ] + /// "type": "string" /// }, - /// "pharmacies": { - /// "description": "BNA category subscore for access to pharmacies", + /// "region": { + /// "description": "Region name. A region can be a state, a province, a + /// community, or\nsomething similar depending on the country. If a country + /// does not have\nthis concept, then the country name is used.", /// "examples": [ - /// 76.62 + /// "Antwerp" /// ], /// "type": [ - /// "number", + /// "string", /// "null" /// ] /// }, - /// "recreation_score": { - /// "description": "BNA category score for access to recreational - /// facilities", + /// "speed_limit": { + /// "description": "Speed limit in kilometer per hour (km/h).", /// "examples": [ - /// 82.13 + /// "50" /// ], /// "type": [ - /// "number", + /// "integer", /// "null" - /// ] + /// ], + /// "format": "int32" /// }, - /// "recreation_trails": { - /// "description": "BNA category subscore for access to bikeable - /// trails", + /// "state": { + /// "description": "State name", /// "examples": [ - /// 94.45 + /// "Antwerp" /// ], - /// "type": [ - /// "number", - /// "null" - /// ] + /// "type": "string" /// }, - /// "retail": { - /// "description": "BNA category score for access to major retail - /// centers", + /// "state_abbrev": { + /// "description": "A short version of the state name, usually 2 or 3 + /// character long", /// "examples": [ - /// 73.71 + /// "VAN" /// ], /// "type": [ - /// "number", + /// "string", /// "null" /// ] /// }, - /// "score": { - /// "description": "BNA total score", - /// "examples": [ - /// 77.0 - /// ], - /// "type": "number" - /// }, - /// "social_services": { - /// "description": "BNA category subscore for access to social - /// services", - /// "examples": [ - /// 77.82 - /// ], + /// "updated_at": { + /// "description": "Update date", /// "type": [ - /// "number", + /// "string", /// "null" - /// ] - /// }, - /// "technical_vocational_college": { - /// "description": "BNA category subscore for access to technical and - /// vocational colleges", - /// "examples": [ - /// 81.67 - /// ], - /// "type": [ - /// "number", - /// "null" - /// ] - /// }, - /// "transit": { - /// "description": "BNA category score for access to major transit - /// stops", - /// "examples": [ - /// 71.59 - /// ], - /// "type": [ - /// "number", - /// "null" - /// ] - /// }, - /// "version": { - /// "description": "Analysis version. The format follows the [calver](https://calver.org) specification with the YY.0M[.Minor] scheme.\n", - /// "examples": [ - /// "23.02" /// ], - /// "type": "string" + /// "format": "date-time" /// } /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct Bna { + pub struct City { + pub country: Country, + ///Creation date + pub created_at: chrono::DateTime, ///City identifier - pub city_id: uuid::Uuid, - ///BNA category subscore for access to community centers - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub community_centers: ::std::option::Option, - ///BNA category score for access to core services - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub coreservices_score: ::std::option::Option, - ///BNA category subscore for access to dentists - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub dentists: ::std::option::Option, - ///BNA category subscore for access to doctors - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub doctors: ::std::option::Option, - ///BNA category subscore for access to job location areas - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub employment: ::std::option::Option, - ///BNA category subscore for access to grocery stores - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub grocery: ::std::option::Option, - ///Total miles of high-stress streets in the measured area - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub high_stress_miles: ::std::option::Option, - ///BNA category subscore for access to universities and colleges - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub higher_education: ::std::option::Option, - ///BNA category subscore for access to hospitals - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub hospitals: ::std::option::Option, - ///Analysis identifier pub id: uuid::Uuid, - ///BNA category subscore for access to k12 schools - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub k12_education: ::std::option::Option, - ///Total miles of low-stress streets and paths in the measured area - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub low_stress_miles: ::std::option::Option, - ///BNA category score for access to education and jobs"" - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub opportunity_score: ::std::option::Option, - ///BNA category subscore for access to parks - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub parks: ::std::option::Option, - ///BNA category score for access to residential areas - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub people: ::std::option::Option, - ///BNA category subscore for access to pharmacies - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub pharmacies: ::std::option::Option, - ///BNA category score for access to recreational facilities + ///Geographic coordinate that specifies the north-south position of a + /// point on the surface of the Earth. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub recreation_score: ::std::option::Option, - ///BNA category subscore for access to bikeable trails + pub latitude: ::std::option::Option, + ///Geographic coordinate that specifies the east–west position of a + /// point on the surface of the Earth. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub recreation_trails: ::std::option::Option, - ///BNA category score for access to major retail centers + pub longitude: ::std::option::Option, + ///City name + pub name: ::std::string::String, + ///Region name. A region can be a state, a province, a community, or + ///something similar depending on the country. If a country does not + /// have this concept, then the country name is used. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub retail: ::std::option::Option, - pub score: f64, - ///BNA category subscore for access to social services + pub region: ::std::option::Option<::std::string::String>, + ///Speed limit in kilometer per hour (km/h). #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub social_services: ::std::option::Option, - ///BNA category subscore for access to technical and vocational - /// colleges + pub speed_limit: ::std::option::Option, + ///State name + pub state: ::std::string::String, + ///A short version of the state name, usually 2 or 3 character long #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub technical_vocational_college: ::std::option::Option, - ///BNA category score for access to major transit stops + pub state_abbrev: ::std::option::Option<::std::string::String>, + ///Update date #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub transit: ::std::option::Option, - ///Analysis version. The format follows the [calver](https://calver.org) specification with the YY.0M[.Minor] scheme. - pub version: ::std::string::String, + pub updated_at: ::std::option::Option>, } - impl From<&Bna> for Bna { - fn from(value: &Bna) -> Self { + impl ::std::convert::From<&City> for City { + fn from(value: &City) -> Self { value.clone() } } - impl Bna { - pub fn builder() -> builder::Bna { + impl City { + pub fn builder() -> builder::City { Default::default() } } - ///BnaPost + ///CityCensuses /// ///
JSON schema /// @@ -1006,69 +1113,42 @@ pub mod types { ///{ /// "type": "object", /// "required": [ - /// "core_services", - /// "infrastructure", - /// "opportunity", - /// "people", - /// "recreation", - /// "retail", - /// "summary", - /// "transit" + /// "censuses", + /// "city" /// ], /// "properties": { - /// "core_services": { - /// "$ref": "#/components/schemas/core_services" - /// }, - /// "infrastructure": { - /// "$ref": "#/components/schemas/infrastructure" - /// }, - /// "opportunity": { - /// "$ref": "#/components/schemas/opportunity" - /// }, - /// "people": { - /// "$ref": "#/components/schemas/people" - /// }, - /// "recreation": { - /// "$ref": "#/components/schemas/recreation" - /// }, - /// "retail": { - /// "$ref": "#/components/schemas/retail" - /// }, - /// "summary": { - /// "$ref": "#/components/schemas/bna_summary" + /// "censuses": { + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/Census" + /// } /// }, - /// "transit": { - /// "$ref": "#/components/schemas/transit" + /// "city": { + /// "$ref": "#/components/schemas/City" /// } /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct BnaPost { - pub core_services: CoreServices, - pub infrastructure: Infrastructure, - pub opportunity: Opportunity, - pub people: People, - pub recreation: Recreation, - pub retail: Retail, - pub summary: BnaSummary, - pub transit: Transit, + pub struct CityCensuses { + pub censuses: ::std::vec::Vec, + pub city: City, } - impl From<&BnaPost> for BnaPost { - fn from(value: &BnaPost) -> Self { + impl ::std::convert::From<&CityCensuses> for CityCensuses { + fn from(value: &CityCensuses) -> Self { value.clone() } } - impl BnaPost { - pub fn builder() -> builder::BnaPost { + impl CityCensuses { + pub fn builder() -> builder::CityCensuses { Default::default() } } - ///BnaSummary + ///CityPost /// ///
JSON schema /// @@ -1076,1246 +1156,1009 @@ pub mod types { ///{ /// "type": "object", /// "required": [ - /// "city_id", - /// "rating_id", - /// "score", - /// "version" + /// "country", + /// "name", + /// "state" /// ], /// "properties": { - /// "city_id": { - /// "description": "City identifier", + /// "country": { + /// "$ref": "#/components/schemas/Country" + /// }, + /// "latitude": { + /// "description": "Geographic coordinate that specifies the + /// north-south position of a point\non the surface of the Earth.", /// "examples": [ - /// "6d1927b4-3474-4ce0-9b2e-2a1f5a7d91bd" + /// "51.260197" /// ], - /// "type": "string", - /// "format": "uuid" + /// "type": [ + /// "number", + /// "null" + /// ], + /// "format": "double" /// }, - /// "created_at": { - /// "description": "Date and time", - /// "type": "string", - /// "format": "date-time" + /// "longitude": { + /// "description": "Geographic coordinate that specifies the east–west + /// position of a point\non the surface of the Earth.", + /// "examples": [ + /// "4.402771" + /// ], + /// "type": [ + /// "number", + /// "null" + /// ], + /// "format": "double" /// }, - /// "rating_id": { - /// "description": "Analysis identifier", + /// "name": { + /// "description": "City name", /// "examples": [ - /// "1a759b85-cd87-4bb1-9efa-5789e38e9982" + /// "Antwerp" /// ], - /// "type": "string", - /// "format": "uuid" + /// "type": "string" /// }, - /// "score": { - /// "description": "BNA score", + /// "region": { + /// "description": "Region name. A region can be a state, a province, a + /// community, or\nsomething similar depending on the country. If a country + /// does not have\nthis concept, then the country name is used.", /// "examples": [ - /// 77.0 + /// "Antwerp" /// ], - /// "type": "number" + /// "type": [ + /// "string", + /// "null" + /// ] /// }, - /// "version": { - /// "description": "Analysis version. The format follows the [calver](https://calver.org) specification with the YY.0M[.Minor] scheme.\n", + /// "speed_limit": { + /// "description": "Speed limit in kilometer per hour (km/h).", /// "examples": [ - /// "23.02" + /// "50" + /// ], + /// "type": [ + /// "integer", + /// "null" + /// ], + /// "format": "int32" + /// }, + /// "state": { + /// "description": "A short version of the state name, usually 2 or 3 + /// character long", + /// "examples": [ + /// "VAN" /// ], /// "type": "string" + /// }, + /// "state_abbrev": { + /// "description": "A short version of the state name, usually 2 or 3 + /// character long", + /// "examples": [ + /// "VAN" + /// ], + /// "type": [ + /// "string", + /// "null" + /// ] /// } /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct BnaSummary { - ///City identifier - pub city_id: uuid::Uuid, - ///Date and time + pub struct CityPost { + pub country: Country, + ///Geographic coordinate that specifies the north-south position of a + /// point on the surface of the Earth. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub created_at: ::std::option::Option>, - ///Analysis identifier - pub rating_id: uuid::Uuid, - pub score: f64, - ///Analysis version. The format follows the [calver](https://calver.org) specification with the YY.0M[.Minor] scheme. - pub version: ::std::string::String, + pub latitude: ::std::option::Option, + ///Geographic coordinate that specifies the east–west position of a + /// point on the surface of the Earth. + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub longitude: ::std::option::Option, + ///City name + pub name: ::std::string::String, + ///Region name. A region can be a state, a province, a community, or + ///something similar depending on the country. If a country does not + /// have this concept, then the country name is used. + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub region: ::std::option::Option<::std::string::String>, + ///Speed limit in kilometer per hour (km/h). + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub speed_limit: ::std::option::Option, + ///A short version of the state name, usually 2 or 3 character long + pub state: ::std::string::String, + ///A short version of the state name, usually 2 or 3 character long + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub state_abbrev: ::std::option::Option<::std::string::String>, } - impl From<&BnaSummary> for BnaSummary { - fn from(value: &BnaSummary) -> Self { + impl ::std::convert::From<&CityPost> for CityPost { + fn from(value: &CityPost) -> Self { value.clone() } } - impl BnaSummary { - pub fn builder() -> builder::BnaSummary { + impl CityPost { + pub fn builder() -> builder::CityPost { Default::default() } } - ///BnaSummaryWithCity + ///CityRatings /// ///
JSON schema /// /// ```json ///{ - /// "type": "array", - /// "items": { - /// "allOf": [ - /// { - /// "$ref": "#/components/schemas/bna_summary" - /// }, - /// { - /// "$ref": "#/components/schemas/city" + /// "type": "object", + /// "required": [ + /// "city", + /// "ratings" + /// ], + /// "properties": { + /// "city": { + /// "$ref": "#/components/schemas/City" + /// }, + /// "ratings": { + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/RatingSummary" /// } - /// ] + /// } /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct BnaSummaryWithCity(pub ::std::vec::Vec); - impl ::std::ops::Deref for BnaSummaryWithCity { - type Target = ::std::vec::Vec; - fn deref(&self) -> &::std::vec::Vec { - &self.0 - } - } - - impl From for ::std::vec::Vec { - fn from(value: BnaSummaryWithCity) -> Self { - value.0 - } + pub struct CityRatings { + pub city: City, + pub ratings: ::std::vec::Vec, } - impl From<&BnaSummaryWithCity> for BnaSummaryWithCity { - fn from(value: &BnaSummaryWithCity) -> Self { + impl ::std::convert::From<&CityRatings> for CityRatings { + fn from(value: &CityRatings) -> Self { value.clone() } } - impl From<::std::vec::Vec> for BnaSummaryWithCity { - fn from(value: ::std::vec::Vec) -> Self { - Self(value) + impl CityRatings { + pub fn builder() -> builder::CityRatings { + Default::default() } } - ///BnaSummaryWithCityItem + ///CoreServices /// ///
JSON schema /// /// ```json ///{ - /// "allOf": [ - /// { - /// "$ref": "#/components/schemas/bna_summary" + /// "type": "object", + /// "properties": { + /// "dentists": { + /// "description": "BNA category subscore for access to dentists.", + /// "type": [ + /// "number", + /// "null" + /// ], + /// "format": "double", + /// "maximum": 100.0, + /// "minimum": 0.0 /// }, - /// { - /// "$ref": "#/components/schemas/city" - /// } - /// ] - ///} - /// ``` - ///
- #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct BnaSummaryWithCityItem { - ///City identifier - pub city_id: uuid::Uuid, - pub country: Country, - pub created_at: chrono::DateTime, - ///City identifier - pub id: uuid::Uuid, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub latitude: ::std::option::Option, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub longitude: ::std::option::Option, - ///City name - pub name: ::std::string::String, - ///Analysis identifier - pub rating_id: uuid::Uuid, - ///Region name. A region can be a state, a province, a community, or - /// something similar depending on the country. If a country does not - /// have this concept, then the country name is used. - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub region: ::std::option::Option<::std::string::String>, - pub score: f64, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub speed_limit: ::std::option::Option, - ///State name - pub state: ::std::string::String, - ///A short version of the state name, usually 2 or 3 character long. - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub state_abbrev: ::std::option::Option<::std::string::String>, - ///Date and time - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub updated_at: ::std::option::Option>, - ///Analysis version. The format follows the [calver](https://calver.org) specification with the YY.0M[.Minor] scheme. - pub version: ::std::string::String, - } - - impl From<&BnaSummaryWithCityItem> for BnaSummaryWithCityItem { - fn from(value: &BnaSummaryWithCityItem) -> Self { - value.clone() - } - } - - impl BnaSummaryWithCityItem { - pub fn builder() -> builder::BnaSummaryWithCityItem { - Default::default() - } - } - - ///Census information - /// - ///
JSON schema - /// - /// ```json - ///{ - /// "description": "Census information", - /// "type": "object", - /// "properties": { - /// "census_id": { - /// "examples": [ - /// 788 + /// "doctors": { + /// "description": "BNA category subscore for access to doctors.", + /// "type": [ + /// "number", + /// "null" /// ], - /// "type": "integer" + /// "format": "double", + /// "maximum": 100.0, + /// "minimum": 0.0 /// }, - /// "city_id": { - /// "description": "City identifier", - /// "examples": [ - /// "6d1927b4-3474-4ce0-9b2e-2a1f5a7d91bd" + /// "grocery": { + /// "description": "BNA category subscore for access to grocery + /// stores.", + /// "type": [ + /// "number", + /// "null" /// ], - /// "type": "string", - /// "format": "uuid" + /// "format": "double", + /// "maximum": 100.0, + /// "minimum": 0.0 /// }, - /// "created_at": { - /// "description": "Date and time", - /// "type": "string", - /// "format": "date-time" + /// "hospitals": { + /// "description": "BNA category subscore for access to hospitals.", + /// "type": [ + /// "number", + /// "null" + /// ], + /// "format": "double", + /// "maximum": 100.0, + /// "minimum": 0.0 /// }, - /// "fips_code": { - /// "description": "Numerical city identifier given by the U.S. census, - /// or 0 for non-US cities\n", - /// "examples": [ - /// "4805000" + /// "pharmacies": { + /// "description": "BNA category subscore for access to pharmacies.", + /// "type": [ + /// "number", + /// "null" /// ], - /// "type": "string" + /// "format": "double", + /// "maximum": 100.0, + /// "minimum": 0.0 /// }, - /// "pop_size": { - /// "description": "City population size category (small (0), medium - /// (1), large (2))\n", - /// "examples": [ - /// 2 + /// "score": { + /// "description": "BNA category score for access to core services.", + /// "type": [ + /// "number", + /// "null" /// ], - /// "type": "integer", - /// "enum": [ - /// 0, - /// 1, - /// 2 - /// ] + /// "format": "double", + /// "maximum": 100.0, + /// "minimum": 0.0 /// }, - /// "population": { - /// "description": "City population", - /// "examples": [ - /// 907779 + /// "social_services": { + /// "description": "BNA category subscore for access to social + /// services.", + /// "type": [ + /// "number", + /// "null" /// ], - /// "type": "integer" + /// "format": "double", + /// "maximum": 100.0, + /// "minimum": 0.0 /// } /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct Census { + pub struct CoreServices { + ///BNA category subscore for access to dentists. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub census_id: ::std::option::Option, - ///City identifier + pub dentists: ::std::option::Option, + ///BNA category subscore for access to doctors. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub city_id: ::std::option::Option, - ///Date and time + pub doctors: ::std::option::Option, + ///BNA category subscore for access to grocery stores. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub created_at: ::std::option::Option>, - ///Numerical city identifier given by the U.S. census, or 0 for non-US - /// cities + pub grocery: ::std::option::Option, + ///BNA category subscore for access to hospitals. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub fips_code: ::std::option::Option<::std::string::String>, - ///City population size category (small (0), medium (1), large (2)) + pub hospitals: ::std::option::Option, + ///BNA category subscore for access to pharmacies. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub pop_size: ::std::option::Option, - ///City population + pub pharmacies: ::std::option::Option, + ///BNA category score for access to core services. + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub score: ::std::option::Option, + ///BNA category subscore for access to social services. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub population: ::std::option::Option, + pub social_services: ::std::option::Option, } - impl From<&Census> for Census { - fn from(value: &Census) -> Self { + impl ::std::convert::From<&CoreServices> for CoreServices { + fn from(value: &CoreServices) -> Self { value.clone() } } - impl Census { - pub fn builder() -> builder::Census { + impl ::std::default::Default for CoreServices { + fn default() -> Self { + Self { + dentists: Default::default(), + doctors: Default::default(), + grocery: Default::default(), + hospitals: Default::default(), + pharmacies: Default::default(), + score: Default::default(), + social_services: Default::default(), + } + } + } + + impl CoreServices { + pub fn builder() -> builder::CoreServices { Default::default() } } - ///City population size category (small (0), medium (1), large (2)) + ///Country /// ///
JSON schema /// /// ```json ///{ - /// "description": "City population size category (small (0), medium (1), - /// large (2))\n", - /// "examples": [ - /// 2 - /// ], - /// "type": "integer", + /// "type": "string", /// "enum": [ - /// 0, - /// 1, - /// 2 + /// "Australia", + /// "Belgium", + /// "Brazil", + /// "Canada", + /// "Chile", + /// "Colombia", + /// "Croatia", + /// "Cuba", + /// "England", + /// "France", + /// "Germany", + /// "Greece", + /// "Guatemala", + /// "Iran", + /// "Iraq", + /// "Ireland", + /// "Italy", + /// "Mexico", + /// "Netherlands", + /// "New Zealand", + /// "Northern Ireland", + /// "Portugal", + /// "Scotland", + /// "Spain", + /// "United States", + /// "Vietnam", + /// "Wales" /// ] ///} /// ``` ///
- #[derive(:: serde :: Serialize, Clone, Debug)] - pub struct CensusPopSize(i64); - impl ::std::ops::Deref for CensusPopSize { - type Target = i64; - fn deref(&self) -> &i64 { - &self.0 - } + #[derive( + :: serde :: Deserialize, + :: serde :: Serialize, + Clone, + Copy, + Debug, + Eq, + Hash, + Ord, + PartialEq, + PartialOrd, + )] + pub enum Country { + Australia, + Belgium, + Brazil, + Canada, + Chile, + Colombia, + Croatia, + Cuba, + England, + France, + Germany, + Greece, + Guatemala, + Iran, + Iraq, + Ireland, + Italy, + Mexico, + Netherlands, + #[serde(rename = "New Zealand")] + NewZealand, + #[serde(rename = "Northern Ireland")] + NorthernIreland, + Portugal, + Scotland, + Spain, + #[serde(rename = "United States")] + UnitedStates, + Vietnam, + Wales, } - impl From for i64 { - fn from(value: CensusPopSize) -> Self { - value.0 + impl ::std::convert::From<&Country> for Country { + fn from(value: &Country) -> Self { + value.clone() } } - impl From<&CensusPopSize> for CensusPopSize { - fn from(value: &CensusPopSize) -> Self { - value.clone() + impl ::std::fmt::Display for Country { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match *self { + Self::Australia => write!(f, "Australia"), + Self::Belgium => write!(f, "Belgium"), + Self::Brazil => write!(f, "Brazil"), + Self::Canada => write!(f, "Canada"), + Self::Chile => write!(f, "Chile"), + Self::Colombia => write!(f, "Colombia"), + Self::Croatia => write!(f, "Croatia"), + Self::Cuba => write!(f, "Cuba"), + Self::England => write!(f, "England"), + Self::France => write!(f, "France"), + Self::Germany => write!(f, "Germany"), + Self::Greece => write!(f, "Greece"), + Self::Guatemala => write!(f, "Guatemala"), + Self::Iran => write!(f, "Iran"), + Self::Iraq => write!(f, "Iraq"), + Self::Ireland => write!(f, "Ireland"), + Self::Italy => write!(f, "Italy"), + Self::Mexico => write!(f, "Mexico"), + Self::Netherlands => write!(f, "Netherlands"), + Self::NewZealand => write!(f, "New Zealand"), + Self::NorthernIreland => write!(f, "Northern Ireland"), + Self::Portugal => write!(f, "Portugal"), + Self::Scotland => write!(f, "Scotland"), + Self::Spain => write!(f, "Spain"), + Self::UnitedStates => write!(f, "United States"), + Self::Vietnam => write!(f, "Vietnam"), + Self::Wales => write!(f, "Wales"), + } } } - impl ::std::convert::TryFrom for CensusPopSize { - type Error = self::error::ConversionError; - fn try_from(value: i64) -> ::std::result::Result { - if ![0_i64, 1_i64, 2_i64].contains(&value) { - Err("invalid value".into()) - } else { - Ok(Self(value)) + impl ::std::str::FromStr for Country { + type Err = self::error::ConversionError; + fn from_str(value: &str) -> ::std::result::Result { + match value { + "Australia" => Ok(Self::Australia), + "Belgium" => Ok(Self::Belgium), + "Brazil" => Ok(Self::Brazil), + "Canada" => Ok(Self::Canada), + "Chile" => Ok(Self::Chile), + "Colombia" => Ok(Self::Colombia), + "Croatia" => Ok(Self::Croatia), + "Cuba" => Ok(Self::Cuba), + "England" => Ok(Self::England), + "France" => Ok(Self::France), + "Germany" => Ok(Self::Germany), + "Greece" => Ok(Self::Greece), + "Guatemala" => Ok(Self::Guatemala), + "Iran" => Ok(Self::Iran), + "Iraq" => Ok(Self::Iraq), + "Ireland" => Ok(Self::Ireland), + "Italy" => Ok(Self::Italy), + "Mexico" => Ok(Self::Mexico), + "Netherlands" => Ok(Self::Netherlands), + "New Zealand" => Ok(Self::NewZealand), + "Northern Ireland" => Ok(Self::NorthernIreland), + "Portugal" => Ok(Self::Portugal), + "Scotland" => Ok(Self::Scotland), + "Spain" => Ok(Self::Spain), + "United States" => Ok(Self::UnitedStates), + "Vietnam" => Ok(Self::Vietnam), + "Wales" => Ok(Self::Wales), + _ => Err("invalid value".into()), } } } - impl<'de> ::serde::Deserialize<'de> for CensusPopSize { - fn deserialize(deserializer: D) -> ::std::result::Result - where - D: ::serde::Deserializer<'de>, - { - Self::try_from(::deserialize(deserializer)?) - .map_err(|e| ::custom(e.to_string())) + impl ::std::convert::TryFrom<&str> for Country { + type Error = self::error::ConversionError; + fn try_from(value: &str) -> ::std::result::Result { + value.parse() } } - ///CensusPost - /// - ///
JSON schema - /// - /// ```json + impl ::std::convert::TryFrom<&::std::string::String> for Country { + type Error = self::error::ConversionError; + fn try_from( + value: &::std::string::String, + ) -> ::std::result::Result { + value.parse() + } + } + + impl ::std::convert::TryFrom<::std::string::String> for Country { + type Error = self::error::ConversionError; + fn try_from( + value: ::std::string::String, + ) -> ::std::result::Result { + value.parse() + } + } + + ///A Fargate price used to estimate the cost of an analysis + /// + ///
JSON schema + /// + /// ```json ///{ + /// "description": "A Fargate price used to estimate the cost of an + /// analysis", /// "type": "object", + /// "required": [ + /// "created_at", + /// "id", + /// "per_second" + /// ], /// "properties": { - /// "fips_code": { - /// "description": "Numerical city identifier given by the U.S. census, - /// or 0 for non-US cities\n", - /// "examples": [ - /// "4805000" - /// ], - /// "type": "string" + /// "created_at": { + /// "description": "Creation date", + /// "type": "string", + /// "format": "date-time" /// }, - /// "pop_size": { - /// "description": "City population size category (small (0), medium - /// (1), large (2))\n", + /// "id": { + /// "description": "Identifier of the Fargate Price rate used to + /// compute the cost of the pipeline run", /// "examples": [ - /// 2 + /// "1" /// ], /// "type": "integer", - /// "enum": [ - /// 0, - /// 1, - /// 2 - /// ] + /// "format": "int32" /// }, - /// "population": { - /// "description": "City population", + /// "per_second": { + /// "description": "Cost to run Fargate for 1 second", /// "examples": [ - /// 907779 + /// "0.0023" /// ], - /// "type": "integer" + /// "type": "string" /// } /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct CensusPost { - ///Numerical city identifier given by the U.S. census, or 0 for non-US - /// cities - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub fips_code: ::std::option::Option<::std::string::String>, - ///City population size category (small (0), medium (1), large (2)) - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub pop_size: ::std::option::Option, - ///City population - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub population: ::std::option::Option, + pub struct FargatePrice { + ///Creation date + pub created_at: chrono::DateTime, + ///Identifier of the Fargate Price rate used to compute the cost of the + /// pipeline run + pub id: i32, + ///Cost to run Fargate for 1 second + pub per_second: ::std::string::String, } - impl From<&CensusPost> for CensusPost { - fn from(value: &CensusPost) -> Self { + impl ::std::convert::From<&FargatePrice> for FargatePrice { + fn from(value: &FargatePrice) -> Self { value.clone() } } - impl CensusPost { - pub fn builder() -> builder::CensusPost { + impl FargatePrice { + pub fn builder() -> builder::FargatePrice { Default::default() } } - ///City population size category (small (0), medium (1), large (2)) + ///A collection of Fargate prices. /// ///
JSON schema /// /// ```json ///{ - /// "description": "City population size category (small (0), medium (1), - /// large (2))\n", - /// "examples": [ - /// 2 - /// ], - /// "type": "integer", - /// "enum": [ - /// 0, - /// 1, - /// 2 - /// ] + /// "description": "A collection of Fargate prices.", + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/FargatePrice" + /// } ///} /// ``` ///
- #[derive(:: serde :: Serialize, Clone, Debug)] - pub struct CensusPostPopSize(i64); - impl ::std::ops::Deref for CensusPostPopSize { - type Target = i64; - fn deref(&self) -> &i64 { + #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] + pub struct FargatePrices(pub ::std::vec::Vec); + impl ::std::ops::Deref for FargatePrices { + type Target = ::std::vec::Vec; + fn deref(&self) -> &::std::vec::Vec { &self.0 } } - impl From for i64 { - fn from(value: CensusPostPopSize) -> Self { + impl ::std::convert::From for ::std::vec::Vec { + fn from(value: FargatePrices) -> Self { value.0 } } - impl From<&CensusPostPopSize> for CensusPostPopSize { - fn from(value: &CensusPostPopSize) -> Self { + impl ::std::convert::From<&FargatePrices> for FargatePrices { + fn from(value: &FargatePrices) -> Self { value.clone() } } - impl ::std::convert::TryFrom for CensusPostPopSize { - type Error = self::error::ConversionError; - fn try_from(value: i64) -> ::std::result::Result { - if ![0_i64, 1_i64, 2_i64].contains(&value) { - Err("invalid value".into()) - } else { - Ok(Self(value)) - } - } - } - - impl<'de> ::serde::Deserialize<'de> for CensusPostPopSize { - fn deserialize(deserializer: D) -> ::std::result::Result - where - D: ::serde::Deserializer<'de>, - { - Self::try_from(::deserialize(deserializer)?) - .map_err(|e| ::custom(e.to_string())) + impl ::std::convert::From<::std::vec::Vec> for FargatePrices { + fn from(value: ::std::vec::Vec) -> Self { + Self(value) } } - ///City + ///Error objects MUST be returned as an array keyed by errors in the top + /// level of a JSON:API document. /// ///
JSON schema /// /// ```json ///{ + /// "description": "Error objects MUST be returned as an array keyed by + /// errors in the top level of a\nJSON:API document.", /// "type": "object", /// "required": [ - /// "country", - /// "created_at", - /// "id", - /// "name", - /// "state" + /// "errors" /// ], /// "properties": { - /// "country": { - /// "$ref": "#/components/schemas/country" - /// }, - /// "created_at": { - /// "description": "Date and time", - /// "type": "string", - /// "format": "date-time" - /// }, - /// "id": { - /// "description": "City identifier", - /// "examples": [ - /// "6d1927b4-3474-4ce0-9b2e-2a1f5a7d91bd" - /// ], - /// "type": "string", - /// "format": "uuid" - /// }, - /// "latitude": { - /// "description": "Geographic coordinate that specifies the - /// north-south position of a point on the surface of the Earth.\n", - /// "examples": [ - /// 51.2194 - /// ], - /// "type": "number" - /// }, - /// "longitude": { - /// "description": "Geographic coordinate that specifies the east–west - /// position of a point on the surface of the Earth.\n", - /// "examples": [ - /// 4.4025 - /// ], - /// "type": "number" - /// }, - /// "name": { - /// "description": "City name", - /// "examples": [ - /// "Antwerp" - /// ], - /// "type": "string" - /// }, - /// "region": { - /// "description": "Region name. A region can be a state, a province, a - /// community, or something similar depending on the country. If a country - /// does not have this concept, then the country name is used.\n", - /// "examples": [ - /// "Belgium" - /// ], - /// "type": "string" - /// }, - /// "speed_limit": { - /// "description": "Speed limit in kilometer per hour (km/h).", - /// "examples": [ - /// 50 - /// ], - /// "type": "number" - /// }, - /// "state": { - /// "description": "State name", - /// "examples": [ - /// "Antwerp" - /// ], - /// "type": "string" - /// }, - /// "state_abbrev": { - /// "description": "A short version of the state name, usually 2 or 3 - /// character long.", - /// "examples": [ - /// "VAN" - /// ], - /// "type": "string" - /// }, - /// "updated_at": { - /// "description": "Date and time", - /// "type": "string", - /// "format": "date-time" + /// "errors": { + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/APIError" + /// } /// } /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct City { - pub country: Country, - ///Date and time - pub created_at: chrono::DateTime, - ///City identifier - pub id: uuid::Uuid, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub latitude: ::std::option::Option, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub longitude: ::std::option::Option, - ///City name - pub name: ::std::string::String, - ///Region name. A region can be a state, a province, a community, or - /// something similar depending on the country. If a country does not - /// have this concept, then the country name is used. - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub region: ::std::option::Option<::std::string::String>, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub speed_limit: ::std::option::Option, - ///State name - pub state: ::std::string::String, - ///A short version of the state name, usually 2 or 3 character long. - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub state_abbrev: ::std::option::Option<::std::string::String>, - ///Date and time - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub updated_at: ::std::option::Option>, + pub struct GetCitiesSubmissionResponse { + pub errors: ::std::vec::Vec, } - impl From<&City> for City { - fn from(value: &City) -> Self { + impl ::std::convert::From<&GetCitiesSubmissionResponse> for GetCitiesSubmissionResponse { + fn from(value: &GetCitiesSubmissionResponse) -> Self { value.clone() } } - impl City { - pub fn builder() -> builder::City { + impl GetCitiesSubmissionResponse { + pub fn builder() -> builder::GetCitiesSubmissionResponse { Default::default() } } - ///CityPost + ///Error objects MUST be returned as an array keyed by errors in the top + /// level of a JSON:API document. /// ///
JSON schema /// /// ```json ///{ + /// "description": "Error objects MUST be returned as an array keyed by + /// errors in the top level of a\nJSON:API document.", /// "type": "object", /// "required": [ - /// "country", - /// "name" + /// "errors" /// ], /// "properties": { - /// "country": { - /// "$ref": "#/components/schemas/country" - /// }, - /// "latitude": { - /// "description": "Geographic coordinate that specifies the - /// north-south position of a point on the surface of the Earth.\n", - /// "examples": [ - /// 51.2194 - /// ], - /// "type": [ - /// "number", - /// "null" - /// ] - /// }, - /// "longitude": { - /// "description": "Geographic coordinate that specifies the east–west - /// position of a point on the surface of the Earth.\n", - /// "examples": [ - /// 4.4025 - /// ], - /// "type": [ - /// "number", - /// "null" - /// ] - /// }, - /// "name": { - /// "description": "City name", - /// "examples": [ - /// "Antwerp" - /// ], - /// "type": "string" - /// }, - /// "speed_limit": { - /// "description": "Speed limit in kilometer per hour (km/h).", - /// "examples": [ - /// 50 - /// ], - /// "type": [ - /// "number", - /// "null" - /// ] - /// }, - /// "state": { - /// "description": "State name", - /// "examples": [ - /// "Antwerp" - /// ], - /// "type": "string" - /// }, - /// "state_abbrev": { - /// "description": "A short version of the state name, usually 2 or 3 - /// character long.", - /// "examples": [ - /// "VAN" - /// ], - /// "type": "string" + /// "errors": { + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/APIError" + /// } /// } /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct CityPost { - pub country: Country, - ///Geographic coordinate that specifies the north-south position of a - /// point on the surface of the Earth. - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub latitude: ::std::option::Option, - ///Geographic coordinate that specifies the east–west position of a - /// point on the surface of the Earth. - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub longitude: ::std::option::Option, - ///City name - pub name: ::std::string::String, - ///Speed limit in kilometer per hour (km/h). - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub speed_limit: ::std::option::Option, - ///State name - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub state: ::std::option::Option<::std::string::String>, - ///A short version of the state name, usually 2 or 3 character long. - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub state_abbrev: ::std::option::Option<::std::string::String>, + pub struct GetCitiesSubmissionsResponse { + pub errors: ::std::vec::Vec, } - impl From<&CityPost> for CityPost { - fn from(value: &CityPost) -> Self { + impl ::std::convert::From<&GetCitiesSubmissionsResponse> for GetCitiesSubmissionsResponse { + fn from(value: &GetCitiesSubmissionsResponse) -> Self { value.clone() } } - impl CityPost { - pub fn builder() -> builder::CityPost { + impl GetCitiesSubmissionsResponse { + pub fn builder() -> builder::GetCitiesSubmissionsResponse { Default::default() } } - ///CoreServices + ///Error objects MUST be returned as an array keyed by errors in the top + /// level of a JSON:API document. /// ///
JSON schema /// /// ```json ///{ + /// "description": "Error objects MUST be returned as an array keyed by + /// errors in the top level of a\nJSON:API document.", /// "type": "object", + /// "required": [ + /// "errors" + /// ], /// "properties": { - /// "dentists": { - /// "description": "BNA category subscore for access to dentists", - /// "examples": [ - /// 68.69 - /// ], - /// "type": "number" - /// }, - /// "doctors": { - /// "description": "BNA category subscore for access to doctors", - /// "examples": [ - /// 73.51 - /// ], - /// "type": "number" - /// }, - /// "grocery": { - /// "description": "BNA category subscore for access to grocery - /// stores", - /// "examples": [ - /// 83.02 - /// ], - /// "type": "number" - /// }, - /// "hospitals": { - /// "description": "BNA category subscore for access to hospitals", - /// "examples": [ - /// 82.43 - /// ], - /// "type": "number" - /// }, - /// "pharmacies": { - /// "description": "BNA category subscore for access to pharmacies", - /// "examples": [ - /// 76.62 - /// ], - /// "type": "number" - /// }, - /// "score": { - /// "description": "BNA total score", - /// "examples": [ - /// 77.0 - /// ], - /// "type": "number" - /// }, - /// "social_services": { - /// "description": "BNA category subscore for access to social - /// services", - /// "examples": [ - /// 77.82 - /// ], - /// "type": "number" + /// "errors": { + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/APIError" + /// } /// } /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct CoreServices { - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub dentists: ::std::option::Option, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub doctors: ::std::option::Option, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub grocery: ::std::option::Option, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub hospitals: ::std::option::Option, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub pharmacies: ::std::option::Option, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub score: ::std::option::Option, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub social_services: ::std::option::Option, + pub struct GetCityCensusesResponse { + pub errors: ::std::vec::Vec, } - impl From<&CoreServices> for CoreServices { - fn from(value: &CoreServices) -> Self { + impl ::std::convert::From<&GetCityCensusesResponse> for GetCityCensusesResponse { + fn from(value: &GetCityCensusesResponse) -> Self { value.clone() } } - impl CoreServices { - pub fn builder() -> builder::CoreServices { + impl GetCityCensusesResponse { + pub fn builder() -> builder::GetCityCensusesResponse { Default::default() } } - ///Country + ///Error objects MUST be returned as an array keyed by errors in the top + /// level of a JSON:API document. /// ///
JSON schema /// /// ```json ///{ - /// "type": "string", - /// "enum": [ - /// "Australia", - /// "Belgium", - /// "Brazil", - /// "Canada", - /// "Chile", - /// "Colombia", - /// "Croatia", - /// "Cuba", - /// "England", - /// "France", - /// "Germany", - /// "Greece", - /// "Guatemala", - /// "Iran", - /// "Iraq", - /// "Ireland", - /// "Italy", - /// "Mexico", - /// "Netherlands", - /// "New Zealand", - /// "Northern Ireland", - /// "Portugal", - /// "Scotland", - /// "Spain", - /// "United States", - /// "Vietnam", - /// "Wales" - /// ] + /// "description": "Error objects MUST be returned as an array keyed by + /// errors in the top level of a\nJSON:API document.", + /// "type": "object", + /// "required": [ + /// "errors" + /// ], + /// "properties": { + /// "errors": { + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/APIError" + /// } + /// } + /// } ///} /// ``` ///
- #[derive( - :: serde :: Deserialize, - :: serde :: Serialize, - Clone, - Copy, - Debug, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - )] - pub enum Country { - Australia, - Belgium, - Brazil, - Canada, - Chile, - Colombia, - Croatia, - Cuba, - England, - France, - Germany, - Greece, - Guatemala, - Iran, - Iraq, - Ireland, - Italy, - Mexico, - Netherlands, - #[serde(rename = "New Zealand")] - NewZealand, - #[serde(rename = "Northern Ireland")] - NorthernIreland, - Portugal, - Scotland, - Spain, - #[serde(rename = "United States")] - UnitedStates, - Vietnam, - Wales, + #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] + pub struct GetCityRatingsResponse { + pub errors: ::std::vec::Vec, } - impl From<&Country> for Country { - fn from(value: &Country) -> Self { + impl ::std::convert::From<&GetCityRatingsResponse> for GetCityRatingsResponse { + fn from(value: &GetCityRatingsResponse) -> Self { value.clone() } } - impl ::std::fmt::Display for Country { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - match *self { - Self::Australia => write!(f, "Australia"), - Self::Belgium => write!(f, "Belgium"), - Self::Brazil => write!(f, "Brazil"), - Self::Canada => write!(f, "Canada"), - Self::Chile => write!(f, "Chile"), - Self::Colombia => write!(f, "Colombia"), - Self::Croatia => write!(f, "Croatia"), - Self::Cuba => write!(f, "Cuba"), - Self::England => write!(f, "England"), - Self::France => write!(f, "France"), - Self::Germany => write!(f, "Germany"), - Self::Greece => write!(f, "Greece"), - Self::Guatemala => write!(f, "Guatemala"), - Self::Iran => write!(f, "Iran"), - Self::Iraq => write!(f, "Iraq"), - Self::Ireland => write!(f, "Ireland"), - Self::Italy => write!(f, "Italy"), - Self::Mexico => write!(f, "Mexico"), - Self::Netherlands => write!(f, "Netherlands"), - Self::NewZealand => write!(f, "New Zealand"), - Self::NorthernIreland => write!(f, "Northern Ireland"), - Self::Portugal => write!(f, "Portugal"), - Self::Scotland => write!(f, "Scotland"), - Self::Spain => write!(f, "Spain"), - Self::UnitedStates => write!(f, "United States"), - Self::Vietnam => write!(f, "Vietnam"), - Self::Wales => write!(f, "Wales"), - } - } - } - - impl std::str::FromStr for Country { - type Err = self::error::ConversionError; - fn from_str(value: &str) -> ::std::result::Result { - match value { - "Australia" => Ok(Self::Australia), - "Belgium" => Ok(Self::Belgium), - "Brazil" => Ok(Self::Brazil), - "Canada" => Ok(Self::Canada), - "Chile" => Ok(Self::Chile), - "Colombia" => Ok(Self::Colombia), - "Croatia" => Ok(Self::Croatia), - "Cuba" => Ok(Self::Cuba), - "England" => Ok(Self::England), - "France" => Ok(Self::France), - "Germany" => Ok(Self::Germany), - "Greece" => Ok(Self::Greece), - "Guatemala" => Ok(Self::Guatemala), - "Iran" => Ok(Self::Iran), - "Iraq" => Ok(Self::Iraq), - "Ireland" => Ok(Self::Ireland), - "Italy" => Ok(Self::Italy), - "Mexico" => Ok(Self::Mexico), - "Netherlands" => Ok(Self::Netherlands), - "New Zealand" => Ok(Self::NewZealand), - "Northern Ireland" => Ok(Self::NorthernIreland), - "Portugal" => Ok(Self::Portugal), - "Scotland" => Ok(Self::Scotland), - "Spain" => Ok(Self::Spain), - "United States" => Ok(Self::UnitedStates), - "Vietnam" => Ok(Self::Vietnam), - "Wales" => Ok(Self::Wales), - _ => Err("invalid value".into()), - } + impl GetCityRatingsResponse { + pub fn builder() -> builder::GetCityRatingsResponse { + Default::default() } } - impl std::convert::TryFrom<&str> for Country { - type Error = self::error::ConversionError; - fn try_from(value: &str) -> ::std::result::Result { - value.parse() - } + ///Error objects MUST be returned as an array keyed by errors in the top + /// level of a JSON:API document. + /// + ///
JSON schema + /// + /// ```json + ///{ + /// "description": "Error objects MUST be returned as an array keyed by + /// errors in the top level of a\nJSON:API document.", + /// "type": "object", + /// "required": [ + /// "errors" + /// ], + /// "properties": { + /// "errors": { + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/APIError" + /// } + /// } + /// } + ///} + /// ``` + ///
+ #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] + pub struct GetCityResponse { + pub errors: ::std::vec::Vec, } - impl std::convert::TryFrom<&::std::string::String> for Country { - type Error = self::error::ConversionError; - fn try_from( - value: &::std::string::String, - ) -> ::std::result::Result { - value.parse() + impl ::std::convert::From<&GetCityResponse> for GetCityResponse { + fn from(value: &GetCityResponse) -> Self { + value.clone() } } - impl std::convert::TryFrom<::std::string::String> for Country { - type Error = self::error::ConversionError; - fn try_from( - value: ::std::string::String, - ) -> ::std::result::Result { - value.parse() + impl GetCityResponse { + pub fn builder() -> builder::GetCityResponse { + Default::default() } } - ///Enqueue + ///Error objects MUST be returned as an array keyed by errors in the top + /// level of a JSON:API document. /// ///
JSON schema /// /// ```json ///{ + /// "description": "Error objects MUST be returned as an array keyed by + /// errors in the top level of a\nJSON:API document.", /// "type": "object", + /// "required": [ + /// "errors" + /// ], /// "properties": { - /// "city": { - /// "description": "City name", - /// "examples": [ - /// "Antwerp" - /// ], - /// "type": "string" - /// }, - /// "country": { - /// "$ref": "#/components/schemas/country" - /// }, - /// "fips_code": { - /// "description": "Numerical city identifier given by the U.S. census, - /// or 0 for non-US cities\n", - /// "examples": [ - /// "4805000" - /// ], - /// "type": "string" - /// }, - /// "region": { - /// "description": "Region name. A region can be a state, a province, a - /// community, or something similar depending on the country. If a country - /// does not have this concept, then the country name is used.\n", - /// "examples": [ - /// "Belgium" - /// ], - /// "type": "string" + /// "errors": { + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/APIError" + /// } /// } /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct Enqueue { - ///City name - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub city: ::std::option::Option<::std::string::String>, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub country: ::std::option::Option, - ///Numerical city identifier given by the U.S. census, or 0 for non-US - /// cities - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub fips_code: ::std::option::Option<::std::string::String>, - ///Region name. A region can be a state, a province, a community, or - /// something similar depending on the country. If a country does not - /// have this concept, then the country name is used. - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub region: ::std::option::Option<::std::string::String>, + pub struct GetPipelinesBnaResponse { + pub errors: ::std::vec::Vec, } - impl From<&Enqueue> for Enqueue { - fn from(value: &Enqueue) -> Self { + impl ::std::convert::From<&GetPipelinesBnaResponse> for GetPipelinesBnaResponse { + fn from(value: &GetPipelinesBnaResponse) -> Self { value.clone() } } - impl Enqueue { - pub fn builder() -> builder::Enqueue { + impl GetPipelinesBnaResponse { + pub fn builder() -> builder::GetPipelinesBnaResponse { Default::default() } } - ///EnqueuePost + ///Error objects MUST be returned as an array keyed by errors in the top + /// level of a JSON:API document. /// ///
JSON schema /// /// ```json ///{ + /// "description": "Error objects MUST be returned as an array keyed by + /// errors in the top level of a\nJSON:API document.", /// "type": "object", + /// "required": [ + /// "errors" + /// ], /// "properties": { - /// "city": { - /// "description": "City name", - /// "examples": [ - /// "Antwerp" - /// ], - /// "type": "string" - /// }, - /// "country": { - /// "$ref": "#/components/schemas/country" - /// }, - /// "fips_code": { - /// "description": "Numerical city identifier given by the U.S. census, - /// or 0 for non-US cities\n", - /// "examples": [ - /// "4805000" - /// ], - /// "type": "string" - /// }, - /// "region": { - /// "description": "Region name. A region can be a state, a province, a - /// community, or something similar depending on the country. If a country - /// does not have this concept, then the country name is used.\n", - /// "examples": [ - /// "Belgium" - /// ], - /// "type": "string" + /// "errors": { + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/APIError" + /// } /// } /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct EnqueuePost { - ///City name - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub city: ::std::option::Option<::std::string::String>, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub country: ::std::option::Option, - ///Numerical city identifier given by the U.S. census, or 0 for non-US - /// cities - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub fips_code: ::std::option::Option<::std::string::String>, - ///Region name. A region can be a state, a province, a community, or - /// something similar depending on the country. If a country does not - /// have this concept, then the country name is used. - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub region: ::std::option::Option<::std::string::String>, + pub struct GetPipelinesBnasResponse { + pub errors: ::std::vec::Vec, } - impl From<&EnqueuePost> for EnqueuePost { - fn from(value: &EnqueuePost) -> Self { + impl ::std::convert::From<&GetPipelinesBnasResponse> for GetPipelinesBnasResponse { + fn from(value: &GetPipelinesBnasResponse) -> Self { value.clone() } } - impl EnqueuePost { - pub fn builder() -> builder::EnqueuePost { + impl GetPipelinesBnasResponse { + pub fn builder() -> builder::GetPipelinesBnasResponse { Default::default() } } - ///API Error object as described in + ///Error objects MUST be returned as an array keyed by errors in the top + /// level of a JSON:API document. /// ///
JSON schema /// /// ```json ///{ - /// "description": "API Error object as described in \n", + /// "description": "Error objects MUST be returned as an array keyed by + /// errors in the top level of a\nJSON:API document.", /// "type": "object", + /// "required": [ + /// "errors" + /// ], /// "properties": { - /// "details": { - /// "description": "detailed error message", - /// "examples": [ - /// "the entry was not found" - /// ], - /// "type": "string" - /// }, - /// "id": { - /// "$ref": "#/components/schemas/api_gateway_id" - /// }, - /// "source": { - /// "$ref": "#/components/schemas/source" - /// }, - /// "status": { - /// "description": "HTTP status associated with the error", - /// "examples": [ - /// 404 - /// ], - /// "type": "integer", - /// "minimum": 400.0 - /// }, - /// "title": { - /// "description": "Error title", - /// "examples": [ - /// "Item Not Found" - /// ], - /// "type": "string" + /// "errors": { + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/APIError" + /// } /// } /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct Error { - ///detailed error message - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub details: ::std::option::Option<::std::string::String>, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub id: ::std::option::Option, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub source: ::std::option::Option, - ///HTTP status associated with the error - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub status: ::std::option::Option, - ///Error title - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub title: ::std::option::Option<::std::string::String>, + pub struct GetPriceFargateResponse { + pub errors: ::std::vec::Vec, } - impl From<&Error> for Error { - fn from(value: &Error) -> Self { + impl ::std::convert::From<&GetPriceFargateResponse> for GetPriceFargateResponse { + fn from(value: &GetPriceFargateResponse) -> Self { value.clone() } } - impl Error { - pub fn builder() -> builder::Error { + impl GetPriceFargateResponse { + pub fn builder() -> builder::GetPriceFargateResponse { Default::default() } } - ///A collection of errors + ///Error objects MUST be returned as an array keyed by errors in the top + /// level of a JSON:API document. /// ///
JSON schema /// /// ```json ///{ - /// "description": "A collection of errors", - /// "type": "array", - /// "items": { - /// "$ref": "#/components/schemas/error" + /// "description": "Error objects MUST be returned as an array keyed by + /// errors in the top level of a\nJSON:API document.", + /// "type": "object", + /// "required": [ + /// "errors" + /// ], + /// "properties": { + /// "errors": { + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/APIError" + /// } + /// } /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct Errors(pub ::std::vec::Vec); - impl ::std::ops::Deref for Errors { - type Target = ::std::vec::Vec; - fn deref(&self) -> &::std::vec::Vec { - &self.0 + pub struct GetRatingResponse { + pub errors: ::std::vec::Vec, + } + + impl ::std::convert::From<&GetRatingResponse> for GetRatingResponse { + fn from(value: &GetRatingResponse) -> Self { + value.clone() } } - impl From for ::std::vec::Vec { - fn from(value: Errors) -> Self { - value.0 + impl GetRatingResponse { + pub fn builder() -> builder::GetRatingResponse { + Default::default() } } - impl From<&Errors> for Errors { - fn from(value: &Errors) -> Self { + ///Error objects MUST be returned as an array keyed by errors in the top + /// level of a JSON:API document. + /// + ///
JSON schema + /// + /// ```json + ///{ + /// "description": "Error objects MUST be returned as an array keyed by + /// errors in the top level of a\nJSON:API document.", + /// "type": "object", + /// "required": [ + /// "errors" + /// ], + /// "properties": { + /// "errors": { + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/APIError" + /// } + /// } + /// } + ///} + /// ``` + ///
+ #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] + pub struct GetRatingsCityResponse { + pub errors: ::std::vec::Vec, + } + + impl ::std::convert::From<&GetRatingsCityResponse> for GetRatingsCityResponse { + fn from(value: &GetRatingsCityResponse) -> Self { value.clone() } } - impl From<::std::vec::Vec> for Errors { - fn from(value: ::std::vec::Vec) -> Self { - Self(value) + impl GetRatingsCityResponse { + pub fn builder() -> builder::GetRatingsCityResponse { + Default::default() } } - ///FargatePrice + ///Infrastructure /// ///
JSON schema /// @@ -2323,201 +2166,318 @@ pub mod types { ///{ /// "type": "object", /// "properties": { - /// "created_at": { - /// "description": "Date and time", - /// "type": "string", - /// "format": "date-time" - /// }, - /// "fargate_price_id": { - /// "description": "Identifier of the Fargate Price rate used to - /// compute the cost of the pipeline run.\n", + /// "high_stress_miles": { + /// "description": "Total miles of high-stress streets in the measured + /// area.", /// "examples": [ - /// 1 + /// 253 + /// ], + /// "type": [ + /// "number", + /// "null" /// ], - /// "type": "number" + /// "format": "double" /// }, - /// "per_second": { - /// "description": "Cost to run Fargate for 1 second", + /// "low_stress_miles": { + /// "description": "Total miles of low-stress streets and paths in the + /// measured area.", /// "examples": [ - /// "0.0023" + /// 127 /// ], - /// "type": "string", - /// "format": "decimal" + /// "type": [ + /// "number", + /// "null" + /// ], + /// "format": "double" /// } /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct FargatePrice { - ///Date and time - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub created_at: ::std::option::Option>, + pub struct Infrastructure { + ///Total miles of high-stress streets in the measured area. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub fargate_price_id: ::std::option::Option, - ///Cost to run Fargate for 1 second + pub high_stress_miles: ::std::option::Option, + ///Total miles of low-stress streets and paths in the measured area. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub per_second: ::std::option::Option<::std::string::String>, + pub low_stress_miles: ::std::option::Option, } - impl From<&FargatePrice> for FargatePrice { - fn from(value: &FargatePrice) -> Self { + impl ::std::convert::From<&Infrastructure> for Infrastructure { + fn from(value: &Infrastructure) -> Self { value.clone() } } - impl FargatePrice { - pub fn builder() -> builder::FargatePrice { + impl ::std::default::Default for Infrastructure { + fn default() -> Self { + Self { + high_stress_miles: Default::default(), + low_stress_miles: Default::default(), + } + } + } + + impl Infrastructure { + pub fn builder() -> builder::Infrastructure { Default::default() } } - ///GetCityCensusResponseItem + ///Opportunity /// ///
JSON schema /// /// ```json ///{ - /// "anyOf": [ - /// { - /// "$ref": "#/components/schemas/city" + /// "type": "object", + /// "properties": { + /// "employment": { + /// "description": "BNA category subscore for access to job location + /// areas.", + /// "type": [ + /// "number", + /// "null" + /// ], + /// "format": "double", + /// "maximum": 100.0, + /// "minimum": 0.0 /// }, - /// { - /// "$ref": "#/components/schemas/census" + /// "higher_education": { + /// "description": "BNA category subscore for access to universities + /// and colleges.", + /// "type": [ + /// "number", + /// "null" + /// ], + /// "format": "double", + /// "maximum": 100.0, + /// "minimum": 0.0 + /// }, + /// "k12_education": { + /// "description": "BNA category subscore for access to k12 schools", + /// "type": [ + /// "number", + /// "null" + /// ], + /// "format": "double", + /// "maximum": 100.0, + /// "minimum": 0.0 + /// }, + /// "score": { + /// "description": "BNA category score for access to education and + /// jobs.", + /// "type": [ + /// "number", + /// "null" + /// ], + /// "format": "double", + /// "maximum": 100.0, + /// "minimum": 0.0 + /// }, + /// "technical_vocational_college": { + /// "description": "BNA category subscore for access to technical and + /// vocational colleges.", + /// "type": [ + /// "number", + /// "null" + /// ], + /// "format": "double", + /// "maximum": 100.0, + /// "minimum": 0.0 /// } - /// ] + /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - #[serde(untagged)] - pub enum GetCityCensusResponseItem { - City(City), - Census(Census), + pub struct Opportunity { + ///BNA category subscore for access to job location areas. + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub employment: ::std::option::Option, + ///BNA category subscore for access to universities and colleges. + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub higher_education: ::std::option::Option, + ///BNA category subscore for access to k12 schools + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub k12_education: ::std::option::Option, + ///BNA category score for access to education and jobs. + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub score: ::std::option::Option, + ///BNA category subscore for access to technical and vocational + /// colleges. + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub technical_vocational_college: ::std::option::Option, } - impl From<&GetCityCensusResponseItem> for GetCityCensusResponseItem { - fn from(value: &GetCityCensusResponseItem) -> Self { + impl ::std::convert::From<&Opportunity> for Opportunity { + fn from(value: &Opportunity) -> Self { value.clone() } } - impl From for GetCityCensusResponseItem { - fn from(value: City) -> Self { - Self::City(value) + impl ::std::default::Default for Opportunity { + fn default() -> Self { + Self { + employment: Default::default(), + higher_education: Default::default(), + k12_education: Default::default(), + score: Default::default(), + technical_vocational_college: Default::default(), + } } } - impl From for GetCityCensusResponseItem { - fn from(value: Census) -> Self { - Self::Census(value) + impl Opportunity { + pub fn builder() -> builder::Opportunity { + Default::default() } } - ///GetCityRatingsResponseItem + ///Error objects MUST be returned as an array keyed by errors in the top + /// level of a JSON:API document. /// ///
JSON schema /// /// ```json ///{ - /// "anyOf": [ - /// { - /// "$ref": "#/components/schemas/city" - /// }, - /// { - /// "$ref": "#/components/schemas/bna_summary" + /// "description": "Error objects MUST be returned as an array keyed by + /// errors in the top level of a\nJSON:API document.", + /// "type": "object", + /// "required": [ + /// "errors" + /// ], + /// "properties": { + /// "errors": { + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/APIError" + /// } /// } - /// ] + /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - #[serde(untagged)] - pub enum GetCityRatingsResponseItem { - City(City), - BnaSummary(BnaSummary), + pub struct PatchCitiesSubmissionResponse { + pub errors: ::std::vec::Vec, } - impl From<&GetCityRatingsResponseItem> for GetCityRatingsResponseItem { - fn from(value: &GetCityRatingsResponseItem) -> Self { + impl ::std::convert::From<&PatchCitiesSubmissionResponse> for PatchCitiesSubmissionResponse { + fn from(value: &PatchCitiesSubmissionResponse) -> Self { value.clone() } } - impl From for GetCityRatingsResponseItem { - fn from(value: City) -> Self { - Self::City(value) + impl PatchCitiesSubmissionResponse { + pub fn builder() -> builder::PatchCitiesSubmissionResponse { + Default::default() + } + } + + ///Error objects MUST be returned as an array keyed by errors in the top + /// level of a JSON:API document. + /// + ///
JSON schema + /// + /// ```json + ///{ + /// "description": "Error objects MUST be returned as an array keyed by + /// errors in the top level of a\nJSON:API document.", + /// "type": "object", + /// "required": [ + /// "errors" + /// ], + /// "properties": { + /// "errors": { + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/APIError" + /// } + /// } + /// } + ///} + /// ``` + ///
+ #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] + pub struct PatchPipelinesBnaResponse { + pub errors: ::std::vec::Vec, + } + + impl ::std::convert::From<&PatchPipelinesBnaResponse> for PatchPipelinesBnaResponse { + fn from(value: &PatchPipelinesBnaResponse) -> Self { + value.clone() } } - impl From for GetCityRatingsResponseItem { - fn from(value: BnaSummary) -> Self { - Self::BnaSummary(value) + impl PatchPipelinesBnaResponse { + pub fn builder() -> builder::PatchPipelinesBnaResponse { + Default::default() } } - ///GetRatingCityResponseItem + ///People /// ///
JSON schema /// /// ```json ///{ - /// "anyOf": [ - /// { - /// "$ref": "#/components/schemas/bna_summary_with_city" - /// }, - /// { - /// "$ref": "#/components/schemas/city" + /// "type": "object", + /// "properties": { + /// "people": { + /// "description": "BNA category score for access to residential + /// areas.", + /// "type": [ + /// "number", + /// "null" + /// ], + /// "format": "double", + /// "maximum": 100.0, + /// "minimum": 0.0 /// } - /// ] + /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - #[serde(untagged)] - pub enum GetRatingCityResponseItem { - BnaSummaryWithCity(BnaSummaryWithCity), - City(City), + pub struct People { + ///BNA category score for access to residential areas. + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub people: ::std::option::Option, } - impl From<&GetRatingCityResponseItem> for GetRatingCityResponseItem { - fn from(value: &GetRatingCityResponseItem) -> Self { + impl ::std::convert::From<&People> for People { + fn from(value: &People) -> Self { value.clone() } } - impl From for GetRatingCityResponseItem { - fn from(value: BnaSummaryWithCity) -> Self { - Self::BnaSummaryWithCity(value) + impl ::std::default::Default for People { + fn default() -> Self { + Self { + people: Default::default(), + } } } - impl From for GetRatingCityResponseItem { - fn from(value: City) -> Self { - Self::City(value) + impl People { + pub fn builder() -> builder::People { + Default::default() } } - ///GetRatingComponent + ///PipelineStatus /// ///
JSON schema /// /// ```json ///{ - /// "examples": [ - /// "All" - /// ], /// "type": "string", /// "enum": [ - /// "All", - /// "CoreServices", - /// "Infratructure", - /// "Opportunity", - /// "People", - /// "Recreation", - /// "Retail", - /// "Summary", - /// "Transit" + /// "Completed", + /// "Pending", + /// "Processing" /// ] ///} /// ``` @@ -2534,66 +2494,48 @@ pub mod types { PartialEq, PartialOrd, )] - pub enum GetRatingComponent { - All, - CoreServices, - Infratructure, - Opportunity, - People, - Recreation, - Retail, - Summary, - Transit, - } - - impl From<&GetRatingComponent> for GetRatingComponent { - fn from(value: &GetRatingComponent) -> Self { - value.clone() - } - } - - impl ::std::fmt::Display for GetRatingComponent { + pub enum PipelineStatus { + Completed, + Pending, + Processing, + } + + impl ::std::convert::From<&PipelineStatus> for PipelineStatus { + fn from(value: &PipelineStatus) -> Self { + value.clone() + } + } + + impl ::std::fmt::Display for PipelineStatus { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match *self { - Self::All => write!(f, "All"), - Self::CoreServices => write!(f, "CoreServices"), - Self::Infratructure => write!(f, "Infratructure"), - Self::Opportunity => write!(f, "Opportunity"), - Self::People => write!(f, "People"), - Self::Recreation => write!(f, "Recreation"), - Self::Retail => write!(f, "Retail"), - Self::Summary => write!(f, "Summary"), - Self::Transit => write!(f, "Transit"), + Self::Completed => write!(f, "Completed"), + Self::Pending => write!(f, "Pending"), + Self::Processing => write!(f, "Processing"), } } } - impl std::str::FromStr for GetRatingComponent { + impl ::std::str::FromStr for PipelineStatus { type Err = self::error::ConversionError; fn from_str(value: &str) -> ::std::result::Result { match value { - "All" => Ok(Self::All), - "CoreServices" => Ok(Self::CoreServices), - "Infratructure" => Ok(Self::Infratructure), - "Opportunity" => Ok(Self::Opportunity), - "People" => Ok(Self::People), - "Recreation" => Ok(Self::Recreation), - "Retail" => Ok(Self::Retail), - "Summary" => Ok(Self::Summary), - "Transit" => Ok(Self::Transit), + "Completed" => Ok(Self::Completed), + "Pending" => Ok(Self::Pending), + "Processing" => Ok(Self::Processing), _ => Err("invalid value".into()), } } } - impl std::convert::TryFrom<&str> for GetRatingComponent { + impl ::std::convert::TryFrom<&str> for PipelineStatus { type Error = self::error::ConversionError; fn try_from(value: &str) -> ::std::result::Result { value.parse() } } - impl std::convert::TryFrom<&::std::string::String> for GetRatingComponent { + impl ::std::convert::TryFrom<&::std::string::String> for PipelineStatus { type Error = self::error::ConversionError; fn try_from( value: &::std::string::String, @@ -2602,7 +2544,7 @@ pub mod types { } } - impl std::convert::TryFrom<::std::string::String> for GetRatingComponent { + impl ::std::convert::TryFrom<::std::string::String> for PipelineStatus { type Error = self::error::ConversionError; fn try_from( value: ::std::string::String, @@ -2611,788 +2553,710 @@ pub mod types { } } - ///The name of a single request header which caused the error + ///Error objects MUST be returned as an array keyed by errors in the top + /// level of a JSON:API document. /// ///
JSON schema /// /// ```json ///{ - /// "description": "The name of a single request header which caused the - /// error", - /// "examples": [ - /// "Authorization" + /// "description": "Error objects MUST be returned as an array keyed by + /// errors in the top level of a\nJSON:API document.", + /// "type": "object", + /// "required": [ + /// "errors" /// ], - /// "type": "string" + /// "properties": { + /// "errors": { + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/APIError" + /// } + /// } + /// } ///} /// ``` ///
- #[derive( - :: serde :: Deserialize, - :: serde :: Serialize, - Clone, - Debug, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - )] - pub struct Header(pub ::std::string::String); - impl ::std::ops::Deref for Header { - type Target = ::std::string::String; - fn deref(&self) -> &::std::string::String { - &self.0 - } - } - - impl From
for ::std::string::String { - fn from(value: Header) -> Self { - value.0 - } + #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] + pub struct PostCitiesSubmissionResponse { + pub errors: ::std::vec::Vec, } - impl From<&Header> for Header { - fn from(value: &Header) -> Self { + impl ::std::convert::From<&PostCitiesSubmissionResponse> for PostCitiesSubmissionResponse { + fn from(value: &PostCitiesSubmissionResponse) -> Self { value.clone() } } - impl From<::std::string::String> for Header { - fn from(value: ::std::string::String) -> Self { - Self(value) - } - } - - impl ::std::str::FromStr for Header { - type Err = ::std::convert::Infallible; - fn from_str(value: &str) -> ::std::result::Result { - Ok(Self(value.to_string())) - } - } - - impl ::std::fmt::Display for Header { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - self.0.fmt(f) + impl PostCitiesSubmissionResponse { + pub fn builder() -> builder::PostCitiesSubmissionResponse { + Default::default() } } - ///Infrastructure + ///Error objects MUST be returned as an array keyed by errors in the top + /// level of a JSON:API document. /// ///
JSON schema /// /// ```json ///{ + /// "description": "Error objects MUST be returned as an array keyed by + /// errors in the top level of a\nJSON:API document.", /// "type": "object", + /// "required": [ + /// "errors" + /// ], /// "properties": { - /// "high_stress_miles": { - /// "description": "Total miles of high-stress streets in the measured - /// area", - /// "examples": [ - /// 437.8 - /// ], - /// "type": "number" - /// }, - /// "low_stress_miles": { - /// "description": "Total miles of low-stress streets and paths in the - /// measured area", - /// "examples": [ - /// 1862.2 - /// ], - /// "type": "number" + /// "errors": { + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/APIError" + /// } /// } /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct Infrastructure { - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub high_stress_miles: ::std::option::Option, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub low_stress_miles: ::std::option::Option, + pub struct PostCityCensusResponse { + pub errors: ::std::vec::Vec, } - impl From<&Infrastructure> for Infrastructure { - fn from(value: &Infrastructure) -> Self { + impl ::std::convert::From<&PostCityCensusResponse> for PostCityCensusResponse { + fn from(value: &PostCityCensusResponse) -> Self { value.clone() } } - impl Infrastructure { - pub fn builder() -> builder::Infrastructure { + impl PostCityCensusResponse { + pub fn builder() -> builder::PostCityCensusResponse { Default::default() } } - ///Opportunity + ///Error objects MUST be returned as an array keyed by errors in the top + /// level of a JSON:API document. /// ///
JSON schema /// /// ```json ///{ + /// "description": "Error objects MUST be returned as an array keyed by + /// errors in the top level of a\nJSON:API document.", /// "type": "object", + /// "required": [ + /// "errors" + /// ], /// "properties": { - /// "employment": { - /// "description": "BNA category subscore for access to job location - /// areas", - /// "examples": [ - /// 0.0 - /// ], - /// "type": "number" - /// }, - /// "higher_education": { - /// "description": "BNA category subscore for access to universities - /// and colleges", - /// "examples": [ - /// 84.76 - /// ], - /// "type": "number" - /// }, - /// "k12_education": { - /// "description": "BNA category subscore for access to k12 schools", - /// "examples": [ - /// 6.63 - /// ], - /// "type": "number" - /// }, - /// "score": { - /// "description": "BNA category score for access to education and - /// jobs\"\"", - /// "examples": [ - /// 79.91 - /// ], - /// "type": "number" - /// }, - /// "technical_vocational_college": { - /// "description": "BNA category subscore for access to technical and - /// vocational colleges", - /// "examples": [ - /// 81.67 - /// ], - /// "type": "number" + /// "errors": { + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/APIError" + /// } /// } /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct Opportunity { - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub employment: ::std::option::Option, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub higher_education: ::std::option::Option, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub k12_education: ::std::option::Option, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub score: ::std::option::Option, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub technical_vocational_college: ::std::option::Option, + pub struct PostCityResponse { + pub errors: ::std::vec::Vec, } - impl From<&Opportunity> for Opportunity { - fn from(value: &Opportunity) -> Self { + impl ::std::convert::From<&PostCityResponse> for PostCityResponse { + fn from(value: &PostCityResponse) -> Self { value.clone() } } - impl Opportunity { - pub fn builder() -> builder::Opportunity { + impl PostCityResponse { + pub fn builder() -> builder::PostCityResponse { Default::default() } } - ///The URI query parameter caused the error + ///Error objects MUST be returned as an array keyed by errors in the top + /// level of a JSON:API document. /// ///
JSON schema /// /// ```json ///{ - /// "description": "The URI query parameter caused the error", - /// "examples": [ - /// "/bnas/analysis/e6aade5a-b343-120b-dbaa-bd916cd99221?" + /// "description": "Error objects MUST be returned as an array keyed by + /// errors in the top level of a\nJSON:API document.", + /// "type": "object", + /// "required": [ + /// "errors" /// ], - /// "type": "string" + /// "properties": { + /// "errors": { + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/APIError" + /// } + /// } + /// } ///} /// ``` ///
- #[derive( - :: serde :: Deserialize, - :: serde :: Serialize, - Clone, - Debug, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - )] - pub struct Parameter(pub ::std::string::String); - impl ::std::ops::Deref for Parameter { - type Target = ::std::string::String; - fn deref(&self) -> &::std::string::String { - &self.0 - } - } - - impl From for ::std::string::String { - fn from(value: Parameter) -> Self { - value.0 - } + #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] + pub struct PostPipelinesBnaResponse { + pub errors: ::std::vec::Vec, } - impl From<&Parameter> for Parameter { - fn from(value: &Parameter) -> Self { + impl ::std::convert::From<&PostPipelinesBnaResponse> for PostPipelinesBnaResponse { + fn from(value: &PostPipelinesBnaResponse) -> Self { value.clone() } } - impl From<::std::string::String> for Parameter { - fn from(value: ::std::string::String) -> Self { - Self(value) - } - } - - impl ::std::str::FromStr for Parameter { - type Err = ::std::convert::Infallible; - fn from_str(value: &str) -> ::std::result::Result { - Ok(Self(value.to_string())) - } - } - - impl ::std::fmt::Display for Parameter { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - self.0.fmt(f) + impl PostPipelinesBnaResponse { + pub fn builder() -> builder::PostPipelinesBnaResponse { + Default::default() } } - ///PatchCityCensusResponseItem + ///Error objects MUST be returned as an array keyed by errors in the top + /// level of a JSON:API document. /// ///
JSON schema /// /// ```json ///{ - /// "anyOf": [ - /// { - /// "$ref": "#/components/schemas/city" - /// }, - /// { - /// "$ref": "#/components/schemas/census" + /// "description": "Error objects MUST be returned as an array keyed by + /// errors in the top level of a\nJSON:API document.", + /// "type": "object", + /// "required": [ + /// "errors" + /// ], + /// "properties": { + /// "errors": { + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/APIError" + /// } /// } - /// ] + /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - #[serde(untagged)] - pub enum PatchCityCensusResponseItem { - City(City), - Census(Census), + pub struct PostRatingResponse { + pub errors: ::std::vec::Vec, } - impl From<&PatchCityCensusResponseItem> for PatchCityCensusResponseItem { - fn from(value: &PatchCityCensusResponseItem) -> Self { + impl ::std::convert::From<&PostRatingResponse> for PostRatingResponse { + fn from(value: &PostRatingResponse) -> Self { value.clone() } } - impl From for PatchCityCensusResponseItem { - fn from(value: City) -> Self { - Self::City(value) - } - } - - impl From for PatchCityCensusResponseItem { - fn from(value: Census) -> Self { - Self::Census(value) + impl PostRatingResponse { + pub fn builder() -> builder::PostRatingResponse { + Default::default() } } - ///People + ///Rating /// ///
JSON schema /// /// ```json ///{ /// "type": "object", + /// "required": [ + /// "city_id", + /// "core_services", + /// "id", + /// "infrastructure", + /// "opportunity", + /// "people", + /// "recreation", + /// "retail", + /// "score", + /// "transit", + /// "version" + /// ], /// "properties": { + /// "city_id": { + /// "description": "City identifier", + /// "type": "string", + /// "format": "uuid" + /// }, + /// "core_services": { + /// "$ref": "#/components/schemas/CoreServices" + /// }, + /// "id": { + /// "description": "Rating identifier", + /// "type": "string", + /// "format": "uuid" + /// }, + /// "infrastructure": { + /// "$ref": "#/components/schemas/Infrastructure" + /// }, + /// "opportunity": { + /// "$ref": "#/components/schemas/Opportunity" + /// }, + /// "people": { + /// "$ref": "#/components/schemas/People" + /// }, + /// "recreation": { + /// "$ref": "#/components/schemas/Recreation" + /// }, + /// "retail": { + /// "$ref": "#/components/schemas/Retail" + /// }, /// "score": { - /// "type": "number" + /// "description": "Total rating score", + /// "type": "number", + /// "format": "double", + /// "maximum": 100.0, + /// "minimum": 0.0 + /// }, + /// "transit": { + /// "$ref": "#/components/schemas/Transit" + /// }, + /// "version": { + /// "description": "Rating version\nThe format follows the [calver](https://calver.org) specification with\nthe YY.0M[.Minor] scheme.", + /// "type": "string" /// } /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct People { - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub score: ::std::option::Option, + pub struct Rating { + ///City identifier + pub city_id: uuid::Uuid, + pub core_services: CoreServices, + ///Rating identifier + pub id: uuid::Uuid, + pub infrastructure: Infrastructure, + pub opportunity: Opportunity, + pub people: People, + pub recreation: Recreation, + pub retail: Retail, + pub score: f64, + pub transit: Transit, + ///Rating version + ///The format follows the [calver](https://calver.org) specification with + ///the YY.0M[.Minor] scheme. + pub version: ::std::string::String, } - impl From<&People> for People { - fn from(value: &People) -> Self { + impl ::std::convert::From<&Rating> for Rating { + fn from(value: &Rating) -> Self { value.clone() } } - impl People { - pub fn builder() -> builder::People { + impl Rating { + pub fn builder() -> builder::Rating { Default::default() } } - ///A JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901) to the value in the request document that caused the error [e.g. "/data" for a primary data object, or "/data/attributes/title" for a specific attribute]. + ///RatingPost /// ///
JSON schema /// /// ```json ///{ - /// "description": "A JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901) to the value in the request document that caused the error [e.g. \"/data\" for a primary data object, or \"/data/attributes/title\" for a specific attribute].\n", - /// "examples": [ - /// "/data" + /// "type": "object", + /// "required": [ + /// "city_id", + /// "core_services", + /// "infrastructure", + /// "opportunity", + /// "people", + /// "recreation", + /// "retail", + /// "transit", + /// "version" /// ], - /// "type": "string" + /// "properties": { + /// "city_id": { + /// "description": "City identifier", + /// "type": "string", + /// "format": "uuid" + /// }, + /// "core_services": { + /// "$ref": "#/components/schemas/CoreServices" + /// }, + /// "infrastructure": { + /// "$ref": "#/components/schemas/Infrastructure" + /// }, + /// "opportunity": { + /// "$ref": "#/components/schemas/Opportunity" + /// }, + /// "people": { + /// "$ref": "#/components/schemas/People" + /// }, + /// "recreation": { + /// "$ref": "#/components/schemas/Recreation" + /// }, + /// "retail": { + /// "$ref": "#/components/schemas/Retail" + /// }, + /// "transit": { + /// "$ref": "#/components/schemas/Transit" + /// }, + /// "version": { + /// "description": "Rating version\nThe format follows the [calver](https://calver.org) specification with\nthe YY.0M[.Minor] scheme.", + /// "type": "string" + /// } + /// } ///} /// ``` ///
- #[derive( - :: serde :: Deserialize, - :: serde :: Serialize, - Clone, - Debug, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - )] - pub struct Pointer(pub ::std::string::String); - impl ::std::ops::Deref for Pointer { - type Target = ::std::string::String; - fn deref(&self) -> &::std::string::String { - &self.0 - } - } - - impl From for ::std::string::String { - fn from(value: Pointer) -> Self { - value.0 - } + #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] + pub struct RatingPost { + ///City identifier + pub city_id: uuid::Uuid, + pub core_services: CoreServices, + pub infrastructure: Infrastructure, + pub opportunity: Opportunity, + pub people: People, + pub recreation: Recreation, + pub retail: Retail, + pub transit: Transit, + ///Rating version + ///The format follows the [calver](https://calver.org) specification with + ///the YY.0M[.Minor] scheme. + pub version: ::std::string::String, } - impl From<&Pointer> for Pointer { - fn from(value: &Pointer) -> Self { + impl ::std::convert::From<&RatingPost> for RatingPost { + fn from(value: &RatingPost) -> Self { value.clone() } } - impl From<::std::string::String> for Pointer { - fn from(value: ::std::string::String) -> Self { - Self(value) - } - } - - impl ::std::str::FromStr for Pointer { - type Err = ::std::convert::Infallible; - fn from_str(value: &str) -> ::std::result::Result { - Ok(Self(value.to_string())) - } - } - - impl ::std::fmt::Display for Pointer { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - self.0.fmt(f) + impl RatingPost { + pub fn builder() -> builder::RatingPost { + Default::default() } } - ///Recreation + ///RatingSummary /// ///
JSON schema /// /// ```json ///{ /// "type": "object", + /// "required": [ + /// "city_id", + /// "created_at", + /// "id", + /// "score", + /// "version" + /// ], /// "properties": { - /// "community_centers": { - /// "description": "BNA category subscore for access to community - /// centers", - /// "examples": [ - /// 70.7 - /// ], - /// "type": "number" + /// "city_id": { + /// "description": "City identifier", + /// "type": "string", + /// "format": "uuid" /// }, - /// "parks": { - /// "description": "BNA category subscore for access to parks", - /// "examples": [ - /// 78.49 - /// ], - /// "type": "number" + /// "created_at": { + /// "description": "Creation date", + /// "type": "string", + /// "format": "date-time" /// }, - /// "recreation_trails": { - /// "description": "BNA category subscore for access to bikeable - /// trails", + /// "id": { + /// "description": "Analysis identifier", + /// "type": "string", + /// "format": "uuid" + /// }, + /// "score": { + /// "description": "BNA score", /// "examples": [ - /// 94.45 + /// "77.0" /// ], - /// "type": "number" + /// "type": "number", + /// "format": "double" /// }, - /// "score": { - /// "description": "BNA total score", + /// "version": { + /// "description": "Analysis version. The format follows the [calver](https://calver.org)\nspecification with the YY.0M[.Minor] scheme.", /// "examples": [ - /// 77.0 + /// "23.12" /// ], - /// "type": "number" + /// "type": "string" /// } /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct Recreation { - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub community_centers: ::std::option::Option, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub parks: ::std::option::Option, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub recreation_trails: ::std::option::Option, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub score: ::std::option::Option, + pub struct RatingSummary { + ///City identifier + pub city_id: uuid::Uuid, + ///Creation date + pub created_at: chrono::DateTime, + ///Analysis identifier + pub id: uuid::Uuid, + pub score: f64, + ///Analysis version. The format follows the [calver](https://calver.org) + ///specification with the YY.0M[.Minor] scheme. + pub version: ::std::string::String, } - impl From<&Recreation> for Recreation { - fn from(value: &Recreation) -> Self { + impl ::std::convert::From<&RatingSummary> for RatingSummary { + fn from(value: &RatingSummary) -> Self { value.clone() } } - impl Recreation { - pub fn builder() -> builder::Recreation { + impl RatingSummary { + pub fn builder() -> builder::RatingSummary { Default::default() } } - ///Retail + ///RatingWithCity /// ///
JSON schema /// /// ```json ///{ /// "type": "object", + /// "required": [ + /// "city", + /// "rating" + /// ], /// "properties": { - /// "score": { - /// "type": "number" + /// "city": { + /// "$ref": "#/components/schemas/City" + /// }, + /// "rating": { + /// "$ref": "#/components/schemas/Rating" /// } /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct Retail { - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub score: ::std::option::Option, + pub struct RatingWithCity { + pub city: City, + pub rating: Rating, } - impl From<&Retail> for Retail { - fn from(value: &Retail) -> Self { + impl ::std::convert::From<&RatingWithCity> for RatingWithCity { + fn from(value: &RatingWithCity) -> Self { value.clone() } } - impl Retail { - pub fn builder() -> builder::Retail { + impl RatingWithCity { + pub fn builder() -> builder::RatingWithCity { Default::default() } } - ///An object containing references to the primary source of the error. + ///Ratings /// ///
JSON schema /// /// ```json ///{ - /// "description": "An object containing references to the primary source - /// of the error.", - /// "examples": [ - /// { - /// "source": "Parameter - /// \"/bnas/analysis/e6aade5a-b343-120b-dbaa-bd916cd99221?\"" - /// } - /// ], - /// "type": "object", - /// "oneOf": [ - /// { - /// "$ref": "#/components/schemas/parameter" - /// }, - /// { - /// "$ref": "#/components/schemas/pointer" - /// }, - /// { - /// "$ref": "#/components/schemas/header" - /// } - /// ] + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/Rating" + /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - #[serde(untagged)] - pub enum Source { - Parameter(Parameter), - Pointer(Pointer), - Header(Header), - } - - impl From<&Source> for Source { - fn from(value: &Source) -> Self { - value.clone() - } - } - - impl std::str::FromStr for Source { - type Err = self::error::ConversionError; - fn from_str(value: &str) -> ::std::result::Result { - if let Ok(v) = value.parse() { - Ok(Self::Parameter(v)) - } else if let Ok(v) = value.parse() { - Ok(Self::Pointer(v)) - } else if let Ok(v) = value.parse() { - Ok(Self::Header(v)) - } else { - Err("string conversion failed for all variants".into()) - } - } - } - - impl std::convert::TryFrom<&str> for Source { - type Error = self::error::ConversionError; - fn try_from(value: &str) -> ::std::result::Result { - value.parse() - } - } - - impl std::convert::TryFrom<&::std::string::String> for Source { - type Error = self::error::ConversionError; - fn try_from( - value: &::std::string::String, - ) -> ::std::result::Result { - value.parse() - } - } - - impl std::convert::TryFrom<::std::string::String> for Source { - type Error = self::error::ConversionError; - fn try_from( - value: ::std::string::String, - ) -> ::std::result::Result { - value.parse() - } - } - - impl ::std::fmt::Display for Source { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - match self { - Self::Parameter(x) => x.fmt(f), - Self::Pointer(x) => x.fmt(f), - Self::Header(x) => x.fmt(f), - } + pub struct Ratings(pub ::std::vec::Vec); + impl ::std::ops::Deref for Ratings { + type Target = ::std::vec::Vec; + fn deref(&self) -> &::std::vec::Vec { + &self.0 } } - impl From for Source { - fn from(value: Parameter) -> Self { - Self::Parameter(value) + impl ::std::convert::From for ::std::vec::Vec { + fn from(value: Ratings) -> Self { + value.0 } } - impl From for Source { - fn from(value: Pointer) -> Self { - Self::Pointer(value) + impl ::std::convert::From<&Ratings> for Ratings { + fn from(value: &Ratings) -> Self { + value.clone() } } - impl From
for Source { - fn from(value: Header) -> Self { - Self::Header(value) + impl ::std::convert::From<::std::vec::Vec> for Ratings { + fn from(value: ::std::vec::Vec) -> Self { + Self(value) } } - ///ID of the AWS state machine that was used to run the pipeline + ///Recreation /// ///
JSON schema /// /// ```json ///{ - /// "description": "ID of the AWS state machine that was used to run the - /// pipeline", - /// "examples": [ - /// "38f4f54e-98d6-4048-8c0f-99cde05a7e76" - /// ], - /// "type": "string", - /// "format": "uuid" + /// "type": "object", + /// "properties": { + /// "community_centers": { + /// "description": "BNA category subscore for access to community + /// centers.", + /// "type": [ + /// "number", + /// "null" + /// ], + /// "format": "double", + /// "maximum": 100.0, + /// "minimum": 0.0 + /// }, + /// "parks": { + /// "description": "BNA category subscore for access to parks.", + /// "type": [ + /// "number", + /// "null" + /// ], + /// "format": "double", + /// "maximum": 100.0, + /// "minimum": 0.0 + /// }, + /// "score": { + /// "description": "BNA category score for access to recreational + /// facilities.", + /// "type": [ + /// "number", + /// "null" + /// ], + /// "format": "double", + /// "maximum": 100.0, + /// "minimum": 0.0 + /// }, + /// "trails": { + /// "description": "BNA category subscore for access to bikeable + /// trails.", + /// "type": [ + /// "number", + /// "null" + /// ], + /// "format": "double", + /// "maximum": 100.0, + /// "minimum": 0.0 + /// } + /// } ///} /// ``` ///
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct StateMachineId(pub uuid::Uuid); - impl ::std::ops::Deref for StateMachineId { - type Target = uuid::Uuid; - fn deref(&self) -> &uuid::Uuid { - &self.0 - } - } - - impl From for uuid::Uuid { - fn from(value: StateMachineId) -> Self { - value.0 - } + pub struct Recreation { + ///BNA category subscore for access to community centers. + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub community_centers: ::std::option::Option, + ///BNA category subscore for access to parks. + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub parks: ::std::option::Option, + ///BNA category score for access to recreational facilities. + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub score: ::std::option::Option, + ///BNA category subscore for access to bikeable trails. + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub trails: ::std::option::Option, } - impl From<&StateMachineId> for StateMachineId { - fn from(value: &StateMachineId) -> Self { + impl ::std::convert::From<&Recreation> for Recreation { + fn from(value: &Recreation) -> Self { value.clone() } } - impl From for StateMachineId { - fn from(value: uuid::Uuid) -> Self { - Self(value) + impl ::std::default::Default for Recreation { + fn default() -> Self { + Self { + community_centers: Default::default(), + parks: Default::default(), + score: Default::default(), + trails: Default::default(), + } } } - impl std::str::FromStr for StateMachineId { - type Err = ::Err; - fn from_str(value: &str) -> ::std::result::Result { - Ok(Self(value.parse()?)) + impl Recreation { + pub fn builder() -> builder::Recreation { + Default::default() } } - impl std::convert::TryFrom<&str> for StateMachineId { - type Error = ::Err; - fn try_from(value: &str) -> ::std::result::Result { - value.parse() - } + ///Retail + /// + ///
JSON schema + /// + /// ```json + ///{ + /// "type": "object", + /// "properties": { + /// "retail": { + /// "description": "BNA category score for access to major retail + /// centers.", + /// "type": [ + /// "number", + /// "null" + /// ], + /// "format": "double", + /// "maximum": 100.0, + /// "minimum": 0.0 + /// } + /// } + ///} + /// ``` + ///
+ #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] + pub struct Retail { + ///BNA category score for access to major retail centers. + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub retail: ::std::option::Option, } - impl std::convert::TryFrom<&String> for StateMachineId { - type Error = ::Err; - fn try_from(value: &String) -> ::std::result::Result { - value.parse() + impl ::std::convert::From<&Retail> for Retail { + fn from(value: &Retail) -> Self { + value.clone() } } - impl std::convert::TryFrom for StateMachineId { - type Error = ::Err; - fn try_from(value: String) -> ::std::result::Result { - value.parse() + impl ::std::default::Default for Retail { + fn default() -> Self { + Self { + retail: Default::default(), + } } } - impl ::std::fmt::Display for StateMachineId { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - self.0.fmt(f) + impl Retail { + pub fn builder() -> builder::Retail { + Default::default() } } - ///Indicate the last step of the pipeline that completed successfully + ///Submission /// ///
JSON schema /// /// ```json ///{ - /// "description": "Indicate the last step of the pipeline that completed - /// successfully", - /// "examples": [ - /// "Cleanup" + /// "type": "object", + /// "required": [ + /// "city", + /// "consent", + /// "country", + /// "created_at", + /// "email", + /// "fips_code", + /// "first_name", + /// "id", + /// "last_name", + /// "status" /// ], - /// "type": "string", - /// "enum": [ - /// "SqsMessage", - /// "Setup", - /// "Analysis", - /// "Cleanup" - /// ] - ///} - /// ``` - ///
- #[derive( - :: serde :: Deserialize, - :: serde :: Serialize, - Clone, - Copy, - Debug, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - )] - pub enum Step { - SqsMessage, - Setup, - Analysis, - Cleanup, - } - - impl From<&Step> for Step { - fn from(value: &Step) -> Self { - value.clone() - } - } - - impl ::std::fmt::Display for Step { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - match *self { - Self::SqsMessage => write!(f, "SqsMessage"), - Self::Setup => write!(f, "Setup"), - Self::Analysis => write!(f, "Analysis"), - Self::Cleanup => write!(f, "Cleanup"), - } - } - } - - impl std::str::FromStr for Step { - type Err = self::error::ConversionError; - fn from_str(value: &str) -> ::std::result::Result { - match value { - "SqsMessage" => Ok(Self::SqsMessage), - "Setup" => Ok(Self::Setup), - "Analysis" => Ok(Self::Analysis), - "Cleanup" => Ok(Self::Cleanup), - _ => Err("invalid value".into()), - } - } - } - - impl std::convert::TryFrom<&str> for Step { - type Error = self::error::ConversionError; - fn try_from(value: &str) -> ::std::result::Result { - value.parse() - } - } - - impl std::convert::TryFrom<&::std::string::String> for Step { - type Error = self::error::ConversionError; - fn try_from( - value: &::std::string::String, - ) -> ::std::result::Result { - value.parse() - } - } - - impl std::convert::TryFrom<::std::string::String> for Step { - type Error = self::error::ConversionError; - fn try_from( - value: ::std::string::String, - ) -> ::std::result::Result { - value.parse() - } - } - - ///Submission - /// - ///
JSON schema - /// - /// ```json - ///{ - /// "type": "object", /// "properties": { /// "city": { /// "description": "City name", @@ -3404,23 +3268,20 @@ pub mod types { /// "consent": { /// "description": "Consent status", /// "examples": [ - /// true + /// "true" /// ], - /// "type": [ - /// "boolean", - /// "null" - /// ] + /// "type": "boolean" /// }, /// "country": { - /// "$ref": "#/components/schemas/country" + /// "$ref": "#/components/schemas/Country" /// }, /// "created_at": { - /// "description": "Date and time", + /// "description": "Creation date", /// "type": "string", /// "format": "date-time" /// }, /// "email": { - /// "description": "Email address", + /// "description": "email address", /// "examples": [ /// "jane.doe@orgllc.com" /// ], @@ -3428,7 +3289,7 @@ pub mod types { /// }, /// "fips_code": { /// "description": "Numerical city identifier given by the U.S. census, - /// or 0 for non-US cities\n", + /// or 0 for non-US cities", /// "examples": [ /// "4805000" /// ], @@ -3443,16 +3304,11 @@ pub mod types { /// }, /// "id": { /// "description": "Submission identifier", - /// "examples": [ - /// 1 - /// ], - /// "type": "integer" + /// "type": "integer", + /// "format": "int32" /// }, /// "last_name": { /// "description": "Last name", - /// "examples": [ - /// "Doe" - /// ], /// "type": "string" /// }, /// "occupation": { @@ -3460,26 +3316,35 @@ pub mod types { /// "examples": [ /// "CTO" /// ], - /// "type": "string" + /// "type": [ + /// "string", + /// "null" + /// ] /// }, /// "organization": { - /// "description": "Name of the organization", + /// "description": "Organization or company", /// "examples": [ /// "Organization LLC" /// ], - /// "type": "string" + /// "type": [ + /// "string", + /// "null" + /// ] /// }, /// "region": { /// "description": "Region name. A region can be a state, a province, a - /// community, or something similar depending on the country. If a country - /// does not have this concept, then the country name is used.\n", + /// community, or\nsomething similar depending on the country. If a country + /// does not have\nthis concept, then the country name is used.", /// "examples": [ - /// "Belgium" + /// "Antwerp" /// ], - /// "type": "string" + /// "type": [ + /// "string", + /// "null" + /// ] /// }, - /// "submission_status": { - /// "description": "The current status of the submission", + /// "status": { + /// "description": "Submission status, e.g. \"Pending\"", /// "examples": [ /// "Pending" /// ], @@ -3492,49 +3357,39 @@ pub mod types { #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] pub struct Submission { ///City name - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub city: ::std::option::Option<::std::string::String>, + pub city: ::std::string::String, ///Consent status - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub consent: ::std::option::Option, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub country: ::std::option::Option, - ///Date and time - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub created_at: ::std::option::Option>, - ///Email address - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub email: ::std::option::Option<::std::string::String>, + pub consent: bool, + pub country: Country, + ///Creation date + pub created_at: chrono::DateTime, + ///email address + pub email: ::std::string::String, ///Numerical city identifier given by the U.S. census, or 0 for non-US /// cities - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub fips_code: ::std::option::Option<::std::string::String>, + pub fips_code: ::std::string::String, ///First name - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub first_name: ::std::option::Option<::std::string::String>, + pub first_name: ::std::string::String, ///Submission identifier - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub id: ::std::option::Option, + pub id: i32, ///Last name - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub last_name: ::std::option::Option<::std::string::String>, + pub last_name: ::std::string::String, ///Job title or position #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub occupation: ::std::option::Option<::std::string::String>, - ///Name of the organization + ///Organization or company #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub organization: ::std::option::Option<::std::string::String>, ///Region name. A region can be a state, a province, a community, or - /// something similar depending on the country. If a country does not + ///something similar depending on the country. If a country does not /// have this concept, then the country name is used. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub region: ::std::option::Option<::std::string::String>, - ///The current status of the submission - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub submission_status: ::std::option::Option<::std::string::String>, + ///Submission status, e.g. "Pending" + pub status: ::std::string::String, } - impl From<&Submission> for Submission { + impl ::std::convert::From<&Submission> for Submission { fn from(value: &Submission) -> Self { value.clone() } @@ -3553,70 +3408,59 @@ pub mod types { /// ```json ///{ /// "type": "object", + /// "required": [ + /// "city", + /// "consent", + /// "country", + /// "email", + /// "fips_code", + /// "first_name", + /// "last_name", + /// "status" + /// ], /// "properties": { /// "city": { /// "description": "City name", /// "examples": [ /// "Antwerp" /// ], - /// "type": [ - /// "string", - /// "null" - /// ] + /// "type": "string" /// }, /// "consent": { /// "description": "Consent status", /// "examples": [ - /// true + /// "true" /// ], - /// "type": [ - /// "boolean", - /// "null" - /// ] + /// "type": "boolean" /// }, /// "country": { - /// "$ref": "#/components/schemas/country" + /// "$ref": "#/components/schemas/Country" /// }, /// "email": { - /// "description": "Email address", + /// "description": "email address", /// "examples": [ /// "jane.doe@orgllc.com" /// ], - /// "type": [ - /// "string", - /// "null" - /// ] + /// "type": "string" /// }, /// "fips_code": { /// "description": "Numerical city identifier given by the U.S. census, - /// or 0 for non-US cities\n", + /// or 0 for non-US cities", /// "examples": [ /// "4805000" /// ], - /// "type": [ - /// "string", - /// "null" - /// ] + /// "type": "string" /// }, /// "first_name": { /// "description": "First name", /// "examples": [ /// "Jane" /// ], - /// "type": [ - /// "string", - /// "null" - /// ] + /// "type": "string" /// }, /// "last_name": { /// "description": "Last name", - /// "examples": [ - /// "Doe" - /// ], - /// "type": [ - /// "string", - /// "null" - /// ] + /// "type": "string" /// }, /// "occupation": { /// "description": "Job title or position", @@ -3629,7 +3473,7 @@ pub mod types { /// ] /// }, /// "organization": { - /// "description": "Name of the organization", + /// "description": "Organization or company", /// "examples": [ /// "Organization LLC" /// ], @@ -3640,25 +3484,22 @@ pub mod types { /// }, /// "region": { /// "description": "Region name. A region can be a state, a province, a - /// community, or something similar depending on the country. If a country - /// does not have this concept, then the country name is used.\n", + /// community, or\nsomething similar depending on the country. If a country + /// does not have\nthis concept, then the country name is used.", /// "examples": [ - /// "Belgium" + /// "Antwerp" /// ], /// "type": [ /// "string", /// "null" /// ] /// }, - /// "submission_status": { - /// "description": "The current status of the submission", + /// "status": { + /// "description": "Submission status, e.g. \"Pending\"", /// "examples": [ /// "Pending" /// ], - /// "type": [ - /// "string", - /// "null" - /// ] + /// "type": "string" /// } /// } ///} @@ -3667,43 +3508,35 @@ pub mod types { #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] pub struct SubmissionPatch { ///City name - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub city: ::std::option::Option<::std::string::String>, + pub city: ::std::string::String, ///Consent status - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub consent: ::std::option::Option, - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub country: ::std::option::Option, - ///Email address - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub email: ::std::option::Option<::std::string::String>, + pub consent: bool, + pub country: Country, + ///email address + pub email: ::std::string::String, ///Numerical city identifier given by the U.S. census, or 0 for non-US /// cities - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub fips_code: ::std::option::Option<::std::string::String>, + pub fips_code: ::std::string::String, ///First name - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub first_name: ::std::option::Option<::std::string::String>, + pub first_name: ::std::string::String, ///Last name - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub last_name: ::std::option::Option<::std::string::String>, + pub last_name: ::std::string::String, ///Job title or position #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub occupation: ::std::option::Option<::std::string::String>, - ///Name of the organization + ///Organization or company #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub organization: ::std::option::Option<::std::string::String>, ///Region name. A region can be a state, a province, a community, or - /// something similar depending on the country. If a country does not + ///something similar depending on the country. If a country does not /// have this concept, then the country name is used. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub region: ::std::option::Option<::std::string::String>, - ///The current status of the submission - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub submission_status: ::std::option::Option<::std::string::String>, + ///Submission status, e.g. "Pending" + pub status: ::std::string::String, } - impl From<&SubmissionPatch> for SubmissionPatch { + impl ::std::convert::From<&SubmissionPatch> for SubmissionPatch { fn from(value: &SubmissionPatch) -> Self { value.clone() } @@ -3729,7 +3562,8 @@ pub mod types { /// "email", /// "fips_code", /// "first_name", - /// "last_name" + /// "last_name", + /// "status" /// ], /// "properties": { /// "city": { @@ -3742,15 +3576,15 @@ pub mod types { /// "consent": { /// "description": "Consent status", /// "examples": [ - /// true + /// "true" /// ], /// "type": "boolean" /// }, /// "country": { - /// "$ref": "#/components/schemas/country" + /// "$ref": "#/components/schemas/Country" /// }, /// "email": { - /// "description": "Email address", + /// "description": "email address", /// "examples": [ /// "jane.doe@orgllc.com" /// ], @@ -3758,7 +3592,7 @@ pub mod types { /// }, /// "fips_code": { /// "description": "Numerical city identifier given by the U.S. census, - /// or 0 for non-US cities\n", + /// or 0 for non-US cities", /// "examples": [ /// "4805000" /// ], @@ -3773,9 +3607,6 @@ pub mod types { /// }, /// "last_name": { /// "description": "Last name", - /// "examples": [ - /// "Doe" - /// ], /// "type": "string" /// }, /// "occupation": { @@ -3789,7 +3620,7 @@ pub mod types { /// ] /// }, /// "organization": { - /// "description": "Name of the organization", + /// "description": "Organization or company", /// "examples": [ /// "Organization LLC" /// ], @@ -3800,18 +3631,18 @@ pub mod types { /// }, /// "region": { /// "description": "Region name. A region can be a state, a province, a - /// community, or something similar depending on the country. If a country - /// does not have this concept, then the country name is used.\n", + /// community, or\nsomething similar depending on the country. If a country + /// does not have\nthis concept, then the country name is used.", /// "examples": [ - /// "Belgium" + /// "Antwerp" /// ], /// "type": [ /// "string", /// "null" /// ] /// }, - /// "submission_status": { - /// "description": "The current status of the submission", + /// "status": { + /// "description": "Submission status, e.g. \"Pending\"", /// "examples": [ /// "Pending" /// ], @@ -3828,7 +3659,7 @@ pub mod types { ///Consent status pub consent: bool, pub country: Country, - ///Email address + ///email address pub email: ::std::string::String, ///Numerical city identifier given by the U.S. census, or 0 for non-US /// cities @@ -3840,20 +3671,19 @@ pub mod types { ///Job title or position #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub occupation: ::std::option::Option<::std::string::String>, - ///Name of the organization + ///Organization or company #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub organization: ::std::option::Option<::std::string::String>, ///Region name. A region can be a state, a province, a community, or - /// something similar depending on the country. If a country does not + ///something similar depending on the country. If a country does not /// have this concept, then the country name is used. #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] pub region: ::std::option::Option<::std::string::String>, - ///The current status of the submission - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub submission_status: ::std::option::Option<::std::string::String>, + ///Submission status, e.g. "Pending" + pub status: ::std::string::String, } - impl From<&SubmissionPost> for SubmissionPost { + impl ::std::convert::From<&SubmissionPost> for SubmissionPost { fn from(value: &SubmissionPost) -> Self { value.clone() } @@ -3865,16 +3695,15 @@ pub mod types { } } - ///A collection of submissions + ///Submissions /// ///
JSON schema /// /// ```json ///{ - /// "description": "A collection of submissions", /// "type": "array", /// "items": { - /// "$ref": "#/components/schemas/submission" + /// "$ref": "#/components/schemas/Submission" /// } ///} /// ``` @@ -3888,61 +3717,563 @@ pub mod types { } } - impl From for ::std::vec::Vec { + impl ::std::convert::From for ::std::vec::Vec { fn from(value: Submissions) -> Self { value.0 } } - impl From<&Submissions> for Submissions { + impl ::std::convert::From<&Submissions> for Submissions { fn from(value: &Submissions) -> Self { value.clone() } } - impl From<::std::vec::Vec> for Submissions { + impl ::std::convert::From<::std::vec::Vec> for Submissions { fn from(value: ::std::vec::Vec) -> Self { Self(value) } - } - - ///Transit - /// - ///
JSON schema - /// - /// ```json - ///{ - /// "type": "object", - /// "properties": { - /// "score": { - /// "type": "number" - /// } - /// } - ///} - /// ``` - ///
- #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] - pub struct Transit { - #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] - pub score: ::std::option::Option, - } + } + + ///Transit + /// + ///
JSON schema + /// + /// ```json + ///{ + /// "type": "object", + /// "properties": { + /// "transit": { + /// "description": "BNA category score for access to major transit + /// stops.", + /// "type": [ + /// "number", + /// "null" + /// ], + /// "format": "double", + /// "maximum": 100.0, + /// "minimum": 0.0 + /// } + /// } + ///} + /// ``` + ///
+ #[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] + pub struct Transit { + ///BNA category score for access to major transit stops. + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub transit: ::std::option::Option, + } + + impl ::std::convert::From<&Transit> for Transit { + fn from(value: &Transit) -> Self { + value.clone() + } + } + + impl ::std::default::Default for Transit { + fn default() -> Self { + Self { + transit: Default::default(), + } + } + } + + impl Transit { + pub fn builder() -> builder::Transit { + Default::default() + } + } + + /// Types for composing complex structures. + pub mod builder { + #[derive(Clone, Debug)] + pub struct ApiError { + details: ::std::result::Result<::std::string::String, ::std::string::String>, + id: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + source: ::std::result::Result, + status: ::std::result::Result<::std::string::String, ::std::string::String>, + title: ::std::result::Result<::std::string::String, ::std::string::String>, + } + + impl ::std::default::Default for ApiError { + fn default() -> Self { + Self { + details: Err("no value supplied for details".to_string()), + id: Ok(Default::default()), + source: Err("no value supplied for source".to_string()), + status: Err("no value supplied for status".to_string()), + title: Err("no value supplied for title".to_string()), + } + } + } + + impl ApiError { + pub fn details(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.details = value + .try_into() + .map_err(|e| format!("error converting supplied value for details: {}", e)); + self + } + pub fn id(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn source(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.source = value + .try_into() + .map_err(|e| format!("error converting supplied value for source: {}", e)); + self + } + pub fn status(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.status = value + .try_into() + .map_err(|e| format!("error converting supplied value for status: {}", e)); + self + } + pub fn title(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.title = value + .try_into() + .map_err(|e| format!("error converting supplied value for title: {}", e)); + self + } + } + + impl ::std::convert::TryFrom for super::ApiError { + type Error = super::error::ConversionError; + fn try_from( + value: ApiError, + ) -> ::std::result::Result { + Ok(Self { + details: value.details?, + id: value.id?, + source: value.source?, + status: value.status?, + title: value.title?, + }) + } + } + + impl ::std::convert::From for ApiError { + fn from(value: super::ApiError) -> Self { + Self { + details: Ok(value.details), + id: Ok(value.id), + source: Ok(value.source), + status: Ok(value.status), + title: Ok(value.title), + } + } + } + + #[derive(Clone, Debug)] + pub struct BnaPipeline { + cost: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + end_time: ::std::result::Result< + ::std::option::Option>, + ::std::string::String, + >, + fargate_price_id: + ::std::result::Result<::std::option::Option, ::std::string::String>, + fargate_task_arn: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + s3_bucket: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + sqs_message: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + start_time: + ::std::result::Result, ::std::string::String>, + state_machine_id: ::std::result::Result, + status: ::std::result::Result, + step: ::std::result::Result, + } + + impl ::std::default::Default for BnaPipeline { + fn default() -> Self { + Self { + cost: Ok(Default::default()), + end_time: Ok(Default::default()), + fargate_price_id: Ok(Default::default()), + fargate_task_arn: Ok(Default::default()), + s3_bucket: Ok(Default::default()), + sqs_message: Ok(Default::default()), + start_time: Err("no value supplied for start_time".to_string()), + state_machine_id: Err("no value supplied for state_machine_id".to_string()), + status: Err("no value supplied for status".to_string()), + step: Err("no value supplied for step".to_string()), + } + } + } + + impl BnaPipeline { + pub fn cost(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.cost = value + .try_into() + .map_err(|e| format!("error converting supplied value for cost: {}", e)); + self + } + pub fn end_time(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::std::option::Option>, + >, + T::Error: ::std::fmt::Display, + { + self.end_time = value + .try_into() + .map_err(|e| format!("error converting supplied value for end_time: {}", e)); + self + } + pub fn fargate_price_id(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.fargate_price_id = value.try_into().map_err(|e| { + format!( + "error converting supplied value for fargate_price_id: {}", + e + ) + }); + self + } + pub fn fargate_task_arn(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.fargate_task_arn = value.try_into().map_err(|e| { + format!( + "error converting supplied value for fargate_task_arn: {}", + e + ) + }); + self + } + pub fn s3_bucket(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.s3_bucket = value + .try_into() + .map_err(|e| format!("error converting supplied value for s3_bucket: {}", e)); + self + } + pub fn sqs_message(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.sqs_message = value + .try_into() + .map_err(|e| format!("error converting supplied value for sqs_message: {}", e)); + self + } + pub fn start_time(mut self, value: T) -> Self + where + T: ::std::convert::TryInto>, + T::Error: ::std::fmt::Display, + { + self.start_time = value + .try_into() + .map_err(|e| format!("error converting supplied value for start_time: {}", e)); + self + } + pub fn state_machine_id(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.state_machine_id = value.try_into().map_err(|e| { + format!( + "error converting supplied value for state_machine_id: {}", + e + ) + }); + self + } + pub fn status(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.status = value + .try_into() + .map_err(|e| format!("error converting supplied value for status: {}", e)); + self + } + pub fn step(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.step = value + .try_into() + .map_err(|e| format!("error converting supplied value for step: {}", e)); + self + } + } + + impl ::std::convert::TryFrom for super::BnaPipeline { + type Error = super::error::ConversionError; + fn try_from( + value: BnaPipeline, + ) -> ::std::result::Result { + Ok(Self { + cost: value.cost?, + end_time: value.end_time?, + fargate_price_id: value.fargate_price_id?, + fargate_task_arn: value.fargate_task_arn?, + s3_bucket: value.s3_bucket?, + sqs_message: value.sqs_message?, + start_time: value.start_time?, + state_machine_id: value.state_machine_id?, + status: value.status?, + step: value.step?, + }) + } + } + + impl ::std::convert::From for BnaPipeline { + fn from(value: super::BnaPipeline) -> Self { + Self { + cost: Ok(value.cost), + end_time: Ok(value.end_time), + fargate_price_id: Ok(value.fargate_price_id), + fargate_task_arn: Ok(value.fargate_task_arn), + s3_bucket: Ok(value.s3_bucket), + sqs_message: Ok(value.sqs_message), + start_time: Ok(value.start_time), + state_machine_id: Ok(value.state_machine_id), + status: Ok(value.status), + step: Ok(value.step), + } + } + } + + #[derive(Clone, Debug)] + pub struct BnaPipelinePatch { + cost: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + end_time: ::std::result::Result< + ::std::option::Option>, + ::std::string::String, + >, + fargate_price_id: + ::std::result::Result<::std::option::Option, ::std::string::String>, + fargate_task_arn: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + s3_bucket: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + sqs_message: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + start_time: + ::std::result::Result, ::std::string::String>, + status: ::std::result::Result, + step: ::std::result::Result, + } + + impl ::std::default::Default for BnaPipelinePatch { + fn default() -> Self { + Self { + cost: Ok(Default::default()), + end_time: Ok(Default::default()), + fargate_price_id: Ok(Default::default()), + fargate_task_arn: Ok(Default::default()), + s3_bucket: Ok(Default::default()), + sqs_message: Ok(Default::default()), + start_time: Err("no value supplied for start_time".to_string()), + status: Err("no value supplied for status".to_string()), + step: Err("no value supplied for step".to_string()), + } + } + } + + impl BnaPipelinePatch { + pub fn cost(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.cost = value + .try_into() + .map_err(|e| format!("error converting supplied value for cost: {}", e)); + self + } + pub fn end_time(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::std::option::Option>, + >, + T::Error: ::std::fmt::Display, + { + self.end_time = value + .try_into() + .map_err(|e| format!("error converting supplied value for end_time: {}", e)); + self + } + pub fn fargate_price_id(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.fargate_price_id = value.try_into().map_err(|e| { + format!( + "error converting supplied value for fargate_price_id: {}", + e + ) + }); + self + } + pub fn fargate_task_arn(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.fargate_task_arn = value.try_into().map_err(|e| { + format!( + "error converting supplied value for fargate_task_arn: {}", + e + ) + }); + self + } + pub fn s3_bucket(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.s3_bucket = value + .try_into() + .map_err(|e| format!("error converting supplied value for s3_bucket: {}", e)); + self + } + pub fn sqs_message(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.sqs_message = value + .try_into() + .map_err(|e| format!("error converting supplied value for sqs_message: {}", e)); + self + } + pub fn start_time(mut self, value: T) -> Self + where + T: ::std::convert::TryInto>, + T::Error: ::std::fmt::Display, + { + self.start_time = value + .try_into() + .map_err(|e| format!("error converting supplied value for start_time: {}", e)); + self + } + pub fn status(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.status = value + .try_into() + .map_err(|e| format!("error converting supplied value for status: {}", e)); + self + } + pub fn step(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.step = value + .try_into() + .map_err(|e| format!("error converting supplied value for step: {}", e)); + self + } + } - impl From<&Transit> for Transit { - fn from(value: &Transit) -> Self { - value.clone() + impl ::std::convert::TryFrom for super::BnaPipelinePatch { + type Error = super::error::ConversionError; + fn try_from( + value: BnaPipelinePatch, + ) -> ::std::result::Result { + Ok(Self { + cost: value.cost?, + end_time: value.end_time?, + fargate_price_id: value.fargate_price_id?, + fargate_task_arn: value.fargate_task_arn?, + s3_bucket: value.s3_bucket?, + sqs_message: value.sqs_message?, + start_time: value.start_time?, + status: value.status?, + step: value.step?, + }) + } } - } - impl Transit { - pub fn builder() -> builder::Transit { - Default::default() + impl ::std::convert::From for BnaPipelinePatch { + fn from(value: super::BnaPipelinePatch) -> Self { + Self { + cost: Ok(value.cost), + end_time: Ok(value.end_time), + fargate_price_id: Ok(value.fargate_price_id), + fargate_task_arn: Ok(value.fargate_task_arn), + s3_bucket: Ok(value.s3_bucket), + sqs_message: Ok(value.sqs_message), + start_time: Ok(value.start_time), + status: Ok(value.status), + step: Ok(value.step), + } + } } - } - /// Types for composing complex structures. - pub mod builder { #[derive(Clone, Debug)] - pub struct Analysis { + pub struct BnaPipelinePost { cost: ::std::result::Result< ::std::option::Option<::std::string::String>, ::std::string::String, @@ -3952,13 +4283,11 @@ pub mod types { ::std::string::String, >, fargate_price_id: - ::std::result::Result<::std::option::Option, ::std::string::String>, + ::std::result::Result<::std::option::Option, ::std::string::String>, fargate_task_arn: ::std::result::Result< ::std::option::Option<::std::string::String>, ::std::string::String, >, - results_posted: - ::std::result::Result<::std::option::Option, ::std::string::String>, s3_bucket: ::std::result::Result< ::std::option::Option<::std::string::String>, ::std::string::String, @@ -3967,43 +4296,28 @@ pub mod types { ::std::option::Option<::std::string::String>, ::std::string::String, >, - start_time: ::std::result::Result< - ::std::option::Option>, - ::std::string::String, - >, - state_machine_id: ::std::result::Result, - status: ::std::result::Result< - ::std::option::Option, - ::std::string::String, - >, - step: ::std::result::Result<::std::option::Option, ::std::string::String>, - torn_down: ::std::result::Result<::std::option::Option, ::std::string::String>, + step: ::std::result::Result, } - impl Default for Analysis { + impl ::std::default::Default for BnaPipelinePost { fn default() -> Self { Self { cost: Ok(Default::default()), end_time: Ok(Default::default()), fargate_price_id: Ok(Default::default()), fargate_task_arn: Ok(Default::default()), - results_posted: Ok(Default::default()), s3_bucket: Ok(Default::default()), sqs_message: Ok(Default::default()), - start_time: Ok(Default::default()), - state_machine_id: Err("no value supplied for state_machine_id".to_string()), - status: Ok(Default::default()), - step: Ok(Default::default()), - torn_down: Ok(Default::default()), + step: Err("no value supplied for step".to_string()), } } } - impl Analysis { + impl BnaPipelinePost { pub fn cost(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, { self.cost = value .try_into() @@ -4012,10 +4326,10 @@ pub mod types { } pub fn end_time(mut self, value: T) -> Self where - T: std::convert::TryInto< + T: ::std::convert::TryInto< ::std::option::Option>, >, - T::Error: std::fmt::Display, + T::Error: ::std::fmt::Display, { self.end_time = value .try_into() @@ -4024,8 +4338,8 @@ pub mod types { } pub fn fargate_price_id(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { self.fargate_price_id = value.try_into().map_err(|e| { format!( @@ -4037,8 +4351,8 @@ pub mod types { } pub fn fargate_task_arn(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, { self.fargate_task_arn = value.try_into().map_err(|e| { format!( @@ -4048,20 +4362,10 @@ pub mod types { }); self } - pub fn results_posted(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.results_posted = value.try_into().map_err(|e| { - format!("error converting supplied value for results_posted: {}", e) - }); - self - } pub fn s3_bucket(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, { self.s3_bucket = value .try_into() @@ -4070,656 +4374,740 @@ pub mod types { } pub fn sqs_message(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, { self.sqs_message = value .try_into() .map_err(|e| format!("error converting supplied value for sqs_message: {}", e)); self } - pub fn start_time(mut self, value: T) -> Self + pub fn step(mut self, value: T) -> Self where - T: std::convert::TryInto< - ::std::option::Option>, - >, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { - self.start_time = value + self.step = value .try_into() - .map_err(|e| format!("error converting supplied value for start_time: {}", e)); + .map_err(|e| format!("error converting supplied value for step: {}", e)); self } - pub fn state_machine_id(mut self, value: T) -> Self + } + + impl ::std::convert::TryFrom for super::BnaPipelinePost { + type Error = super::error::ConversionError; + fn try_from( + value: BnaPipelinePost, + ) -> ::std::result::Result { + Ok(Self { + cost: value.cost?, + end_time: value.end_time?, + fargate_price_id: value.fargate_price_id?, + fargate_task_arn: value.fargate_task_arn?, + s3_bucket: value.s3_bucket?, + sqs_message: value.sqs_message?, + step: value.step?, + }) + } + } + + impl ::std::convert::From for BnaPipelinePost { + fn from(value: super::BnaPipelinePost) -> Self { + Self { + cost: Ok(value.cost), + end_time: Ok(value.end_time), + fargate_price_id: Ok(value.fargate_price_id), + fargate_task_arn: Ok(value.fargate_task_arn), + s3_bucket: Ok(value.s3_bucket), + sqs_message: Ok(value.sqs_message), + step: Ok(value.step), + } + } + } + + #[derive(Clone, Debug)] + pub struct Census { + city_id: ::std::result::Result, + created_at: + ::std::result::Result, ::std::string::String>, + fips_code: ::std::result::Result<::std::string::String, ::std::string::String>, + id: ::std::result::Result, + pop_size: ::std::result::Result, + population: ::std::result::Result, + } + + impl ::std::default::Default for Census { + fn default() -> Self { + Self { + city_id: Err("no value supplied for city_id".to_string()), + created_at: Err("no value supplied for created_at".to_string()), + fips_code: Err("no value supplied for fips_code".to_string()), + id: Err("no value supplied for id".to_string()), + pop_size: Err("no value supplied for pop_size".to_string()), + population: Err("no value supplied for population".to_string()), + } + } + } + + impl Census { + pub fn city_id(mut self, value: T) -> Self where - T: std::convert::TryInto, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { - self.state_machine_id = value.try_into().map_err(|e| { - format!( - "error converting supplied value for state_machine_id: {}", - e - ) - }); + self.city_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for city_id: {}", e)); + self + } + pub fn created_at(mut self, value: T) -> Self + where + T: ::std::convert::TryInto>, + T::Error: ::std::fmt::Display, + { + self.created_at = value + .try_into() + .map_err(|e| format!("error converting supplied value for created_at: {}", e)); + self + } + pub fn fips_code(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.fips_code = value + .try_into() + .map_err(|e| format!("error converting supplied value for fips_code: {}", e)); + self + } + pub fn id(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn pop_size(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.pop_size = value + .try_into() + .map_err(|e| format!("error converting supplied value for pop_size: {}", e)); + self + } + pub fn population(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.population = value + .try_into() + .map_err(|e| format!("error converting supplied value for population: {}", e)); self } - pub fn status(mut self, value: T) -> Self + } + + impl ::std::convert::TryFrom for super::Census { + type Error = super::error::ConversionError; + fn try_from( + value: Census, + ) -> ::std::result::Result { + Ok(Self { + city_id: value.city_id?, + created_at: value.created_at?, + fips_code: value.fips_code?, + id: value.id?, + pop_size: value.pop_size?, + population: value.population?, + }) + } + } + + impl ::std::convert::From for Census { + fn from(value: super::Census) -> Self { + Self { + city_id: Ok(value.city_id), + created_at: Ok(value.created_at), + fips_code: Ok(value.fips_code), + id: Ok(value.id), + pop_size: Ok(value.pop_size), + population: Ok(value.population), + } + } + } + + #[derive(Clone, Debug)] + pub struct CensusPost { + fips_code: ::std::result::Result<::std::string::String, ::std::string::String>, + pop_size: ::std::result::Result, + population: ::std::result::Result, + } + + impl ::std::default::Default for CensusPost { + fn default() -> Self { + Self { + fips_code: Err("no value supplied for fips_code".to_string()), + pop_size: Err("no value supplied for pop_size".to_string()), + population: Err("no value supplied for population".to_string()), + } + } + } + + impl CensusPost { + pub fn fips_code(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { - self.status = value + self.fips_code = value .try_into() - .map_err(|e| format!("error converting supplied value for status: {}", e)); + .map_err(|e| format!("error converting supplied value for fips_code: {}", e)); self } - pub fn step(mut self, value: T) -> Self + pub fn pop_size(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { - self.step = value + self.pop_size = value .try_into() - .map_err(|e| format!("error converting supplied value for step: {}", e)); + .map_err(|e| format!("error converting supplied value for pop_size: {}", e)); self } - pub fn torn_down(mut self, value: T) -> Self + pub fn population(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { - self.torn_down = value + self.population = value .try_into() - .map_err(|e| format!("error converting supplied value for torn_down: {}", e)); + .map_err(|e| format!("error converting supplied value for population: {}", e)); self } } - impl ::std::convert::TryFrom for super::Analysis { + impl ::std::convert::TryFrom for super::CensusPost { type Error = super::error::ConversionError; fn try_from( - value: Analysis, + value: CensusPost, ) -> ::std::result::Result { Ok(Self { - cost: value.cost?, - end_time: value.end_time?, - fargate_price_id: value.fargate_price_id?, - fargate_task_arn: value.fargate_task_arn?, - results_posted: value.results_posted?, - s3_bucket: value.s3_bucket?, - sqs_message: value.sqs_message?, - start_time: value.start_time?, - state_machine_id: value.state_machine_id?, - status: value.status?, - step: value.step?, - torn_down: value.torn_down?, + fips_code: value.fips_code?, + pop_size: value.pop_size?, + population: value.population?, }) } } - impl From for Analysis { - fn from(value: super::Analysis) -> Self { + impl ::std::convert::From for CensusPost { + fn from(value: super::CensusPost) -> Self { Self { - cost: Ok(value.cost), - end_time: Ok(value.end_time), - fargate_price_id: Ok(value.fargate_price_id), - fargate_task_arn: Ok(value.fargate_task_arn), - results_posted: Ok(value.results_posted), - s3_bucket: Ok(value.s3_bucket), - sqs_message: Ok(value.sqs_message), - start_time: Ok(value.start_time), - state_machine_id: Ok(value.state_machine_id), - status: Ok(value.status), - step: Ok(value.step), - torn_down: Ok(value.torn_down), + fips_code: Ok(value.fips_code), + pop_size: Ok(value.pop_size), + population: Ok(value.population), } } } #[derive(Clone, Debug)] - pub struct AnalysisPatch { - cost: ::std::result::Result<::std::option::Option, ::std::string::String>, - end_time: ::std::result::Result< - ::std::option::Option>, - ::std::string::String, - >, - fargate_task_arn: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, - results_posted: - ::std::result::Result<::std::option::Option, ::std::string::String>, - s3_bucket: ::std::result::Result< + pub struct City { + country: ::std::result::Result, + created_at: + ::std::result::Result, ::std::string::String>, + id: ::std::result::Result, + latitude: ::std::result::Result<::std::option::Option, ::std::string::String>, + longitude: ::std::result::Result<::std::option::Option, ::std::string::String>, + name: ::std::result::Result<::std::string::String, ::std::string::String>, + region: ::std::result::Result< ::std::option::Option<::std::string::String>, ::std::string::String, >, - sqs_message: ::std::result::Result< + speed_limit: ::std::result::Result<::std::option::Option, ::std::string::String>, + state: ::std::result::Result<::std::string::String, ::std::string::String>, + state_abbrev: ::std::result::Result< ::std::option::Option<::std::string::String>, ::std::string::String, >, - start_time: ::std::result::Result< + updated_at: ::std::result::Result< ::std::option::Option>, ::std::string::String, >, - status: ::std::result::Result< - ::std::option::Option, - ::std::string::String, - >, - step: ::std::result::Result<::std::option::Option, ::std::string::String>, - torn_down: ::std::result::Result<::std::option::Option, ::std::string::String>, } - impl Default for AnalysisPatch { + impl ::std::default::Default for City { fn default() -> Self { Self { - cost: Ok(Default::default()), - end_time: Ok(Default::default()), - fargate_task_arn: Ok(Default::default()), - results_posted: Ok(Default::default()), - s3_bucket: Ok(Default::default()), - sqs_message: Ok(Default::default()), - start_time: Ok(Default::default()), - status: Ok(Default::default()), - step: Ok(Default::default()), - torn_down: Ok(Default::default()), + country: Err("no value supplied for country".to_string()), + created_at: Err("no value supplied for created_at".to_string()), + id: Err("no value supplied for id".to_string()), + latitude: Ok(Default::default()), + longitude: Ok(Default::default()), + name: Err("no value supplied for name".to_string()), + region: Ok(Default::default()), + speed_limit: Ok(Default::default()), + state: Err("no value supplied for state".to_string()), + state_abbrev: Ok(Default::default()), + updated_at: Ok(Default::default()), } } } - impl AnalysisPatch { - pub fn cost(mut self, value: T) -> Self + impl City { + pub fn country(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { - self.cost = value + self.country = value .try_into() - .map_err(|e| format!("error converting supplied value for cost: {}", e)); + .map_err(|e| format!("error converting supplied value for country: {}", e)); self } - pub fn end_time(mut self, value: T) -> Self + pub fn created_at(mut self, value: T) -> Self where - T: std::convert::TryInto< - ::std::option::Option>, - >, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto>, + T::Error: ::std::fmt::Display, { - self.end_time = value + self.created_at = value .try_into() - .map_err(|e| format!("error converting supplied value for end_time: {}", e)); + .map_err(|e| format!("error converting supplied value for created_at: {}", e)); self } - pub fn fargate_task_arn(mut self, value: T) -> Self + pub fn id(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { - self.fargate_task_arn = value.try_into().map_err(|e| { - format!( - "error converting supplied value for fargate_task_arn: {}", - e - ) - }); + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); self } - pub fn results_posted(mut self, value: T) -> Self + pub fn latitude(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { - self.results_posted = value.try_into().map_err(|e| { - format!("error converting supplied value for results_posted: {}", e) - }); + self.latitude = value + .try_into() + .map_err(|e| format!("error converting supplied value for latitude: {}", e)); self } - pub fn s3_bucket(mut self, value: T) -> Self + pub fn longitude(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { - self.s3_bucket = value + self.longitude = value .try_into() - .map_err(|e| format!("error converting supplied value for s3_bucket: {}", e)); + .map_err(|e| format!("error converting supplied value for longitude: {}", e)); self } - pub fn sqs_message(mut self, value: T) -> Self + pub fn name(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { - self.sqs_message = value + self.name = value .try_into() - .map_err(|e| format!("error converting supplied value for sqs_message: {}", e)); + .map_err(|e| format!("error converting supplied value for name: {}", e)); self } - pub fn start_time(mut self, value: T) -> Self + pub fn region(mut self, value: T) -> Self where - T: std::convert::TryInto< - ::std::option::Option>, - >, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, { - self.start_time = value + self.region = value .try_into() - .map_err(|e| format!("error converting supplied value for start_time: {}", e)); + .map_err(|e| format!("error converting supplied value for region: {}", e)); self } - pub fn status(mut self, value: T) -> Self + pub fn speed_limit(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { - self.status = value + self.speed_limit = value .try_into() - .map_err(|e| format!("error converting supplied value for status: {}", e)); + .map_err(|e| format!("error converting supplied value for speed_limit: {}", e)); self } - pub fn step(mut self, value: T) -> Self + pub fn state(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { - self.step = value + self.state = value .try_into() - .map_err(|e| format!("error converting supplied value for step: {}", e)); + .map_err(|e| format!("error converting supplied value for state: {}", e)); + self + } + pub fn state_abbrev(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.state_abbrev = value.try_into().map_err(|e| { + format!("error converting supplied value for state_abbrev: {}", e) + }); self } - pub fn torn_down(mut self, value: T) -> Self + pub fn updated_at(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto< + ::std::option::Option>, + >, + T::Error: ::std::fmt::Display, { - self.torn_down = value + self.updated_at = value .try_into() - .map_err(|e| format!("error converting supplied value for torn_down: {}", e)); + .map_err(|e| format!("error converting supplied value for updated_at: {}", e)); self } } - impl ::std::convert::TryFrom for super::AnalysisPatch { + impl ::std::convert::TryFrom for super::City { type Error = super::error::ConversionError; - fn try_from( - value: AnalysisPatch, - ) -> ::std::result::Result { + fn try_from(value: City) -> ::std::result::Result { Ok(Self { - cost: value.cost?, - end_time: value.end_time?, - fargate_task_arn: value.fargate_task_arn?, - results_posted: value.results_posted?, - s3_bucket: value.s3_bucket?, - sqs_message: value.sqs_message?, - start_time: value.start_time?, - status: value.status?, - step: value.step?, - torn_down: value.torn_down?, + country: value.country?, + created_at: value.created_at?, + id: value.id?, + latitude: value.latitude?, + longitude: value.longitude?, + name: value.name?, + region: value.region?, + speed_limit: value.speed_limit?, + state: value.state?, + state_abbrev: value.state_abbrev?, + updated_at: value.updated_at?, }) } } - impl From for AnalysisPatch { - fn from(value: super::AnalysisPatch) -> Self { + impl ::std::convert::From for City { + fn from(value: super::City) -> Self { Self { - cost: Ok(value.cost), - end_time: Ok(value.end_time), - fargate_task_arn: Ok(value.fargate_task_arn), - results_posted: Ok(value.results_posted), - s3_bucket: Ok(value.s3_bucket), - sqs_message: Ok(value.sqs_message), - start_time: Ok(value.start_time), - status: Ok(value.status), - step: Ok(value.step), - torn_down: Ok(value.torn_down), + country: Ok(value.country), + created_at: Ok(value.created_at), + id: Ok(value.id), + latitude: Ok(value.latitude), + longitude: Ok(value.longitude), + name: Ok(value.name), + region: Ok(value.region), + speed_limit: Ok(value.speed_limit), + state: Ok(value.state), + state_abbrev: Ok(value.state_abbrev), + updated_at: Ok(value.updated_at), } } } #[derive(Clone, Debug)] - pub struct AnalysisPost { - cost: ::std::result::Result<::std::option::Option, ::std::string::String>, - end_time: ::std::result::Result< - ::std::option::Option>, - ::std::string::String, - >, - fargate_price_id: - ::std::result::Result<::std::option::Option, ::std::string::String>, - fargate_task_arn: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, - result_posted: - ::std::result::Result<::std::option::Option, ::std::string::String>, - s3_bucket: ::std::result::Result< + pub struct CityCensuses { + censuses: ::std::result::Result<::std::vec::Vec, ::std::string::String>, + city: ::std::result::Result, + } + + impl ::std::default::Default for CityCensuses { + fn default() -> Self { + Self { + censuses: Err("no value supplied for censuses".to_string()), + city: Err("no value supplied for city".to_string()), + } + } + } + + impl CityCensuses { + pub fn censuses(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, + { + self.censuses = value + .try_into() + .map_err(|e| format!("error converting supplied value for censuses: {}", e)); + self + } + pub fn city(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.city = value + .try_into() + .map_err(|e| format!("error converting supplied value for city: {}", e)); + self + } + } + + impl ::std::convert::TryFrom for super::CityCensuses { + type Error = super::error::ConversionError; + fn try_from( + value: CityCensuses, + ) -> ::std::result::Result { + Ok(Self { + censuses: value.censuses?, + city: value.city?, + }) + } + } + + impl ::std::convert::From for CityCensuses { + fn from(value: super::CityCensuses) -> Self { + Self { + censuses: Ok(value.censuses), + city: Ok(value.city), + } + } + } + + #[derive(Clone, Debug)] + pub struct CityPost { + country: ::std::result::Result, + latitude: ::std::result::Result<::std::option::Option, ::std::string::String>, + longitude: ::std::result::Result<::std::option::Option, ::std::string::String>, + name: ::std::result::Result<::std::string::String, ::std::string::String>, + region: ::std::result::Result< ::std::option::Option<::std::string::String>, ::std::string::String, >, - sqs_message: ::std::result::Result< + speed_limit: ::std::result::Result<::std::option::Option, ::std::string::String>, + state: ::std::result::Result<::std::string::String, ::std::string::String>, + state_abbrev: ::std::result::Result< ::std::option::Option<::std::string::String>, ::std::string::String, >, - start_time: ::std::result::Result< - ::std::option::Option>, - ::std::string::String, - >, - state_machine_id: ::std::result::Result< - ::std::option::Option, - ::std::string::String, - >, - status: ::std::result::Result< - ::std::option::Option, - ::std::string::String, - >, - step: ::std::result::Result<::std::option::Option, ::std::string::String>, - torn_down: ::std::result::Result<::std::option::Option, ::std::string::String>, } - impl Default for AnalysisPost { + impl ::std::default::Default for CityPost { fn default() -> Self { Self { - cost: Ok(Default::default()), - end_time: Ok(Default::default()), - fargate_price_id: Ok(Default::default()), - fargate_task_arn: Ok(Default::default()), - result_posted: Ok(Default::default()), - s3_bucket: Ok(Default::default()), - sqs_message: Ok(Default::default()), - start_time: Ok(Default::default()), - state_machine_id: Ok(Default::default()), - status: Ok(Default::default()), - step: Ok(Default::default()), - torn_down: Ok(Default::default()), + country: Err("no value supplied for country".to_string()), + latitude: Ok(Default::default()), + longitude: Ok(Default::default()), + name: Err("no value supplied for name".to_string()), + region: Ok(Default::default()), + speed_limit: Ok(Default::default()), + state: Err("no value supplied for state".to_string()), + state_abbrev: Ok(Default::default()), } } } - impl AnalysisPost { - pub fn cost(mut self, value: T) -> Self + impl CityPost { + pub fn country(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { - self.cost = value + self.country = value .try_into() - .map_err(|e| format!("error converting supplied value for cost: {}", e)); + .map_err(|e| format!("error converting supplied value for country: {}", e)); self } - pub fn end_time(mut self, value: T) -> Self + pub fn latitude(mut self, value: T) -> Self where - T: std::convert::TryInto< - ::std::option::Option>, - >, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { - self.end_time = value + self.latitude = value .try_into() - .map_err(|e| format!("error converting supplied value for end_time: {}", e)); - self - } - pub fn fargate_price_id(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.fargate_price_id = value.try_into().map_err(|e| { - format!( - "error converting supplied value for fargate_price_id: {}", - e - ) - }); + .map_err(|e| format!("error converting supplied value for latitude: {}", e)); self } - pub fn fargate_task_arn(mut self, value: T) -> Self + pub fn longitude(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { - self.fargate_task_arn = value.try_into().map_err(|e| { - format!( - "error converting supplied value for fargate_task_arn: {}", - e - ) - }); + self.longitude = value + .try_into() + .map_err(|e| format!("error converting supplied value for longitude: {}", e)); self } - pub fn result_posted(mut self, value: T) -> Self + pub fn name(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { - self.result_posted = value.try_into().map_err(|e| { - format!("error converting supplied value for result_posted: {}", e) - }); + self.name = value + .try_into() + .map_err(|e| format!("error converting supplied value for name: {}", e)); self } - pub fn s3_bucket(mut self, value: T) -> Self + pub fn region(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, { - self.s3_bucket = value + self.region = value .try_into() - .map_err(|e| format!("error converting supplied value for s3_bucket: {}", e)); + .map_err(|e| format!("error converting supplied value for region: {}", e)); self } - pub fn sqs_message(mut self, value: T) -> Self + pub fn speed_limit(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { - self.sqs_message = value + self.speed_limit = value .try_into() - .map_err(|e| format!("error converting supplied value for sqs_message: {}", e)); + .map_err(|e| format!("error converting supplied value for speed_limit: {}", e)); self } - pub fn start_time(mut self, value: T) -> Self + pub fn state(mut self, value: T) -> Self where - T: std::convert::TryInto< - ::std::option::Option>, - >, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { - self.start_time = value + self.state = value .try_into() - .map_err(|e| format!("error converting supplied value for start_time: {}", e)); + .map_err(|e| format!("error converting supplied value for state: {}", e)); self } - pub fn state_machine_id(mut self, value: T) -> Self + pub fn state_abbrev(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, { - self.state_machine_id = value.try_into().map_err(|e| { - format!( - "error converting supplied value for state_machine_id: {}", - e - ) + self.state_abbrev = value.try_into().map_err(|e| { + format!("error converting supplied value for state_abbrev: {}", e) }); self } - pub fn status(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.status = value - .try_into() - .map_err(|e| format!("error converting supplied value for status: {}", e)); - self + } + + impl ::std::convert::TryFrom for super::CityPost { + type Error = super::error::ConversionError; + fn try_from( + value: CityPost, + ) -> ::std::result::Result { + Ok(Self { + country: value.country?, + latitude: value.latitude?, + longitude: value.longitude?, + name: value.name?, + region: value.region?, + speed_limit: value.speed_limit?, + state: value.state?, + state_abbrev: value.state_abbrev?, + }) } - pub fn step(mut self, value: T) -> Self + } + + impl ::std::convert::From for CityPost { + fn from(value: super::CityPost) -> Self { + Self { + country: Ok(value.country), + latitude: Ok(value.latitude), + longitude: Ok(value.longitude), + name: Ok(value.name), + region: Ok(value.region), + speed_limit: Ok(value.speed_limit), + state: Ok(value.state), + state_abbrev: Ok(value.state_abbrev), + } + } + } + + #[derive(Clone, Debug)] + pub struct CityRatings { + city: ::std::result::Result, + ratings: + ::std::result::Result<::std::vec::Vec, ::std::string::String>, + } + + impl ::std::default::Default for CityRatings { + fn default() -> Self { + Self { + city: Err("no value supplied for city".to_string()), + ratings: Err("no value supplied for ratings".to_string()), + } + } + } + + impl CityRatings { + pub fn city(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { - self.step = value + self.city = value .try_into() - .map_err(|e| format!("error converting supplied value for step: {}", e)); + .map_err(|e| format!("error converting supplied value for city: {}", e)); self } - pub fn torn_down(mut self, value: T) -> Self + pub fn ratings(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, { - self.torn_down = value + self.ratings = value .try_into() - .map_err(|e| format!("error converting supplied value for torn_down: {}", e)); + .map_err(|e| format!("error converting supplied value for ratings: {}", e)); self } } - impl ::std::convert::TryFrom for super::AnalysisPost { + impl ::std::convert::TryFrom for super::CityRatings { type Error = super::error::ConversionError; fn try_from( - value: AnalysisPost, + value: CityRatings, ) -> ::std::result::Result { Ok(Self { - cost: value.cost?, - end_time: value.end_time?, - fargate_price_id: value.fargate_price_id?, - fargate_task_arn: value.fargate_task_arn?, - result_posted: value.result_posted?, - s3_bucket: value.s3_bucket?, - sqs_message: value.sqs_message?, - start_time: value.start_time?, - state_machine_id: value.state_machine_id?, - status: value.status?, - step: value.step?, - torn_down: value.torn_down?, + city: value.city?, + ratings: value.ratings?, }) } } - impl From for AnalysisPost { - fn from(value: super::AnalysisPost) -> Self { + impl ::std::convert::From for CityRatings { + fn from(value: super::CityRatings) -> Self { Self { - cost: Ok(value.cost), - end_time: Ok(value.end_time), - fargate_price_id: Ok(value.fargate_price_id), - fargate_task_arn: Ok(value.fargate_task_arn), - result_posted: Ok(value.result_posted), - s3_bucket: Ok(value.s3_bucket), - sqs_message: Ok(value.sqs_message), - start_time: Ok(value.start_time), - state_machine_id: Ok(value.state_machine_id), - status: Ok(value.status), - step: Ok(value.step), - torn_down: Ok(value.torn_down), + city: Ok(value.city), + ratings: Ok(value.ratings), } } } #[derive(Clone, Debug)] - pub struct Bna { - city_id: ::std::result::Result, - community_centers: - ::std::result::Result<::std::option::Option, ::std::string::String>, - coreservices_score: - ::std::result::Result<::std::option::Option, ::std::string::String>, + pub struct CoreServices { dentists: ::std::result::Result<::std::option::Option, ::std::string::String>, doctors: ::std::result::Result<::std::option::Option, ::std::string::String>, - employment: ::std::result::Result<::std::option::Option, ::std::string::String>, grocery: ::std::result::Result<::std::option::Option, ::std::string::String>, - high_stress_miles: - ::std::result::Result<::std::option::Option, ::std::string::String>, - higher_education: - ::std::result::Result<::std::option::Option, ::std::string::String>, hospitals: ::std::result::Result<::std::option::Option, ::std::string::String>, - id: ::std::result::Result, - k12_education: ::std::result::Result<::std::option::Option, ::std::string::String>, - low_stress_miles: - ::std::result::Result<::std::option::Option, ::std::string::String>, - opportunity_score: - ::std::result::Result<::std::option::Option, ::std::string::String>, - parks: ::std::result::Result<::std::option::Option, ::std::string::String>, - people: ::std::result::Result<::std::option::Option, ::std::string::String>, pharmacies: ::std::result::Result<::std::option::Option, ::std::string::String>, - recreation_score: - ::std::result::Result<::std::option::Option, ::std::string::String>, - recreation_trails: - ::std::result::Result<::std::option::Option, ::std::string::String>, - retail: ::std::result::Result<::std::option::Option, ::std::string::String>, - score: ::std::result::Result, + score: ::std::result::Result<::std::option::Option, ::std::string::String>, social_services: ::std::result::Result<::std::option::Option, ::std::string::String>, - technical_vocational_college: - ::std::result::Result<::std::option::Option, ::std::string::String>, - transit: ::std::result::Result<::std::option::Option, ::std::string::String>, - version: ::std::result::Result<::std::string::String, ::std::string::String>, } - impl Default for Bna { + impl ::std::default::Default for CoreServices { fn default() -> Self { Self { - city_id: Err("no value supplied for city_id".to_string()), - community_centers: Ok(Default::default()), - coreservices_score: Ok(Default::default()), dentists: Ok(Default::default()), doctors: Ok(Default::default()), - employment: Ok(Default::default()), grocery: Ok(Default::default()), - high_stress_miles: Ok(Default::default()), - higher_education: Ok(Default::default()), hospitals: Ok(Default::default()), - id: Err("no value supplied for id".to_string()), - k12_education: Ok(Default::default()), - low_stress_miles: Ok(Default::default()), - opportunity_score: Ok(Default::default()), - parks: Ok(Default::default()), - people: Ok(Default::default()), pharmacies: Ok(Default::default()), - recreation_score: Ok(Default::default()), - recreation_trails: Ok(Default::default()), - retail: Ok(Default::default()), - score: Err("no value supplied for score".to_string()), + score: Ok(Default::default()), social_services: Ok(Default::default()), - technical_vocational_college: Ok(Default::default()), - transit: Ok(Default::default()), - version: Err("no value supplied for version".to_string()), } } } - - impl Bna { - pub fn city_id(mut self, value: T) -> Self - where - T: std::convert::TryInto, - T::Error: std::fmt::Display, - { - self.city_id = value - .try_into() - .map_err(|e| format!("error converting supplied value for city_id: {}", e)); - self - } - pub fn community_centers(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.community_centers = value.try_into().map_err(|e| { - format!( - "error converting supplied value for community_centers: {}", - e - ) - }); - self - } - pub fn coreservices_score(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.coreservices_score = value.try_into().map_err(|e| { - format!( - "error converting supplied value for coreservices_score: {}", - e - ) - }); - self - } + + impl CoreServices { pub fn dentists(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { self.dentists = value .try_into() @@ -4728,186 +5116,48 @@ pub mod types { } pub fn doctors(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { self.doctors = value .try_into() .map_err(|e| format!("error converting supplied value for doctors: {}", e)); self } - pub fn employment(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.employment = value - .try_into() - .map_err(|e| format!("error converting supplied value for employment: {}", e)); - self - } pub fn grocery(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { self.grocery = value .try_into() .map_err(|e| format!("error converting supplied value for grocery: {}", e)); self } - pub fn high_stress_miles(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.high_stress_miles = value.try_into().map_err(|e| { - format!( - "error converting supplied value for high_stress_miles: {}", - e - ) - }); - self - } - pub fn higher_education(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.higher_education = value.try_into().map_err(|e| { - format!( - "error converting supplied value for higher_education: {}", - e - ) - }); - self - } pub fn hospitals(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { self.hospitals = value .try_into() .map_err(|e| format!("error converting supplied value for hospitals: {}", e)); self } - pub fn id(mut self, value: T) -> Self - where - T: std::convert::TryInto, - T::Error: std::fmt::Display, - { - self.id = value - .try_into() - .map_err(|e| format!("error converting supplied value for id: {}", e)); - self - } - pub fn k12_education(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.k12_education = value.try_into().map_err(|e| { - format!("error converting supplied value for k12_education: {}", e) - }); - self - } - pub fn low_stress_miles(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.low_stress_miles = value.try_into().map_err(|e| { - format!( - "error converting supplied value for low_stress_miles: {}", - e - ) - }); - self - } - pub fn opportunity_score(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.opportunity_score = value.try_into().map_err(|e| { - format!( - "error converting supplied value for opportunity_score: {}", - e - ) - }); - self - } - pub fn parks(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.parks = value - .try_into() - .map_err(|e| format!("error converting supplied value for parks: {}", e)); - self - } - pub fn people(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.people = value - .try_into() - .map_err(|e| format!("error converting supplied value for people: {}", e)); - self - } pub fn pharmacies(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { self.pharmacies = value .try_into() .map_err(|e| format!("error converting supplied value for pharmacies: {}", e)); self } - pub fn recreation_score(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.recreation_score = value.try_into().map_err(|e| { - format!( - "error converting supplied value for recreation_score: {}", - e - ) - }); - self - } - pub fn recreation_trails(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.recreation_trails = value.try_into().map_err(|e| { - format!( - "error converting supplied value for recreation_trails: {}", - e - ) - }); - self - } - pub fn retail(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.retail = value - .try_into() - .map_err(|e| format!("error converting supplied value for retail: {}", e)); - self - } pub fn score(mut self, value: T) -> Self where - T: std::convert::TryInto, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { self.score = value .try_into() @@ -4916,1889 +5166,1608 @@ pub mod types { } pub fn social_services(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { self.social_services = value.try_into().map_err(|e| { format!("error converting supplied value for social_services: {}", e) }); self } - pub fn technical_vocational_college(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.technical_vocational_college = value.try_into().map_err(|e| { - format!( - "error converting supplied value for technical_vocational_college: {}", - e - ) - }); - self - } - pub fn transit(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.transit = value - .try_into() - .map_err(|e| format!("error converting supplied value for transit: {}", e)); - self - } - pub fn version(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::string::String>, - T::Error: std::fmt::Display, - { - self.version = value - .try_into() - .map_err(|e| format!("error converting supplied value for version: {}", e)); - self - } } - impl ::std::convert::TryFrom for super::Bna { + impl ::std::convert::TryFrom for super::CoreServices { type Error = super::error::ConversionError; - fn try_from(value: Bna) -> ::std::result::Result { + fn try_from( + value: CoreServices, + ) -> ::std::result::Result { Ok(Self { - city_id: value.city_id?, - community_centers: value.community_centers?, - coreservices_score: value.coreservices_score?, dentists: value.dentists?, doctors: value.doctors?, - employment: value.employment?, grocery: value.grocery?, - high_stress_miles: value.high_stress_miles?, - higher_education: value.higher_education?, hospitals: value.hospitals?, - id: value.id?, - k12_education: value.k12_education?, - low_stress_miles: value.low_stress_miles?, - opportunity_score: value.opportunity_score?, - parks: value.parks?, - people: value.people?, pharmacies: value.pharmacies?, - recreation_score: value.recreation_score?, - recreation_trails: value.recreation_trails?, - retail: value.retail?, score: value.score?, social_services: value.social_services?, - technical_vocational_college: value.technical_vocational_college?, - transit: value.transit?, - version: value.version?, }) } } - impl From for Bna { - fn from(value: super::Bna) -> Self { + impl ::std::convert::From for CoreServices { + fn from(value: super::CoreServices) -> Self { Self { - city_id: Ok(value.city_id), - community_centers: Ok(value.community_centers), - coreservices_score: Ok(value.coreservices_score), dentists: Ok(value.dentists), doctors: Ok(value.doctors), - employment: Ok(value.employment), grocery: Ok(value.grocery), - high_stress_miles: Ok(value.high_stress_miles), - higher_education: Ok(value.higher_education), hospitals: Ok(value.hospitals), - id: Ok(value.id), - k12_education: Ok(value.k12_education), - low_stress_miles: Ok(value.low_stress_miles), - opportunity_score: Ok(value.opportunity_score), - parks: Ok(value.parks), - people: Ok(value.people), pharmacies: Ok(value.pharmacies), - recreation_score: Ok(value.recreation_score), - recreation_trails: Ok(value.recreation_trails), - retail: Ok(value.retail), score: Ok(value.score), social_services: Ok(value.social_services), - technical_vocational_college: Ok(value.technical_vocational_college), - transit: Ok(value.transit), - version: Ok(value.version), } } } #[derive(Clone, Debug)] - pub struct BnaPost { - core_services: ::std::result::Result, - infrastructure: ::std::result::Result, - opportunity: ::std::result::Result, - people: ::std::result::Result, - recreation: ::std::result::Result, - retail: ::std::result::Result, - summary: ::std::result::Result, - transit: ::std::result::Result, + pub struct FargatePrice { + created_at: + ::std::result::Result, ::std::string::String>, + id: ::std::result::Result, + per_second: ::std::result::Result<::std::string::String, ::std::string::String>, } - impl Default for BnaPost { + impl ::std::default::Default for FargatePrice { fn default() -> Self { Self { - core_services: Err("no value supplied for core_services".to_string()), - infrastructure: Err("no value supplied for infrastructure".to_string()), - opportunity: Err("no value supplied for opportunity".to_string()), - people: Err("no value supplied for people".to_string()), - recreation: Err("no value supplied for recreation".to_string()), - retail: Err("no value supplied for retail".to_string()), - summary: Err("no value supplied for summary".to_string()), - transit: Err("no value supplied for transit".to_string()), + created_at: Err("no value supplied for created_at".to_string()), + id: Err("no value supplied for id".to_string()), + per_second: Err("no value supplied for per_second".to_string()), } } } - impl BnaPost { - pub fn core_services(mut self, value: T) -> Self - where - T: std::convert::TryInto, - T::Error: std::fmt::Display, - { - self.core_services = value.try_into().map_err(|e| { - format!("error converting supplied value for core_services: {}", e) - }); - self - } - pub fn infrastructure(mut self, value: T) -> Self - where - T: std::convert::TryInto, - T::Error: std::fmt::Display, - { - self.infrastructure = value.try_into().map_err(|e| { - format!("error converting supplied value for infrastructure: {}", e) - }); - self - } - pub fn opportunity(mut self, value: T) -> Self + impl FargatePrice { + pub fn created_at(mut self, value: T) -> Self where - T: std::convert::TryInto, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto>, + T::Error: ::std::fmt::Display, { - self.opportunity = value + self.created_at = value .try_into() - .map_err(|e| format!("error converting supplied value for opportunity: {}", e)); + .map_err(|e| format!("error converting supplied value for created_at: {}", e)); self } - pub fn people(mut self, value: T) -> Self + pub fn id(mut self, value: T) -> Self where - T: std::convert::TryInto, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { - self.people = value + self.id = value .try_into() - .map_err(|e| format!("error converting supplied value for people: {}", e)); + .map_err(|e| format!("error converting supplied value for id: {}", e)); self } - pub fn recreation(mut self, value: T) -> Self + pub fn per_second(mut self, value: T) -> Self where - T: std::convert::TryInto, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { - self.recreation = value + self.per_second = value .try_into() - .map_err(|e| format!("error converting supplied value for recreation: {}", e)); + .map_err(|e| format!("error converting supplied value for per_second: {}", e)); self } - pub fn retail(mut self, value: T) -> Self - where - T: std::convert::TryInto, - T::Error: std::fmt::Display, - { - self.retail = value - .try_into() - .map_err(|e| format!("error converting supplied value for retail: {}", e)); - self + } + + impl ::std::convert::TryFrom for super::FargatePrice { + type Error = super::error::ConversionError; + fn try_from( + value: FargatePrice, + ) -> ::std::result::Result { + Ok(Self { + created_at: value.created_at?, + id: value.id?, + per_second: value.per_second?, + }) + } + } + + impl ::std::convert::From for FargatePrice { + fn from(value: super::FargatePrice) -> Self { + Self { + created_at: Ok(value.created_at), + id: Ok(value.id), + per_second: Ok(value.per_second), + } + } + } + + #[derive(Clone, Debug)] + pub struct GetCitiesSubmissionResponse { + errors: ::std::result::Result<::std::vec::Vec, ::std::string::String>, + } + + impl ::std::default::Default for GetCitiesSubmissionResponse { + fn default() -> Self { + Self { + errors: Err("no value supplied for errors".to_string()), + } } - pub fn summary(mut self, value: T) -> Self + } + + impl GetCitiesSubmissionResponse { + pub fn errors(mut self, value: T) -> Self where - T: std::convert::TryInto, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, { - self.summary = value + self.errors = value .try_into() - .map_err(|e| format!("error converting supplied value for summary: {}", e)); + .map_err(|e| format!("error converting supplied value for errors: {}", e)); self } - pub fn transit(mut self, value: T) -> Self + } + + impl ::std::convert::TryFrom for super::GetCitiesSubmissionResponse { + type Error = super::error::ConversionError; + fn try_from( + value: GetCitiesSubmissionResponse, + ) -> ::std::result::Result { + Ok(Self { + errors: value.errors?, + }) + } + } + + impl ::std::convert::From for GetCitiesSubmissionResponse { + fn from(value: super::GetCitiesSubmissionResponse) -> Self { + Self { + errors: Ok(value.errors), + } + } + } + + #[derive(Clone, Debug)] + pub struct GetCitiesSubmissionsResponse { + errors: ::std::result::Result<::std::vec::Vec, ::std::string::String>, + } + + impl ::std::default::Default for GetCitiesSubmissionsResponse { + fn default() -> Self { + Self { + errors: Err("no value supplied for errors".to_string()), + } + } + } + + impl GetCitiesSubmissionsResponse { + pub fn errors(mut self, value: T) -> Self where - T: std::convert::TryInto, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, { - self.transit = value + self.errors = value .try_into() - .map_err(|e| format!("error converting supplied value for transit: {}", e)); + .map_err(|e| format!("error converting supplied value for errors: {}", e)); self } } - impl ::std::convert::TryFrom for super::BnaPost { + impl ::std::convert::TryFrom for super::GetCitiesSubmissionsResponse { type Error = super::error::ConversionError; fn try_from( - value: BnaPost, + value: GetCitiesSubmissionsResponse, ) -> ::std::result::Result { Ok(Self { - core_services: value.core_services?, - infrastructure: value.infrastructure?, - opportunity: value.opportunity?, - people: value.people?, - recreation: value.recreation?, - retail: value.retail?, - summary: value.summary?, - transit: value.transit?, + errors: value.errors?, }) } } - impl From for BnaPost { - fn from(value: super::BnaPost) -> Self { + impl ::std::convert::From for GetCitiesSubmissionsResponse { + fn from(value: super::GetCitiesSubmissionsResponse) -> Self { Self { - core_services: Ok(value.core_services), - infrastructure: Ok(value.infrastructure), - opportunity: Ok(value.opportunity), - people: Ok(value.people), - recreation: Ok(value.recreation), - retail: Ok(value.retail), - summary: Ok(value.summary), - transit: Ok(value.transit), + errors: Ok(value.errors), } } } #[derive(Clone, Debug)] - pub struct BnaSummary { - city_id: ::std::result::Result, - created_at: ::std::result::Result< - ::std::option::Option>, - ::std::string::String, - >, - rating_id: ::std::result::Result, - score: ::std::result::Result, - version: ::std::result::Result<::std::string::String, ::std::string::String>, + pub struct GetCityCensusesResponse { + errors: ::std::result::Result<::std::vec::Vec, ::std::string::String>, } - impl Default for BnaSummary { + impl ::std::default::Default for GetCityCensusesResponse { fn default() -> Self { Self { - city_id: Err("no value supplied for city_id".to_string()), - created_at: Ok(Default::default()), - rating_id: Err("no value supplied for rating_id".to_string()), - score: Err("no value supplied for score".to_string()), - version: Err("no value supplied for version".to_string()), + errors: Err("no value supplied for errors".to_string()), } } } - impl BnaSummary { - pub fn city_id(mut self, value: T) -> Self + impl GetCityCensusesResponse { + pub fn errors(mut self, value: T) -> Self where - T: std::convert::TryInto, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, { - self.city_id = value + self.errors = value .try_into() - .map_err(|e| format!("error converting supplied value for city_id: {}", e)); + .map_err(|e| format!("error converting supplied value for errors: {}", e)); self } - pub fn created_at(mut self, value: T) -> Self - where - T: std::convert::TryInto< - ::std::option::Option>, - >, - T::Error: std::fmt::Display, - { - self.created_at = value - .try_into() - .map_err(|e| format!("error converting supplied value for created_at: {}", e)); - self + } + + impl ::std::convert::TryFrom for super::GetCityCensusesResponse { + type Error = super::error::ConversionError; + fn try_from( + value: GetCityCensusesResponse, + ) -> ::std::result::Result { + Ok(Self { + errors: value.errors?, + }) } - pub fn rating_id(mut self, value: T) -> Self - where - T: std::convert::TryInto, - T::Error: std::fmt::Display, - { - self.rating_id = value - .try_into() - .map_err(|e| format!("error converting supplied value for rating_id: {}", e)); - self + } + + impl ::std::convert::From for GetCityCensusesResponse { + fn from(value: super::GetCityCensusesResponse) -> Self { + Self { + errors: Ok(value.errors), + } } - pub fn score(mut self, value: T) -> Self - where - T: std::convert::TryInto, - T::Error: std::fmt::Display, - { - self.score = value - .try_into() - .map_err(|e| format!("error converting supplied value for score: {}", e)); - self + } + + #[derive(Clone, Debug)] + pub struct GetCityRatingsResponse { + errors: ::std::result::Result<::std::vec::Vec, ::std::string::String>, + } + + impl ::std::default::Default for GetCityRatingsResponse { + fn default() -> Self { + Self { + errors: Err("no value supplied for errors".to_string()), + } } - pub fn version(mut self, value: T) -> Self + } + + impl GetCityRatingsResponse { + pub fn errors(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::string::String>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, { - self.version = value + self.errors = value .try_into() - .map_err(|e| format!("error converting supplied value for version: {}", e)); + .map_err(|e| format!("error converting supplied value for errors: {}", e)); self } } - impl ::std::convert::TryFrom for super::BnaSummary { + impl ::std::convert::TryFrom for super::GetCityRatingsResponse { type Error = super::error::ConversionError; fn try_from( - value: BnaSummary, + value: GetCityRatingsResponse, ) -> ::std::result::Result { Ok(Self { - city_id: value.city_id?, - created_at: value.created_at?, - rating_id: value.rating_id?, - score: value.score?, - version: value.version?, + errors: value.errors?, }) } } - impl From for BnaSummary { - fn from(value: super::BnaSummary) -> Self { + impl ::std::convert::From for GetCityRatingsResponse { + fn from(value: super::GetCityRatingsResponse) -> Self { Self { - city_id: Ok(value.city_id), - created_at: Ok(value.created_at), - rating_id: Ok(value.rating_id), - score: Ok(value.score), - version: Ok(value.version), + errors: Ok(value.errors), } } } #[derive(Clone, Debug)] - pub struct BnaSummaryWithCityItem { - city_id: ::std::result::Result, - country: ::std::result::Result, - created_at: - ::std::result::Result, ::std::string::String>, - id: ::std::result::Result, - latitude: ::std::result::Result<::std::option::Option, ::std::string::String>, - longitude: ::std::result::Result<::std::option::Option, ::std::string::String>, - name: ::std::result::Result<::std::string::String, ::std::string::String>, - rating_id: ::std::result::Result, - region: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, - score: ::std::result::Result, - speed_limit: ::std::result::Result<::std::option::Option, ::std::string::String>, - state: ::std::result::Result<::std::string::String, ::std::string::String>, - state_abbrev: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, - updated_at: ::std::result::Result< - ::std::option::Option>, - ::std::string::String, - >, - version: ::std::result::Result<::std::string::String, ::std::string::String>, + pub struct GetCityResponse { + errors: ::std::result::Result<::std::vec::Vec, ::std::string::String>, } - impl Default for BnaSummaryWithCityItem { + impl ::std::default::Default for GetCityResponse { fn default() -> Self { Self { - city_id: Err("no value supplied for city_id".to_string()), - country: Err("no value supplied for country".to_string()), - created_at: Err("no value supplied for created_at".to_string()), - id: Err("no value supplied for id".to_string()), - latitude: Ok(Default::default()), - longitude: Ok(Default::default()), - name: Err("no value supplied for name".to_string()), - rating_id: Err("no value supplied for rating_id".to_string()), - region: Ok(Default::default()), - score: Err("no value supplied for score".to_string()), - speed_limit: Ok(Default::default()), - state: Err("no value supplied for state".to_string()), - state_abbrev: Ok(Default::default()), - updated_at: Ok(Default::default()), - version: Err("no value supplied for version".to_string()), + errors: Err("no value supplied for errors".to_string()), } } } - impl BnaSummaryWithCityItem { - pub fn city_id(mut self, value: T) -> Self + impl GetCityResponse { + pub fn errors(mut self, value: T) -> Self where - T: std::convert::TryInto, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, { - self.city_id = value + self.errors = value .try_into() - .map_err(|e| format!("error converting supplied value for city_id: {}", e)); + .map_err(|e| format!("error converting supplied value for errors: {}", e)); self } - pub fn country(mut self, value: T) -> Self - where - T: std::convert::TryInto, - T::Error: std::fmt::Display, - { - self.country = value - .try_into() - .map_err(|e| format!("error converting supplied value for country: {}", e)); - self + } + + impl ::std::convert::TryFrom for super::GetCityResponse { + type Error = super::error::ConversionError; + fn try_from( + value: GetCityResponse, + ) -> ::std::result::Result { + Ok(Self { + errors: value.errors?, + }) } - pub fn created_at(mut self, value: T) -> Self - where - T: std::convert::TryInto>, - T::Error: std::fmt::Display, - { - self.created_at = value - .try_into() - .map_err(|e| format!("error converting supplied value for created_at: {}", e)); - self + } + + impl ::std::convert::From for GetCityResponse { + fn from(value: super::GetCityResponse) -> Self { + Self { + errors: Ok(value.errors), + } } - pub fn id(mut self, value: T) -> Self - where - T: std::convert::TryInto, - T::Error: std::fmt::Display, - { - self.id = value - .try_into() - .map_err(|e| format!("error converting supplied value for id: {}", e)); - self + } + + #[derive(Clone, Debug)] + pub struct GetPipelinesBnaResponse { + errors: ::std::result::Result<::std::vec::Vec, ::std::string::String>, + } + + impl ::std::default::Default for GetPipelinesBnaResponse { + fn default() -> Self { + Self { + errors: Err("no value supplied for errors".to_string()), + } } - pub fn latitude(mut self, value: T) -> Self + } + + impl GetPipelinesBnaResponse { + pub fn errors(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, { - self.latitude = value + self.errors = value .try_into() - .map_err(|e| format!("error converting supplied value for latitude: {}", e)); + .map_err(|e| format!("error converting supplied value for errors: {}", e)); self } - pub fn longitude(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.longitude = value - .try_into() - .map_err(|e| format!("error converting supplied value for longitude: {}", e)); - self + } + + impl ::std::convert::TryFrom for super::GetPipelinesBnaResponse { + type Error = super::error::ConversionError; + fn try_from( + value: GetPipelinesBnaResponse, + ) -> ::std::result::Result { + Ok(Self { + errors: value.errors?, + }) } - pub fn name(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::string::String>, - T::Error: std::fmt::Display, - { - self.name = value - .try_into() - .map_err(|e| format!("error converting supplied value for name: {}", e)); - self + } + + impl ::std::convert::From for GetPipelinesBnaResponse { + fn from(value: super::GetPipelinesBnaResponse) -> Self { + Self { + errors: Ok(value.errors), + } } - pub fn rating_id(mut self, value: T) -> Self - where - T: std::convert::TryInto, - T::Error: std::fmt::Display, - { - self.rating_id = value - .try_into() - .map_err(|e| format!("error converting supplied value for rating_id: {}", e)); - self + } + + #[derive(Clone, Debug)] + pub struct GetPipelinesBnasResponse { + errors: ::std::result::Result<::std::vec::Vec, ::std::string::String>, + } + + impl ::std::default::Default for GetPipelinesBnasResponse { + fn default() -> Self { + Self { + errors: Err("no value supplied for errors".to_string()), + } } - pub fn region(mut self, value: T) -> Self + } + + impl GetPipelinesBnasResponse { + pub fn errors(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, { - self.region = value + self.errors = value .try_into() - .map_err(|e| format!("error converting supplied value for region: {}", e)); + .map_err(|e| format!("error converting supplied value for errors: {}", e)); self } - pub fn score(mut self, value: T) -> Self + } + + impl ::std::convert::TryFrom for super::GetPipelinesBnasResponse { + type Error = super::error::ConversionError; + fn try_from( + value: GetPipelinesBnasResponse, + ) -> ::std::result::Result { + Ok(Self { + errors: value.errors?, + }) + } + } + + impl ::std::convert::From for GetPipelinesBnasResponse { + fn from(value: super::GetPipelinesBnasResponse) -> Self { + Self { + errors: Ok(value.errors), + } + } + } + + #[derive(Clone, Debug)] + pub struct GetPriceFargateResponse { + errors: ::std::result::Result<::std::vec::Vec, ::std::string::String>, + } + + impl ::std::default::Default for GetPriceFargateResponse { + fn default() -> Self { + Self { + errors: Err("no value supplied for errors".to_string()), + } + } + } + + impl GetPriceFargateResponse { + pub fn errors(mut self, value: T) -> Self where - T: std::convert::TryInto, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, { - self.score = value + self.errors = value .try_into() - .map_err(|e| format!("error converting supplied value for score: {}", e)); + .map_err(|e| format!("error converting supplied value for errors: {}", e)); self } - pub fn speed_limit(mut self, value: T) -> Self + } + + impl ::std::convert::TryFrom for super::GetPriceFargateResponse { + type Error = super::error::ConversionError; + fn try_from( + value: GetPriceFargateResponse, + ) -> ::std::result::Result { + Ok(Self { + errors: value.errors?, + }) + } + } + + impl ::std::convert::From for GetPriceFargateResponse { + fn from(value: super::GetPriceFargateResponse) -> Self { + Self { + errors: Ok(value.errors), + } + } + } + + #[derive(Clone, Debug)] + pub struct GetRatingResponse { + errors: ::std::result::Result<::std::vec::Vec, ::std::string::String>, + } + + impl ::std::default::Default for GetRatingResponse { + fn default() -> Self { + Self { + errors: Err("no value supplied for errors".to_string()), + } + } + } + + impl GetRatingResponse { + pub fn errors(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, { - self.speed_limit = value + self.errors = value .try_into() - .map_err(|e| format!("error converting supplied value for speed_limit: {}", e)); + .map_err(|e| format!("error converting supplied value for errors: {}", e)); self } - pub fn state(mut self, value: T) -> Self + } + + impl ::std::convert::TryFrom for super::GetRatingResponse { + type Error = super::error::ConversionError; + fn try_from( + value: GetRatingResponse, + ) -> ::std::result::Result { + Ok(Self { + errors: value.errors?, + }) + } + } + + impl ::std::convert::From for GetRatingResponse { + fn from(value: super::GetRatingResponse) -> Self { + Self { + errors: Ok(value.errors), + } + } + } + + #[derive(Clone, Debug)] + pub struct GetRatingsCityResponse { + errors: ::std::result::Result<::std::vec::Vec, ::std::string::String>, + } + + impl ::std::default::Default for GetRatingsCityResponse { + fn default() -> Self { + Self { + errors: Err("no value supplied for errors".to_string()), + } + } + } + + impl GetRatingsCityResponse { + pub fn errors(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::string::String>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, { - self.state = value + self.errors = value .try_into() - .map_err(|e| format!("error converting supplied value for state: {}", e)); + .map_err(|e| format!("error converting supplied value for errors: {}", e)); self } - pub fn state_abbrev(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, - { - self.state_abbrev = value.try_into().map_err(|e| { - format!("error converting supplied value for state_abbrev: {}", e) - }); - self + } + + impl ::std::convert::TryFrom for super::GetRatingsCityResponse { + type Error = super::error::ConversionError; + fn try_from( + value: GetRatingsCityResponse, + ) -> ::std::result::Result { + Ok(Self { + errors: value.errors?, + }) } - pub fn updated_at(mut self, value: T) -> Self + } + + impl ::std::convert::From for GetRatingsCityResponse { + fn from(value: super::GetRatingsCityResponse) -> Self { + Self { + errors: Ok(value.errors), + } + } + } + + #[derive(Clone, Debug)] + pub struct Infrastructure { + high_stress_miles: + ::std::result::Result<::std::option::Option, ::std::string::String>, + low_stress_miles: + ::std::result::Result<::std::option::Option, ::std::string::String>, + } + + impl ::std::default::Default for Infrastructure { + fn default() -> Self { + Self { + high_stress_miles: Ok(Default::default()), + low_stress_miles: Ok(Default::default()), + } + } + } + + impl Infrastructure { + pub fn high_stress_miles(mut self, value: T) -> Self where - T: std::convert::TryInto< - ::std::option::Option>, - >, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { - self.updated_at = value - .try_into() - .map_err(|e| format!("error converting supplied value for updated_at: {}", e)); + self.high_stress_miles = value.try_into().map_err(|e| { + format!( + "error converting supplied value for high_stress_miles: {}", + e + ) + }); self } - pub fn version(mut self, value: T) -> Self + pub fn low_stress_miles(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::string::String>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { - self.version = value - .try_into() - .map_err(|e| format!("error converting supplied value for version: {}", e)); + self.low_stress_miles = value.try_into().map_err(|e| { + format!( + "error converting supplied value for low_stress_miles: {}", + e + ) + }); self } } - impl ::std::convert::TryFrom for super::BnaSummaryWithCityItem { + impl ::std::convert::TryFrom for super::Infrastructure { type Error = super::error::ConversionError; fn try_from( - value: BnaSummaryWithCityItem, + value: Infrastructure, ) -> ::std::result::Result { Ok(Self { - city_id: value.city_id?, - country: value.country?, - created_at: value.created_at?, - id: value.id?, - latitude: value.latitude?, - longitude: value.longitude?, - name: value.name?, - rating_id: value.rating_id?, - region: value.region?, - score: value.score?, - speed_limit: value.speed_limit?, - state: value.state?, - state_abbrev: value.state_abbrev?, - updated_at: value.updated_at?, - version: value.version?, + high_stress_miles: value.high_stress_miles?, + low_stress_miles: value.low_stress_miles?, }) } } - impl From for BnaSummaryWithCityItem { - fn from(value: super::BnaSummaryWithCityItem) -> Self { + impl ::std::convert::From for Infrastructure { + fn from(value: super::Infrastructure) -> Self { Self { - city_id: Ok(value.city_id), - country: Ok(value.country), - created_at: Ok(value.created_at), - id: Ok(value.id), - latitude: Ok(value.latitude), - longitude: Ok(value.longitude), - name: Ok(value.name), - rating_id: Ok(value.rating_id), - region: Ok(value.region), - score: Ok(value.score), - speed_limit: Ok(value.speed_limit), - state: Ok(value.state), - state_abbrev: Ok(value.state_abbrev), - updated_at: Ok(value.updated_at), - version: Ok(value.version), + high_stress_miles: Ok(value.high_stress_miles), + low_stress_miles: Ok(value.low_stress_miles), } } } #[derive(Clone, Debug)] - pub struct Census { - census_id: ::std::result::Result<::std::option::Option, ::std::string::String>, - city_id: - ::std::result::Result<::std::option::Option, ::std::string::String>, - created_at: ::std::result::Result< - ::std::option::Option>, - ::std::string::String, - >, - fips_code: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, - pop_size: ::std::result::Result< - ::std::option::Option, - ::std::string::String, - >, - population: ::std::result::Result<::std::option::Option, ::std::string::String>, + pub struct Opportunity { + employment: ::std::result::Result<::std::option::Option, ::std::string::String>, + higher_education: + ::std::result::Result<::std::option::Option, ::std::string::String>, + k12_education: ::std::result::Result<::std::option::Option, ::std::string::String>, + score: ::std::result::Result<::std::option::Option, ::std::string::String>, + technical_vocational_college: + ::std::result::Result<::std::option::Option, ::std::string::String>, } - impl Default for Census { + impl ::std::default::Default for Opportunity { fn default() -> Self { Self { - census_id: Ok(Default::default()), - city_id: Ok(Default::default()), - created_at: Ok(Default::default()), - fips_code: Ok(Default::default()), - pop_size: Ok(Default::default()), - population: Ok(Default::default()), + employment: Ok(Default::default()), + higher_education: Ok(Default::default()), + k12_education: Ok(Default::default()), + score: Ok(Default::default()), + technical_vocational_college: Ok(Default::default()), } } } - impl Census { - pub fn census_id(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.census_id = value - .try_into() - .map_err(|e| format!("error converting supplied value for census_id: {}", e)); - self - } - pub fn city_id(mut self, value: T) -> Self + impl Opportunity { + pub fn employment(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { - self.city_id = value + self.employment = value .try_into() - .map_err(|e| format!("error converting supplied value for city_id: {}", e)); + .map_err(|e| format!("error converting supplied value for employment: {}", e)); self } - pub fn created_at(mut self, value: T) -> Self + pub fn higher_education(mut self, value: T) -> Self where - T: std::convert::TryInto< - ::std::option::Option>, - >, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { - self.created_at = value - .try_into() - .map_err(|e| format!("error converting supplied value for created_at: {}", e)); + self.higher_education = value.try_into().map_err(|e| { + format!( + "error converting supplied value for higher_education: {}", + e + ) + }); self } - pub fn fips_code(mut self, value: T) -> Self + pub fn k12_education(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { - self.fips_code = value - .try_into() - .map_err(|e| format!("error converting supplied value for fips_code: {}", e)); + self.k12_education = value.try_into().map_err(|e| { + format!("error converting supplied value for k12_education: {}", e) + }); self } - pub fn pop_size(mut self, value: T) -> Self + pub fn score(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { - self.pop_size = value + self.score = value .try_into() - .map_err(|e| format!("error converting supplied value for pop_size: {}", e)); + .map_err(|e| format!("error converting supplied value for score: {}", e)); self } - pub fn population(mut self, value: T) -> Self + pub fn technical_vocational_college(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { - self.population = value - .try_into() - .map_err(|e| format!("error converting supplied value for population: {}", e)); + self.technical_vocational_college = value.try_into().map_err(|e| { + format!( + "error converting supplied value for technical_vocational_college: {}", + e + ) + }); self } } - impl ::std::convert::TryFrom for super::Census { + impl ::std::convert::TryFrom for super::Opportunity { type Error = super::error::ConversionError; fn try_from( - value: Census, + value: Opportunity, ) -> ::std::result::Result { Ok(Self { - census_id: value.census_id?, - city_id: value.city_id?, - created_at: value.created_at?, - fips_code: value.fips_code?, - pop_size: value.pop_size?, - population: value.population?, + employment: value.employment?, + higher_education: value.higher_education?, + k12_education: value.k12_education?, + score: value.score?, + technical_vocational_college: value.technical_vocational_college?, }) } } - impl From for Census { - fn from(value: super::Census) -> Self { + impl ::std::convert::From for Opportunity { + fn from(value: super::Opportunity) -> Self { Self { - census_id: Ok(value.census_id), - city_id: Ok(value.city_id), - created_at: Ok(value.created_at), - fips_code: Ok(value.fips_code), - pop_size: Ok(value.pop_size), - population: Ok(value.population), + employment: Ok(value.employment), + higher_education: Ok(value.higher_education), + k12_education: Ok(value.k12_education), + score: Ok(value.score), + technical_vocational_college: Ok(value.technical_vocational_college), } } } #[derive(Clone, Debug)] - pub struct CensusPost { - fips_code: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, - pop_size: ::std::result::Result< - ::std::option::Option, - ::std::string::String, - >, - population: ::std::result::Result<::std::option::Option, ::std::string::String>, + pub struct PatchCitiesSubmissionResponse { + errors: ::std::result::Result<::std::vec::Vec, ::std::string::String>, } - impl Default for CensusPost { + impl ::std::default::Default for PatchCitiesSubmissionResponse { fn default() -> Self { Self { - fips_code: Ok(Default::default()), - pop_size: Ok(Default::default()), - population: Ok(Default::default()), + errors: Err("no value supplied for errors".to_string()), } } } - impl CensusPost { - pub fn fips_code(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, - { - self.fips_code = value - .try_into() - .map_err(|e| format!("error converting supplied value for fips_code: {}", e)); - self - } - pub fn pop_size(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.pop_size = value - .try_into() - .map_err(|e| format!("error converting supplied value for pop_size: {}", e)); - self - } - pub fn population(mut self, value: T) -> Self + impl PatchCitiesSubmissionResponse { + pub fn errors(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, { - self.population = value + self.errors = value .try_into() - .map_err(|e| format!("error converting supplied value for population: {}", e)); + .map_err(|e| format!("error converting supplied value for errors: {}", e)); self } } - impl ::std::convert::TryFrom for super::CensusPost { + impl ::std::convert::TryFrom + for super::PatchCitiesSubmissionResponse + { type Error = super::error::ConversionError; fn try_from( - value: CensusPost, + value: PatchCitiesSubmissionResponse, ) -> ::std::result::Result { Ok(Self { - fips_code: value.fips_code?, - pop_size: value.pop_size?, - population: value.population?, + errors: value.errors?, }) } } - impl From for CensusPost { - fn from(value: super::CensusPost) -> Self { + impl ::std::convert::From for PatchCitiesSubmissionResponse { + fn from(value: super::PatchCitiesSubmissionResponse) -> Self { Self { - fips_code: Ok(value.fips_code), - pop_size: Ok(value.pop_size), - population: Ok(value.population), + errors: Ok(value.errors), } } } #[derive(Clone, Debug)] - pub struct City { - country: ::std::result::Result, - created_at: - ::std::result::Result, ::std::string::String>, - id: ::std::result::Result, - latitude: ::std::result::Result<::std::option::Option, ::std::string::String>, - longitude: ::std::result::Result<::std::option::Option, ::std::string::String>, - name: ::std::result::Result<::std::string::String, ::std::string::String>, - region: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, - speed_limit: ::std::result::Result<::std::option::Option, ::std::string::String>, - state: ::std::result::Result<::std::string::String, ::std::string::String>, - state_abbrev: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, - updated_at: ::std::result::Result< - ::std::option::Option>, - ::std::string::String, - >, + pub struct PatchPipelinesBnaResponse { + errors: ::std::result::Result<::std::vec::Vec, ::std::string::String>, } - impl Default for City { + impl ::std::default::Default for PatchPipelinesBnaResponse { fn default() -> Self { Self { - country: Err("no value supplied for country".to_string()), - created_at: Err("no value supplied for created_at".to_string()), - id: Err("no value supplied for id".to_string()), - latitude: Ok(Default::default()), - longitude: Ok(Default::default()), - name: Err("no value supplied for name".to_string()), - region: Ok(Default::default()), - speed_limit: Ok(Default::default()), - state: Err("no value supplied for state".to_string()), - state_abbrev: Ok(Default::default()), - updated_at: Ok(Default::default()), + errors: Err("no value supplied for errors".to_string()), } } } - impl City { - pub fn country(mut self, value: T) -> Self - where - T: std::convert::TryInto, - T::Error: std::fmt::Display, - { - self.country = value - .try_into() - .map_err(|e| format!("error converting supplied value for country: {}", e)); - self - } - pub fn created_at(mut self, value: T) -> Self - where - T: std::convert::TryInto>, - T::Error: std::fmt::Display, - { - self.created_at = value - .try_into() - .map_err(|e| format!("error converting supplied value for created_at: {}", e)); - self - } - pub fn id(mut self, value: T) -> Self - where - T: std::convert::TryInto, - T::Error: std::fmt::Display, - { - self.id = value - .try_into() - .map_err(|e| format!("error converting supplied value for id: {}", e)); - self - } - pub fn latitude(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.latitude = value - .try_into() - .map_err(|e| format!("error converting supplied value for latitude: {}", e)); - self - } - pub fn longitude(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.longitude = value - .try_into() - .map_err(|e| format!("error converting supplied value for longitude: {}", e)); - self - } - pub fn name(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::string::String>, - T::Error: std::fmt::Display, - { - self.name = value - .try_into() - .map_err(|e| format!("error converting supplied value for name: {}", e)); - self - } - pub fn region(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, - { - self.region = value - .try_into() - .map_err(|e| format!("error converting supplied value for region: {}", e)); - self - } - pub fn speed_limit(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.speed_limit = value - .try_into() - .map_err(|e| format!("error converting supplied value for speed_limit: {}", e)); - self - } - pub fn state(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::string::String>, - T::Error: std::fmt::Display, - { - self.state = value - .try_into() - .map_err(|e| format!("error converting supplied value for state: {}", e)); - self - } - pub fn state_abbrev(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, - { - self.state_abbrev = value.try_into().map_err(|e| { - format!("error converting supplied value for state_abbrev: {}", e) - }); - self - } - pub fn updated_at(mut self, value: T) -> Self + impl PatchPipelinesBnaResponse { + pub fn errors(mut self, value: T) -> Self where - T: std::convert::TryInto< - ::std::option::Option>, - >, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, { - self.updated_at = value + self.errors = value .try_into() - .map_err(|e| format!("error converting supplied value for updated_at: {}", e)); + .map_err(|e| format!("error converting supplied value for errors: {}", e)); self } } - impl ::std::convert::TryFrom for super::City { + impl ::std::convert::TryFrom for super::PatchPipelinesBnaResponse { type Error = super::error::ConversionError; - fn try_from(value: City) -> ::std::result::Result { + fn try_from( + value: PatchPipelinesBnaResponse, + ) -> ::std::result::Result { Ok(Self { - country: value.country?, - created_at: value.created_at?, - id: value.id?, - latitude: value.latitude?, - longitude: value.longitude?, - name: value.name?, - region: value.region?, - speed_limit: value.speed_limit?, - state: value.state?, - state_abbrev: value.state_abbrev?, - updated_at: value.updated_at?, + errors: value.errors?, }) } } - impl From for City { - fn from(value: super::City) -> Self { + impl ::std::convert::From for PatchPipelinesBnaResponse { + fn from(value: super::PatchPipelinesBnaResponse) -> Self { Self { - country: Ok(value.country), - created_at: Ok(value.created_at), - id: Ok(value.id), - latitude: Ok(value.latitude), - longitude: Ok(value.longitude), - name: Ok(value.name), - region: Ok(value.region), - speed_limit: Ok(value.speed_limit), - state: Ok(value.state), - state_abbrev: Ok(value.state_abbrev), - updated_at: Ok(value.updated_at), + errors: Ok(value.errors), } } } #[derive(Clone, Debug)] - pub struct CityPost { - country: ::std::result::Result, - latitude: ::std::result::Result<::std::option::Option, ::std::string::String>, - longitude: ::std::result::Result<::std::option::Option, ::std::string::String>, - name: ::std::result::Result<::std::string::String, ::std::string::String>, - speed_limit: ::std::result::Result<::std::option::Option, ::std::string::String>, - state: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, - state_abbrev: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, + pub struct People { + people: ::std::result::Result<::std::option::Option, ::std::string::String>, } - impl Default for CityPost { + impl ::std::default::Default for People { fn default() -> Self { Self { - country: Err("no value supplied for country".to_string()), - latitude: Ok(Default::default()), - longitude: Ok(Default::default()), - name: Err("no value supplied for name".to_string()), - speed_limit: Ok(Default::default()), - state: Ok(Default::default()), - state_abbrev: Ok(Default::default()), + people: Ok(Default::default()), } } } - impl CityPost { - pub fn country(mut self, value: T) -> Self - where - T: std::convert::TryInto, - T::Error: std::fmt::Display, - { - self.country = value - .try_into() - .map_err(|e| format!("error converting supplied value for country: {}", e)); - self - } - pub fn latitude(mut self, value: T) -> Self + impl People { + pub fn people(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { - self.latitude = value + self.people = value .try_into() - .map_err(|e| format!("error converting supplied value for latitude: {}", e)); + .map_err(|e| format!("error converting supplied value for people: {}", e)); self } - pub fn longitude(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.longitude = value - .try_into() - .map_err(|e| format!("error converting supplied value for longitude: {}", e)); - self + } + + impl ::std::convert::TryFrom for super::People { + type Error = super::error::ConversionError; + fn try_from( + value: People, + ) -> ::std::result::Result { + Ok(Self { + people: value.people?, + }) } - pub fn name(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::string::String>, - T::Error: std::fmt::Display, - { - self.name = value - .try_into() - .map_err(|e| format!("error converting supplied value for name: {}", e)); - self + } + + impl ::std::convert::From for People { + fn from(value: super::People) -> Self { + Self { + people: Ok(value.people), + } } - pub fn speed_limit(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.speed_limit = value - .try_into() - .map_err(|e| format!("error converting supplied value for speed_limit: {}", e)); - self + } + + #[derive(Clone, Debug)] + pub struct PostCitiesSubmissionResponse { + errors: ::std::result::Result<::std::vec::Vec, ::std::string::String>, + } + + impl ::std::default::Default for PostCitiesSubmissionResponse { + fn default() -> Self { + Self { + errors: Err("no value supplied for errors".to_string()), + } } - pub fn state(mut self, value: T) -> Self + } + + impl PostCitiesSubmissionResponse { + pub fn errors(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, { - self.state = value + self.errors = value .try_into() - .map_err(|e| format!("error converting supplied value for state: {}", e)); - self - } - pub fn state_abbrev(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, - { - self.state_abbrev = value.try_into().map_err(|e| { - format!("error converting supplied value for state_abbrev: {}", e) - }); + .map_err(|e| format!("error converting supplied value for errors: {}", e)); self } } - impl ::std::convert::TryFrom for super::CityPost { + impl ::std::convert::TryFrom for super::PostCitiesSubmissionResponse { type Error = super::error::ConversionError; fn try_from( - value: CityPost, + value: PostCitiesSubmissionResponse, ) -> ::std::result::Result { Ok(Self { - country: value.country?, - latitude: value.latitude?, - longitude: value.longitude?, - name: value.name?, - speed_limit: value.speed_limit?, - state: value.state?, - state_abbrev: value.state_abbrev?, + errors: value.errors?, }) } } - impl From for CityPost { - fn from(value: super::CityPost) -> Self { + impl ::std::convert::From for PostCitiesSubmissionResponse { + fn from(value: super::PostCitiesSubmissionResponse) -> Self { Self { - country: Ok(value.country), - latitude: Ok(value.latitude), - longitude: Ok(value.longitude), - name: Ok(value.name), - speed_limit: Ok(value.speed_limit), - state: Ok(value.state), - state_abbrev: Ok(value.state_abbrev), + errors: Ok(value.errors), } } } #[derive(Clone, Debug)] - pub struct CoreServices { - dentists: ::std::result::Result<::std::option::Option, ::std::string::String>, - doctors: ::std::result::Result<::std::option::Option, ::std::string::String>, - grocery: ::std::result::Result<::std::option::Option, ::std::string::String>, - hospitals: ::std::result::Result<::std::option::Option, ::std::string::String>, - pharmacies: ::std::result::Result<::std::option::Option, ::std::string::String>, - score: ::std::result::Result<::std::option::Option, ::std::string::String>, - social_services: - ::std::result::Result<::std::option::Option, ::std::string::String>, + pub struct PostCityCensusResponse { + errors: ::std::result::Result<::std::vec::Vec, ::std::string::String>, } - impl Default for CoreServices { + impl ::std::default::Default for PostCityCensusResponse { fn default() -> Self { Self { - dentists: Ok(Default::default()), - doctors: Ok(Default::default()), - grocery: Ok(Default::default()), - hospitals: Ok(Default::default()), - pharmacies: Ok(Default::default()), - score: Ok(Default::default()), - social_services: Ok(Default::default()), + errors: Err("no value supplied for errors".to_string()), } } } - impl CoreServices { - pub fn dentists(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.dentists = value - .try_into() - .map_err(|e| format!("error converting supplied value for dentists: {}", e)); - self - } - pub fn doctors(mut self, value: T) -> Self + impl PostCityCensusResponse { + pub fn errors(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, { - self.doctors = value + self.errors = value .try_into() - .map_err(|e| format!("error converting supplied value for doctors: {}", e)); + .map_err(|e| format!("error converting supplied value for errors: {}", e)); self } - pub fn grocery(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.grocery = value - .try_into() - .map_err(|e| format!("error converting supplied value for grocery: {}", e)); - self + } + + impl ::std::convert::TryFrom for super::PostCityCensusResponse { + type Error = super::error::ConversionError; + fn try_from( + value: PostCityCensusResponse, + ) -> ::std::result::Result { + Ok(Self { + errors: value.errors?, + }) } - pub fn hospitals(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.hospitals = value - .try_into() - .map_err(|e| format!("error converting supplied value for hospitals: {}", e)); - self + } + + impl ::std::convert::From for PostCityCensusResponse { + fn from(value: super::PostCityCensusResponse) -> Self { + Self { + errors: Ok(value.errors), + } } - pub fn pharmacies(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.pharmacies = value - .try_into() - .map_err(|e| format!("error converting supplied value for pharmacies: {}", e)); - self + } + + #[derive(Clone, Debug)] + pub struct PostCityResponse { + errors: ::std::result::Result<::std::vec::Vec, ::std::string::String>, + } + + impl ::std::default::Default for PostCityResponse { + fn default() -> Self { + Self { + errors: Err("no value supplied for errors".to_string()), + } } - pub fn score(mut self, value: T) -> Self + } + + impl PostCityResponse { + pub fn errors(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, { - self.score = value + self.errors = value .try_into() - .map_err(|e| format!("error converting supplied value for score: {}", e)); - self - } - pub fn social_services(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.social_services = value.try_into().map_err(|e| { - format!("error converting supplied value for social_services: {}", e) - }); + .map_err(|e| format!("error converting supplied value for errors: {}", e)); self } } - impl ::std::convert::TryFrom for super::CoreServices { + impl ::std::convert::TryFrom for super::PostCityResponse { type Error = super::error::ConversionError; fn try_from( - value: CoreServices, + value: PostCityResponse, ) -> ::std::result::Result { Ok(Self { - dentists: value.dentists?, - doctors: value.doctors?, - grocery: value.grocery?, - hospitals: value.hospitals?, - pharmacies: value.pharmacies?, - score: value.score?, - social_services: value.social_services?, + errors: value.errors?, }) } } - impl From for CoreServices { - fn from(value: super::CoreServices) -> Self { + impl ::std::convert::From for PostCityResponse { + fn from(value: super::PostCityResponse) -> Self { Self { - dentists: Ok(value.dentists), - doctors: Ok(value.doctors), - grocery: Ok(value.grocery), - hospitals: Ok(value.hospitals), - pharmacies: Ok(value.pharmacies), - score: Ok(value.score), - social_services: Ok(value.social_services), + errors: Ok(value.errors), } } } #[derive(Clone, Debug)] - pub struct Enqueue { - city: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, - country: - ::std::result::Result<::std::option::Option, ::std::string::String>, - fips_code: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, - region: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, + pub struct PostPipelinesBnaResponse { + errors: ::std::result::Result<::std::vec::Vec, ::std::string::String>, } - impl Default for Enqueue { + impl ::std::default::Default for PostPipelinesBnaResponse { fn default() -> Self { Self { - city: Ok(Default::default()), - country: Ok(Default::default()), - fips_code: Ok(Default::default()), - region: Ok(Default::default()), + errors: Err("no value supplied for errors".to_string()), } } } - impl Enqueue { - pub fn city(mut self, value: T) -> Self + impl PostPipelinesBnaResponse { + pub fn errors(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, { - self.city = value + self.errors = value .try_into() - .map_err(|e| format!("error converting supplied value for city: {}", e)); + .map_err(|e| format!("error converting supplied value for errors: {}", e)); self } - pub fn country(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, - { - self.country = value - .try_into() - .map_err(|e| format!("error converting supplied value for country: {}", e)); - self + } + + impl ::std::convert::TryFrom for super::PostPipelinesBnaResponse { + type Error = super::error::ConversionError; + fn try_from( + value: PostPipelinesBnaResponse, + ) -> ::std::result::Result { + Ok(Self { + errors: value.errors?, + }) } - pub fn fips_code(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, - { - self.fips_code = value - .try_into() - .map_err(|e| format!("error converting supplied value for fips_code: {}", e)); - self + } + + impl ::std::convert::From for PostPipelinesBnaResponse { + fn from(value: super::PostPipelinesBnaResponse) -> Self { + Self { + errors: Ok(value.errors), + } } - pub fn region(mut self, value: T) -> Self + } + + #[derive(Clone, Debug)] + pub struct PostRatingResponse { + errors: ::std::result::Result<::std::vec::Vec, ::std::string::String>, + } + + impl ::std::default::Default for PostRatingResponse { + fn default() -> Self { + Self { + errors: Err("no value supplied for errors".to_string()), + } + } + } + + impl PostRatingResponse { + pub fn errors(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, { - self.region = value + self.errors = value .try_into() - .map_err(|e| format!("error converting supplied value for region: {}", e)); + .map_err(|e| format!("error converting supplied value for errors: {}", e)); self } } - impl ::std::convert::TryFrom for super::Enqueue { + impl ::std::convert::TryFrom for super::PostRatingResponse { type Error = super::error::ConversionError; fn try_from( - value: Enqueue, + value: PostRatingResponse, ) -> ::std::result::Result { Ok(Self { - city: value.city?, - country: value.country?, - fips_code: value.fips_code?, - region: value.region?, + errors: value.errors?, }) } } - impl From for Enqueue { - fn from(value: super::Enqueue) -> Self { + impl ::std::convert::From for PostRatingResponse { + fn from(value: super::PostRatingResponse) -> Self { Self { - city: Ok(value.city), - country: Ok(value.country), - fips_code: Ok(value.fips_code), - region: Ok(value.region), + errors: Ok(value.errors), } } } #[derive(Clone, Debug)] - pub struct EnqueuePost { - city: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, - country: - ::std::result::Result<::std::option::Option, ::std::string::String>, - fips_code: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, - region: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, + pub struct Rating { + city_id: ::std::result::Result, + core_services: ::std::result::Result, + id: ::std::result::Result, + infrastructure: ::std::result::Result, + opportunity: ::std::result::Result, + people: ::std::result::Result, + recreation: ::std::result::Result, + retail: ::std::result::Result, + score: ::std::result::Result, + transit: ::std::result::Result, + version: ::std::result::Result<::std::string::String, ::std::string::String>, } - impl Default for EnqueuePost { + impl ::std::default::Default for Rating { fn default() -> Self { Self { - city: Ok(Default::default()), - country: Ok(Default::default()), - fips_code: Ok(Default::default()), - region: Ok(Default::default()), + city_id: Err("no value supplied for city_id".to_string()), + core_services: Err("no value supplied for core_services".to_string()), + id: Err("no value supplied for id".to_string()), + infrastructure: Err("no value supplied for infrastructure".to_string()), + opportunity: Err("no value supplied for opportunity".to_string()), + people: Err("no value supplied for people".to_string()), + recreation: Err("no value supplied for recreation".to_string()), + retail: Err("no value supplied for retail".to_string()), + score: Err("no value supplied for score".to_string()), + transit: Err("no value supplied for transit".to_string()), + version: Err("no value supplied for version".to_string()), } } } - impl EnqueuePost { - pub fn city(mut self, value: T) -> Self + impl Rating { + pub fn city_id(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { - self.city = value + self.city_id = value .try_into() - .map_err(|e| format!("error converting supplied value for city: {}", e)); + .map_err(|e| format!("error converting supplied value for city_id: {}", e)); self } - pub fn country(mut self, value: T) -> Self + pub fn core_services(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { - self.country = value + self.core_services = value.try_into().map_err(|e| { + format!("error converting supplied value for core_services: {}", e) + }); + self + } + pub fn id(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.id = value .try_into() - .map_err(|e| format!("error converting supplied value for country: {}", e)); + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn infrastructure(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.infrastructure = value.try_into().map_err(|e| { + format!("error converting supplied value for infrastructure: {}", e) + }); self } - pub fn fips_code(mut self, value: T) -> Self + pub fn opportunity(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { - self.fips_code = value + self.opportunity = value .try_into() - .map_err(|e| format!("error converting supplied value for fips_code: {}", e)); + .map_err(|e| format!("error converting supplied value for opportunity: {}", e)); self } - pub fn region(mut self, value: T) -> Self + pub fn people(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { - self.region = value + self.people = value .try_into() - .map_err(|e| format!("error converting supplied value for region: {}", e)); + .map_err(|e| format!("error converting supplied value for people: {}", e)); self } - } - - impl ::std::convert::TryFrom for super::EnqueuePost { - type Error = super::error::ConversionError; - fn try_from( - value: EnqueuePost, - ) -> ::std::result::Result { - Ok(Self { - city: value.city?, - country: value.country?, - fips_code: value.fips_code?, - region: value.region?, - }) - } - } - - impl From for EnqueuePost { - fn from(value: super::EnqueuePost) -> Self { - Self { - city: Ok(value.city), - country: Ok(value.country), - fips_code: Ok(value.fips_code), - region: Ok(value.region), - } - } - } - - #[derive(Clone, Debug)] - pub struct Error { - details: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, - id: ::std::result::Result< - ::std::option::Option, - ::std::string::String, - >, - source: - ::std::result::Result<::std::option::Option, ::std::string::String>, - status: ::std::result::Result<::std::option::Option, ::std::string::String>, - title: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, - } - - impl Default for Error { - fn default() -> Self { - Self { - details: Ok(Default::default()), - id: Ok(Default::default()), - source: Ok(Default::default()), - status: Ok(Default::default()), - title: Ok(Default::default()), - } - } - } - - impl Error { - pub fn details(mut self, value: T) -> Self + pub fn recreation(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { - self.details = value + self.recreation = value .try_into() - .map_err(|e| format!("error converting supplied value for details: {}", e)); + .map_err(|e| format!("error converting supplied value for recreation: {}", e)); self } - pub fn id(mut self, value: T) -> Self + pub fn retail(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { - self.id = value + self.retail = value .try_into() - .map_err(|e| format!("error converting supplied value for id: {}", e)); + .map_err(|e| format!("error converting supplied value for retail: {}", e)); self } - pub fn source(mut self, value: T) -> Self + pub fn score(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { - self.source = value + self.score = value .try_into() - .map_err(|e| format!("error converting supplied value for source: {}", e)); + .map_err(|e| format!("error converting supplied value for score: {}", e)); self } - pub fn status(mut self, value: T) -> Self + pub fn transit(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { - self.status = value + self.transit = value .try_into() - .map_err(|e| format!("error converting supplied value for status: {}", e)); + .map_err(|e| format!("error converting supplied value for transit: {}", e)); self } - pub fn title(mut self, value: T) -> Self + pub fn version(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { - self.title = value + self.version = value .try_into() - .map_err(|e| format!("error converting supplied value for title: {}", e)); + .map_err(|e| format!("error converting supplied value for version: {}", e)); self } } - impl ::std::convert::TryFrom for super::Error { + impl ::std::convert::TryFrom for super::Rating { type Error = super::error::ConversionError; fn try_from( - value: Error, + value: Rating, ) -> ::std::result::Result { Ok(Self { - details: value.details?, + city_id: value.city_id?, + core_services: value.core_services?, id: value.id?, - source: value.source?, - status: value.status?, - title: value.title?, + infrastructure: value.infrastructure?, + opportunity: value.opportunity?, + people: value.people?, + recreation: value.recreation?, + retail: value.retail?, + score: value.score?, + transit: value.transit?, + version: value.version?, }) } } - impl From for Error { - fn from(value: super::Error) -> Self { + impl ::std::convert::From for Rating { + fn from(value: super::Rating) -> Self { Self { - details: Ok(value.details), + city_id: Ok(value.city_id), + core_services: Ok(value.core_services), id: Ok(value.id), - source: Ok(value.source), - status: Ok(value.status), - title: Ok(value.title), + infrastructure: Ok(value.infrastructure), + opportunity: Ok(value.opportunity), + people: Ok(value.people), + recreation: Ok(value.recreation), + retail: Ok(value.retail), + score: Ok(value.score), + transit: Ok(value.transit), + version: Ok(value.version), } } } #[derive(Clone, Debug)] - pub struct FargatePrice { - created_at: ::std::result::Result< - ::std::option::Option>, - ::std::string::String, - >, - fargate_price_id: - ::std::result::Result<::std::option::Option, ::std::string::String>, - per_second: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, + pub struct RatingPost { + city_id: ::std::result::Result, + core_services: ::std::result::Result, + infrastructure: ::std::result::Result, + opportunity: ::std::result::Result, + people: ::std::result::Result, + recreation: ::std::result::Result, + retail: ::std::result::Result, + transit: ::std::result::Result, + version: ::std::result::Result<::std::string::String, ::std::string::String>, } - impl Default for FargatePrice { + impl ::std::default::Default for RatingPost { fn default() -> Self { Self { - created_at: Ok(Default::default()), - fargate_price_id: Ok(Default::default()), - per_second: Ok(Default::default()), + city_id: Err("no value supplied for city_id".to_string()), + core_services: Err("no value supplied for core_services".to_string()), + infrastructure: Err("no value supplied for infrastructure".to_string()), + opportunity: Err("no value supplied for opportunity".to_string()), + people: Err("no value supplied for people".to_string()), + recreation: Err("no value supplied for recreation".to_string()), + retail: Err("no value supplied for retail".to_string()), + transit: Err("no value supplied for transit".to_string()), + version: Err("no value supplied for version".to_string()), } } } - impl FargatePrice { - pub fn created_at(mut self, value: T) -> Self + impl RatingPost { + pub fn city_id(mut self, value: T) -> Self where - T: std::convert::TryInto< - ::std::option::Option>, - >, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { - self.created_at = value + self.city_id = value .try_into() - .map_err(|e| format!("error converting supplied value for created_at: {}", e)); + .map_err(|e| format!("error converting supplied value for city_id: {}", e)); self } - pub fn fargate_price_id(mut self, value: T) -> Self + pub fn core_services(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { - self.fargate_price_id = value.try_into().map_err(|e| { - format!( - "error converting supplied value for fargate_price_id: {}", - e - ) + self.core_services = value.try_into().map_err(|e| { + format!("error converting supplied value for core_services: {}", e) }); self } - pub fn per_second(mut self, value: T) -> Self + pub fn infrastructure(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { - self.per_second = value + self.infrastructure = value.try_into().map_err(|e| { + format!("error converting supplied value for infrastructure: {}", e) + }); + self + } + pub fn opportunity(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.opportunity = value .try_into() - .map_err(|e| format!("error converting supplied value for per_second: {}", e)); + .map_err(|e| format!("error converting supplied value for opportunity: {}", e)); self } - } - - impl ::std::convert::TryFrom for super::FargatePrice { - type Error = super::error::ConversionError; - fn try_from( - value: FargatePrice, - ) -> ::std::result::Result { - Ok(Self { - created_at: value.created_at?, - fargate_price_id: value.fargate_price_id?, - per_second: value.per_second?, - }) + pub fn people(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.people = value + .try_into() + .map_err(|e| format!("error converting supplied value for people: {}", e)); + self } - } - - impl From for FargatePrice { - fn from(value: super::FargatePrice) -> Self { - Self { - created_at: Ok(value.created_at), - fargate_price_id: Ok(value.fargate_price_id), - per_second: Ok(value.per_second), - } + pub fn recreation(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.recreation = value + .try_into() + .map_err(|e| format!("error converting supplied value for recreation: {}", e)); + self } - } - - #[derive(Clone, Debug)] - pub struct Infrastructure { - high_stress_miles: - ::std::result::Result<::std::option::Option, ::std::string::String>, - low_stress_miles: - ::std::result::Result<::std::option::Option, ::std::string::String>, - } - - impl Default for Infrastructure { - fn default() -> Self { - Self { - high_stress_miles: Ok(Default::default()), - low_stress_miles: Ok(Default::default()), - } + pub fn retail(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.retail = value + .try_into() + .map_err(|e| format!("error converting supplied value for retail: {}", e)); + self } - } - - impl Infrastructure { - pub fn high_stress_miles(mut self, value: T) -> Self + pub fn transit(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { - self.high_stress_miles = value.try_into().map_err(|e| { - format!( - "error converting supplied value for high_stress_miles: {}", - e - ) - }); + self.transit = value + .try_into() + .map_err(|e| format!("error converting supplied value for transit: {}", e)); self } - pub fn low_stress_miles(mut self, value: T) -> Self + pub fn version(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { - self.low_stress_miles = value.try_into().map_err(|e| { - format!( - "error converting supplied value for low_stress_miles: {}", - e - ) - }); + self.version = value + .try_into() + .map_err(|e| format!("error converting supplied value for version: {}", e)); self } } - impl ::std::convert::TryFrom for super::Infrastructure { + impl ::std::convert::TryFrom for super::RatingPost { type Error = super::error::ConversionError; fn try_from( - value: Infrastructure, + value: RatingPost, ) -> ::std::result::Result { Ok(Self { - high_stress_miles: value.high_stress_miles?, - low_stress_miles: value.low_stress_miles?, + city_id: value.city_id?, + core_services: value.core_services?, + infrastructure: value.infrastructure?, + opportunity: value.opportunity?, + people: value.people?, + recreation: value.recreation?, + retail: value.retail?, + transit: value.transit?, + version: value.version?, }) } } - impl From for Infrastructure { - fn from(value: super::Infrastructure) -> Self { + impl ::std::convert::From for RatingPost { + fn from(value: super::RatingPost) -> Self { Self { - high_stress_miles: Ok(value.high_stress_miles), - low_stress_miles: Ok(value.low_stress_miles), + city_id: Ok(value.city_id), + core_services: Ok(value.core_services), + infrastructure: Ok(value.infrastructure), + opportunity: Ok(value.opportunity), + people: Ok(value.people), + recreation: Ok(value.recreation), + retail: Ok(value.retail), + transit: Ok(value.transit), + version: Ok(value.version), } } } #[derive(Clone, Debug)] - pub struct Opportunity { - employment: ::std::result::Result<::std::option::Option, ::std::string::String>, - higher_education: - ::std::result::Result<::std::option::Option, ::std::string::String>, - k12_education: ::std::result::Result<::std::option::Option, ::std::string::String>, - score: ::std::result::Result<::std::option::Option, ::std::string::String>, - technical_vocational_college: - ::std::result::Result<::std::option::Option, ::std::string::String>, + pub struct RatingSummary { + city_id: ::std::result::Result, + created_at: + ::std::result::Result, ::std::string::String>, + id: ::std::result::Result, + score: ::std::result::Result, + version: ::std::result::Result<::std::string::String, ::std::string::String>, } - impl Default for Opportunity { + impl ::std::default::Default for RatingSummary { fn default() -> Self { Self { - employment: Ok(Default::default()), - higher_education: Ok(Default::default()), - k12_education: Ok(Default::default()), - score: Ok(Default::default()), - technical_vocational_college: Ok(Default::default()), + city_id: Err("no value supplied for city_id".to_string()), + created_at: Err("no value supplied for created_at".to_string()), + id: Err("no value supplied for id".to_string()), + score: Err("no value supplied for score".to_string()), + version: Err("no value supplied for version".to_string()), } } } - impl Opportunity { - pub fn employment(mut self, value: T) -> Self + impl RatingSummary { + pub fn city_id(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { - self.employment = value + self.city_id = value .try_into() - .map_err(|e| format!("error converting supplied value for employment: {}", e)); + .map_err(|e| format!("error converting supplied value for city_id: {}", e)); self } - pub fn higher_education(mut self, value: T) -> Self + pub fn created_at(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto>, + T::Error: ::std::fmt::Display, { - self.higher_education = value.try_into().map_err(|e| { - format!( - "error converting supplied value for higher_education: {}", - e - ) - }); + self.created_at = value + .try_into() + .map_err(|e| format!("error converting supplied value for created_at: {}", e)); self } - pub fn k12_education(mut self, value: T) -> Self + pub fn id(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { - self.k12_education = value.try_into().map_err(|e| { - format!("error converting supplied value for k12_education: {}", e) - }); + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); self } pub fn score(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { self.score = value .try_into() .map_err(|e| format!("error converting supplied value for score: {}", e)); self } - pub fn technical_vocational_college(mut self, value: T) -> Self + pub fn version(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { - self.technical_vocational_college = value.try_into().map_err(|e| { - format!( - "error converting supplied value for technical_vocational_college: {}", - e - ) - }); + self.version = value + .try_into() + .map_err(|e| format!("error converting supplied value for version: {}", e)); self } } - impl ::std::convert::TryFrom for super::Opportunity { + impl ::std::convert::TryFrom for super::RatingSummary { type Error = super::error::ConversionError; fn try_from( - value: Opportunity, + value: RatingSummary, ) -> ::std::result::Result { Ok(Self { - employment: value.employment?, - higher_education: value.higher_education?, - k12_education: value.k12_education?, + city_id: value.city_id?, + created_at: value.created_at?, + id: value.id?, score: value.score?, - technical_vocational_college: value.technical_vocational_college?, + version: value.version?, }) } } - impl From for Opportunity { - fn from(value: super::Opportunity) -> Self { + impl ::std::convert::From for RatingSummary { + fn from(value: super::RatingSummary) -> Self { Self { - employment: Ok(value.employment), - higher_education: Ok(value.higher_education), - k12_education: Ok(value.k12_education), + city_id: Ok(value.city_id), + created_at: Ok(value.created_at), + id: Ok(value.id), score: Ok(value.score), - technical_vocational_college: Ok(value.technical_vocational_college), + version: Ok(value.version), } } } #[derive(Clone, Debug)] - pub struct People { - score: ::std::result::Result<::std::option::Option, ::std::string::String>, + pub struct RatingWithCity { + city: ::std::result::Result, + rating: ::std::result::Result, } - impl Default for People { + impl ::std::default::Default for RatingWithCity { fn default() -> Self { Self { - score: Ok(Default::default()), + city: Err("no value supplied for city".to_string()), + rating: Err("no value supplied for rating".to_string()), } } } - impl People { - pub fn score(mut self, value: T) -> Self + impl RatingWithCity { + pub fn city(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { - self.score = value + self.city = value .try_into() - .map_err(|e| format!("error converting supplied value for score: {}", e)); + .map_err(|e| format!("error converting supplied value for city: {}", e)); + self + } + pub fn rating(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.rating = value + .try_into() + .map_err(|e| format!("error converting supplied value for rating: {}", e)); self } } - impl ::std::convert::TryFrom for super::People { + impl ::std::convert::TryFrom for super::RatingWithCity { type Error = super::error::ConversionError; fn try_from( - value: People, + value: RatingWithCity, ) -> ::std::result::Result { Ok(Self { - score: value.score?, + city: value.city?, + rating: value.rating?, }) } } - impl From for People { - fn from(value: super::People) -> Self { + impl ::std::convert::From for RatingWithCity { + fn from(value: super::RatingWithCity) -> Self { Self { - score: Ok(value.score), + city: Ok(value.city), + rating: Ok(value.rating), } } } @@ -6808,18 +6777,17 @@ pub mod types { community_centers: ::std::result::Result<::std::option::Option, ::std::string::String>, parks: ::std::result::Result<::std::option::Option, ::std::string::String>, - recreation_trails: - ::std::result::Result<::std::option::Option, ::std::string::String>, score: ::std::result::Result<::std::option::Option, ::std::string::String>, + trails: ::std::result::Result<::std::option::Option, ::std::string::String>, } - impl Default for Recreation { + impl ::std::default::Default for Recreation { fn default() -> Self { Self { community_centers: Ok(Default::default()), parks: Ok(Default::default()), - recreation_trails: Ok(Default::default()), score: Ok(Default::default()), + trails: Ok(Default::default()), } } } @@ -6827,8 +6795,8 @@ pub mod types { impl Recreation { pub fn community_centers(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { self.community_centers = value.try_into().map_err(|e| { format!( @@ -6840,35 +6808,32 @@ pub mod types { } pub fn parks(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { self.parks = value .try_into() .map_err(|e| format!("error converting supplied value for parks: {}", e)); self } - pub fn recreation_trails(mut self, value: T) -> Self + pub fn score(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { - self.recreation_trails = value.try_into().map_err(|e| { - format!( - "error converting supplied value for recreation_trails: {}", - e - ) - }); + self.score = value + .try_into() + .map_err(|e| format!("error converting supplied value for score: {}", e)); self } - pub fn score(mut self, value: T) -> Self + pub fn trails(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { - self.score = value + self.trails = value .try_into() - .map_err(|e| format!("error converting supplied value for score: {}", e)); + .map_err(|e| format!("error converting supplied value for trails: {}", e)); self } } @@ -6881,45 +6846,45 @@ pub mod types { Ok(Self { community_centers: value.community_centers?, parks: value.parks?, - recreation_trails: value.recreation_trails?, score: value.score?, + trails: value.trails?, }) } } - impl From for Recreation { + impl ::std::convert::From for Recreation { fn from(value: super::Recreation) -> Self { Self { community_centers: Ok(value.community_centers), parks: Ok(value.parks), - recreation_trails: Ok(value.recreation_trails), score: Ok(value.score), + trails: Ok(value.trails), } } } #[derive(Clone, Debug)] pub struct Retail { - score: ::std::result::Result<::std::option::Option, ::std::string::String>, + retail: ::std::result::Result<::std::option::Option, ::std::string::String>, } - impl Default for Retail { + impl ::std::default::Default for Retail { fn default() -> Self { Self { - score: Ok(Default::default()), + retail: Ok(Default::default()), } } } impl Retail { - pub fn score(mut self, value: T) -> Self + pub fn retail(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { - self.score = value + self.retail = value .try_into() - .map_err(|e| format!("error converting supplied value for score: {}", e)); + .map_err(|e| format!("error converting supplied value for retail: {}", e)); self } } @@ -6930,49 +6895,31 @@ pub mod types { value: Retail, ) -> ::std::result::Result { Ok(Self { - score: value.score?, + retail: value.retail?, }) } } - impl From for Retail { + impl ::std::convert::From for Retail { fn from(value: super::Retail) -> Self { Self { - score: Ok(value.score), + retail: Ok(value.retail), } } } #[derive(Clone, Debug)] pub struct Submission { - city: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, - consent: ::std::result::Result<::std::option::Option, ::std::string::String>, - country: - ::std::result::Result<::std::option::Option, ::std::string::String>, - created_at: ::std::result::Result< - ::std::option::Option>, - ::std::string::String, - >, - email: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, - fips_code: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, - first_name: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, - id: ::std::result::Result<::std::option::Option, ::std::string::String>, - last_name: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, + city: ::std::result::Result<::std::string::String, ::std::string::String>, + consent: ::std::result::Result, + country: ::std::result::Result, + created_at: + ::std::result::Result, ::std::string::String>, + email: ::std::result::Result<::std::string::String, ::std::string::String>, + fips_code: ::std::result::Result<::std::string::String, ::std::string::String>, + first_name: ::std::result::Result<::std::string::String, ::std::string::String>, + id: ::std::result::Result, + last_name: ::std::result::Result<::std::string::String, ::std::string::String>, occupation: ::std::result::Result< ::std::option::Option<::std::string::String>, ::std::string::String, @@ -6985,28 +6932,25 @@ pub mod types { ::std::option::Option<::std::string::String>, ::std::string::String, >, - submission_status: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, + status: ::std::result::Result<::std::string::String, ::std::string::String>, } - impl Default for Submission { + impl ::std::default::Default for Submission { fn default() -> Self { Self { - city: Ok(Default::default()), - consent: Ok(Default::default()), - country: Ok(Default::default()), - created_at: Ok(Default::default()), - email: Ok(Default::default()), - fips_code: Ok(Default::default()), - first_name: Ok(Default::default()), - id: Ok(Default::default()), - last_name: Ok(Default::default()), + city: Err("no value supplied for city".to_string()), + consent: Err("no value supplied for consent".to_string()), + country: Err("no value supplied for country".to_string()), + created_at: Err("no value supplied for created_at".to_string()), + email: Err("no value supplied for email".to_string()), + fips_code: Err("no value supplied for fips_code".to_string()), + first_name: Err("no value supplied for first_name".to_string()), + id: Err("no value supplied for id".to_string()), + last_name: Err("no value supplied for last_name".to_string()), occupation: Ok(Default::default()), organization: Ok(Default::default()), region: Ok(Default::default()), - submission_status: Ok(Default::default()), + status: Err("no value supplied for status".to_string()), } } } @@ -7014,8 +6958,8 @@ pub mod types { impl Submission { pub fn city(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { self.city = value .try_into() @@ -7024,8 +6968,8 @@ pub mod types { } pub fn consent(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { self.consent = value .try_into() @@ -7034,8 +6978,8 @@ pub mod types { } pub fn country(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { self.country = value .try_into() @@ -7044,10 +6988,8 @@ pub mod types { } pub fn created_at(mut self, value: T) -> Self where - T: std::convert::TryInto< - ::std::option::Option>, - >, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto>, + T::Error: ::std::fmt::Display, { self.created_at = value .try_into() @@ -7056,8 +6998,8 @@ pub mod types { } pub fn email(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { self.email = value .try_into() @@ -7066,8 +7008,8 @@ pub mod types { } pub fn fips_code(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { self.fips_code = value .try_into() @@ -7076,8 +7018,8 @@ pub mod types { } pub fn first_name(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { self.first_name = value .try_into() @@ -7086,8 +7028,8 @@ pub mod types { } pub fn id(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { self.id = value .try_into() @@ -7096,8 +7038,8 @@ pub mod types { } pub fn last_name(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { self.last_name = value .try_into() @@ -7106,8 +7048,8 @@ pub mod types { } pub fn occupation(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, { self.occupation = value .try_into() @@ -7116,8 +7058,8 @@ pub mod types { } pub fn organization(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, { self.organization = value.try_into().map_err(|e| { format!("error converting supplied value for organization: {}", e) @@ -7126,25 +7068,22 @@ pub mod types { } pub fn region(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, { self.region = value .try_into() .map_err(|e| format!("error converting supplied value for region: {}", e)); self } - pub fn submission_status(mut self, value: T) -> Self + pub fn status(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { - self.submission_status = value.try_into().map_err(|e| { - format!( - "error converting supplied value for submission_status: {}", - e - ) - }); + self.status = value + .try_into() + .map_err(|e| format!("error converting supplied value for status: {}", e)); self } } @@ -7167,12 +7106,12 @@ pub mod types { occupation: value.occupation?, organization: value.organization?, region: value.region?, - submission_status: value.submission_status?, + status: value.status?, }) } } - impl From for Submission { + impl ::std::convert::From for Submission { fn from(value: super::Submission) -> Self { Self { city: Ok(value.city), @@ -7187,36 +7126,20 @@ pub mod types { occupation: Ok(value.occupation), organization: Ok(value.organization), region: Ok(value.region), - submission_status: Ok(value.submission_status), + status: Ok(value.status), } } } #[derive(Clone, Debug)] pub struct SubmissionPatch { - city: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, - consent: ::std::result::Result<::std::option::Option, ::std::string::String>, - country: - ::std::result::Result<::std::option::Option, ::std::string::String>, - email: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, - fips_code: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, - first_name: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, - last_name: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, + city: ::std::result::Result<::std::string::String, ::std::string::String>, + consent: ::std::result::Result, + country: ::std::result::Result, + email: ::std::result::Result<::std::string::String, ::std::string::String>, + fips_code: ::std::result::Result<::std::string::String, ::std::string::String>, + first_name: ::std::result::Result<::std::string::String, ::std::string::String>, + last_name: ::std::result::Result<::std::string::String, ::std::string::String>, occupation: ::std::result::Result< ::std::option::Option<::std::string::String>, ::std::string::String, @@ -7229,26 +7152,23 @@ pub mod types { ::std::option::Option<::std::string::String>, ::std::string::String, >, - submission_status: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, + status: ::std::result::Result<::std::string::String, ::std::string::String>, } - impl Default for SubmissionPatch { + impl ::std::default::Default for SubmissionPatch { fn default() -> Self { Self { - city: Ok(Default::default()), - consent: Ok(Default::default()), - country: Ok(Default::default()), - email: Ok(Default::default()), - fips_code: Ok(Default::default()), - first_name: Ok(Default::default()), - last_name: Ok(Default::default()), + city: Err("no value supplied for city".to_string()), + consent: Err("no value supplied for consent".to_string()), + country: Err("no value supplied for country".to_string()), + email: Err("no value supplied for email".to_string()), + fips_code: Err("no value supplied for fips_code".to_string()), + first_name: Err("no value supplied for first_name".to_string()), + last_name: Err("no value supplied for last_name".to_string()), occupation: Ok(Default::default()), organization: Ok(Default::default()), region: Ok(Default::default()), - submission_status: Ok(Default::default()), + status: Err("no value supplied for status".to_string()), } } } @@ -7256,8 +7176,8 @@ pub mod types { impl SubmissionPatch { pub fn city(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { self.city = value .try_into() @@ -7266,8 +7186,8 @@ pub mod types { } pub fn consent(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { self.consent = value .try_into() @@ -7276,8 +7196,8 @@ pub mod types { } pub fn country(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { self.country = value .try_into() @@ -7286,8 +7206,8 @@ pub mod types { } pub fn email(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { self.email = value .try_into() @@ -7296,8 +7216,8 @@ pub mod types { } pub fn fips_code(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { self.fips_code = value .try_into() @@ -7306,8 +7226,8 @@ pub mod types { } pub fn first_name(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { self.first_name = value .try_into() @@ -7316,8 +7236,8 @@ pub mod types { } pub fn last_name(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { self.last_name = value .try_into() @@ -7326,8 +7246,8 @@ pub mod types { } pub fn occupation(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, { self.occupation = value .try_into() @@ -7336,8 +7256,8 @@ pub mod types { } pub fn organization(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, { self.organization = value.try_into().map_err(|e| { format!("error converting supplied value for organization: {}", e) @@ -7346,25 +7266,22 @@ pub mod types { } pub fn region(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, { self.region = value .try_into() .map_err(|e| format!("error converting supplied value for region: {}", e)); self } - pub fn submission_status(mut self, value: T) -> Self + pub fn status(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { - self.submission_status = value.try_into().map_err(|e| { - format!( - "error converting supplied value for submission_status: {}", - e - ) - }); + self.status = value + .try_into() + .map_err(|e| format!("error converting supplied value for status: {}", e)); self } } @@ -7385,12 +7302,12 @@ pub mod types { occupation: value.occupation?, organization: value.organization?, region: value.region?, - submission_status: value.submission_status?, + status: value.status?, }) } } - impl From for SubmissionPatch { + impl ::std::convert::From for SubmissionPatch { fn from(value: super::SubmissionPatch) -> Self { Self { city: Ok(value.city), @@ -7403,7 +7320,7 @@ pub mod types { occupation: Ok(value.occupation), organization: Ok(value.organization), region: Ok(value.region), - submission_status: Ok(value.submission_status), + status: Ok(value.status), } } } @@ -7429,13 +7346,10 @@ pub mod types { ::std::option::Option<::std::string::String>, ::std::string::String, >, - submission_status: ::std::result::Result< - ::std::option::Option<::std::string::String>, - ::std::string::String, - >, + status: ::std::result::Result<::std::string::String, ::std::string::String>, } - impl Default for SubmissionPost { + impl ::std::default::Default for SubmissionPost { fn default() -> Self { Self { city: Err("no value supplied for city".to_string()), @@ -7448,7 +7362,7 @@ pub mod types { occupation: Ok(Default::default()), organization: Ok(Default::default()), region: Ok(Default::default()), - submission_status: Ok(Default::default()), + status: Err("no value supplied for status".to_string()), } } } @@ -7456,8 +7370,8 @@ pub mod types { impl SubmissionPost { pub fn city(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::string::String>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { self.city = value .try_into() @@ -7466,8 +7380,8 @@ pub mod types { } pub fn consent(mut self, value: T) -> Self where - T: std::convert::TryInto, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { self.consent = value .try_into() @@ -7476,8 +7390,8 @@ pub mod types { } pub fn country(mut self, value: T) -> Self where - T: std::convert::TryInto, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, { self.country = value .try_into() @@ -7486,8 +7400,8 @@ pub mod types { } pub fn email(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::string::String>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { self.email = value .try_into() @@ -7496,8 +7410,8 @@ pub mod types { } pub fn fips_code(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::string::String>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { self.fips_code = value .try_into() @@ -7506,8 +7420,8 @@ pub mod types { } pub fn first_name(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::string::String>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { self.first_name = value .try_into() @@ -7516,8 +7430,8 @@ pub mod types { } pub fn last_name(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::string::String>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, { self.last_name = value .try_into() @@ -7526,8 +7440,8 @@ pub mod types { } pub fn occupation(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, { self.occupation = value .try_into() @@ -7536,8 +7450,8 @@ pub mod types { } pub fn organization(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, { self.organization = value.try_into().map_err(|e| { format!("error converting supplied value for organization: {}", e) @@ -7546,25 +7460,22 @@ pub mod types { } pub fn region(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, { self.region = value .try_into() .map_err(|e| format!("error converting supplied value for region: {}", e)); self } - pub fn submission_status(mut self, value: T) -> Self - where - T: std::convert::TryInto<::std::option::Option<::std::string::String>>, - T::Error: std::fmt::Display, - { - self.submission_status = value.try_into().map_err(|e| { - format!( - "error converting supplied value for submission_status: {}", - e - ) - }); + pub fn status(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.status = value + .try_into() + .map_err(|e| format!("error converting supplied value for status: {}", e)); self } } @@ -7585,12 +7496,12 @@ pub mod types { occupation: value.occupation?, organization: value.organization?, region: value.region?, - submission_status: value.submission_status?, + status: value.status?, }) } } - impl From for SubmissionPost { + impl ::std::convert::From for SubmissionPost { fn from(value: super::SubmissionPost) -> Self { Self { city: Ok(value.city), @@ -7603,33 +7514,33 @@ pub mod types { occupation: Ok(value.occupation), organization: Ok(value.organization), region: Ok(value.region), - submission_status: Ok(value.submission_status), + status: Ok(value.status), } } } #[derive(Clone, Debug)] pub struct Transit { - score: ::std::result::Result<::std::option::Option, ::std::string::String>, + transit: ::std::result::Result<::std::option::Option, ::std::string::String>, } - impl Default for Transit { + impl ::std::default::Default for Transit { fn default() -> Self { Self { - score: Ok(Default::default()), + transit: Ok(Default::default()), } } } impl Transit { - pub fn score(mut self, value: T) -> Self + pub fn transit(mut self, value: T) -> Self where - T: std::convert::TryInto<::std::option::Option>, - T::Error: std::fmt::Display, + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, { - self.score = value + self.transit = value .try_into() - .map_err(|e| format!("error converting supplied value for score: {}", e)); + .map_err(|e| format!("error converting supplied value for transit: {}", e)); self } } @@ -7640,15 +7551,15 @@ pub mod types { value: Transit, ) -> ::std::result::Result { Ok(Self { - score: value.score?, + transit: value.transit?, }) } } - impl From for Transit { + impl ::std::convert::From for Transit { fn from(value: super::Transit) -> Self { Self { - score: Ok(value.score), + transit: Ok(value.transit), } } } @@ -7718,439 +7629,375 @@ impl Client { } impl Client { - ///Get city rating summaries - /// - ///Get city rating summaries. + ///Get the details of all cities where an BNA analysis was performed. /// - ///Sends a `GET` request to `/ratings` + ///Sends a `GET` request to `/cities` /// ///Arguments: - /// - `page`: Page index (starting at 0) - /// - `page_size`: The number of items to be returned per page (1..50) + /// - `page`: The result page being returned + /// - `page_size`: The number of items per page ///```ignore - /// let response = client.get_ratings() + /// let response = client.get_cities() /// .page(page) /// .page_size(page_size) /// .send() /// .await; /// ``` - pub fn get_ratings(&self) -> builder::GetRatings { - builder::GetRatings::new(self) + pub fn get_cities(&self) -> builder::GetCities { + builder::GetCities::new(self) } - ///Create new city rating - /// - ///Create a new city rating + ///Create a new city. /// - ///Sends a `POST` request to `/ratings` + ///Sends a `POST` request to `/cities` /// - ///Arguments: - /// - `body`: Create bna ///```ignore - /// let response = client.post_ratings() + /// let response = client.post_city() /// .body(body) /// .send() /// .await; /// ``` - pub fn post_ratings(&self) -> builder::PostRatings { - builder::PostRatings::new(self) + pub fn post_city(&self) -> builder::PostCity { + builder::PostCity::new(self) } - ///Get the city rating analys details - /// - ///Get the city rating analys details + ///Get the submissions details. /// - ///Sends a `GET` request to `/ratings/analyses` + ///Sends a `GET` request to `/cities/submissions` /// ///Arguments: - /// - `page`: Page index (starting at 0) - /// - `page_size`: The number of items to be returned per page (1..50) + /// - `page`: The result page being returned + /// - `page_size`: The number of items per page + /// - `status`: Filter for the submission status ///```ignore - /// let response = client.get_ratings_analyses() + /// let response = client.get_cities_submissions() /// .page(page) /// .page_size(page_size) + /// .status(status) /// .send() /// .await; /// ``` - pub fn get_ratings_analyses(&self) -> builder::GetRatingsAnalyses { - builder::GetRatingsAnalyses::new(self) + pub fn get_cities_submissions(&self) -> builder::GetCitiesSubmissions { + builder::GetCitiesSubmissions::new(self) } - ///Submit a new city to analyze - /// - ///Submit a new city to analyze + ///Create a new city submission. /// - ///Sends a `POST` request to `/ratings/analyses` + ///Sends a `POST` request to `/cities/submissions` /// - ///Arguments: - /// - `body`: Create a new analysis performed by the brokenspoke-analyzer ///```ignore - /// let response = client.post_ratings_analyses() + /// let response = client.post_cities_submission() /// .body(body) /// .send() /// .await; /// ``` - pub fn post_ratings_analyses(&self) -> builder::PostRatingsAnalyses { - builder::PostRatingsAnalyses::new(self) + pub fn post_cities_submission(&self) -> builder::PostCitiesSubmission { + builder::PostCitiesSubmission::new(self) } - ///Get the summary of a specific analysis - /// - ///Get the summary of a specific analysis . + ///Get the details of a specific sumission. /// - ///Sends a `GET` request to `/ratings/analyses/{analysis_id}` + ///Sends a `GET` request to `/cities/submissions/{submission_id}` /// ///Arguments: - /// - `analysis_id`: State Machine Identifier + /// - `submission_id`: Submission identifier + /// - `status`: Filter for the submission status ///```ignore - /// let response = client.get_analysis() - /// .analysis_id(analysis_id) + /// let response = client.get_cities_submission() + /// .submission_id(submission_id) + /// .status(status) /// .send() /// .await; /// ``` - pub fn get_analysis(&self) -> builder::GetAnalysis { - builder::GetAnalysis::new(self) + pub fn get_cities_submission(&self) -> builder::GetCitiesSubmission { + builder::GetCitiesSubmission::new(self) } - ///Update an analysis - /// - ///Update an analysis + ///Update a city submission. /// - ///Sends a `PATCH` request to `/ratings/analyses/{analysis_id}` + ///Sends a `PATCH` request to `/cities/submissions/{submission_id}` /// ///Arguments: - /// - `analysis_id`: State Machine Identifier - /// - `body`: Update a new analysis performed by the brokenspoke-analyzer + /// - `submission_id`: Submission identifier + /// - `body` ///```ignore - /// let response = client.patch_analysis() - /// .analysis_id(analysis_id) + /// let response = client.patch_cities_submission() + /// .submission_id(submission_id) /// .body(body) /// .send() /// .await; /// ``` - pub fn patch_analysis(&self) -> builder::PatchAnalysis { - builder::PatchAnalysis::new(self) + pub fn patch_cities_submission(&self) -> builder::PatchCitiesSubmission { + builder::PatchCitiesSubmission::new(self) } - ///Get a specific city rating summary - /// - ///Get a specific city rating summary. + ///Get the details of a specific city where an BNA analysis was computed. /// - ///Sends a `GET` request to `/ratings/{rating_id}` + ///Sends a `GET` request to `/cities/{country}/{region}/{name}` /// ///Arguments: - /// - `rating_id`: Analysis identifier - /// - `component`: Select a component to retrieve alongside the BNA summary. - /// If none is specified, all the components are returned. - /// + /// - `country`: Country name + /// - `region`: Region name. A region can be a state, a province, a + /// community, or + ///something similar depending on the country. If a country does not have + ///this concept, then the country name is used. + /// - `name`: City name ///```ignore - /// let response = client.get_rating() - /// .rating_id(rating_id) - /// .component(component) + /// let response = client.get_city() + /// .country(country) + /// .region(region) + /// .name(name) /// .send() /// .await; /// ``` - pub fn get_rating(&self) -> builder::GetRating { - builder::GetRating::new(self) + pub fn get_city(&self) -> builder::GetCity { + builder::GetCity::new(self) } - ///Get a specific city rating summary and its associated city details - /// - ///Get a specific city rating summary and its associated city details. + ///Get the details of a specific city with its associated census + /// information. /// - ///Sends a `GET` request to `/ratings/{rating_id}/city` + ///Sends a `GET` request to `/cities/{country}/{region}/{name}/census` /// ///Arguments: - /// - `rating_id`: Analysis identifier + /// - `country`: Country name + /// - `region`: Region name. A region can be a state, a province, a + /// community, or + ///something similar depending on the country. If a country does not have + ///this concept, then the country name is used. + /// - `name`: City name + /// - `page`: The result page being returned + /// - `page_size`: The number of items per page ///```ignore - /// let response = client.get_rating_city() - /// .rating_id(rating_id) + /// let response = client.get_city_censuses() + /// .country(country) + /// .region(region) + /// .name(name) + /// .page(page) + /// .page_size(page_size) /// .send() /// .await; /// ``` - pub fn get_rating_city(&self) -> builder::GetRatingCity { - builder::GetRatingCity::new(self) + pub fn get_city_censuses(&self) -> builder::GetCityCensuses { + builder::GetCityCensuses::new(self) } - ///Get city details - /// - ///Get the details of all cities where an BNA analysis was performed. + ///Create census information for a specific city. /// - ///Sends a `GET` request to `/cities` + ///Sends a `POST` request to `/cities/{country}/{region}/{name}/census` /// ///Arguments: - /// - `page`: Page index (starting at 0) - /// - `page_size`: The number of items to be returned per page (1..50) + /// - `country`: Country name + /// - `region`: Region name. A region can be a state, a province, a + /// community, or + ///something similar depending on the country. If a country does not have + ///this concept, then the country name is used. + /// - `name`: City name + /// - `body` ///```ignore - /// let response = client.get_cities() - /// .page(page) - /// .page_size(page_size) + /// let response = client.post_city_census() + /// .country(country) + /// .region(region) + /// .name(name) + /// .body(body) /// .send() /// .await; /// ``` - pub fn get_cities(&self) -> builder::GetCities { - builder::GetCities::new(self) + pub fn post_city_census(&self) -> builder::PostCityCensus { + builder::PostCityCensus::new(self) } - ///Create a new city - /// - ///Create a new city. + ///Get the details of a specific city with all the analysis that were + /// performed against it. /// - ///Sends a `POST` request to `/cities` + ///Sends a `GET` request to `/cities/{country}/{region}/{name}/ratings` /// ///Arguments: - /// - `page`: Page index (starting at 0) - /// - `page_size`: The number of items to be returned per page (1..50) - /// - `body`: Create a new city. + /// - `country`: Country name + /// - `region`: Region name. A region can be a state, a province, a + /// community, or + ///something similar depending on the country. If a country does not have + ///this concept, then the country name is used. + /// - `name`: City name + /// - `page`: The result page being returned + /// - `page_size`: The number of items per page ///```ignore - /// let response = client.post_city() + /// let response = client.get_city_ratings() + /// .country(country) + /// .region(region) + /// .name(name) /// .page(page) /// .page_size(page_size) - /// .body(body) /// .send() /// .await; /// ``` - pub fn post_city(&self) -> builder::PostCity { - builder::PostCity::new(self) + pub fn get_city_ratings(&self) -> builder::GetCityRatings { + builder::GetCityRatings::new(self) } - ///Get the cities that were submitted for analysis - /// - ///Get the cities that were submitted for analysis. + ///Get the details of all BNA pipelines /// - ///Sends a `GET` request to `/cities/submissions` + ///Sends a `GET` request to `/pipelines/bna` /// ///Arguments: - /// - `page`: Page index (starting at 0) - /// - `page_size`: The number of items to be returned per page (1..50) + /// - `page`: The result page being returned + /// - `page_size`: The number of items per page ///```ignore - /// let response = client.get_city_submissions() + /// let response = client.get_pipelines_bnas() /// .page(page) /// .page_size(page_size) /// .send() /// .await; /// ``` - pub fn get_city_submissions(&self) -> builder::GetCitySubmissions { - builder::GetCitySubmissions::new(self) + pub fn get_pipelines_bnas(&self) -> builder::GetPipelinesBnas { + builder::GetPipelinesBnas::new(self) } - ///Submit a new city for analysis - /// - ///Submit a new city for analysis. + ///Create a new BNA pipeline /// - ///Sends a `POST` request to `/cities/submissions` + ///Sends a `POST` request to `/pipelines/bna` /// - ///Arguments: - /// - `body`: Create a new analysis to be performed by the - /// brokenspoke-analyzer ///```ignore - /// let response = client.post_city_submission() + /// let response = client.post_pipelines_bna() /// .body(body) /// .send() /// .await; /// ``` - pub fn post_city_submission(&self) -> builder::PostCitySubmission { - builder::PostCitySubmission::new(self) + pub fn post_pipelines_bna(&self) -> builder::PostPipelinesBna { + builder::PostPipelinesBna::new(self) } - ///Get the details of a specific sumission + ///Get the details of a specific BNA pipeline /// - ///Get the details of a specific sumission. - /// - ///Sends a `GET` request to `/cities/submissions/{submission_id}` + ///Sends a `GET` request to `/pipelines/bna/{pipeline_id}` /// ///Arguments: - /// - `submission_id`: Submission identifier + /// - `pipeline_id`: Pipeline identifier ///```ignore - /// let response = client.get_city_submission() - /// .submission_id(submission_id) + /// let response = client.get_pipelines_bna() + /// .pipeline_id(pipeline_id) /// .send() /// .await; /// ``` - pub fn get_city_submission(&self) -> builder::GetCitySubmission { - builder::GetCitySubmission::new(self) + pub fn get_pipelines_bna(&self) -> builder::GetPipelinesBna { + builder::GetPipelinesBna::new(self) } - ///Update the details of a specific sumission - /// - ///Update the details of a specific sumission. + ///Update the details of a specific BNA pipeline /// - ///Sends a `PATCH` request to `/cities/submissions/{submission_id}` + ///Sends a `PATCH` request to `/pipelines/bna/{pipeline_id}` /// ///Arguments: - /// - `submission_id`: Submission identifier - /// - `body`: Update the details of a specific sumission. + /// - `pipeline_id`: Pipeline identifier + /// - `body` ///```ignore - /// let response = client.patch_city_submissions() - /// .submission_id(submission_id) + /// let response = client.patch_pipelines_bna() + /// .pipeline_id(pipeline_id) /// .body(body) /// .send() /// .await; /// ``` - pub fn patch_city_submissions(&self) -> builder::PatchCitySubmissions { - builder::PatchCitySubmissions::new(self) + pub fn patch_pipelines_bna(&self) -> builder::PatchPipelinesBna { + builder::PatchPipelinesBna::new(self) } - ///Get the details of specific city - /// - ///Get the details of a specific city where an BNA analysis was computed. - /// + ///Get all the AWS Fargate prices used to compute analysis costs. /// - ///Sends a `GET` request to `/cities/{country}/{region}/{name}` + ///Sends a `GET` request to `/prices/fargate` /// ///Arguments: - /// - `country`: Country name - /// - `region`: Region name. A region can be a state, a province, a - /// community, or something similar depending on the country. If a country - /// does not have this concept, then the country name is used. - /// - /// - `name`: City name + /// - `page`: The result page being returned + /// - `page_size`: The number of items per page ///```ignore - /// let response = client.get_city() - /// .country(country) - /// .region(region) - /// .name(name) + /// let response = client.get_prices_fargate() + /// .page(page) + /// .page_size(page_size) /// .send() /// .await; /// ``` - pub fn get_city(&self) -> builder::GetCity { - builder::GetCity::new(self) + pub fn get_prices_fargate(&self) -> builder::GetPricesFargate { + builder::GetPricesFargate::new(self) } - ///Get the details of a specific city with all the analysis that were - /// performed against it - /// - /// - ///Get the details of a specific city with all the analysis that were - /// performed against it. + ///Get a specific AWS Fargate price used to compute the cost of analysis + /// cost. /// - /// - ///Sends a `GET` request to `/cities/{country}/{region}/{name}/ratings` + ///Sends a `GET` request to `/prices/fargate/{price_id}` /// ///Arguments: - /// - `country`: Country name - /// - `region`: Region name. A region can be a state, a province, a - /// community, or something similar depending on the country. If a country - /// does not have this concept, then the country name is used. - /// - /// - `name`: City name + /// - `price_id`: Identifier of a Fargate price ///```ignore - /// let response = client.get_city_ratings() - /// .country(country) - /// .region(region) - /// .name(name) + /// let response = client.get_price_fargate() + /// .price_id(price_id) /// .send() /// .await; /// ``` - pub fn get_city_ratings(&self) -> builder::GetCityRatings { - builder::GetCityRatings::new(self) + pub fn get_price_fargate(&self) -> builder::GetPriceFargate { + builder::GetPriceFargate::new(self) } - ///Get the details of a specific city with its associated census - /// information. - /// - /// - ///Get the details of a specific city with its associated census - /// information. - /// + ///Get city ratings /// - ///Sends a `GET` request to `/cities/{country}/{region}/{name}/census` + ///Sends a `GET` request to `/ratings` /// ///Arguments: - /// - `country`: Country name - /// - `region`: Region name. A region can be a state, a province, a - /// community, or something similar depending on the country. If a country - /// does not have this concept, then the country name is used. - /// - /// - `name`: City name + /// - `page`: The result page being returned + /// - `page_size`: The number of items per page ///```ignore - /// let response = client.get_city_census() - /// .country(country) - /// .region(region) - /// .name(name) + /// let response = client.get_ratings() + /// .page(page) + /// .page_size(page_size) /// .send() /// .await; /// ``` - pub fn get_city_census(&self) -> builder::GetCityCensus { - builder::GetCityCensus::new(self) + pub fn get_ratings(&self) -> builder::GetRatings { + builder::GetRatings::new(self) } - ///Create census information for a specific city - /// - ///Create census information for a specific city. - /// - ///Sends a `POST` request to `/cities/{country}/{region}/{name}/census` + ///Create a new city rating /// - ///Arguments: - /// - `country`: Country name - /// - `region`: Region name. A region can be a state, a province, a - /// community, or something similar depending on the country. If a country - /// does not have this concept, then the country name is used. + ///Sends a `POST` request to `/ratings` /// - /// - `name`: City name - /// - `body`: Create the census information for a specific city. ///```ignore - /// let response = client.patch_city_census() - /// .country(country) - /// .region(region) - /// .name(name) + /// let response = client.post_rating() /// .body(body) /// .send() /// .await; /// ``` - pub fn patch_city_census(&self) -> builder::PatchCityCensus { - builder::PatchCityCensus::new(self) + pub fn post_rating(&self) -> builder::PostRating { + builder::PostRating::new(self) } - ///Enqueue a city to process - /// - ///Enqueue a city to process. + ///Get the details of a specific city rating /// - ///Sends a `POST` request to `/ratings/enqueue` + ///Sends a `GET` request to `/ratings/{rating_id}` /// ///Arguments: - /// - `body`: Create a new city to enqueue. - ///```ignore - /// let response = client.post_rating_enqueue() - /// .body(body) - /// .send() - /// .await; - /// ``` - pub fn post_rating_enqueue(&self) -> builder::PostRatingEnqueue { - builder::PostRatingEnqueue::new(self) - } - - ///Get all the AWS Fargate prices used to compute analysis costs - /// - ///Get all the AWS Fargate prices used to compute analysis costs. - /// - ///Sends a `GET` request to `/price/fargate` - /// + /// - `rating_id`: Rating identifier ///```ignore - /// let response = client.get_prices_fargate() + /// let response = client.get_rating() + /// .rating_id(rating_id) /// .send() /// .await; /// ``` - pub fn get_prices_fargate(&self) -> builder::GetPricesFargate { - builder::GetPricesFargate::new(self) + pub fn get_rating(&self) -> builder::GetRating { + builder::GetRating::new(self) } - ///Get a AWS Fargate price used to compute the cost of an analysis - /// - ///Get a AWS Fargate price used to compute the cost of analysis cost. + ///Get a city rating and its associated city details /// - ///Sends a `GET` request to `/price/fargate/{fargate_price_id}` + ///Sends a `GET` request to `/ratings/{rating_id}/city` /// ///Arguments: - /// - `fargate_price_id`: Identifier of a Fargate price + /// - `rating_id`: Rating identifier ///```ignore - /// let response = client.get_price_fargate() - /// .fargate_price_id(fargate_price_id) + /// let response = client.get_ratings_city() + /// .rating_id(rating_id) /// .send() /// .await; /// ``` - pub fn get_price_fargate(&self) -> builder::GetPriceFargate { - builder::GetPriceFargate::new(self) + pub fn get_ratings_city(&self) -> builder::GetRatingsCity { + builder::GetRatingsCity::new(self) } } @@ -8162,17 +8009,17 @@ pub mod builder { use super::{ encode_path, ByteStream, Error, HeaderMap, HeaderValue, RequestBuilderExt, ResponseValue, }; - ///Builder for [`Client::get_ratings`] + ///Builder for [`Client::get_cities`] /// - ///[`Client::get_ratings`]: super::Client::get_ratings + ///[`Client::get_cities`]: super::Client::get_cities #[derive(Debug, Clone)] - pub struct GetRatings<'a> { + pub struct GetCities<'a> { client: &'a super::Client, page: Result, String>, page_size: Result, String>, } - impl<'a> GetRatings<'a> { + impl<'a> GetCities<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, @@ -8203,10 +8050,8 @@ pub mod builder { self } - ///Sends a `GET` request to `/ratings` - pub async fn send( - self, - ) -> Result>, Error<()>> { + ///Sends a `GET` request to `/cities` + pub async fn send(self) -> Result, Error<()>> { let Self { client, page, @@ -8214,7 +8059,7 @@ pub mod builder { } = self; let page = page.map_err(Error::InvalidRequest)?; let page_size = page_size.map_err(Error::InvalidRequest)?; - let url = format!("{}/ratings", client.baseurl,); + let url = format!("{}/cities", client.baseurl,); let mut query = Vec::with_capacity(2usize); if let Some(v) = &page { query.push(("page", v.to_string())); @@ -8241,50 +8086,52 @@ pub mod builder { } } - ///Builder for [`Client::post_ratings`] + ///Builder for [`Client::post_city`] /// - ///[`Client::post_ratings`]: super::Client::post_ratings + ///[`Client::post_city`]: super::Client::post_city #[derive(Debug, Clone)] - pub struct PostRatings<'a> { + pub struct PostCity<'a> { client: &'a super::Client, - body: Result, + body: Result, } - impl<'a> PostRatings<'a> { + impl<'a> PostCity<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, - body: Ok(types::builder::BnaPost::default()), + body: Ok(types::builder::CityPost::default()), } } pub fn body(mut self, value: V) -> Self where - V: std::convert::TryInto, - >::Error: std::fmt::Display, + V: std::convert::TryInto, + >::Error: std::fmt::Display, { self.body = value .try_into() .map(From::from) - .map_err(|s| format!("conversion to `BnaPost` for body failed: {}", s)); + .map_err(|s| format!("conversion to `CityPost` for body failed: {}", s)); self } pub fn body_map(mut self, f: F) -> Self where - F: std::ops::FnOnce(types::builder::BnaPost) -> types::builder::BnaPost, + F: std::ops::FnOnce(types::builder::CityPost) -> types::builder::CityPost, { self.body = self.body.map(f); self } - ///Sends a `POST` request to `/ratings` - pub async fn send(self) -> Result, Error> { + ///Sends a `POST` request to `/cities` + pub async fn send( + self, + ) -> Result, Error> { let Self { client, body } = self; let body = body - .and_then(|v| types::BnaPost::try_from(v).map_err(|e| e.to_string())) + .and_then(|v| types::CityPost::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/ratings", client.baseurl,); + let url = format!("{}/cities", client.baseurl,); #[allow(unused_mut)] let mut request = client .client @@ -8299,30 +8146,41 @@ pub mod builder { let response = result?; match response.status().as_u16() { 201u16 => ResponseValue::from_response(response).await, + 400u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 401u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), 403u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), + 404u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), _ => Err(Error::UnexpectedResponse(response)), } } } - ///Builder for [`Client::get_ratings_analyses`] + ///Builder for [`Client::get_cities_submissions`] /// - ///[`Client::get_ratings_analyses`]: super::Client::get_ratings_analyses + ///[`Client::get_cities_submissions`]: super::Client::get_cities_submissions #[derive(Debug, Clone)] - pub struct GetRatingsAnalyses<'a> { + pub struct GetCitiesSubmissions<'a> { client: &'a super::Client, page: Result, String>, page_size: Result, String>, + status: Result, String>, } - impl<'a> GetRatingsAnalyses<'a> { + impl<'a> GetCitiesSubmissions<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, page: Ok(None), page_size: Ok(None), + status: Ok(None), } } @@ -8348,25 +8206,41 @@ pub mod builder { self } - ///Sends a `GET` request to `/ratings/analyses` + pub fn status(mut self, value: V) -> Self + where + V: std::convert::TryInto<::std::string::String>, + { + self.status = value.try_into().map(Some).map_err(|_| { + "conversion to `:: std :: string :: String` for status failed".to_string() + }); + self + } + + ///Sends a `GET` request to `/cities/submissions` pub async fn send( self, - ) -> Result>, Error> { + ) -> Result, Error> + { let Self { client, page, page_size, + status, } = self; let page = page.map_err(Error::InvalidRequest)?; let page_size = page_size.map_err(Error::InvalidRequest)?; - let url = format!("{}/ratings/analyses", client.baseurl,); - let mut query = Vec::with_capacity(2usize); + let status = status.map_err(Error::InvalidRequest)?; + let url = format!("{}/cities/submissions", client.baseurl,); + let mut query = Vec::with_capacity(3usize); if let Some(v) = &page { query.push(("page", v.to_string())); } if let Some(v) = &page_size { query.push(("page_size", v.to_string())); } + if let Some(v) = &status { + query.push(("status", v.to_string())); + } #[allow(unused_mut)] let mut request = client .client @@ -8381,58 +8255,70 @@ pub mod builder { let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, + 400u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 401u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), 403u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), + 404u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), _ => Err(Error::UnexpectedResponse(response)), } } } - ///Builder for [`Client::post_ratings_analyses`] + ///Builder for [`Client::post_cities_submission`] /// - ///[`Client::post_ratings_analyses`]: super::Client::post_ratings_analyses + ///[`Client::post_cities_submission`]: super::Client::post_cities_submission #[derive(Debug, Clone)] - pub struct PostRatingsAnalyses<'a> { + pub struct PostCitiesSubmission<'a> { client: &'a super::Client, - body: Result, + body: Result, } - impl<'a> PostRatingsAnalyses<'a> { + impl<'a> PostCitiesSubmission<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, - body: Ok(types::builder::AnalysisPost::default()), + body: Ok(types::builder::SubmissionPost::default()), } } pub fn body(mut self, value: V) -> Self where - V: std::convert::TryInto, - >::Error: std::fmt::Display, + V: std::convert::TryInto, + >::Error: std::fmt::Display, { self.body = value .try_into() .map(From::from) - .map_err(|s| format!("conversion to `AnalysisPost` for body failed: {}", s)); + .map_err(|s| format!("conversion to `SubmissionPost` for body failed: {}", s)); self } pub fn body_map(mut self, f: F) -> Self where - F: std::ops::FnOnce(types::builder::AnalysisPost) -> types::builder::AnalysisPost, + F: std::ops::FnOnce(types::builder::SubmissionPost) -> types::builder::SubmissionPost, { self.body = self.body.map(f); self } - ///Sends a `POST` request to `/ratings/analyses` - pub async fn send(self) -> Result, Error> { + ///Sends a `POST` request to `/cities/submissions` + pub async fn send( + self, + ) -> Result, Error> + { let Self { client, body } = self; let body = body - .and_then(|v| types::AnalysisPost::try_from(v).map_err(|e| e.to_string())) + .and_then(|v| types::SubmissionPost::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/ratings/analyses", client.baseurl,); + let url = format!("{}/cities/submissions", client.baseurl,); #[allow(unused_mut)] let mut request = client .client @@ -8450,50 +8336,80 @@ pub mod builder { 400u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), + 401u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 403u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 404u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), _ => Err(Error::UnexpectedResponse(response)), } } } - ///Builder for [`Client::get_analysis`] + ///Builder for [`Client::get_cities_submission`] /// - ///[`Client::get_analysis`]: super::Client::get_analysis + ///[`Client::get_cities_submission`]: super::Client::get_cities_submission #[derive(Debug, Clone)] - pub struct GetAnalysis<'a> { + pub struct GetCitiesSubmission<'a> { client: &'a super::Client, - analysis_id: Result, + submission_id: Result, + status: Result, String>, } - impl<'a> GetAnalysis<'a> { + impl<'a> GetCitiesSubmission<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, - analysis_id: Err("analysis_id was not initialized".to_string()), + submission_id: Err("submission_id was not initialized".to_string()), + status: Ok(None), } } - pub fn analysis_id(mut self, value: V) -> Self + pub fn submission_id(mut self, value: V) -> Self where - V: std::convert::TryInto, + V: std::convert::TryInto, { - self.analysis_id = value + self.submission_id = value .try_into() - .map_err(|_| "conversion to `StateMachineId` for analysis_id failed".to_string()); + .map_err(|_| "conversion to `i32` for submission_id failed".to_string()); + self + } + + pub fn status(mut self, value: V) -> Self + where + V: std::convert::TryInto<::std::string::String>, + { + self.status = value.try_into().map(Some).map_err(|_| { + "conversion to `:: std :: string :: String` for status failed".to_string() + }); self } - ///Sends a `GET` request to `/ratings/analyses/{analysis_id}` - pub async fn send(self) -> Result, Error> { + ///Sends a `GET` request to `/cities/submissions/{submission_id}` + pub async fn send( + self, + ) -> Result, Error> + { let Self { client, - analysis_id, + submission_id, + status, } = self; - let analysis_id = analysis_id.map_err(Error::InvalidRequest)?; + let submission_id = submission_id.map_err(Error::InvalidRequest)?; + let status = status.map_err(Error::InvalidRequest)?; let url = format!( - "{}/ratings/analyses/{}", + "{}/cities/submissions/{}", client.baseurl, - encode_path(&analysis_id.to_string()), + encode_path(&submission_id.to_string()), ); + let mut query = Vec::with_capacity(1usize); + if let Some(v) = &status { + query.push(("status", v.to_string())); + } #[allow(unused_mut)] let mut request = client .client @@ -8502,6 +8418,7 @@ pub mod builder { reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) + .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; @@ -8510,6 +8427,9 @@ pub mod builder { 400u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), + 401u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), 403u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), @@ -8521,70 +8441,73 @@ pub mod builder { } } - ///Builder for [`Client::patch_analysis`] + ///Builder for [`Client::patch_cities_submission`] /// - ///[`Client::patch_analysis`]: super::Client::patch_analysis + ///[`Client::patch_cities_submission`]: super::Client::patch_cities_submission #[derive(Debug, Clone)] - pub struct PatchAnalysis<'a> { + pub struct PatchCitiesSubmission<'a> { client: &'a super::Client, - analysis_id: Result, - body: Result, + submission_id: Result, + body: Result, } - impl<'a> PatchAnalysis<'a> { + impl<'a> PatchCitiesSubmission<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, - analysis_id: Err("analysis_id was not initialized".to_string()), - body: Ok(types::builder::AnalysisPatch::default()), + submission_id: Err("submission_id was not initialized".to_string()), + body: Ok(types::builder::SubmissionPatch::default()), } } - pub fn analysis_id(mut self, value: V) -> Self + pub fn submission_id(mut self, value: V) -> Self where - V: std::convert::TryInto, + V: std::convert::TryInto, { - self.analysis_id = value + self.submission_id = value .try_into() - .map_err(|_| "conversion to `StateMachineId` for analysis_id failed".to_string()); + .map_err(|_| "conversion to `i32` for submission_id failed".to_string()); self } pub fn body(mut self, value: V) -> Self where - V: std::convert::TryInto, - >::Error: std::fmt::Display, + V: std::convert::TryInto, + >::Error: std::fmt::Display, { self.body = value .try_into() .map(From::from) - .map_err(|s| format!("conversion to `AnalysisPatch` for body failed: {}", s)); + .map_err(|s| format!("conversion to `SubmissionPatch` for body failed: {}", s)); self } pub fn body_map(mut self, f: F) -> Self where - F: std::ops::FnOnce(types::builder::AnalysisPatch) -> types::builder::AnalysisPatch, + F: std::ops::FnOnce(types::builder::SubmissionPatch) -> types::builder::SubmissionPatch, { self.body = self.body.map(f); self } - ///Sends a `PATCH` request to `/ratings/analyses/{analysis_id}` - pub async fn send(self) -> Result, Error> { + ///Sends a `PATCH` request to `/cities/submissions/{submission_id}` + pub async fn send( + self, + ) -> Result, Error> + { let Self { client, - analysis_id, + submission_id, body, } = self; - let analysis_id = analysis_id.map_err(Error::InvalidRequest)?; + let submission_id = submission_id.map_err(Error::InvalidRequest)?; let body = body - .and_then(|v| types::AnalysisPatch::try_from(v).map_err(|e| e.to_string())) + .and_then(|v| types::SubmissionPatch::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; let url = format!( - "{}/ratings/analyses/{}", + "{}/cities/submissions/{}", client.baseurl, - encode_path(&analysis_id.to_string()), + encode_path(&submission_id.to_string()), ); #[allow(unused_mut)] let mut request = client @@ -8603,6 +8526,9 @@ pub mod builder { 400u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), + 401u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), 403u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), @@ -8614,63 +8540,215 @@ pub mod builder { } } - ///Builder for [`Client::get_rating`] + ///Builder for [`Client::get_city`] /// - ///[`Client::get_rating`]: super::Client::get_rating + ///[`Client::get_city`]: super::Client::get_city #[derive(Debug, Clone)] - pub struct GetRating<'a> { + pub struct GetCity<'a> { client: &'a super::Client, - rating_id: Result, - component: Result, String>, + country: Result, + region: Result<::std::string::String, String>, + name: Result<::std::string::String, String>, } - impl<'a> GetRating<'a> { + impl<'a> GetCity<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, - rating_id: Err("rating_id was not initialized".to_string()), - component: Ok(None), + country: Err("country was not initialized".to_string()), + region: Err("region was not initialized".to_string()), + name: Err("name was not initialized".to_string()), } } - pub fn rating_id(mut self, value: V) -> Self + pub fn country(mut self, value: V) -> Self where - V: std::convert::TryInto, + V: std::convert::TryInto, { - self.rating_id = value + self.country = value .try_into() - .map_err(|_| "conversion to `uuid :: Uuid` for rating_id failed".to_string()); + .map_err(|_| "conversion to `Country` for country failed".to_string()); + self + } + + pub fn region(mut self, value: V) -> Self + where + V: std::convert::TryInto<::std::string::String>, + { + self.region = value.try_into().map_err(|_| { + "conversion to `:: std :: string :: String` for region failed".to_string() + }); + self + } + + pub fn name(mut self, value: V) -> Self + where + V: std::convert::TryInto<::std::string::String>, + { + self.name = value.try_into().map_err(|_| { + "conversion to `:: std :: string :: String` for name failed".to_string() + }); + self + } + + ///Sends a `GET` request to `/cities/{country}/{region}/{name}` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + country, + region, + name, + } = self; + let country = country.map_err(Error::InvalidRequest)?; + let region = region.map_err(Error::InvalidRequest)?; + let name = name.map_err(Error::InvalidRequest)?; + let url = format!( + "{}/cities/{}/{}/{}", + client.baseurl, + encode_path(&country.to_string()), + encode_path(®ion.to_string()), + encode_path(&name.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 401u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 403u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 404u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + ///Builder for [`Client::get_city_censuses`] + /// + ///[`Client::get_city_censuses`]: super::Client::get_city_censuses + #[derive(Debug, Clone)] + pub struct GetCityCensuses<'a> { + client: &'a super::Client, + country: Result, + region: Result<::std::string::String, String>, + name: Result<::std::string::String, String>, + page: Result, String>, + page_size: Result, String>, + } + + impl<'a> GetCityCensuses<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + country: Err("country was not initialized".to_string()), + region: Err("region was not initialized".to_string()), + name: Err("name was not initialized".to_string()), + page: Ok(None), + page_size: Ok(None), + } + } + + pub fn country(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.country = value + .try_into() + .map_err(|_| "conversion to `Country` for country failed".to_string()); + self + } + + pub fn region(mut self, value: V) -> Self + where + V: std::convert::TryInto<::std::string::String>, + { + self.region = value.try_into().map_err(|_| { + "conversion to `:: std :: string :: String` for region failed".to_string() + }); + self + } + + pub fn name(mut self, value: V) -> Self + where + V: std::convert::TryInto<::std::string::String>, + { + self.name = value.try_into().map_err(|_| { + "conversion to `:: std :: string :: String` for name failed".to_string() + }); + self + } + + pub fn page(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.page = value + .try_into() + .map(Some) + .map_err(|_| "conversion to `i64` for page failed".to_string()); self } - pub fn component(mut self, value: V) -> Self + pub fn page_size(mut self, value: V) -> Self where - V: std::convert::TryInto, + V: std::convert::TryInto, { - self.component = value + self.page_size = value .try_into() .map(Some) - .map_err(|_| "conversion to `GetRatingComponent` for component failed".to_string()); + .map_err(|_| "conversion to `i64` for page_size failed".to_string()); self } - ///Sends a `GET` request to `/ratings/{rating_id}` - pub async fn send(self) -> Result, Error> { + ///Sends a `GET` request to `/cities/{country}/{region}/{name}/census` + pub async fn send( + self, + ) -> Result, Error> + { let Self { client, - rating_id, - component, + country, + region, + name, + page, + page_size, } = self; - let rating_id = rating_id.map_err(Error::InvalidRequest)?; - let component = component.map_err(Error::InvalidRequest)?; + let country = country.map_err(Error::InvalidRequest)?; + let region = region.map_err(Error::InvalidRequest)?; + let name = name.map_err(Error::InvalidRequest)?; + let page = page.map_err(Error::InvalidRequest)?; + let page_size = page_size.map_err(Error::InvalidRequest)?; let url = format!( - "{}/ratings/{}", + "{}/cities/{}/{}/{}/census", client.baseurl, - encode_path(&rating_id.to_string()), + encode_path(&country.to_string()), + encode_path(®ion.to_string()), + encode_path(&name.to_string()), ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &component { - query.push(("component", v.to_string())); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &page { + query.push(("page", v.to_string())); + } + if let Some(v) = &page_size { + query.push(("page_size", v.to_string())); } #[allow(unused_mut)] let mut request = client @@ -8689,6 +8767,12 @@ pub mod builder { 400u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), + 401u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 403u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), 404u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), @@ -8697,63 +8781,126 @@ pub mod builder { } } - ///Builder for [`Client::get_rating_city`] + ///Builder for [`Client::post_city_census`] /// - ///[`Client::get_rating_city`]: super::Client::get_rating_city + ///[`Client::post_city_census`]: super::Client::post_city_census #[derive(Debug, Clone)] - pub struct GetRatingCity<'a> { + pub struct PostCityCensus<'a> { client: &'a super::Client, - rating_id: Result, + country: Result, + region: Result<::std::string::String, String>, + name: Result<::std::string::String, String>, + body: Result, } - impl<'a> GetRatingCity<'a> { + impl<'a> PostCityCensus<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, - rating_id: Err("rating_id was not initialized".to_string()), + country: Err("country was not initialized".to_string()), + region: Err("region was not initialized".to_string()), + name: Err("name was not initialized".to_string()), + body: Ok(types::builder::CensusPost::default()), } } - pub fn rating_id(mut self, value: V) -> Self + pub fn country(mut self, value: V) -> Self where - V: std::convert::TryInto, + V: std::convert::TryInto, { - self.rating_id = value + self.country = value .try_into() - .map_err(|_| "conversion to `uuid :: Uuid` for rating_id failed".to_string()); + .map_err(|_| "conversion to `Country` for country failed".to_string()); self } - ///Sends a `GET` request to `/ratings/{rating_id}/city` + pub fn region(mut self, value: V) -> Self + where + V: std::convert::TryInto<::std::string::String>, + { + self.region = value.try_into().map_err(|_| { + "conversion to `:: std :: string :: String` for region failed".to_string() + }); + self + } + + pub fn name(mut self, value: V) -> Self + where + V: std::convert::TryInto<::std::string::String>, + { + self.name = value.try_into().map_err(|_| { + "conversion to `:: std :: string :: String` for name failed".to_string() + }); + self + } + + pub fn body(mut self, value: V) -> Self + where + V: std::convert::TryInto, + >::Error: std::fmt::Display, + { + self.body = value + .try_into() + .map(From::from) + .map_err(|s| format!("conversion to `CensusPost` for body failed: {}", s)); + self + } + + pub fn body_map(mut self, f: F) -> Self + where + F: std::ops::FnOnce(types::builder::CensusPost) -> types::builder::CensusPost, + { + self.body = self.body.map(f); + self + } + + ///Sends a `POST` request to `/cities/{country}/{region}/{name}/census` pub async fn send( self, - ) -> Result< - ResponseValue<::std::vec::Vec>, - Error, - > { - let Self { client, rating_id } = self; - let rating_id = rating_id.map_err(Error::InvalidRequest)?; + ) -> Result, Error> { + let Self { + client, + country, + region, + name, + body, + } = self; + let country = country.map_err(Error::InvalidRequest)?; + let region = region.map_err(Error::InvalidRequest)?; + let name = name.map_err(Error::InvalidRequest)?; + let body = body + .and_then(|v| types::CensusPost::try_from(v).map_err(|e| e.to_string())) + .map_err(Error::InvalidRequest)?; let url = format!( - "{}/ratings/{}/city", + "{}/cities/{}/{}/{}/census", client.baseurl, - encode_path(&rating_id.to_string()), + encode_path(&country.to_string()), + encode_path(®ion.to_string()), + encode_path(&name.to_string()), ); #[allow(unused_mut)] let mut request = client .client - .get(url) + .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) + .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, + 201u16 => ResponseValue::from_response(response).await, 400u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), + 401u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 403u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), 404u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), @@ -8762,102 +8909,59 @@ pub mod builder { } } - ///Builder for [`Client::get_cities`] + ///Builder for [`Client::get_city_ratings`] /// - ///[`Client::get_cities`]: super::Client::get_cities + ///[`Client::get_city_ratings`]: super::Client::get_city_ratings #[derive(Debug, Clone)] - pub struct GetCities<'a> { + pub struct GetCityRatings<'a> { client: &'a super::Client, + country: Result, + region: Result<::std::string::String, String>, + name: Result<::std::string::String, String>, page: Result, String>, page_size: Result, String>, } - impl<'a> GetCities<'a> { + impl<'a> GetCityRatings<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, + country: Err("country was not initialized".to_string()), + region: Err("region was not initialized".to_string()), + name: Err("name was not initialized".to_string()), page: Ok(None), page_size: Ok(None), } } - pub fn page(mut self, value: V) -> Self + pub fn country(mut self, value: V) -> Self where - V: std::convert::TryInto, + V: std::convert::TryInto, { - self.page = value + self.country = value .try_into() - .map(Some) - .map_err(|_| "conversion to `i64` for page failed".to_string()); + .map_err(|_| "conversion to `Country` for country failed".to_string()); self } - pub fn page_size(mut self, value: V) -> Self + pub fn region(mut self, value: V) -> Self where - V: std::convert::TryInto, + V: std::convert::TryInto<::std::string::String>, { - self.page_size = value - .try_into() - .map(Some) - .map_err(|_| "conversion to `i64` for page_size failed".to_string()); + self.region = value.try_into().map_err(|_| { + "conversion to `:: std :: string :: String` for region failed".to_string() + }); self } - ///Sends a `GET` request to `/cities` - pub async fn send(self) -> Result>, Error<()>> { - let Self { - client, - page, - page_size, - } = self; - let page = page.map_err(Error::InvalidRequest)?; - let page_size = page_size.map_err(Error::InvalidRequest)?; - let url = format!("{}/cities", client.baseurl,); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &page_size { - query.push(("page_size", v.to_string())); - } - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - } - - ///Builder for [`Client::post_city`] - /// - ///[`Client::post_city`]: super::Client::post_city - #[derive(Debug, Clone)] - pub struct PostCity<'a> { - client: &'a super::Client, - page: Result, String>, - page_size: Result, String>, - body: Result, - } - - impl<'a> PostCity<'a> { - pub fn new(client: &'a super::Client) -> Self { - Self { - client: client, - page: Ok(None), - page_size: Ok(None), - body: Ok(types::builder::CityPost::default()), - } + pub fn name(mut self, value: V) -> Self + where + V: std::convert::TryInto<::std::string::String>, + { + self.name = value.try_into().map_err(|_| { + "conversion to `:: std :: string :: String` for name failed".to_string() + }); + self } pub fn page(mut self, value: V) -> Self @@ -8882,40 +8986,31 @@ pub mod builder { self } - pub fn body(mut self, value: V) -> Self - where - V: std::convert::TryInto, - >::Error: std::fmt::Display, - { - self.body = value - .try_into() - .map(From::from) - .map_err(|s| format!("conversion to `CityPost` for body failed: {}", s)); - self - } - - pub fn body_map(mut self, f: F) -> Self - where - F: std::ops::FnOnce(types::builder::CityPost) -> types::builder::CityPost, + ///Sends a `GET` request to `/cities/{country}/{region}/{name}/ratings` + pub async fn send( + self, + ) -> Result, Error> { - self.body = self.body.map(f); - self - } - - ///Sends a `POST` request to `/cities` - pub async fn send(self) -> Result, Error> { let Self { client, + country, + region, + name, page, page_size, - body, } = self; + let country = country.map_err(Error::InvalidRequest)?; + let region = region.map_err(Error::InvalidRequest)?; + let name = name.map_err(Error::InvalidRequest)?; let page = page.map_err(Error::InvalidRequest)?; let page_size = page_size.map_err(Error::InvalidRequest)?; - let body = body - .and_then(|v| types::CityPost::try_from(v).map_err(|e| e.to_string())) - .map_err(Error::InvalidRequest)?; - let url = format!("{}/cities", client.baseurl,); + let url = format!( + "{}/cities/{}/{}/{}/ratings", + client.baseurl, + encode_path(&country.to_string()), + encode_path(®ion.to_string()), + encode_path(&name.to_string()), + ); let mut query = Vec::with_capacity(2usize); if let Some(v) = &page { query.push(("page", v.to_string())); @@ -8926,37 +9021,45 @@ pub mod builder { #[allow(unused_mut)] let mut request = client .client - .post(url) + .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .json(&body) .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, + 200u16 => ResponseValue::from_response(response).await, 400u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), + 401u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 403u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 404u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), _ => Err(Error::UnexpectedResponse(response)), } } } - ///Builder for [`Client::get_city_submissions`] + ///Builder for [`Client::get_pipelines_bnas`] /// - ///[`Client::get_city_submissions`]: super::Client::get_city_submissions + ///[`Client::get_pipelines_bnas`]: super::Client::get_pipelines_bnas #[derive(Debug, Clone)] - pub struct GetCitySubmissions<'a> { + pub struct GetPipelinesBnas<'a> { client: &'a super::Client, page: Result, String>, page_size: Result, String>, } - impl<'a> GetCitySubmissions<'a> { + impl<'a> GetPipelinesBnas<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, @@ -8987,10 +9090,11 @@ pub mod builder { self } - ///Sends a `GET` request to `/cities/submissions` + ///Sends a `GET` request to `/pipelines/bna` pub async fn send( self, - ) -> Result>, Error<()>> { + ) -> Result, Error> + { let Self { client, page, @@ -8998,7 +9102,7 @@ pub mod builder { } = self; let page = page.map_err(Error::InvalidRequest)?; let page_size = page_size.map_err(Error::InvalidRequest)?; - let url = format!("{}/cities/submissions", client.baseurl,); + let url = format!("{}/pipelines/bna", client.baseurl,); let mut query = Vec::with_capacity(2usize); if let Some(v) = &page { query.push(("page", v.to_string())); @@ -9020,55 +9124,70 @@ pub mod builder { let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, + 400u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 401u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 403u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 404u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), _ => Err(Error::UnexpectedResponse(response)), } } } - ///Builder for [`Client::post_city_submission`] + ///Builder for [`Client::post_pipelines_bna`] /// - ///[`Client::post_city_submission`]: super::Client::post_city_submission + ///[`Client::post_pipelines_bna`]: super::Client::post_pipelines_bna #[derive(Debug, Clone)] - pub struct PostCitySubmission<'a> { + pub struct PostPipelinesBna<'a> { client: &'a super::Client, - body: Result, + body: Result, } - impl<'a> PostCitySubmission<'a> { + impl<'a> PostPipelinesBna<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, - body: Ok(types::builder::SubmissionPost::default()), + body: Ok(types::builder::BnaPipelinePost::default()), } } pub fn body(mut self, value: V) -> Self where - V: std::convert::TryInto, - >::Error: std::fmt::Display, + V: std::convert::TryInto, + >::Error: std::fmt::Display, { self.body = value .try_into() .map(From::from) - .map_err(|s| format!("conversion to `SubmissionPost` for body failed: {}", s)); + .map_err(|s| format!("conversion to `BnaPipelinePost` for body failed: {}", s)); self } pub fn body_map(mut self, f: F) -> Self where - F: std::ops::FnOnce(types::builder::SubmissionPost) -> types::builder::SubmissionPost, + F: std::ops::FnOnce(types::builder::BnaPipelinePost) -> types::builder::BnaPipelinePost, { self.body = self.body.map(f); self } - ///Sends a `POST` request to `/cities/submissions` - pub async fn send(self) -> Result, Error> { + ///Sends a `POST` request to `/pipelines/bna` + pub async fn send( + self, + ) -> Result, Error> + { let Self { client, body } = self; let body = body - .and_then(|v| types::SubmissionPost::try_from(v).map_err(|e| e.to_string())) + .and_then(|v| types::BnaPipelinePost::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/cities/submissions", client.baseurl,); + let url = format!("{}/pipelines/bna", client.baseurl,); #[allow(unused_mut)] let mut request = client .client @@ -9086,49 +9205,61 @@ pub mod builder { 400u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), + 401u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 403u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 404u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), _ => Err(Error::UnexpectedResponse(response)), } } } - ///Builder for [`Client::get_city_submission`] + ///Builder for [`Client::get_pipelines_bna`] /// - ///[`Client::get_city_submission`]: super::Client::get_city_submission + ///[`Client::get_pipelines_bna`]: super::Client::get_pipelines_bna #[derive(Debug, Clone)] - pub struct GetCitySubmission<'a> { + pub struct GetPipelinesBna<'a> { client: &'a super::Client, - submission_id: Result, + pipeline_id: Result, } - impl<'a> GetCitySubmission<'a> { + impl<'a> GetPipelinesBna<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, - submission_id: Err("submission_id was not initialized".to_string()), + pipeline_id: Err("pipeline_id was not initialized".to_string()), } } - pub fn submission_id(mut self, value: V) -> Self + pub fn pipeline_id(mut self, value: V) -> Self where - V: std::convert::TryInto, + V: std::convert::TryInto, { - self.submission_id = value + self.pipeline_id = value .try_into() - .map_err(|_| "conversion to `i64` for submission_id failed".to_string()); + .map_err(|_| "conversion to `uuid :: Uuid` for pipeline_id failed".to_string()); self } - ///Sends a `GET` request to `/cities/submissions/{submission_id}` - pub async fn send(self) -> Result, Error> { + ///Sends a `GET` request to `/pipelines/bna/{pipeline_id}` + pub async fn send( + self, + ) -> Result, Error> + { let Self { client, - submission_id, + pipeline_id, } = self; - let submission_id = submission_id.map_err(Error::InvalidRequest)?; + let pipeline_id = pipeline_id.map_err(Error::InvalidRequest)?; let url = format!( - "{}/cities/submissions/{}", + "{}/pipelines/bna/{}", client.baseurl, - encode_path(&submission_id.to_string()), + encode_path(&pipeline_id.to_string()), ); #[allow(unused_mut)] let mut request = client @@ -9146,6 +9277,12 @@ pub mod builder { 400u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), + 401u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 403u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), 404u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), @@ -9154,70 +9291,75 @@ pub mod builder { } } - ///Builder for [`Client::patch_city_submissions`] + ///Builder for [`Client::patch_pipelines_bna`] /// - ///[`Client::patch_city_submissions`]: super::Client::patch_city_submissions + ///[`Client::patch_pipelines_bna`]: super::Client::patch_pipelines_bna #[derive(Debug, Clone)] - pub struct PatchCitySubmissions<'a> { + pub struct PatchPipelinesBna<'a> { client: &'a super::Client, - submission_id: Result, - body: Result, + pipeline_id: Result, + body: Result, } - impl<'a> PatchCitySubmissions<'a> { + impl<'a> PatchPipelinesBna<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, - submission_id: Err("submission_id was not initialized".to_string()), - body: Ok(types::builder::SubmissionPatch::default()), + pipeline_id: Err("pipeline_id was not initialized".to_string()), + body: Ok(types::builder::BnaPipelinePatch::default()), } } - pub fn submission_id(mut self, value: V) -> Self + pub fn pipeline_id(mut self, value: V) -> Self where - V: std::convert::TryInto, + V: std::convert::TryInto, { - self.submission_id = value + self.pipeline_id = value .try_into() - .map_err(|_| "conversion to `i64` for submission_id failed".to_string()); + .map_err(|_| "conversion to `uuid :: Uuid` for pipeline_id failed".to_string()); self } pub fn body(mut self, value: V) -> Self where - V: std::convert::TryInto, - >::Error: std::fmt::Display, + V: std::convert::TryInto, + >::Error: std::fmt::Display, { self.body = value .try_into() .map(From::from) - .map_err(|s| format!("conversion to `SubmissionPatch` for body failed: {}", s)); + .map_err(|s| format!("conversion to `BnaPipelinePatch` for body failed: {}", s)); self } pub fn body_map(mut self, f: F) -> Self where - F: std::ops::FnOnce(types::builder::SubmissionPatch) -> types::builder::SubmissionPatch, + F: std::ops::FnOnce( + types::builder::BnaPipelinePatch, + ) -> types::builder::BnaPipelinePatch, { self.body = self.body.map(f); self } - ///Sends a `PATCH` request to `/cities/submissions/{submission_id}` - pub async fn send(self) -> Result, Error> { + ///Sends a `PATCH` request to `/pipelines/bna/{pipeline_id}` + pub async fn send( + self, + ) -> Result, Error> + { let Self { client, - submission_id, + pipeline_id, body, } = self; - let submission_id = submission_id.map_err(Error::InvalidRequest)?; + let pipeline_id = pipeline_id.map_err(Error::InvalidRequest)?; let body = body - .and_then(|v| types::SubmissionPatch::try_from(v).map_err(|e| e.to_string())) + .and_then(|v| types::BnaPipelinePatch::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; let url = format!( - "{}/cities/submissions/{}", + "{}/pipelines/bna/{}", client.baseurl, - encode_path(&submission_id.to_string()), + encode_path(&pipeline_id.to_string()), ); #[allow(unused_mut)] let mut request = client @@ -9236,100 +9378,10 @@ pub mod builder { 400u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), - 403u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 404u16 => Err(Error::ErrorResponse( + 401u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), - _ => Err(Error::UnexpectedResponse(response)), - } - } - } - - ///Builder for [`Client::get_city`] - /// - ///[`Client::get_city`]: super::Client::get_city - #[derive(Debug, Clone)] - pub struct GetCity<'a> { - client: &'a super::Client, - country: Result, - region: Result<::std::string::String, String>, - name: Result<::std::string::String, String>, - } - - impl<'a> GetCity<'a> { - pub fn new(client: &'a super::Client) -> Self { - Self { - client: client, - country: Err("country was not initialized".to_string()), - region: Err("region was not initialized".to_string()), - name: Err("name was not initialized".to_string()), - } - } - - pub fn country(mut self, value: V) -> Self - where - V: std::convert::TryInto, - { - self.country = value - .try_into() - .map_err(|_| "conversion to `Country` for country failed".to_string()); - self - } - - pub fn region(mut self, value: V) -> Self - where - V: std::convert::TryInto<::std::string::String>, - { - self.region = value.try_into().map_err(|_| { - "conversion to `:: std :: string :: String` for region failed".to_string() - }); - self - } - - pub fn name(mut self, value: V) -> Self - where - V: std::convert::TryInto<::std::string::String>, - { - self.name = value.try_into().map_err(|_| { - "conversion to `:: std :: string :: String` for name failed".to_string() - }); - self - } - - ///Sends a `GET` request to `/cities/{country}/{region}/{name}` - pub async fn send(self) -> Result, Error> { - let Self { - client, - country, - region, - name, - } = self; - let country = country.map_err(Error::InvalidRequest)?; - let region = region.map_err(Error::InvalidRequest)?; - let name = name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/cities/{}/{}/{}", - client.baseurl, - encode_path(&country.to_string()), - encode_path(®ion.to_string()), - encode_path(&name.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16 => Err(Error::ErrorResponse( + 403u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), 404u16 => Err(Error::ErrorResponse( @@ -9340,80 +9392,64 @@ pub mod builder { } } - ///Builder for [`Client::get_city_ratings`] + ///Builder for [`Client::get_prices_fargate`] /// - ///[`Client::get_city_ratings`]: super::Client::get_city_ratings + ///[`Client::get_prices_fargate`]: super::Client::get_prices_fargate #[derive(Debug, Clone)] - pub struct GetCityRatings<'a> { + pub struct GetPricesFargate<'a> { client: &'a super::Client, - country: Result, - region: Result<::std::string::String, String>, - name: Result<::std::string::String, String>, + page: Result, String>, + page_size: Result, String>, } - impl<'a> GetCityRatings<'a> { + impl<'a> GetPricesFargate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, - country: Err("country was not initialized".to_string()), - region: Err("region was not initialized".to_string()), - name: Err("name was not initialized".to_string()), + page: Ok(None), + page_size: Ok(None), } } - pub fn country(mut self, value: V) -> Self + pub fn page(mut self, value: V) -> Self where - V: std::convert::TryInto, + V: std::convert::TryInto, { - self.country = value + self.page = value .try_into() - .map_err(|_| "conversion to `Country` for country failed".to_string()); - self - } - - pub fn region(mut self, value: V) -> Self - where - V: std::convert::TryInto<::std::string::String>, - { - self.region = value.try_into().map_err(|_| { - "conversion to `:: std :: string :: String` for region failed".to_string() - }); + .map(Some) + .map_err(|_| "conversion to `i64` for page failed".to_string()); self } - pub fn name(mut self, value: V) -> Self + pub fn page_size(mut self, value: V) -> Self where - V: std::convert::TryInto<::std::string::String>, + V: std::convert::TryInto, { - self.name = value.try_into().map_err(|_| { - "conversion to `:: std :: string :: String` for name failed".to_string() - }); + self.page_size = value + .try_into() + .map(Some) + .map_err(|_| "conversion to `i64` for page_size failed".to_string()); self } - ///Sends a `GET` request to `/cities/{country}/{region}/{name}/ratings` - pub async fn send( - self, - ) -> Result< - ResponseValue<::std::vec::Vec>, - Error, - > { + ///Sends a `GET` request to `/prices/fargate` + pub async fn send(self) -> Result, Error<()>> { let Self { client, - country, - region, - name, + page, + page_size, } = self; - let country = country.map_err(Error::InvalidRequest)?; - let region = region.map_err(Error::InvalidRequest)?; - let name = name.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/cities/{}/{}/{}/ratings", - client.baseurl, - encode_path(&country.to_string()), - encode_path(®ion.to_string()), - encode_path(&name.to_string()), - ); + let page = page.map_err(Error::InvalidRequest)?; + let page_size = page_size.map_err(Error::InvalidRequest)?; + let url = format!("{}/prices/fargate", client.baseurl,); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &page { + query.push(("page", v.to_string())); + } + if let Some(v) = &page_size { + query.push(("page_size", v.to_string())); + } #[allow(unused_mut)] let mut request = client .client @@ -9422,95 +9458,55 @@ pub mod builder { reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) + .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, - 400u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 404u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), _ => Err(Error::UnexpectedResponse(response)), } } } - ///Builder for [`Client::get_city_census`] + ///Builder for [`Client::get_price_fargate`] /// - ///[`Client::get_city_census`]: super::Client::get_city_census + ///[`Client::get_price_fargate`]: super::Client::get_price_fargate #[derive(Debug, Clone)] - pub struct GetCityCensus<'a> { + pub struct GetPriceFargate<'a> { client: &'a super::Client, - country: Result, - region: Result<::std::string::String, String>, - name: Result<::std::string::String, String>, + price_id: Result, } - impl<'a> GetCityCensus<'a> { + impl<'a> GetPriceFargate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, - country: Err("country was not initialized".to_string()), - region: Err("region was not initialized".to_string()), - name: Err("name was not initialized".to_string()), + price_id: Err("price_id was not initialized".to_string()), } } - pub fn country(mut self, value: V) -> Self + pub fn price_id(mut self, value: V) -> Self where - V: std::convert::TryInto, + V: std::convert::TryInto, { - self.country = value + self.price_id = value .try_into() - .map_err(|_| "conversion to `Country` for country failed".to_string()); - self - } - - pub fn region(mut self, value: V) -> Self - where - V: std::convert::TryInto<::std::string::String>, - { - self.region = value.try_into().map_err(|_| { - "conversion to `:: std :: string :: String` for region failed".to_string() - }); - self - } - - pub fn name(mut self, value: V) -> Self - where - V: std::convert::TryInto<::std::string::String>, - { - self.name = value.try_into().map_err(|_| { - "conversion to `:: std :: string :: String` for name failed".to_string() - }); + .map_err(|_| "conversion to `i32` for price_id failed".to_string()); self } - ///Sends a `GET` request to `/cities/{country}/{region}/{name}/census` + ///Sends a `GET` request to `/prices/fargate/{price_id}` pub async fn send( self, - ) -> Result< - ResponseValue<::std::vec::Vec>, - Error, - > { - let Self { - client, - country, - region, - name, - } = self; - let country = country.map_err(Error::InvalidRequest)?; - let region = region.map_err(Error::InvalidRequest)?; - let name = name.map_err(Error::InvalidRequest)?; + ) -> Result, Error> + { + let Self { client, price_id } = self; + let price_id = price_id.map_err(Error::InvalidRequest)?; let url = format!( - "{}/cities/{}/{}/{}/census", + "{}/prices/fargate/{}", client.baseurl, - encode_path(&country.to_string()), - encode_path(®ion.to_string()), - encode_path(&name.to_string()), + encode_path(&price_id.to_string()), ); #[allow(unused_mut)] let mut request = client @@ -9528,6 +9524,12 @@ pub mod builder { 400u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), + 401u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 403u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), 404u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), @@ -9536,175 +9538,129 @@ pub mod builder { } } - ///Builder for [`Client::patch_city_census`] + ///Builder for [`Client::get_ratings`] /// - ///[`Client::patch_city_census`]: super::Client::patch_city_census + ///[`Client::get_ratings`]: super::Client::get_ratings #[derive(Debug, Clone)] - pub struct PatchCityCensus<'a> { + pub struct GetRatings<'a> { client: &'a super::Client, - country: Result, - region: Result<::std::string::String, String>, - name: Result<::std::string::String, String>, - body: Result, + page: Result, String>, + page_size: Result, String>, } - impl<'a> PatchCityCensus<'a> { + impl<'a> GetRatings<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, - country: Err("country was not initialized".to_string()), - region: Err("region was not initialized".to_string()), - name: Err("name was not initialized".to_string()), - body: Ok(types::builder::CensusPost::default()), + page: Ok(None), + page_size: Ok(None), } } - pub fn country(mut self, value: V) -> Self + pub fn page(mut self, value: V) -> Self where - V: std::convert::TryInto, + V: std::convert::TryInto, { - self.country = value + self.page = value .try_into() - .map_err(|_| "conversion to `Country` for country failed".to_string()); - self - } - - pub fn region(mut self, value: V) -> Self - where - V: std::convert::TryInto<::std::string::String>, - { - self.region = value.try_into().map_err(|_| { - "conversion to `:: std :: string :: String` for region failed".to_string() - }); - self - } - - pub fn name(mut self, value: V) -> Self - where - V: std::convert::TryInto<::std::string::String>, - { - self.name = value.try_into().map_err(|_| { - "conversion to `:: std :: string :: String` for name failed".to_string() - }); + .map(Some) + .map_err(|_| "conversion to `i64` for page failed".to_string()); self } - pub fn body(mut self, value: V) -> Self + pub fn page_size(mut self, value: V) -> Self where - V: std::convert::TryInto, - >::Error: std::fmt::Display, + V: std::convert::TryInto, { - self.body = value + self.page_size = value .try_into() - .map(From::from) - .map_err(|s| format!("conversion to `CensusPost` for body failed: {}", s)); - self - } - - pub fn body_map(mut self, f: F) -> Self - where - F: std::ops::FnOnce(types::builder::CensusPost) -> types::builder::CensusPost, - { - self.body = self.body.map(f); + .map(Some) + .map_err(|_| "conversion to `i64` for page_size failed".to_string()); self } - ///Sends a `POST` request to `/cities/{country}/{region}/{name}/census` - pub async fn send( - self, - ) -> Result< - ResponseValue<::std::vec::Vec>, - Error, - > { + ///Sends a `GET` request to `/ratings` + pub async fn send(self) -> Result, Error<()>> { let Self { client, - country, - region, - name, - body, + page, + page_size, } = self; - let country = country.map_err(Error::InvalidRequest)?; - let region = region.map_err(Error::InvalidRequest)?; - let name = name.map_err(Error::InvalidRequest)?; - let body = body - .and_then(|v| types::CensusPost::try_from(v).map_err(|e| e.to_string())) - .map_err(Error::InvalidRequest)?; - let url = format!( - "{}/cities/{}/{}/{}/census", - client.baseurl, - encode_path(&country.to_string()), - encode_path(®ion.to_string()), - encode_path(&name.to_string()), - ); + let page = page.map_err(Error::InvalidRequest)?; + let page_size = page_size.map_err(Error::InvalidRequest)?; + let url = format!("{}/ratings", client.baseurl,); + let mut query = Vec::with_capacity(2usize); + if let Some(v) = &page { + query.push(("page", v.to_string())); + } + if let Some(v) = &page_size { + query.push(("page_size", v.to_string())); + } #[allow(unused_mut)] let mut request = client .client - .post(url) + .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .json(&body) + .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - 400u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 404u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), + 200u16 => ResponseValue::from_response(response).await, _ => Err(Error::UnexpectedResponse(response)), } } } - ///Builder for [`Client::post_rating_enqueue`] + ///Builder for [`Client::post_rating`] /// - ///[`Client::post_rating_enqueue`]: super::Client::post_rating_enqueue + ///[`Client::post_rating`]: super::Client::post_rating #[derive(Debug, Clone)] - pub struct PostRatingEnqueue<'a> { + pub struct PostRating<'a> { client: &'a super::Client, - body: Result, + body: Result, } - impl<'a> PostRatingEnqueue<'a> { + impl<'a> PostRating<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, - body: Ok(types::builder::EnqueuePost::default()), + body: Ok(types::builder::RatingPost::default()), } } pub fn body(mut self, value: V) -> Self where - V: std::convert::TryInto, - >::Error: std::fmt::Display, + V: std::convert::TryInto, + >::Error: std::fmt::Display, { self.body = value .try_into() .map(From::from) - .map_err(|s| format!("conversion to `EnqueuePost` for body failed: {}", s)); + .map_err(|s| format!("conversion to `RatingPost` for body failed: {}", s)); self } pub fn body_map(mut self, f: F) -> Self where - F: std::ops::FnOnce(types::builder::EnqueuePost) -> types::builder::EnqueuePost, + F: std::ops::FnOnce(types::builder::RatingPost) -> types::builder::RatingPost, { self.body = self.body.map(f); self } - ///Sends a `POST` request to `/ratings/enqueue` - pub async fn send(self) -> Result, Error> { + ///Sends a `POST` request to `/ratings` + pub async fn send( + self, + ) -> Result, Error> { let Self { client, body } = self; let body = body - .and_then(|v| types::EnqueuePost::try_from(v).map_err(|e| e.to_string())) + .and_then(|v| types::RatingPost::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; - let url = format!("{}/ratings/enqueue", client.baseurl,); + let url = format!("{}/ratings", client.baseurl,); #[allow(unused_mut)] let mut request = client .client @@ -9722,33 +9678,58 @@ pub mod builder { 400u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), + 401u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), 403u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), + 404u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), _ => Err(Error::UnexpectedResponse(response)), } } } - ///Builder for [`Client::get_prices_fargate`] + ///Builder for [`Client::get_rating`] /// - ///[`Client::get_prices_fargate`]: super::Client::get_prices_fargate + ///[`Client::get_rating`]: super::Client::get_rating #[derive(Debug, Clone)] - pub struct GetPricesFargate<'a> { + pub struct GetRating<'a> { client: &'a super::Client, + rating_id: Result, } - impl<'a> GetPricesFargate<'a> { + impl<'a> GetRating<'a> { pub fn new(client: &'a super::Client) -> Self { - Self { client: client } + Self { + client: client, + rating_id: Err("rating_id was not initialized".to_string()), + } + } + + pub fn rating_id(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.rating_id = value + .try_into() + .map_err(|_| "conversion to `uuid :: Uuid` for rating_id failed".to_string()); + self } - ///Sends a `GET` request to `/price/fargate` + ///Sends a `GET` request to `/ratings/{rating_id}` pub async fn send( self, - ) -> Result>, Error<()>> { - let Self { client } = self; - let url = format!("{}/price/fargate", client.baseurl,); + ) -> Result, Error> { + let Self { client, rating_id } = self; + let rating_id = rating_id.map_err(Error::InvalidRequest)?; + let url = format!( + "{}/ratings/{}", + client.baseurl, + encode_path(&rating_id.to_string()), + ); #[allow(unused_mut)] let mut request = client .client @@ -9762,51 +9743,61 @@ pub mod builder { let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, + 400u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 401u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 403u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 404u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), _ => Err(Error::UnexpectedResponse(response)), } } } - ///Builder for [`Client::get_price_fargate`] + ///Builder for [`Client::get_ratings_city`] /// - ///[`Client::get_price_fargate`]: super::Client::get_price_fargate + ///[`Client::get_ratings_city`]: super::Client::get_ratings_city #[derive(Debug, Clone)] - pub struct GetPriceFargate<'a> { + pub struct GetRatingsCity<'a> { client: &'a super::Client, - fargate_price_id: Result, + rating_id: Result, } - impl<'a> GetPriceFargate<'a> { + impl<'a> GetRatingsCity<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, - fargate_price_id: Err("fargate_price_id was not initialized".to_string()), + rating_id: Err("rating_id was not initialized".to_string()), } } - pub fn fargate_price_id(mut self, value: V) -> Self + pub fn rating_id(mut self, value: V) -> Self where - V: std::convert::TryInto, + V: std::convert::TryInto, { - self.fargate_price_id = value + self.rating_id = value .try_into() - .map_err(|_| "conversion to `i64` for fargate_price_id failed".to_string()); + .map_err(|_| "conversion to `uuid :: Uuid` for rating_id failed".to_string()); self } - ///Sends a `GET` request to `/price/fargate/{fargate_price_id}` + ///Sends a `GET` request to `/ratings/{rating_id}/city` pub async fn send( self, - ) -> Result, Error> { - let Self { - client, - fargate_price_id, - } = self; - let fargate_price_id = fargate_price_id.map_err(Error::InvalidRequest)?; + ) -> Result, Error> + { + let Self { client, rating_id } = self; + let rating_id = rating_id.map_err(Error::InvalidRequest)?; let url = format!( - "{}/price/fargate/{}", + "{}/ratings/{}/city", client.baseurl, - encode_path(&fargate_price_id.to_string()), + encode_path(&rating_id.to_string()), ); #[allow(unused_mut)] let mut request = client @@ -9821,6 +9812,15 @@ pub mod builder { let response = result?; match response.status().as_u16() { 200u16 => ResponseValue::from_response(response).await, + 400u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 401u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 403u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), 404u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), diff --git a/bnaclient/src/progenitor_client.rs b/bnaclient/src/progenitor_client.rs index 61b79eb..d36990c 100644 --- a/bnaclient/src/progenitor_client.rs +++ b/bnaclient/src/progenitor_client.rs @@ -12,12 +12,10 @@ use reqwest::RequestBuilder; use serde::{de::DeserializeOwned, Serialize}; #[cfg(not(target_arch = "wasm32"))] -type InnerByteStream = - std::pin::Pin> + Send + Sync>>; +type InnerByteStream = std::pin::Pin> + Send + Sync>>; #[cfg(target_arch = "wasm32")] -type InnerByteStream = - std::pin::Pin>>>; +type InnerByteStream = std::pin::Pin>>>; /// Untyped byte stream used for both success and error responses. pub struct ByteStream(InnerByteStream); @@ -63,14 +61,12 @@ pub struct ResponseValue { impl ResponseValue { #[doc(hidden)] - pub async fn from_response( - response: reqwest::Response, - ) -> Result> { + pub async fn from_response(response: reqwest::Response) -> Result> { let status = response.status(); let headers = response.headers().clone(); let full = response.bytes().await.map_err(Error::ResponseBodyError)?; - let inner = serde_json::from_slice(&full) - .map_err(|e| Error::InvalidResponsePayload(full, e))?; + let inner = + serde_json::from_slice(&full).map_err(|e| Error::InvalidResponsePayload(full, e))?; Ok(Self { inner, @@ -89,8 +85,7 @@ impl ResponseValue { let status = response.status(); let headers = response.headers().clone(); if status == reqwest::StatusCode::SWITCHING_PROTOCOLS { - let inner = - response.upgrade().await.map_err(Error::InvalidUpgrade)?; + let inner = response.upgrade().await.map_err(Error::InvalidUpgrade)?; Ok(Self { inner, @@ -135,11 +130,7 @@ impl ResponseValue { /// Creates a [`ResponseValue`] from the inner type, status, and headers. /// /// Useful for generating test fixtures. - pub fn new( - inner: T, - status: reqwest::StatusCode, - headers: reqwest::header::HeaderMap, - ) -> Self { + pub fn new(inner: T, status: reqwest::StatusCode, headers: reqwest::header::HeaderMap) -> Self { Self { inner, status, @@ -174,10 +165,7 @@ impl ResponseValue { } #[doc(hidden)] - pub fn map( - self, - f: F, - ) -> Result, E> + pub fn map(self, f: F) -> Result, E> where F: FnOnce(T) -> U, { @@ -300,9 +288,7 @@ impl Error { }), Error::InvalidUpgrade(e) => Error::InvalidUpgrade(e), Error::ResponseBodyError(e) => Error::ResponseBodyError(e), - Error::InvalidResponsePayload(b, e) => { - Error::InvalidResponsePayload(b, e) - } + Error::InvalidResponsePayload(b, e) => Error::InvalidResponsePayload(b, e), Error::UnexpectedResponse(r) => Error::UnexpectedResponse(r), } } @@ -441,26 +427,19 @@ pub fn encode_path(pc: &str) -> String { #[doc(hidden)] pub trait RequestBuilderExt { - fn form_urlencoded( - self, - body: &T, - ) -> Result>; + fn form_urlencoded(self, body: &T) -> Result>; } impl RequestBuilderExt for RequestBuilder { - fn form_urlencoded( - self, - body: &T, - ) -> Result> { + fn form_urlencoded(self, body: &T) -> Result> { Ok(self .header( reqwest::header::CONTENT_TYPE, - reqwest::header::HeaderValue::from_static( - "application/x-www-form-urlencoded", - ), + reqwest::header::HeaderValue::from_static("application/x-www-form-urlencoded"), ) - .body(serde_urlencoded::to_string(body).map_err(|_| { - Error::InvalidRequest("failed to serialize body".to_string()) - })?)) + .body( + serde_urlencoded::to_string(body) + .map_err(|_| Error::InvalidRequest("failed to serialize body".to_string()))?, + )) } } diff --git a/entity/src/entities/approval_status.rs b/entity/src/entities/approval_status.rs index 4a2c6bb..6329e84 100644 --- a/entity/src/entities/approval_status.rs +++ b/entity/src/entities/approval_status.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; diff --git a/entity/src/entities/bna_pipeline.rs b/entity/src/entities/bna_pipeline.rs index 91a8827..7b08256 100644 --- a/entity/src/entities/bna_pipeline.rs +++ b/entity/src/entities/bna_pipeline.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; @@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize}; pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub state_machine_id: Uuid, - pub step: Option, + pub step: String, pub sqs_message: Option, pub fargate_price_id: Option, pub fargate_task_arn: Option, @@ -16,8 +16,6 @@ pub struct Model { pub status: String, pub start_time: DateTimeWithTimeZone, pub end_time: Option, - pub torn_down: Option, - pub results_posted: Option, pub cost: Option, } diff --git a/entity/src/entities/bna_pipeline_status.rs b/entity/src/entities/bna_pipeline_status.rs index 1526de3..68e7fa1 100644 --- a/entity/src/entities/bna_pipeline_status.rs +++ b/entity/src/entities/bna_pipeline_status.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; diff --git a/entity/src/entities/bna_pipeline_step.rs b/entity/src/entities/bna_pipeline_step.rs index 94d6cba..5589962 100644 --- a/entity/src/entities/bna_pipeline_step.rs +++ b/entity/src/entities/bna_pipeline_step.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; diff --git a/entity/src/entities/bna_region.rs b/entity/src/entities/bna_region.rs index 3c9bf09..65ec3ba 100644 --- a/entity/src/entities/bna_region.rs +++ b/entity/src/entities/bna_region.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; diff --git a/entity/src/entities/census.rs b/entity/src/entities/census.rs index 71bc261..f48fb12 100644 --- a/entity/src/entities/census.rs +++ b/entity/src/entities/census.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; diff --git a/entity/src/entities/city.rs b/entity/src/entities/city.rs index cf8e405..c6e5e03 100644 --- a/entity/src/entities/city.rs +++ b/entity/src/entities/city.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; diff --git a/entity/src/entities/core_services.rs b/entity/src/entities/core_services.rs index bd816e2..57962ad 100644 --- a/entity/src/entities/core_services.rs +++ b/entity/src/entities/core_services.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; diff --git a/entity/src/entities/country.rs b/entity/src/entities/country.rs index a383436..513f63b 100644 --- a/entity/src/entities/country.rs +++ b/entity/src/entities/country.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; diff --git a/entity/src/entities/fargate_price.rs b/entity/src/entities/fargate_price.rs index 6dde20c..29e965b 100644 --- a/entity/src/entities/fargate_price.rs +++ b/entity/src/entities/fargate_price.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; diff --git a/entity/src/entities/infrastructure.rs b/entity/src/entities/infrastructure.rs index 9ffd535..aefdaa6 100644 --- a/entity/src/entities/infrastructure.rs +++ b/entity/src/entities/infrastructure.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; diff --git a/entity/src/entities/mod.rs b/entity/src/entities/mod.rs index 5027ece..133eec1 100644 --- a/entity/src/entities/mod.rs +++ b/entity/src/entities/mod.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 pub mod prelude; diff --git a/entity/src/entities/opportunity.rs b/entity/src/entities/opportunity.rs index 93861c2..f57c221 100644 --- a/entity/src/entities/opportunity.rs +++ b/entity/src/entities/opportunity.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; diff --git a/entity/src/entities/people.rs b/entity/src/entities/people.rs index 9a42307..1e3ab66 100644 --- a/entity/src/entities/people.rs +++ b/entity/src/entities/people.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; diff --git a/entity/src/entities/prelude.rs b/entity/src/entities/prelude.rs index 61e43a0..03040e1 100644 --- a/entity/src/entities/prelude.rs +++ b/entity/src/entities/prelude.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 pub use super::approval_status::Entity as ApprovalStatus; pub use super::bna_pipeline::Entity as BnaPipeline; diff --git a/entity/src/entities/recreation.rs b/entity/src/entities/recreation.rs index f96bafb..370cbad 100644 --- a/entity/src/entities/recreation.rs +++ b/entity/src/entities/recreation.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; diff --git a/entity/src/entities/retail.rs b/entity/src/entities/retail.rs index cd83d3b..58a7157 100644 --- a/entity/src/entities/retail.rs +++ b/entity/src/entities/retail.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; diff --git a/entity/src/entities/speed_limit.rs b/entity/src/entities/speed_limit.rs index 512a0f9..77d8a54 100644 --- a/entity/src/entities/speed_limit.rs +++ b/entity/src/entities/speed_limit.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; diff --git a/entity/src/entities/state_region_crosswalk.rs b/entity/src/entities/state_region_crosswalk.rs index f9ea371..44b9ce7 100644 --- a/entity/src/entities/state_region_crosswalk.rs +++ b/entity/src/entities/state_region_crosswalk.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; diff --git a/entity/src/entities/submission.rs b/entity/src/entities/submission.rs index 4edd034..3374aad 100644 --- a/entity/src/entities/submission.rs +++ b/entity/src/entities/submission.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; diff --git a/entity/src/entities/summary.rs b/entity/src/entities/summary.rs index 0c41726..5a3e1fe 100644 --- a/entity/src/entities/summary.rs +++ b/entity/src/entities/summary.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; diff --git a/entity/src/entities/transit.rs b/entity/src/entities/transit.rs index 5e49306..c075ea2 100644 --- a/entity/src/entities/transit.rs +++ b/entity/src/entities/transit.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; diff --git a/entity/src/entities/us_state.rs b/entity/src/entities/us_state.rs index 602176d..b697804 100644 --- a/entity/src/entities/us_state.rs +++ b/entity/src/entities/us_state.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; diff --git a/entity/src/wrappers/bna_pipeline.rs b/entity/src/wrappers/bna_pipeline.rs index c9aec24..2a1ab5d 100644 --- a/entity/src/wrappers/bna_pipeline.rs +++ b/entity/src/wrappers/bna_pipeline.rs @@ -16,7 +16,7 @@ pub struct BNAPipelinePost { pub sqs_message: Option, pub start_time: DateTimeWithTimeZone, pub state_machine_id: Uuid, - pub step: Option, + pub step: String, pub torn_down: Option, } @@ -27,14 +27,12 @@ impl IntoActiveModel for BNAPipelinePost { end_time: ActiveValue::Set(self.end_time), fargate_price_id: ActiveValue::Set(self.fargate_price_id), fargate_task_arn: ActiveValue::Set(self.fargate_task_arn), - results_posted: ActiveValue::Set(self.result_posted), s3_bucket: ActiveValue::Set(self.s3_bucket), sqs_message: ActiveValue::Set(self.sqs_message), start_time: ActiveValue::Set(self.start_time), state_machine_id: ActiveValue::Set(self.state_machine_id), status: ActiveValue::Set("Pending".to_string()), step: ActiveValue::Set(self.step), - torn_down: ActiveValue::Set(self.torn_down), } } } @@ -50,7 +48,7 @@ pub struct BNAPipelinePatch { pub sqs_message: Option>, pub start_time: Option>, pub status: Option, - pub step: Option>, + pub step: Option, pub torn_down: Option>, } @@ -70,10 +68,6 @@ impl IntoActiveModel for BNAPipelinePatch { s3_bucket: self.s3_bucket.map_or(ActiveValue::NotSet, ActiveValue::Set), start_time: ActiveValue::NotSet, end_time: self.end_time.map_or(ActiveValue::NotSet, ActiveValue::Set), - torn_down: self.torn_down.map_or(ActiveValue::NotSet, ActiveValue::Set), - results_posted: self - .result_posted - .map_or(ActiveValue::NotSet, ActiveValue::Set), fargate_price_id: self .fargate_price_id .map_or(ActiveValue::NotSet, ActiveValue::Set), diff --git a/justfile b/justfile index 3eb6fb4..5337bcf 100644 --- a/justfile +++ b/justfile @@ -97,7 +97,7 @@ compose-down: generate-client: RUST_LOG="debug" \ cargo progenitor \ - -i ./openapi.yaml \ + -i ./openapi-3.0.yaml \ -o bnaclient \ -n bnaclient \ --interface builder \ @@ -111,3 +111,16 @@ debug-axum: DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres \ cargo watch -x \ 'run -p lambdas --bin axumed' +# Generate the OAS 3.1.x from the Axum source code. +generate-oas-31: + BNA_API_GENERATE_ONLY=1 \ + cargo run \ + -p lambdas \ + --bin axumed + +# Generate the OAS 3.0.x from the OAS 3.1.x. +generate-oas-30: + openapi-down-convert --input openapi-3.1.yaml --output openapi-3.0.yaml + +# Regenerate the OpenAPI specifications and the client. +regenerate-all: generate-oas-31 generate-oas-30 generate-client diff --git a/lambdas/Cargo.toml b/lambdas/Cargo.toml index d21ca90..e53b876 100644 --- a/lambdas/Cargo.toml +++ b/lambdas/Cargo.toml @@ -11,6 +11,7 @@ aws-sdk-s3 = { workspace = true } aws-sdk-sqs = { workspace = true } aws_lambda_events = { workspace = true } bnacore = { workspace = true } +chrono = { workspace = true } dotenv = { workspace = true } effortless = { path = "../effortless" } entity = { path = "../entity" } @@ -29,12 +30,16 @@ sea-orm = { workspace = true, features = [ serde = { workspace = true } serde_json = { workspace = true } serde_plain = { workspace = true } +serde_with = { workspace = true } thiserror = { workspace = true } tokio = { workspace = true, features = ["macros"] } tower-http = { workspace = true, features = ["trace"] } tracing = { workspace = true, features = ["log"] } tracing-subscriber = { workspace = true, features = ["fmt"] } url = { workspace = true } +utoipa = { workspace = true, features = ["chrono", "decimal", "uuid", "yaml"] } +utoipa-axum = { workspace = true } +utoipa-swagger-ui = { workspace = true, features = ["axum"] } uuid = { workspace = true, features = ["v4", "serde"] } [lints.clippy] @@ -49,74 +54,6 @@ path = "src/lib.rs" name = "axumed" path = "src/main.rs" -[[bin]] -name = "get-ratings" -path = "src/bin/ratings/get-ratings.rs" - -[[bin]] -name = "post-ratings" -path = "src/bin/ratings/post-ratings.rs" - -# [[bin]] -# name = "patch-bnas" -# path = "src/bnas/patch-bnas.rs" - -[[bin]] -name = "get-ratings-cities" -path = "src/bin/ratings/get-ratings-cities.rs" - -[[bin]] -name = "get-ratings-analysis" -path = "src/bin/ratings/get-ratings-analysis.rs" - -[[bin]] -name = "get-cities" -path = "src/bin/cities/get-cities.rs" - -[[bin]] -name = "get-cities-ratings" -path = "src/bin/cities/get-cities-ratings.rs" - -[[bin]] -name = "get-cities-census" -path = "src/bin/cities/get-cities-census.rs" - -[[bin]] -name = "get-cities-submissions" -path = "src/bin/cities/get-cities-submissions.rs" - -[[bin]] -name = "get-price-fargate" -path = "src/bin/price-fargate/get-price-fargate.rs" - -[[bin]] -name = "patch-ratings-analysis" -path = "src/bin/ratings/patch-ratings-analysis.rs" - -[[bin]] -name = "patch-cities-submissions" -path = "src/bin/cities/patch-cities-submissions.rs" - -[[bin]] -name = "post-cities-submissions" -path = "src/bin/cities/post-cities-submissions.rs" - -[[bin]] -name = "post-ratings-analysis" -path = "src/bin/ratings/post-ratings-analysis.rs" - -[[bin]] -name = "post-ratings-enqueue" -path = "src/bin/ratings/post-ratings-enqueue.rs" - -[[bin]] -name = "get-ratings-results" -path = "src/bin/ratings/get-ratings-results.rs" - -[[bin]] -name = "post-cities" -path = "src/bin/cities/post-cities.rs" - [dev-dependencies] color-eyre = { workspace = true } rstest = { workspace = true } diff --git a/lambdas/src/bin/cities/get-cities-census.rs b/lambdas/src/bin/cities/get-cities-census.rs deleted file mode 100644 index e88bf2a..0000000 --- a/lambdas/src/bin/cities/get-cities-census.rs +++ /dev/null @@ -1,78 +0,0 @@ -use dotenv::dotenv; -use effortless::{api::extract_pagination_parameters, error::APIErrors}; -use lambda_http::{run, service_fn, Body, Error, IntoResponse, Request, Response}; -use lambdas::core::resource::cities::{ - adaptor::get_cities_censuses_adaptor, extract_path_parameters, CitiesPathParameters, -}; -use tracing::info; - -#[tokio::main] -async fn main() -> Result<(), Error> { - tracing_subscriber::fmt() - .with_max_level(tracing::Level::INFO) - // disable printing the name of the module in every log line. - .with_target(false) - // disabling time is handy because CloudWatch will add the ingestion time. - .without_time() - .init(); - - run(service_fn(function_handler)).await.map_err(|e| { - info!("{e}"); - e - }) -} - -async fn function_handler(event: Request) -> Result, Error> { - dotenv().ok(); - - // Extract the path parameters. - let params: CitiesPathParameters = match extract_path_parameters(&event) { - Ok(p) => p, - Err(e) => return Ok(e.into()), - }; - - // Retrieve pagination parameters if any. - let pagination = match extract_pagination_parameters(&event) { - Ok(p) => p, - Err(e) => return Ok(e), - }; - - match get_cities_censuses_adaptor( - ¶ms.country, - ¶ms.region, - ¶ms.name, - pagination.page, - pagination.page_size(), - ) - .await - { - Ok(v) => Ok(v.payload().into_response().await), - Err(e) => Ok(APIErrors::from(e).into()), - } -} - -// #[cfg(test)] -// mod tests { - -// use super::*; -// use aws_lambda_events::http; -// use lambda_http::RequestExt; -// use std::collections::HashMap; - -// #[tokio::test] -// async fn test_handler() { -// let event = http::Request::builder() -// .header(http::header::CONTENT_TYPE, "application/json") -// .body(Body::Empty) -// .expect("failed to build request") -// .with_path_parameters(HashMap::from([( -// "id".to_string(), -// "c49fa94e-542d-421f-9826-e233538be929".to_string(), // Santa Monica, CA -// )])) -// .with_request_context(lambda_http::request::RequestContext::ApiGatewayV2( -// lambda_http::aws_lambda_events::apigw::ApiGatewayV2httpRequestContext::default(), -// )); -// let r = function_handler(event).await.unwrap(); -// dbg!(r); -// } -// } diff --git a/lambdas/src/bin/cities/get-cities-ratings.rs b/lambdas/src/bin/cities/get-cities-ratings.rs deleted file mode 100644 index 6ffd2ed..0000000 --- a/lambdas/src/bin/cities/get-cities-ratings.rs +++ /dev/null @@ -1,96 +0,0 @@ -use dotenv::dotenv; -use effortless::{api::extract_pagination_parameters, error::APIErrors, fragment::BnaRequestExt}; -use lambda_http::{run, service_fn, Body, Error, IntoResponse, Request, Response}; -use lambdas::{ - core::resource::cities::{ - adaptor::get_cities_ratings_adaptor, extract_path_parameters, CitiesPathParameters, - }, - Context, -}; -use tracing::info; - -async fn function_handler(event: Request) -> Result, Error> { - dotenv().ok(); - - // Extract the path parameters. - let params: CitiesPathParameters = match extract_path_parameters(&event) { - Ok(p) => p, - Err(e) => return Ok(e.into()), - }; - - // Retrieve pagination parameters if any. - let pagination = match extract_pagination_parameters(&event) { - Ok(p) => p, - Err(e) => return Ok(e), - }; - let ctx = Context::new( - event.apigw_request_id(), - event - .uri() - .path_and_query() - .expect("to have a path and optional query parameters") - .to_string(), - ); - - match get_cities_ratings_adaptor( - ¶ms.country, - ¶ms.region, - ¶ms.name, - pagination.page, - pagination.page_size(), - ctx, - ) - .await - { - Ok(v) => Ok(v.payload().into_response().await), - Err(e) => Ok(APIErrors::from(e).into()), - } -} - -#[tokio::main] -async fn main() -> Result<(), Error> { - tracing_subscriber::fmt() - .with_max_level(tracing::Level::INFO) - // disable printing the name of the module in every log line. - .with_target(false) - // disabling time is handy because CloudWatch will add the ingestion time. - .without_time() - .init(); - - run(service_fn(function_handler)).await.map_err(|e| { - info!("{e}"); - e - }) -} - -#[cfg(test)] -mod tests { - // use super::*; - // use lambda_http::{http, RequestExt}; - // use std::collections::HashMap; - - // #[tokio::test] - // async fn test_handler_opportunity() { - // let event = http::Request::builder() - // .header(http::header::CONTENT_TYPE, "application/json") - // .body(Body::Empty) - // .expect("failed to build request") - // .with_path_parameters(HashMap::from([( - // "country".to_string(), - // "United%20States".to_string(), - // )])) - // .with_query_string_parameters(HashMap::from([( - // "region".to_string(), - // "Texas".to_string(), - // )])) - // .with_query_string_parameters(HashMap::from([( - // "name".to_string(), - // "Austin".to_string(), - // )])) - // .with_request_context(lambda_http::request::RequestContext::ApiGatewayV2( - // lambda_http::aws_lambda_events::apigw::ApiGatewayV2httpRequestContext::default(), - // )); - // let r = function_handler(event).await.unwrap(); - // dbg!(r); - // } -} diff --git a/lambdas/src/bin/cities/get-cities-submissions.rs b/lambdas/src/bin/cities/get-cities-submissions.rs deleted file mode 100644 index 6d93ea5..0000000 --- a/lambdas/src/bin/cities/get-cities-submissions.rs +++ /dev/null @@ -1,79 +0,0 @@ -use dotenv::dotenv; -use effortless::{ - api::{extract_pagination_parameters, parse_path_parameter, parse_query_string_parameter}, - error::APIErrors, - fragment::BnaRequestExt, -}; -use lambda_http::{run, service_fn, Body, Error, IntoResponse, Request, Response}; -use lambdas::{ - core::resource::cities::adaptor::{ - get_cities_submission_adaptor, get_cities_submissions_adaptor, - }, - Context, -}; -use tracing::{debug, info}; - -async fn function_handler(event: Request) -> Result, Error> { - dotenv().ok(); - - // Retrieve pagination parameters if any. - let pagination = match extract_pagination_parameters(&event) { - Ok(p) => p, - Err(e) => return Ok(e), - }; - - // Retrieve the status parameter if available. - let query_param_key = "status"; - let status = match parse_query_string_parameter::(&event, query_param_key) { - Ok(status) => status, - Err(e) => return Ok(e.into()), - }; - - // Retrieve the ID of the Submission to get if any. - let submission_id = match parse_path_parameter::(&event, "id") { - Ok(value) => value, - Err(e) => return Ok(e.into()), - }; - - let ctx = Context::new( - event.apigw_request_id(), - event - .uri() - .path_and_query() - .expect("to have a path and optional query parameters") - .to_string(), - ); - - // Retrieve all submissions or a specific one. - debug!("Processing the requests..."); - match submission_id { - Some(id) => match get_cities_submission_adaptor(id, status, ctx).await { - Ok(v) => Ok(v.into_response().await), - Err(e) => Ok(APIErrors::from(e).into()), - }, - None => { - match get_cities_submissions_adaptor(status, pagination.page, pagination.page_size()) - .await - { - Ok(v) => Ok(v.payload().into_response().await), - Err(e) => Ok(APIErrors::from(e).into()), - } - } - } -} - -#[tokio::main] -async fn main() -> Result<(), Error> { - tracing_subscriber::fmt() - .with_max_level(tracing::Level::INFO) - // disable printing the name of the module in every log line. - .with_target(false) - // disabling time is handy because CloudWatch will add the ingestion time. - .without_time() - .init(); - - run(service_fn(function_handler)).await.map_err(|e| { - info!("{e}"); - e - }) -} diff --git a/lambdas/src/bin/cities/get-cities.rs b/lambdas/src/bin/cities/get-cities.rs deleted file mode 100644 index a03dfe5..0000000 --- a/lambdas/src/bin/cities/get-cities.rs +++ /dev/null @@ -1,116 +0,0 @@ -use dotenv::dotenv; -use effortless::{api::extract_pagination_parameters, error::APIErrors, fragment::BnaRequestExt}; -use lambda_http::{run, service_fn, Body, Error, IntoResponse, Request, Response}; -use lambdas::{ - core::resource::cities::{ - adaptor::{get_cities_adaptor, get_city_adaptor}, - extract_path_parameters, CitiesPathParameters, - }, - Context, -}; -use tracing::info; - -async fn function_handler(event: Request) -> Result, Error> { - dotenv().ok(); - - // Retrieve a single city. - if event.has_path_parameters() { - let params: CitiesPathParameters = match extract_path_parameters(&event) { - Ok(p) => p, - Err(e) => return Ok(e.into()), - }; - let ctx = Context::new( - event.apigw_request_id(), - event - .uri() - .path_and_query() - .expect("to have a path and optional query parameters") - .to_string(), - ); - info!("{:#?}", params); - match get_city_adaptor(¶ms.country, ¶ms.region, ¶ms.name, ctx).await { - Ok(v) => return Ok(v.into_response().await), - Err(e) => return Ok(APIErrors::from(e).into()), - } - } - - // Extract pagination parameters if any. - let pagination = match extract_pagination_parameters(&event) { - Ok(p) => p, - Err(e) => return Ok(e), - }; - - // Retrieve all cities. - match get_cities_adaptor(pagination.page, pagination.page_size()).await { - Ok(v) => Ok(v.payload().into_response().await), - Err(e) => Ok(APIErrors::from(e).into()), - } -} - -#[tokio::main] -async fn main() -> Result<(), Error> { - tracing_subscriber::fmt() - .with_max_level(tracing::Level::INFO) - // disable printing the name of the module in every log line. - .with_target(false) - // disabling time is handy because CloudWatch will add the ingestion time. - .without_time() - .init(); - - run(service_fn(function_handler)).await.map_err(|e| { - info!("{e}"); - e - }) -} - -#[cfg(test)] -mod tests { - use super::*; - use lambda_http::{http, RequestExt}; - use std::collections::HashMap; - - #[test] - fn test_extract_path_parameters() { - let country: String = String::from("United States"); - let region: String = String::from("Texas"); - let name: String = String::from("Austin"); - let event = http::Request::builder() - .header(http::header::CONTENT_TYPE, "application/json") - .body(Body::Empty) - .expect("failed to build request") - .with_path_parameters(HashMap::from([ - ("country".to_string(), country.clone()), - ("region".to_string(), region.clone()), - ("name".to_string(), name.clone()), - ])) - .with_request_context(lambda_http::request::RequestContext::ApiGatewayV2( - lambda_http::aws_lambda_events::apigw::ApiGatewayV2httpRequestContext::default(), - )); - let r = extract_path_parameters(&event).unwrap(); - assert_eq!(r.country, country); - assert_eq!(r.region, region); - assert_eq!(r.name, name); - } - - // #[tokio::test] - // async fn test_handler() { - // let country: String = String::from("United States"); - // let region: String = String::from("Texas"); - // let name: String = String::from("Austin"); - // let event = http::Request::builder() - // .header(http::header::CONTENT_TYPE, "application/json") - // .body(Body::Empty) - // .expect("failed to build request") - // .with_path_parameters(HashMap::from([ - // ("country".to_string(), country.clone()), - // ("region".to_string(), region.clone()), - // ("name".to_string(), name.clone()), - // ])) - // .with_request_context(lambda_http::request::RequestContext::ApiGatewayV2( - // lambda_http::aws_lambda_events::apigw::ApiGatewayV2httpRequestContext::default(), - // )); - - // let res = function_handler(event).await.unwrap(); - // dbg!(res); - // } -} diff --git a/lambdas/src/bin/cities/patch-cities-submissions.rs b/lambdas/src/bin/cities/patch-cities-submissions.rs deleted file mode 100644 index 8f05edf..0000000 --- a/lambdas/src/bin/cities/patch-cities-submissions.rs +++ /dev/null @@ -1,73 +0,0 @@ -use dotenv::dotenv; -use effortless::{ - api::{missing_parameter, parse_path_parameter, parse_request_body}, - error::APIErrors, -}; -use entity::wrappers::submission::SubmissionPatch; -use lambda_http::{run, service_fn, Body, Error, IntoResponse, Request, Response}; -use lambdas::core::resource::cities::adaptor::patch_cities_submission_adaptor; -use tracing::info; - -async fn function_handler(event: Request) -> Result, Error> { - dotenv().ok(); - - // Retrieve the ID of the Submission to update. - let parameter = "submission_id"; - let submission_id = match parse_path_parameter::(&event, parameter) { - Ok(id) => match id { - Some(id) => id, - None => return Ok(missing_parameter(&event, parameter).into()), - }, - Err(e) => return Ok(e.into()), - }; - - // Prepare the model to update. - let submission = match parse_request_body::(&event) { - Ok(v) => v, - Err(e) => return Ok(e.into()), - }; - - match patch_cities_submission_adaptor(submission_id, submission).await { - Ok(v) => Ok(v.into_response().await), - Err(e) => Ok(APIErrors::from(e).into()), - } -} - -#[tokio::main] -async fn main() -> Result<(), Error> { - tracing_subscriber::fmt() - .with_max_level(tracing::Level::INFO) - // disable printing the name of the module in every log line. - .with_target(false) - // disabling time is handy because CloudWatch will add the ingestion time. - .without_time() - .init(); - - run(service_fn(function_handler)).await.map_err(|e| { - info!("{e}"); - e - }) -} - -// #[cfg(test)] -// mod tests { -// use super::*; -// use aws_lambda_events::http; -// use lambda_http::RequestExt; -// use std::collections::HashMap; - -// #[test] -// fn test_prepare_active_model() { -// let event = http::Request::builder() -// .header(http::header::CONTENT_TYPE, "application/json") -// .body(Body::from(r#"{"city": "santa rosa","country": "usa","email": "jane.dpe@orgllc.com","fips_code": "3570670","first_name": "Jane","last_name": "Doe","organization": "Organization LLC","region": "new mexico","title": "CTO","consent": true}"#)) -// .expect("failed to build request") -// .with_path_parameters(HashMap::from([("submission_id".to_string(), "1".to_string())])) -// .with_request_context(lambda_http::request::RequestContext::ApiGatewayV2(lambda_http::aws_lambda_events::apigw::ApiGatewayV2httpRequestContext::default())); -// let active_submission = prepare_active_model(&event).unwrap(); -// assert_eq!( -// active_submission.country, -// sea_orm::ActiveValue::Set("usa".to_string()) -// ) -// } -// } diff --git a/lambdas/src/bin/cities/post-cities-submissions.rs b/lambdas/src/bin/cities/post-cities-submissions.rs deleted file mode 100644 index f879d82..0000000 --- a/lambdas/src/bin/cities/post-cities-submissions.rs +++ /dev/null @@ -1,75 +0,0 @@ -use dotenv::dotenv; -use effortless::{api::parse_request_body, error::APIErrors, response::make_json_created_response}; -use entity::wrappers::submission::SubmissionPost; -use lambda_http::{run, service_fn, Body, Error, Request, Response}; -use lambdas::core::resource::cities::adaptor::post_cities_submission_adaptor; -use serde_json::json; -use tracing::info; - -async fn function_handler(event: Request) -> Result, Error> { - dotenv().ok(); - - // Extract and serialize the data. - let wrapper = match parse_request_body::(&event) { - Ok(value) => value, - Err(e) => return Ok(e.into()), - }; - // let country = wrapper.country.clone(); - - match post_cities_submission_adaptor(wrapper).await { - Ok(v) => Ok(make_json_created_response(json!(v).to_string()) - .expect("unable to build http::Response")), - Err(e) => Ok(APIErrors::from(e).into()), - } -} - -#[tokio::main] -async fn main() -> Result<(), Error> { - tracing_subscriber::fmt() - .with_max_level(tracing::Level::INFO) - // disable printing the name of the module in every log line. - .with_target(false) - // disabling time is handy because CloudWatch will add the ingestion time. - .without_time() - .init(); - - run(service_fn(function_handler)).await.map_err(|e| { - info!("{e}"); - e - }) -} - -#[cfg(test)] -mod tests { - - // use super::*; - // use aws_lambda_events::http; - // use lambda_http::RequestExt; - - // #[tokio::test] - // async fn test_handler() { - // let event = http::Request::builder() - // .header(http::header::CONTENT_TYPE, "application/json") - // .body(Body::Text( - // r#"{ - // "city": "santa rosa", - // "country": "United States", - // "email": "jane.dpe@orgllc.com", - // "fips_code": "3570670", - // "first_name": "Jane", - // "last_name": "Doe", - // "organization": "Organization LLC", - // "region": "new mexico", - // "occupation": "CTO", - // "consent": true - // }"# - // .to_string(), - // )) - // .expect("failed to build request") - // .with_request_context(lambda_http::request::RequestContext::ApiGatewayV2( - // lambda_http::aws_lambda_events::apigw::ApiGatewayV2httpRequestContext::default(), - // )); - // let r = function_handler(event).await.unwrap(); - // dbg!(r); - // } -} diff --git a/lambdas/src/bin/cities/post-cities.rs b/lambdas/src/bin/cities/post-cities.rs deleted file mode 100644 index e592b58..0000000 --- a/lambdas/src/bin/cities/post-cities.rs +++ /dev/null @@ -1,55 +0,0 @@ -use dotenv::dotenv; -use effortless::{api::parse_request_body, error::APIErrors}; -use entity::wrappers::city::CityPost; -use lambda_http::{run, service_fn, Body, Error, IntoResponse, Request, Response}; -use lambdas::core::resource::cities::adaptor::post_cities_adaptor; -use tracing::info; - -#[tokio::main] -async fn main() -> Result<(), Error> { - tracing_subscriber::fmt() - .with_max_level(tracing::Level::INFO) - // disable printing the name of the module in every log line. - .with_target(false) - // disabling time is handy because CloudWatch will add the ingestion time. - .without_time() - .init(); - - run(service_fn(function_handler)).await.map_err(|e| { - info!("{e}"); - e - }) -} - -async fn function_handler(event: Request) -> Result, Error> { - dotenv().ok(); - - // Extract and serialize the data. - let wrapper = match parse_request_body::(&event) { - Ok(value) => value, - Err(e) => return Ok(e.into()), - }; - - match post_cities_adaptor(wrapper).await { - Ok(v) => Ok(v.into_response().await), - Err(e) => Ok(APIErrors::from(e).into()), - } -} - -#[cfg(test)] -mod tests { - // use super::*; - // use lambda_http::{http, RequestExt}; - - // #[tokio::test] - // async fn test_handler() { - // let event = http::Request::builder() - // .header(http::header::CONTENT_TYPE, "application/json") - // .body(Body::from(r#"{"name": "santa rosa 000","country": "united states","fips_code": "3570670","state": "new mexico", "state_abbrev": "NM"}"#)) - // .expect("failed to build request") - // .with_request_context(lambda_http::request::RequestContext::ApiGatewayV2(lambda_http::aws_lambda_events::apigw::ApiGatewayV2httpRequestContext::default())); - - // let r = function_handler(event).await.unwrap(); - // dbg!(r); - // } -} diff --git a/lambdas/src/bin/price-fargate/get-price-fargate.rs b/lambdas/src/bin/price-fargate/get-price-fargate.rs deleted file mode 100644 index 87c3993..0000000 --- a/lambdas/src/bin/price-fargate/get-price-fargate.rs +++ /dev/null @@ -1,117 +0,0 @@ -use dotenv::dotenv; -use effortless::{ - api::{extract_pagination_parameters, invalid_path_parameter, invalid_query_parameter}, - error::APIErrors, - fragment::BnaRequestExt, -}; -use lambda_http::{run, service_fn, Body, Error, IntoResponse, Request, Response}; -use lambdas::{ - core::resource::price::{ - adaptor::{get_price_fargate_adaptor, get_prices_fargate_adaptor}, - PriceParameters, - }, - Context, Sort, -}; -use tracing::info; - -async fn function_handler(event: Request) -> Result, Error> { - dotenv().ok(); - - // Retrieve pagination parameters if any. - let pagination = match extract_pagination_parameters(&event) { - Ok(p) => p, - Err(e) => return Ok(e), - }; - - // Retrieve price parameter. - let mut price_parameters = PriceParameters::default(); - let parameter = "sort"; - let sort = event.query_string_parameter::(parameter); - if let Some(sort) = sort { - match sort { - Ok(sort) => { - price_parameters.set_sort(Some(sort)); - } - Err(e) => { - let api_error = invalid_query_parameter( - &event, - parameter, - format!("failed to process the `{parameter}` parameter: {e}").as_str(), - ); - return Ok(APIErrors::new(&[api_error]).into()); - } - } - } - - let parameter = "latest"; - let latest = event.query_string_parameter::(parameter); - if let Some(latest) = latest { - match latest { - Ok(latest) => { - price_parameters.set_latest(latest); - } - Err(e) => { - let api_error = invalid_query_parameter( - &event, - parameter, - format!("failed to process the `{parameter}` parameter: {e}").as_str(), - ); - return Ok(APIErrors::new(&[api_error]).into()); - } - } - } - - // Retrieve the ID of the entry to retrieve. - let parameter = "price_id"; - let id = event.path_parameter::(parameter); - - // Retrieve a specific entry if an id was specified. - if let Some(id) = id { - let id = match id { - Ok(id) => id, - Err(e) => { - let api_error = invalid_path_parameter( - &event, - parameter, - format!("failed to process the `{parameter}` parameter: {e}").as_str(), - ); - return Ok(APIErrors::new(&[api_error]).into()); - } - }; - let ctx = Context::new( - event.apigw_request_id(), - event - .uri() - .path_and_query() - .expect("to have a path and optional query parameters") - .to_string(), - ); - match get_price_fargate_adaptor(id, ctx).await { - Ok(v) => return Ok(v.into_response().await), - Err(e) => return Ok(APIErrors::from(e).into()), - }; - } - // Retrieve all entries. - match get_prices_fargate_adaptor(price_parameters, pagination.page, pagination.page_size()) - .await - { - Ok(v) => Ok(v.payload().into_response().await), - Err(e) => Ok(APIErrors::from(e).into()), - } -} - -#[tokio::main] -async fn main() -> Result<(), Error> { - tracing_subscriber::fmt() - .with_max_level(tracing::Level::INFO) - // disable printing the name of the module in every log line. - .with_target(false) - // disabling time is handy because CloudWatch will add the ingestion time. - .without_time() - .init(); - - run(service_fn(function_handler)).await.map_err(|e| { - info!("{e}"); - e - }) -} diff --git a/lambdas/src/bin/ratings/get-ratings-analysis.rs b/lambdas/src/bin/ratings/get-ratings-analysis.rs deleted file mode 100644 index ae18878..0000000 --- a/lambdas/src/bin/ratings/get-ratings-analysis.rs +++ /dev/null @@ -1,64 +0,0 @@ -use dotenv::dotenv; -use effortless::{api::extract_pagination_parameters, error::APIErrors, fragment::BnaRequestExt}; -use lambda_http::{run, service_fn, Body, Error, IntoResponse, Request, Response}; -use lambdas::{ - core::resource::ratings::{ - adaptor::{get_ratings_analyses_adaptor, get_ratings_analysis_adaptor}, - extract_path_parameters, - }, - Context, -}; -use tracing::{debug, info}; - -async fn function_handler(event: Request) -> Result, Error> { - dotenv().ok(); - - if event.has_path_parameters() { - let params = match extract_path_parameters(&event) { - Ok(p) => p, - Err(e) => return Ok(e.into()), - }; - let ctx = Context::new( - event.apigw_request_id(), - event - .uri() - .path_and_query() - .expect("to have a path and optional query parameters") - .to_string(), - ); - - // Retrieve a specific entry. - debug!("Processing the requests..."); - match get_ratings_analysis_adaptor(params.rating_id, ctx).await { - Ok(v) => return Ok(v.into_response().await), - Err(e) => return Ok(APIErrors::from(e).into()), - } - } - - // Retrieve pagination parameters if any. - let pagination = match extract_pagination_parameters(&event) { - Ok(p) => p, - Err(e) => return Ok(e), - }; - - match get_ratings_analyses_adaptor(pagination.page, pagination.page_size()).await { - Ok(v) => Ok(v.into()), - Err(e) => Ok(APIErrors::from(e).into()), - } -} - -#[tokio::main] -async fn main() -> Result<(), Error> { - tracing_subscriber::fmt() - .with_max_level(tracing::Level::INFO) - // disable printing the name of the module in every log line. - .with_target(false) - // disabling time is handy because CloudWatch will add the ingestion time. - .without_time() - .init(); - - run(service_fn(function_handler)).await.map_err(|e| { - info!("{e}"); - e - }) -} diff --git a/lambdas/src/bin/ratings/get-ratings-cities.rs b/lambdas/src/bin/ratings/get-ratings-cities.rs deleted file mode 100644 index ed355de..0000000 --- a/lambdas/src/bin/ratings/get-ratings-cities.rs +++ /dev/null @@ -1,47 +0,0 @@ -use dotenv::dotenv; -use effortless::{error::APIErrors, fragment::BnaRequestExt}; -use lambda_http::{run, service_fn, Body, Error, IntoResponse, Request, Response}; -use lambdas::{ - core::resource::ratings::{adaptor::get_ratings_city_adaptor, extract_path_parameters}, - Context, -}; -use tracing::info; - -async fn function_handler(event: Request) -> Result, Error> { - dotenv().ok(); - - // Retrieve the parameters. - let params = match extract_path_parameters(&event) { - Ok(p) => p, - Err(e) => return Ok(e.into()), - }; - let ctx = Context::new( - event.apigw_request_id(), - event - .uri() - .path_and_query() - .expect("to have a path and optional query parameters") - .to_string(), - ); - - match get_ratings_city_adaptor(params.rating_id, ctx).await { - Ok(v) => Ok(v.into_response().await), - Err(e) => Ok(APIErrors::from(e).into()), - } -} - -#[tokio::main] -async fn main() -> Result<(), Error> { - tracing_subscriber::fmt() - .with_max_level(tracing::Level::INFO) - // disable printing the name of the module in every log line. - .with_target(false) - // disabling time is handy because CloudWatch will add the ingestion time. - .without_time() - .init(); - - run(service_fn(function_handler)).await.map_err(|e| { - info!("{e}"); - e - }) -} diff --git a/lambdas/src/bin/ratings/get-ratings-results.rs b/lambdas/src/bin/ratings/get-ratings-results.rs deleted file mode 100644 index 758e75b..0000000 --- a/lambdas/src/bin/ratings/get-ratings-results.rs +++ /dev/null @@ -1,65 +0,0 @@ -use aws_config::BehaviorVersion; -use dotenv::dotenv; -use effortless::{error::APIError, fragment::get_apigw_request_id}; -use lambda_http::{ - http::StatusCode, run, service_fn, Body, Error, IntoResponse, Request, Response, -}; -use serde::{Deserialize, Serialize}; -use serde_json::json; -use tracing::info; - -const BUCKET_NAME: &str = "brokenspoke-analyzer"; - -#[derive(Deserialize, Serialize, Debug)] -pub struct BNAResults { - results: Vec, -} - -async fn function_handler(event: Request) -> Result, Error> { - dotenv().ok(); - - // Configure the AWS S3 client. - let aws_config = aws_config::load_defaults(BehaviorVersion::latest()).await; - let s3_client = aws_sdk_s3::Client::new(&aws_config); - - // Collect the folders in the bucket. - let objects = s3_client.list_objects_v2().bucket(BUCKET_NAME).send().await; - match objects { - Ok(o) => { - let mut bna_results = o - .contents() - .iter() - .filter(|o| o.key.clone().unwrap().ends_with('/')) - .map(|o| o.key.clone().unwrap()) - .collect::>(); - bna_results.sort(); - Ok(json!(bna_results).into_response().await) - } - Err(e) => { - let api_error = APIError::new( - get_apigw_request_id(&event), - StatusCode::BAD_REQUEST, - "S3 Client Error", - format!("Cannot retrieve the content of the {BUCKET_NAME} bucket: {e}").as_str(), - None, - ); - Ok(api_error.into()) - } - } -} - -#[tokio::main] -async fn main() -> Result<(), Error> { - tracing_subscriber::fmt() - .with_max_level(tracing::Level::INFO) - // disable printing the name of the module in every log line. - .with_target(false) - // disabling time is handy because CloudWatch will add the ingestion time. - .without_time() - .init(); - - run(service_fn(function_handler)).await.map_err(|e| { - info!("{e}"); - e - }) -} diff --git a/lambdas/src/bin/ratings/get-ratings.rs b/lambdas/src/bin/ratings/get-ratings.rs deleted file mode 100644 index 2e1df62..0000000 --- a/lambdas/src/bin/ratings/get-ratings.rs +++ /dev/null @@ -1,324 +0,0 @@ -use dotenv::dotenv; -use effortless::{ - api::{entry_not_found, extract_pagination_parameters}, - error::APIErrors, - fragment::BnaRequestExt, -}; -use entity::{ - core_services, infrastructure, opportunity, people, prelude::*, recreation, retail, transit, -}; -use lambda_http::{run, service_fn, Body, Error, IntoResponse, Request, Response}; -use lambdas::{ - core::resource::ratings::{ - adaptor::get_ratings_summaries_adaptor, extract_path_parameters, extract_query_parameters, - BNAComponent, BNAPathParameters, BNAQueryParameters, - }, - database_connect, -}; -use sea_orm::{prelude::Uuid, EntityTrait, FromQueryResult, JoinType, QuerySelect, RelationTrait}; -use serde::{Deserialize, Serialize}; -use serde_json::json; -use tracing::{debug, info}; - -#[derive(FromQueryResult, Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BNA { - // BNA Summary - pub id: Uuid, - pub city_id: Uuid, - pub score: f64, - pub version: String, - - // BNAInfrastructure - pub low_stress_miles: Option, - pub high_stress_miles: Option, - - // BNA Recreation - pub community_centers: Option, - pub parks: Option, - pub recreation_trails: Option, - pub recreation_score: Option, - - // BNA Opportunity - pub employment: Option, - pub higher_education: Option, - pub k12_education: Option, - pub opportunity_score: Option, - pub technical_vocational_college: Option, - - // BNA Core Services - pub dentists: Option, - pub doctors: Option, - pub grocery: Option, - pub hospitals: Option, - pub pharmacies: Option, - pub coreservices_score: Option, - pub social_services: Option, - - // BNA People - pub people: Option, - - // BNA Retail - pub retail: Option, - - // BNA Transit - pub transit: Option, -} - -async fn function_handler(event: Request) -> Result, Error> { - dotenv().ok(); - - // Get the database connection. - // let db = match api_database_connect(&event).await { - // Ok(db) => db, - // Err(e) => return Ok(e), - // }; - let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; - - // Retrieve all bnas or a specific one. - debug!("Processing the requests..."); - - // With params. - if event.has_path_parameters() { - let params: BNAPathParameters = match extract_path_parameters(&event) { - Ok(p) => p, - Err(e) => return Ok(e.into()), - }; - - let queries: BNAQueryParameters = match extract_query_parameters(&event) { - Ok(a) => a, - Err(e) => return Ok(e.into()), - }; - - let select = Summary::find_by_id(params.rating_id); - let res = match queries.component { - BNAComponent::All => { - let model = select - .clone() - .columns([ - entity::core_services::Column::Dentists, - entity::core_services::Column::Doctors, - entity::core_services::Column::Grocery, - entity::core_services::Column::Hospitals, - entity::core_services::Column::Pharmacies, - entity::core_services::Column::SocialServices, - ]) - .column_as(entity::core_services::Column::Score, "coreservices_score") - .columns([ - entity::infrastructure::Column::HighStressMiles, - entity::infrastructure::Column::LowStressMiles, - ]) - .columns([ - entity::recreation::Column::CommunityCenters, - entity::recreation::Column::Parks, - entity::recreation::Column::RecreationTrails, - ]) - .column_as(entity::recreation::Column::Score, "recreation_score") - .columns([ - entity::opportunity::Column::Employment, - entity::opportunity::Column::HigherEducation, - entity::opportunity::Column::K12Education, - entity::opportunity::Column::TechnicalVocationalCollege, - ]) - .column_as(entity::opportunity::Column::Score, "opportunity_score") - .column_as(entity::people::Column::Score, "people_score") - .column_as(entity::retail::Column::Score, "retail_score") - .column_as(entity::transit::Column::Score, "transit_score") - .join( - JoinType::InnerJoin, - entity::summary::Relation::CoreServices.def(), - ) - .join( - JoinType::InnerJoin, - entity::summary::Relation::Infrastructure.def(), - ) - .join( - JoinType::InnerJoin, - entity::summary::Relation::Recreation.def(), - ) - .join( - JoinType::InnerJoin, - entity::summary::Relation::Opportunity.def(), - ) - .join( - sea_orm::JoinType::InnerJoin, - entity::summary::Relation::People.def(), - ) - .join( - sea_orm::JoinType::InnerJoin, - entity::summary::Relation::Retail.def(), - ) - .join( - sea_orm::JoinType::InnerJoin, - entity::summary::Relation::Transit.def(), - ) - .into_model::() - .one(&db) - .await?; - match model { - Some(model) => json!(model).into_response().await, - None => entry_not_found(&event).into(), - } - } - BNAComponent::Summary => { - let model = select.clone().one(&db).await?; - match model { - Some(model) => json!(model).into_response().await, - None => entry_not_found(&event).into(), - } - } - BNAComponent::Infratructure => { - let model = select - .clone() - .find_also_related(infrastructure::Entity) - .one(&db) - .await?; - match model { - Some(model) => json!(model).into_response().await, - None => entry_not_found(&event).into(), - } - } - BNAComponent::Recreation => { - let model = select - .clone() - .find_also_related(recreation::Entity) - .one(&db) - .await?; - match model { - Some(model) => json!(model).into_response().await, - None => entry_not_found(&event).into(), - } - } - BNAComponent::Opportunity => { - let model = select - .clone() - .find_also_related(opportunity::Entity) - .one(&db) - .await?; - match model { - Some(model) => json!(model).into_response().await, - None => entry_not_found(&event).into(), - } - } - BNAComponent::CoreServices => { - let model = select - .clone() - .find_also_related(core_services::Entity) - .one(&db) - .await?; - match model { - Some(model) => json!(model).into_response().await, - None => entry_not_found(&event).into(), - } - } - BNAComponent::People => { - let model = select - .clone() - .find_also_related(people::Entity) - .one(&db) - .await?; - match model { - Some(model) => json!(model).into_response().await, - None => entry_not_found(&event).into(), - } - } - BNAComponent::Retail => { - let model = select - .clone() - .find_also_related(retail::Entity) - .one(&db) - .await?; - match model { - Some(model) => json!(model).into_response().await, - None => entry_not_found(&event).into(), - } - } - BNAComponent::Transit => { - let model = select - .clone() - .find_also_related(transit::Entity) - .one(&db) - .await?; - match model { - Some(model) => json!(model).into_response().await, - None => entry_not_found(&event).into(), - } - } - }; - return Ok(res); - } - - // Retrieve pagination parameters if any. - let pagination = match extract_pagination_parameters(&event) { - Ok(p) => p, - Err(e) => return Ok(e), - }; - - // Retrieve entries. - match get_ratings_summaries_adaptor(pagination.page, pagination.page_size()).await { - Ok(v) => Ok(v.payload().into_response().await), - Err(e) => Ok(APIErrors::from(e).into()), - } -} - -#[tokio::main] -async fn main() -> Result<(), Error> { - tracing_subscriber::fmt() - .with_max_level(tracing::Level::INFO) - // disable printing the name of the module in every log line. - .with_target(false) - // disabling time is handy because CloudWatch will add the ingestion time. - .without_time() - .init(); - - run(service_fn(function_handler)).await.map_err(|e| { - info!("{e}"); - e - }) -} - -#[cfg(test)] -mod tests { - - // use super::*; - // use aws_lambda_events::http; - // use lambda_http::RequestExt; - // use std::collections::HashMap; - - // #[tokio::test] - // async fn test_handler_all() { - // let event = http::Request::builder() - // .header(http::header::CONTENT_TYPE, "application/json") - // .body(Body::Empty) - // .expect("failed to build request") - // .with_path_parameters(HashMap::from([( - // "rating_id".to_string(), - // "837082b8-c8a0-469e-b310-c868d7f140a2".to_string(), // Santa Monica, CA - // )])) - // .with_request_context(lambda_http::request::RequestContext::ApiGatewayV2( - // lambda_http::aws_lambda_events::apigw::ApiGatewayV2httpRequestContext::default(), - // )); - // let r = function_handler(event).await.unwrap(); - // dbg!(r); - // } - - // #[tokio::test] - // async fn test_handler_opportunity() { - // let event = http::Request::builder() - // .header(http::header::CONTENT_TYPE, "application/json") - // .body(Body::Empty) - // .expect("failed to build request") - // .with_path_parameters(HashMap::from([( - // "id".to_string(), - // "837082b8-c8a0-469e-b310-c868d7f140a2".to_string(), // Santa Monica, CA - // )])) - // .with_query_string_parameters(HashMap::from([( - // "component".to_string(), - // "Opportunity".to_string(), - // )])) - // .with_request_context(lambda_http::request::RequestContext::ApiGatewayV2( - // lambda_http::aws_lambda_events::apigw::ApiGatewayV2httpRequestContext::default(), - // )); - // let r = function_handler(event).await.unwrap(); - // dbg!(r); - // } -} diff --git a/lambdas/src/bin/ratings/patch-ratings.rs b/lambdas/src/bin/ratings/patch-ratings.rs deleted file mode 100644 index 784883a..0000000 --- a/lambdas/src/bin/ratings/patch-ratings.rs +++ /dev/null @@ -1,102 +0,0 @@ -use dotenv::dotenv; -use effortless::{ - api::{ - entry_not_found, invalid_path_parameter, missing_parameter, parse_path_parameter, - parse_request_body, - }, - fragment::BnaRequestExt, -}; -use entity::{ - core_services, features, infrastructure, opportunity, prelude, recreation, summary, - wrappers::bna::BNAPatch, -}; -use lambda_http::{run, service_fn, Body, Error, IntoResponse, Request, Response}; -use lambdas::database_connect; -use sea_orm::{prelude::Uuid, ActiveValue, EntityTrait}; -use serde_json::json; -use tracing::info; - -#[tokio::main] -async fn main() -> Result<(), Error> { - tracing_subscriber::fmt() - .with_max_level(tracing::Level::INFO) - // disable printing the name of the module in every log line. - .with_target(false) - // disabling time is handy because CloudWatch will add the ingestion time. - .without_time() - .init(); - - run(service_fn(function_handler)).await.map_err(|e| { - info!("{e}"); - e - }) -} - -async fn function_handler(event: Request) -> Result, Error> { - dotenv().ok(); - - // Retrieve the ID of the entry to update. - let parameter = "id"; - let id = event - .path_parameter::(parameter) - .ok_or(missing_parameter(&event, parameter))? - .map_err(|e| invalid_path_parameter(&event, parameter, e.to_string().as_str()))?; - - // Extract and deserialize the data. - let wrapper = match parse_request_body::(&event) { - Ok(value) => value, - Err(e) => return Ok(e.into()), - }; - - // Turn the model wrapper into active models. - let summary = summary::ActiveModel { - bna_uuid: ActiveValue::NotSet, - city_id: wrapper - .summary - .city_id - .map_or(ActiveValue::NotSet, ActiveValue::Set), - created_at: ActiveValue::NotSet, - score: ActiveValue::Set(wrapper.summary.score), - version: ActiveValue::Set(wrapper.summary.version), - }; - let core_services = core_services::ActiveModel { - bna_uuid: ActiveValue::NotSet, - dentists: ActiveValue::Set(wrapper.core_services.dentists), - doctors: ActiveValue::Set(wrapper.core_services.doctors), - grocery: ActiveValue::Set(wrapper.core_services.grocery), - hospitals: ActiveValue::Set(wrapper.core_services.hospitals), - pharmacies: ActiveValue::Set(wrapper.core_services.pharmacies), - score: ActiveValue::Set(wrapper.core_services.score), - social_services: ActiveValue::Set(wrapper.core_services.social_services), - }; - let features = features::ActiveModel { - bna_uuid: ActiveValue::NotSet, - people: ActiveValue::Set(wrapper.features.people), - retail: ActiveValue::Set(wrapper.features.retail), - transit: ActiveValue::Set(wrapper.features.transit), - }; - let infrastructure = infrastructure::ActiveModel { - bna_uuid: ActiveValue::NotSet, - low_stress_miles: ActiveValue::Set(wrapper.infrastructure.low_stress_miles), - high_stress_miles: ActiveValue::Set(wrapper.infrastructure.high_stress_miles), - }; - let opportunity = opportunity::ActiveModel { - bna_uuid: ActiveValue::NotSet, - employment: ActiveValue::Set(wrapper.opportunity.employment), - higher_education: ActiveValue::Set(wrapper.opportunity.higher_education), - k12_education: ActiveValue::Set(wrapper.opportunity.k12_education), - score: ActiveValue::Set(wrapper.opportunity.score), - technical_vocational_college: ActiveValue::Set( - wrapper.opportunity.technical_vocational_college, - ), - }; - let recreation = recreation::ActiveModel { - bna_uuid: ActiveValue::NotSet, - community_centers: ActiveValue::Set(wrapper.recreation.community_centers), - parks: ActiveValue::Set(wrapper.recreation.parks), - recreation_trails: ActiveValue::Set(wrapper.recreation.recreation_trails), - score: ActiveValue::Set(wrapper.recreation.score), - }; - - Ok(Body::Empty.into_response().await) -} diff --git a/lambdas/src/bin/ratings/post-ratings-analysis.rs b/lambdas/src/bin/ratings/post-ratings-analysis.rs deleted file mode 100644 index ed53303..0000000 --- a/lambdas/src/bin/ratings/post-ratings-analysis.rs +++ /dev/null @@ -1,84 +0,0 @@ -use dotenv::dotenv; -use effortless::{api::parse_request_body, error::APIErrors}; -use entity::wrappers::bna_pipeline::BNAPipelinePost; -use lambda_http::{run, service_fn, Body, Error, IntoResponse, Request, Response}; -use lambdas::core::resource::ratings::adaptor::post_ratings_analysis_adaptor; -use tracing::info; - -async fn function_handler(event: Request) -> Result, Error> { - dotenv().ok(); - - // Extract and serialize the data. - let wrapper = match parse_request_body::(&event) { - Ok(value) => value, - Err(e) => return Ok(e.into()), - }; - - match post_ratings_analysis_adaptor(wrapper).await { - Ok(v) => Ok(v.into_response().await), - Err(e) => Ok(APIErrors::from(e).into()), - } -} - -#[tokio::main] -async fn main() -> Result<(), Error> { - tracing_subscriber::fmt() - .with_max_level(tracing::Level::INFO) - // disable printing the name of the module in every log line. - .with_target(false) - // disabling time is handy because CloudWatch will add the ingestion time. - .without_time() - .init(); - - run(service_fn(function_handler)).await.map_err(|e| { - info!("{e}"); - e - }) -} - -#[cfg(test)] -mod tests { - - use super::*; - use aws_lambda_events::http; - use lambda_http::RequestExt; - - #[tokio::test] - async fn test_handler_all() { - let event = http::Request::builder() - .header(http::header::CONTENT_TYPE, "application/json") - .body(Body::Text( - r#"{ - "cost": null, - "end_time": null, - "fargate_price_id": null, - "fargate_task_arn": null, - "result_posted": null, - "s3_bucket": null, - "sqs_message": null, - "start_time": [ - 2024, - 247, - 13, - 7, - 29, - 922293000, - 0, - 0, - 0 - ], - "state_machine_id": "fc009967-c4d0-416b-baee-93708ac80cbc", - "status": null, - "step": "Analysis", - "torn_down": null - }"# - .to_string(), - )) - .expect("failed to build request") - .with_request_context(lambda_http::request::RequestContext::ApiGatewayV2( - lambda_http::aws_lambda_events::apigw::ApiGatewayV2httpRequestContext::default(), - )); - let r = function_handler(event).await; - let _var_name = dbg!(r); - } -} diff --git a/lambdas/src/bin/ratings/post-ratings-enqueue.rs b/lambdas/src/bin/ratings/post-ratings-enqueue.rs deleted file mode 100644 index 155f3ff..0000000 --- a/lambdas/src/bin/ratings/post-ratings-enqueue.rs +++ /dev/null @@ -1,79 +0,0 @@ -use aws_config::BehaviorVersion; -use bnacore::aws::get_aws_parameter; -use dotenv::dotenv; -use effortless::api::{internal_error, invalid_body, parse_request_body}; -use lambda_http::{run, service_fn, Body, Error, IntoResponse, Request, Response}; -use serde::{Deserialize, Serialize}; -use serde_json::json; -use tracing::info; - -#[derive(Deserialize, Serialize, Debug)] -pub struct EnqueueCity { - pub country: String, - pub city: String, - pub region: String, - pub fips_code: String, -} - -async fn function_handler(event: Request) -> Result, Error> { - dotenv().ok(); - - // Extract and deserialize the data. - let enqueued_cities = match parse_request_body::>(&event) { - Ok(value) => value, - Err(e) => return Ok(e.into()), - }; - - // Prepare the AWS client. - let aws_config = aws_config::load_defaults(BehaviorVersion::latest()).await; - let sqs_client = aws_sdk_sqs::Client::new(&aws_config); - let bna_sqs_queue = match get_aws_parameter("BNA_SQS_QUEUE_URL").await { - Ok(param) => param, - Err(e) => { - let message = format!("cannot retrieve the SQS Queue URL: {e}"); - info!(message); - return Ok(internal_error(&event, &message).into()); - } - }; - - // Enqueue the messages. - let mut count = 0; - for enqueued_city in enqueued_cities { - let enqueued_city_string = match serde_json::to_string(&enqueued_city) { - Ok(s) => s, - Err(e) => return Ok(invalid_body(&event, e.to_string().as_str()).into()), - }; - let send_message = sqs_client - .send_message() - .queue_url(&bna_sqs_queue.parameter.value) - .message_body(enqueued_city_string) - .send() - .await; - if send_message.is_err() { - let e = send_message.err().unwrap(); - let message = format!("cannot send the message to the SQS queue: {e}"); - info!(message); - return Ok(internal_error(&event, &message).into()); - } - count += 1; - } - - // Return the number of messages successfully processed.. - Ok(json!({"messages": count}).into_response().await) -} - -#[tokio::main] -async fn main() -> Result<(), Error> { - tracing_subscriber::fmt() - .with_max_level(tracing::Level::INFO) - // disable printing the name of the module in every log line. - .with_target(false) - // disabling time is handy because CloudWatch will add the ingestion time. - .without_time() - .init(); - - run(service_fn(function_handler)).await.map_err(|e| { - info!("{e}"); - e - }) -} diff --git a/lambdas/src/bin/ratings/post-ratings.rs b/lambdas/src/bin/ratings/post-ratings.rs deleted file mode 100644 index c90d075..0000000 --- a/lambdas/src/bin/ratings/post-ratings.rs +++ /dev/null @@ -1,201 +0,0 @@ -use dotenv::dotenv; -use effortless::{api::parse_request_body, response::make_json_created_response}; -use entity::{ - core_services, infrastructure, opportunity, people, recreation, retail, summary, transit, - wrappers::bna::BNAPost, -}; -use lambda_http::{run, service_fn, Body, Error, Request, Response}; -use lambdas::database_connect; -use sea_orm::{ActiveModelTrait, ActiveValue}; -use serde_json::json; -use tracing::info; - -#[tokio::main] -async fn main() -> Result<(), Error> { - tracing_subscriber::fmt() - .with_max_level(tracing::Level::INFO) - // disable printing the name of the module in every log line. - .with_target(false) - // disabling time is handy because CloudWatch will add the ingestion time. - .without_time() - .init(); - - run(service_fn(function_handler)).await.map_err(|e| { - info!("{e}"); - e - }) -} - -async fn function_handler(event: Request) -> Result, Error> { - dotenv().ok(); - - // Extract and serialize the data. - info!("Parsing body into BNAPost..."); - let wrapper = match parse_request_body::(&event) { - Ok(value) => value, - Err(e) => return Ok(e.into()), - }; - - // Note(rgreinho): We are note supposed to do that. The Brokenspoke-analyzer - // already computes the scores for us. - // Refresh the scores. - // wrapper.core_services.refresh_score(); - // wrapper.opportunity.refresh_score(); - // wrapper.recreation.refresh_score(); - // wrapper.refresh_score(); - - // Turn the model wrapper into active models. - let summary = summary::ActiveModel { - id: ActiveValue::Set(wrapper.summary.rating_id), - city_id: ActiveValue::Set(wrapper.summary.city_id), - created_at: ActiveValue::NotSet, - score: ActiveValue::Set(wrapper.summary.score), - version: ActiveValue::Set(wrapper.summary.version), - }; - info!("{:?}", summary); - let core_services = core_services::ActiveModel { - id: ActiveValue::Set(wrapper.summary.rating_id), - dentists: ActiveValue::Set(wrapper.core_services.dentists), - doctors: ActiveValue::Set(wrapper.core_services.doctors), - grocery: ActiveValue::Set(wrapper.core_services.grocery), - hospitals: ActiveValue::Set(wrapper.core_services.hospitals), - pharmacies: ActiveValue::Set(wrapper.core_services.pharmacies), - score: ActiveValue::Set(wrapper.core_services.score), - social_services: ActiveValue::Set(wrapper.core_services.social_services), - }; - info!("{:?}", core_services); - let people = people::ActiveModel { - id: ActiveValue::Set(wrapper.summary.rating_id), - score: ActiveValue::Set(wrapper.people.score), - }; - info!("{:?}", people); - let retail = retail::ActiveModel { - id: ActiveValue::Set(wrapper.summary.rating_id), - score: ActiveValue::Set(wrapper.retail.score), - }; - info!("{:?}", people); - let transit = transit::ActiveModel { - id: ActiveValue::Set(wrapper.summary.rating_id), - score: ActiveValue::Set(wrapper.transit.score), - }; - info!("{:?}", people); - let infrastructure = infrastructure::ActiveModel { - id: ActiveValue::Set(wrapper.summary.rating_id), - low_stress_miles: ActiveValue::Set(wrapper.infrastructure.low_stress_miles), - high_stress_miles: ActiveValue::Set(wrapper.infrastructure.high_stress_miles), - }; - info!("{:?}", infrastructure); - let opportunity = opportunity::ActiveModel { - id: ActiveValue::Set(wrapper.summary.rating_id), - employment: ActiveValue::Set(wrapper.opportunity.employment), - higher_education: ActiveValue::Set(wrapper.opportunity.higher_education), - k12_education: ActiveValue::Set(wrapper.opportunity.k12_education), - score: ActiveValue::Set(wrapper.opportunity.score), - technical_vocational_college: ActiveValue::Set( - wrapper.opportunity.technical_vocational_college, - ), - }; - info!("{:?}", opportunity); - let recreation = recreation::ActiveModel { - id: ActiveValue::Set(wrapper.summary.rating_id), - community_centers: ActiveValue::Set(wrapper.recreation.community_centers), - parks: ActiveValue::Set(wrapper.recreation.parks), - recreation_trails: ActiveValue::Set(wrapper.recreation.recreation_trails), - score: ActiveValue::Set(wrapper.recreation.score), - }; - info!("{:?}", recreation); - - // Get the database connection. - let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; - - // And insert a new entry for each model. - let summary_res = summary.insert(&db).await?; - let core_services_res = core_services.insert(&db).await?; - let people_res = people.insert(&db).await?; - let retail_res = retail.insert(&db).await?; - let transit_res = transit.insert(&db).await?; - let infrastructure_res = infrastructure.insert(&db).await?; - let opportunity_res = opportunity.insert(&db).await?; - let recreation_res = recreation.insert(&db).await?; - let res = ( - summary_res, - core_services_res, - people_res, - retail_res, - transit_res, - infrastructure_res, - opportunity_res, - recreation_res, - ); - info!("{:?}", res); - let response = - make_json_created_response(json!(res).to_string()).expect("unable to build http::Response"); - Ok(response) - - // Ok(Body::Empty.into_response().await) -} - -#[cfg(test)] -mod tests { - // use super::*; - // use entity::wrappers::bna::{ - // BNACoreServices, BNAFeatures, BNAInfrastructure, BNAOpportunity, BNARecreation, BNASummary, - // }; - // use lambda_http::{http, RequestExt}; - // use sea_orm::prelude::Uuid; - - // #[tokio::test] - // async fn test_post() { - // let bna_uuid = Uuid::new_v4(); - // dbg!(&bna_uuid); - // let bna_post = BNAPost { - // core_services: BNACoreServices { - // dentists: Some(0.0), - // doctors: Some(0.0), - // grocery: Some(1.69), - // hospitals: Some(5.18), - // pharmacies: Some(0.0), - // social_services: Some(0.0), - // score: Some(0.0), - // }, - // features: BNAFeatures { - // people: Some(19.17), - // retail: Some(0.0), - // transit: Some(0.0), - // }, - // infrastructure: BNAInfrastructure { - // low_stress_miles: Some(9.3), - // high_stress_miles: Some(64.5), - // }, - // opportunity: BNAOpportunity { - // employment: Some(8.26), - // higher_education: Some(0.0), - // k12_education: Some(8.31), - // technical_vocational_college: Some(0.0), - // score: Some(0.0), - // }, - // recreation: BNARecreation { - // community_centers: Some(0.0), - // parks: Some(7.13), - // recreation_trails: Some(0.0), - // score: Some(0.0), - // }, - // summary: BNASummary { - // bna_uuid, - // version: "24.05".to_string(), - // city_id: Uuid::parse_str("02fa7cef-bfb9-494e-9ae9-cdbaeb15f11f").unwrap(), - // score: 0.0, - // }, - // }; - // let body = serde_json::to_string(&bna_post).unwrap(); - // let event = http::Request::builder() - // .header(http::header::CONTENT_TYPE, "application/json") - // .body(Body::from(body)) - // .expect("failed to build request") - // .with_request_context(lambda_http::request::RequestContext::ApiGatewayV2( - // lambda_http::aws_lambda_events::apigw::ApiGatewayV2httpRequestContext::default(), - // )); - // let r = function_handler(event).await.unwrap(); - // dbg!(r); - // } -} diff --git a/lambdas/src/core/resource/cities/adaptor.rs b/lambdas/src/core/resource/cities/adaptor.rs index 76d7273..66c3b6c 100644 --- a/lambdas/src/core/resource/cities/adaptor.rs +++ b/lambdas/src/core/resource/cities/adaptor.rs @@ -2,11 +2,14 @@ use super::db::{ fetch_cities, fetch_cities_censuses, fetch_cities_ratings, fetch_cities_submission, fetch_cities_submissions, fetch_city, fetch_country, fetch_state_region_crosswalk, }; -use crate::{database_connect, Context, ExecutionError, PageFlow, Paginatron}; -use entity::wrappers::{ - census::CensusFromCityPost, - city::CityPost, - submission::{SubmissionPatch, SubmissionPost}, +use crate::{database_connect, Context, ExecutionError}; +use entity::{ + census, city, summary, + wrappers::{ + census::CensusFromCityPost, + city::CityPost, + submission::{SubmissionPatch, SubmissionPost}, + }, }; use sea_orm::{ActiveModelTrait, ActiveValue, IntoActiveModel}; use serde_json::{json, Value}; @@ -18,7 +21,7 @@ pub async fn get_city_adaptor( region: &str, name: &str, ctx: Context, -) -> Result { +) -> Result { // Set the database connection. let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; @@ -31,7 +34,7 @@ pub async fn get_city_adaptor( } }; match model { - Some(model) => Ok(json!(model)), + Some(model) => Ok(model), None => Err(ExecutionError::NotFound( ctx.request_id(), ctx.source(), @@ -40,18 +43,15 @@ pub async fn get_city_adaptor( } } -pub async fn get_cities_adaptor(page: u64, page_size: u64) -> Result { +pub async fn get_cities_adaptor( + page: u64, + page_size: u64, +) -> Result<(u64, Vec), ExecutionError> { // Set the database connection. let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; // Fetch a page of cities. - let (total_items, models) = fetch_cities(&db, page, page_size).await?; - - // Return the paginated response. - Ok(PageFlow::new( - Paginatron::new(None, total_items, page, page_size), - json!(models), - )) + Ok(fetch_cities(&db, page, page_size).await?) } pub async fn get_cities_censuses_adaptor( @@ -60,19 +60,21 @@ pub async fn get_cities_censuses_adaptor( name: &str, page: u64, page_size: u64, -) -> Result { +) -> Result<(u64, Vec<(city::Model, Option)>), ExecutionError> { // Set the database connection. let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; // Fetch a page of city censuses. - let (total_items, models) = - fetch_cities_censuses(&db, country, region, name, page, page_size).await?; - - // Return the paginated response. - Ok(PageFlow::new( - Paginatron::new(None, total_items, page, page_size), - json!(models), - )) + let res = fetch_cities_censuses(&db, country, region, name, page, page_size).await?; + if res.1.is_empty() { + Err(ExecutionError::NotFound( + Some(country.to_string()), + region.to_string(), + name.to_string(), + )) + } else { + Ok(res) + } } pub async fn post_cities_census_adaptor( @@ -80,7 +82,7 @@ pub async fn post_cities_census_adaptor( region: &str, name: &str, census: CensusFromCityPost, -) -> Result { +) -> Result { // Set the database connection. let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; @@ -95,8 +97,7 @@ pub async fn post_cities_census_adaptor( // And insert a new entry. let model = active_model.insert(&db).await?; - let value = json!(model); - Ok(value) + Ok(model) } else { Err(ExecutionError::NotFound( Some(country.to_string()), @@ -113,7 +114,7 @@ pub async fn get_cities_ratings_adaptor( page: u64, page_size: u64, ctx: Context, -) -> Result { +) -> Result<(u64, Vec<(city::Model, Option)>), ExecutionError> { // Set the database connection. let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; @@ -130,11 +131,7 @@ pub async fn get_cities_ratings_adaptor( )); } - // Return the paginated response. - Ok(PageFlow::new( - Paginatron::new(None, total_items, page, page_size), - json!(models), - )) + Ok((total_items, models)) } pub async fn post_cities_adaptor(city: CityPost) -> Result { @@ -173,7 +170,6 @@ pub async fn post_cities_adaptor(city: CityPost) -> Result, ctx: Context, -) -> Result { +) -> Result { // Set the database connection. let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; @@ -190,7 +186,7 @@ pub async fn get_cities_submission_adaptor( let status_str = status.clone().unwrap_or("any".to_string()); let model = fetch_cities_submission(&db, submission_id, status).await?; match model { - Some(model) => Ok(json!(model)), + Some(model) => Ok(model), None => Err(ExecutionError::NotFound( ctx.request_id(), ctx.source(), @@ -203,24 +199,18 @@ pub async fn get_cities_submissions_adaptor( status: Option, page: u64, page_size: u64, -) -> Result { +) -> Result<(u64, Vec), ExecutionError> { // Set the database connection. let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; // Fetch the model. - let (total_items, models) = fetch_cities_submissions(&db, status, page, page_size).await?; - - // Return the paginated response. - Ok(PageFlow::new( - Paginatron::new(None, total_items, page, page_size), - json!(models), - )) + Ok(fetch_cities_submissions(&db, status, page, page_size).await?) } pub async fn patch_cities_submission_adaptor( submission_id: i32, submission: SubmissionPatch, -) -> Result { +) -> Result { // Set the database connection. let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; @@ -229,12 +219,12 @@ pub async fn patch_cities_submission_adaptor( active_model.id = ActiveValue::Unchanged(submission_id); let model = active_model.update(&db).await?; - Ok(json!(model)) + Ok(model) } pub async fn post_cities_submission_adaptor( submission: SubmissionPost, -) -> Result { +) -> Result { // Set the database connection. let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; @@ -251,5 +241,5 @@ pub async fn post_cities_submission_adaptor( // And insert a new entry. let model = active_model.insert(&db).await?; - Ok(json!(model)) + Ok(model) } diff --git a/lambdas/src/core/resource/cities/db.rs b/lambdas/src/core/resource/cities/db.rs index 5f77873..ea8222b 100644 --- a/lambdas/src/core/resource/cities/db.rs +++ b/lambdas/src/core/resource/cities/db.rs @@ -42,7 +42,7 @@ pub async fn fetch_cities_censuses( let select = city::Entity::find_by_id((country.to_string(), region.to_string(), name.to_string())) .find_also_related(census::Entity); - let models = select + let models: Vec<(city::Model, Option)> = select .clone() .paginate(db, page_size) .fetch_page(page) diff --git a/lambdas/src/core/resource/cities/endpoint.rs b/lambdas/src/core/resource/cities/endpoint.rs index 620f24d..7dbccf0 100644 --- a/lambdas/src/core/resource/cities/endpoint.rs +++ b/lambdas/src/core/resource/cities/endpoint.rs @@ -1,86 +1,164 @@ -use super::adaptor::{ - get_cities_adaptor, get_cities_censuses_adaptor, get_cities_ratings_adaptor, - get_cities_submission_adaptor, get_cities_submissions_adaptor, get_city_adaptor, - patch_cities_submission_adaptor, post_cities_adaptor, post_cities_census_adaptor, - post_cities_submission_adaptor, +use super::{ + adaptor::{ + get_cities_adaptor, get_cities_censuses_adaptor, get_cities_ratings_adaptor, + get_cities_submission_adaptor, get_cities_submissions_adaptor, get_city_adaptor, + patch_cities_submission_adaptor, post_cities_adaptor, post_cities_census_adaptor, + post_cities_submission_adaptor, + }, + schema::{ + Census, CensusPost, Cities, CityCensuses, CityPost, CityRatings, RatingSummary, Submission, + SubmissionPatch, SubmissionPost, Submissions, + }, +}; +use crate::{ + core::resource::{ + cities::{schema::CityParams, CitiesPathParameters}, + schema::{City, ErrorResponses, PaginationParams}, + }, + Context, ExecutionError, PageFlow, Paginatron, }; -use crate::{core::resource::cities::CitiesPathParameters, Context, ExecutionError}; use axum::{ - debug_handler, extract::{Path, Query}, http::StatusCode, - response::IntoResponse, - routing::get, - Json, Router, + Json, }; use axum_extra::extract::OptionalQuery; use effortless::api::PaginationParameters; -use entity::wrappers::{ - census::CensusFromCityPost, - city::CityPost, - submission::{SubmissionPatch, SubmissionPost}, -}; -use serde::Deserialize; -use serde_json::{json, Value}; - -pub fn routes() -> Router { - Router::new() - .route("/cities", get(get_cities).post(post_cities)) - .route("/cities/:country/:region/:name", get(get_city)) - .route( - "/cities/:country/:region/:name/census", - get(get_city_censuses).post(post_city_census), - ) - .route( - "/cities/:country/:region/:name/ratings", - get(get_city_ratings), - ) - .route( - "/cities/submissions", - get(get_cities_submissions).post(post_cities_submissions), - ) - .route( - "/cities/submissions/:submission_id", - get(get_cities_submission).patch(patch_cities_submission), - ) +use entity::wrappers::{census::CensusFromCityPost, city, submission}; +use serde::{self, Deserialize}; +use serde_json::Value; +use tracing::debug; +use utoipa_axum::{router::OpenApiRouter, routes}; + +const TAG: &str = "city"; + +pub fn routes() -> OpenApiRouter { + OpenApiRouter::new() + .routes(routes!(get_city)) + .routes(routes!(post_city)) + .routes(routes!(get_cities)) + .routes(routes!(get_city_censuses)) + .routes(routes!(post_city_census)) + .routes(routes!(get_city_ratings)) + .routes(routes!(get_cities_submission)) + .routes(routes!(post_cities_submission)) + .routes(routes!(patch_cities_submission)) + .routes(routes!(get_cities_submissions)) } +#[utoipa::path( + get, + path = "/cities/{country}/{region}/{name}", + description = "Get the details of a specific city where an BNA analysis was computed.", + tag = TAG, + params( + CityParams, + ), + responses( + (status = OK, description = "Fetches a city", body = City), + ErrorResponses, + ))] async fn get_city( Path(params): Path, ctx: Context, -) -> Result, ExecutionError> { +) -> Result, ExecutionError> { get_city_adaptor(¶ms.country, ¶ms.region, ¶ms.name, ctx) .await + .map(City::from) .map(Json) } -async fn get_cities(pagination: Option>) -> impl IntoResponse { +#[utoipa::path( + get, + path = "/cities", + description = "Get the details of all cities where an BNA analysis was performed.", + tag = TAG, + params( + PaginationParams, + ), + responses( + (status = OK, description = "Fetches cities", body = Cities), + ))] +async fn get_cities( + pagination: Option>, +) -> Result, ExecutionError> { let Query(pagination) = pagination.unwrap_or_default(); - get_cities_adaptor(pagination.page, pagination.page_size()).await + let payload = get_cities_adaptor(pagination.page, pagination.page_size()).await?; + Ok(PageFlow::new( + Paginatron::new(None, payload.0, pagination.page, pagination.page_size()), + payload.1.into(), + )) } +#[utoipa::path( + get, + path = "/cities/{country}/{region}/{name}/census", + description = "Get the details of a specific city with its associated census information.", + tag = TAG, + params( + CityParams, + PaginationParams, + ), + responses( + (status = OK, description = "Fetches city censuses", body = CityCensuses), + ErrorResponses, + ))] async fn get_city_censuses( Path(params): Path, pagination: Option>, -) -> impl IntoResponse { +) -> Result, ExecutionError> { let Query(pagination) = pagination.unwrap_or_default(); - get_cities_censuses_adaptor( + let city_censuses = get_cities_censuses_adaptor( ¶ms.country, ¶ms.region, ¶ms.name, pagination.page, pagination.page_size(), ) - .await + .await?; + debug!("{:#?}", city_censuses); + let city = city_censuses.1.first().unwrap().0.clone(); + let censuses = city_censuses + .1 + .iter() + .filter_map(|e| e.1.clone()) + .map(Census::from) + .collect::>(); + let payload = CityCensuses { + city: city.into(), + censuses, + }; + Ok(PageFlow::new( + Paginatron::new( + None, + city_censuses.0, + pagination.page, + pagination.page_size(), + ), + payload, + )) } +#[utoipa::path( + get, + path = "/cities/{country}/{region}/{name}/ratings", + description = "Get the details of a specific city with all the analysis that were performed against it.", + tag = TAG, + params( + CityParams, + PaginationParams, + ), + responses( + (status = OK, description = "Fetches city ratings", body = CityRatings), + ErrorResponses, + ))] async fn get_city_ratings( Path(params): Path, pagination: Option>, ctx: Context, -) -> impl IntoResponse { +) -> Result, ExecutionError> { let Query(pagination) = pagination.unwrap_or_default(); - get_cities_ratings_adaptor( + let city_ratings = get_cities_ratings_adaptor( ¶ms.country, ¶ms.region, ¶ms.name, @@ -88,21 +166,64 @@ async fn get_city_ratings( pagination.page_size(), ctx, ) - .await + .await?; + let city = city_ratings.1.first().unwrap().0.clone(); + let ratings = city_ratings + .1 + .iter() + .filter_map(|e| e.1.clone()) + .map(RatingSummary::from) + .collect::>(); + let payload = CityRatings { + city: city.into(), + ratings, + }; + Ok(PageFlow::new( + Paginatron::new( + None, + city_ratings.0, + pagination.page, + pagination.page_size(), + ), + payload, + )) } -async fn post_cities(Json(city): Json) -> Result, ExecutionError> { +#[utoipa::path( + post, + path = "/cities", + description = "Create a new city.", + tag = TAG, + request_body = CityPost, + responses( + (status = CREATED, description = "Creates a new city", body = City), + ErrorResponses, + ))] +async fn post_city(Json(city): Json) -> Result, ExecutionError> { post_cities_adaptor(city).await.map(Json) } +#[utoipa::path( + get, + path = "/cities/submissions/{submission_id}", + description = "Get the details of a specific sumission.", + tag = TAG, + params( + ("submission_id" = i32, Path, description = "Submission identifier", example = "1"), + ("status" = Option, Query, description = "Filter for the submission status", example = "Pending"), + ), + responses( + (status = OK, description = "Fetches a submission", body = Submission), + ErrorResponses, + ))] async fn get_cities_submission( Path(submission_id): Path, OptionalQuery(status): OptionalQuery, ctx: Context, -) -> Result, ExecutionError> { - // let ctx = Context::new(request_id, source); +) -> Result, ExecutionError> { get_cities_submission_adaptor(submission_id, status, ctx) .await + .map(Submission::from) .map(Json) } @@ -111,45 +232,110 @@ struct SubmissionParameters { pub status: Option, } -#[debug_handler] +#[utoipa::path( + get, + path = "/cities/submissions", + description = "Get the submissions details.", + tag = TAG, + params( + ("status" = Option, Query, description = "Filter for the submission status", example = "Pending"), + PaginationParams, + ), + responses( + (status = OK, description = "Fetches submissions", body = Submissions), + ErrorResponses, + ))] async fn get_cities_submissions( Query(submission_params): Query, pagination: Option>, -) -> Result, ExecutionError> { +) -> Result, ExecutionError> { let Query(pagination) = pagination.unwrap_or_default(); - get_cities_submissions_adaptor( + let cities_submissions = get_cities_submissions_adaptor( submission_params.status, pagination.page, pagination.page_size(), ) - .await - .map(|v| Json(json!(v.payload()))) + .await?; + // .map(|v| Json(json!(v.payload()))) + let submissions = cities_submissions + .1 + .into_iter() + .map(Submission::from) + .collect::>(); + let payload = Submissions(submissions); + Ok(PageFlow::new( + Paginatron::new( + None, + cities_submissions.0, + pagination.page, + pagination.page_size(), + ), + payload, + )) } +#[utoipa::path( + post, + path = "/cities/submissions", + description = "Create a new city submission.", + tag = TAG, + request_body = SubmissionPost, + responses( + (status = CREATED, description = "Creates a new city submission", body = Submission), + ErrorResponses, + ))] +async fn post_cities_submission( + Json(submission): Json, +) -> Result<(StatusCode, Json), ExecutionError> { + post_cities_submission_adaptor(submission) + .await + .map(Submission::from) + .map(|v| (StatusCode::CREATED, Json(v))) +} + +#[utoipa::path( + patch, + path = "/cities/submissions/{submission_id}", + description = "Update a city submission.", + tag = TAG, + params( + ("submission_id" = i32, Path, description = "Submission identifier", example = "1"), + ), + request_body = SubmissionPatch, + responses( + (status = OK, description = "Updates a city submission", body = Submission), + ErrorResponses, + ))] async fn patch_cities_submission( Query(submission_id): Query, - Json(submission): Json, -) -> Result, ExecutionError> { + Json(submission): Json, +) -> Result, ExecutionError> { patch_cities_submission_adaptor(submission_id, submission) .await + .map(Submission::from) .map(Json) } -async fn post_cities_submissions( - Json(submission): Json, -) -> Result<(StatusCode, Json), ExecutionError> { - post_cities_submission_adaptor(submission) - .await - .map(|v| (StatusCode::CREATED, Json(v))) -} - -#[axum::debug_handler] +#[utoipa::path( + post, + path = "/cities/{country}/{region}/{name}/census", + description = "Create census information for a specific city.", + tag = TAG, + params( + CityParams, + ), + request_body = CensusPost, + responses( + (status = CREATED, description = "Creates a new census entry for a city", body = Census), + ErrorResponses, + ))] async fn post_city_census( Path(params): Path, Json(census): Json, -) -> Result<(StatusCode, Json), ExecutionError> { +) -> Result<(StatusCode, Json), ExecutionError> { post_cities_census_adaptor(¶ms.country, ¶ms.region, ¶ms.name, census) .await + .map(Census::from) .map(|v| (StatusCode::CREATED, Json(v))) } diff --git a/lambdas/src/core/resource/cities/mod.rs b/lambdas/src/core/resource/cities/mod.rs index 119db0e..61120da 100644 --- a/lambdas/src/core/resource/cities/mod.rs +++ b/lambdas/src/core/resource/cities/mod.rs @@ -2,6 +2,7 @@ pub mod adaptor; mod db; pub mod endpoint; +mod schema; use effortless::{api::parse_path_parameter, error::APIErrors}; use serde::Deserialize; diff --git a/lambdas/src/core/resource/cities/schema.rs b/lambdas/src/core/resource/cities/schema.rs new file mode 100644 index 0000000..ab3a525 --- /dev/null +++ b/lambdas/src/core/resource/cities/schema.rs @@ -0,0 +1,307 @@ +//! Describes the Citi schemas. +use crate::core::resource::schema::{City, Country}; +use chrono::DateTime; +use entity::{census, submission, summary}; +use serde::{Deserialize, Serialize}; +use utoipa::{IntoParams, ToSchema}; +use uuid::Uuid; + +#[derive(ToSchema, Serialize)] +pub(crate) struct Cities(Vec); + +impl From> for Cities { + fn from(value: Vec) -> Self { + let c = value.into_iter().map(City::from).collect::>(); + Cities(c) + } +} + +#[allow(dead_code)] +#[derive(ToSchema)] +pub(crate) struct CityPost { + /// Country name + #[schema(examples("Belgium"))] + country: Country, + /// Geographic coordinate that specifies the north-south position of a point + /// on the surface of the Earth. + #[schema(examples("51.260197"))] + latitude: Option, + /// Geographic coordinate that specifies the east–west position of a point + /// on the surface of the Earth. + #[schema(examples("4.402771"))] + longitude: Option, + /// City name + #[schema(examples("Antwerp"))] + name: String, + /// Region name. A region can be a state, a province, a community, or + /// something similar depending on the country. If a country does not have + /// this concept, then the country name is used. + #[schema(examples("Antwerp"))] + region: Option, + /// A short version of the state name, usually 2 or 3 character long + #[schema(examples("VAN"))] + state: String, + /// A short version of the state name, usually 2 or 3 character long + #[schema(examples("VAN"))] + state_abbrev: Option, + /// Speed limit in kilometer per hour (km/h). + #[schema(examples("50"))] + speed_limit: Option, +} + +#[derive(ToSchema, Serialize)] +#[schema(description = "Census information of a city")] +pub(crate) struct Census { + /// Census identifier + id: i32, + /// City identifier + city_id: Uuid, + /// Creation date + created_at: DateTime, + /// Numerical city identifier given by the U.S. census, or 0 for non-US cities + #[schema(examples("4805000"))] + fips_code: String, + /// City population size category (small (0), medium (1), large (2)) + #[schema(examples("1"))] + pop_size: i32, + /// City population + #[schema(examples("907779"))] + population: i32, +} + +impl From for Census { + fn from(value: census::Model) -> Self { + Self { + id: value.id, + city_id: value.city_id, + created_at: value.created_at, + fips_code: value.fips_code, + pop_size: value.pop_size, + population: value.population, + } + } +} + +#[allow(dead_code)] +#[derive(ToSchema)] +pub(crate) struct CensusPost { + /// Numerical city identifier given by the U.S. census, or 0 for non-US cities + #[schema(examples("4805000"))] + fips_code: String, + /// City population size category (small (0), medium (1), large (2)) + #[schema(examples("1"))] + pop_size: i32, + /// City population + #[schema(examples("907779"))] + population: i32, +} + +// This is the current version which does not seem to be valid OAS3.1 +// https://github.com/juhaku/utoipa/issues/901 +// https://github.com/juhaku/utoipa/pull/1103 +// https://json-schema.org/understanding-json-schema/reference/array#tupleValidation +// struct CityCensuses(Vec<(City, Option)>); +// So here is the new idea, which shounds more correct anyway +#[derive(ToSchema, Serialize)] +pub(crate) struct CityCensuses { + pub(crate) city: City, + pub(crate) censuses: Vec, +} + +#[derive(ToSchema, Serialize)] +pub(crate) struct RatingSummary { + /// Analysis identifier + id: Uuid, + /// City identifier + city_id: Uuid, + /// Creation date + created_at: DateTime, + /// BNA score + #[schema(examples("77.0"))] + score: f64, + /// Analysis version. The format follows the [calver](https://calver.org) + /// specification with the YY.0M[.Minor] scheme. + #[schema(examples("23.12"))] + version: String, +} + +impl From for RatingSummary { + fn from(value: summary::Model) -> Self { + Self { + id: value.id, + city_id: value.city_id, + created_at: value.created_at, + score: value.score, + version: value.version, + } + } +} + +#[derive(ToSchema, Serialize)] +pub(crate) struct CityRatings { + pub(crate) city: City, + pub(crate) ratings: Vec, +} + +#[derive(ToSchema, Serialize)] +pub(crate) struct Submission { + /// Submission identifier + id: i32, + /// First name + #[schema(examples("Jane"))] + first_name: String, + /// Last name + last_name: String, + #[schema(examples("Doe"))] + /// Job title or position + #[schema(examples("CTO"))] + occupation: Option, + /// Organization or company + #[schema(examples("Organization LLC"))] + organization: Option, + /// email address + #[schema(examples("jane.doe@orgllc.com"))] + email: String, + /// Country + #[schema(examples("Belgium"))] + country: Country, + /// City name + #[schema(examples("Antwerp"))] + city: String, + /// Region name. A region can be a state, a province, a community, or + /// something similar depending on the country. If a country does not have + /// this concept, then the country name is used. + #[schema(examples("Antwerp"))] + region: Option, + /// Numerical city identifier given by the U.S. census, or 0 for non-US cities + #[schema(examples("4805000"))] + fips_code: String, + /// Consent status + #[schema(examples("true"))] + consent: bool, + /// Submission status, e.g. "Pending" + #[schema(examples("Pending"))] + status: String, + /// Creation date + created_at: DateTime, +} + +impl From for Submission { + fn from(value: submission::Model) -> Self { + Self { + id: value.id, + first_name: value.first_name, + last_name: value.last_name, + occupation: value.occupation, + organization: value.organization, + email: value.email, + country: value.country.into(), + city: value.city, + region: value.region, + fips_code: value.fips_code, + consent: value.consent, + status: value.status, + created_at: value.created_at, + } + } +} + +#[allow(dead_code)] +#[derive(ToSchema)] +pub(crate) struct SubmissionPost { + /// First name + #[schema(examples("Jane"))] + first_name: String, + /// Last name + last_name: String, + #[schema(examples("Doe"))] + /// Job title or position + #[schema(examples("CTO"))] + occupation: Option, + /// Organization or company + #[schema(examples("Organization LLC"))] + organization: Option, + /// email address + #[schema(examples("jane.doe@orgllc.com"))] + email: String, + /// Country + #[schema(examples("Belgium"))] + country: Country, + /// City name + #[schema(examples("Antwerp"))] + city: String, + /// Region name. A region can be a state, a province, a community, or + /// something similar depending on the country. If a country does not have + /// this concept, then the country name is used. + #[schema(examples("Antwerp"))] + region: Option, + /// Numerical city identifier given by the U.S. census, or 0 for non-US cities + #[schema(examples("4805000"))] + fips_code: String, + /// Consent status + #[schema(examples("true"))] + consent: bool, + /// Submission status, e.g. "Pending" + #[schema(examples("Pending"))] + status: String, +} + +#[allow(dead_code)] +#[derive(ToSchema)] +pub(crate) struct SubmissionPatch { + /// First name + #[schema(examples("Jane"))] + first_name: String, + /// Last name + last_name: String, + #[schema(examples("Doe"))] + /// Job title or position + #[schema(examples("CTO"))] + occupation: Option, + /// Organization or company + #[schema(examples("Organization LLC"))] + organization: Option, + /// email address + #[schema(examples("jane.doe@orgllc.com"))] + email: String, + /// Country + #[schema(examples("Belgium"))] + country: Country, + /// City name + #[schema(examples("Antwerp"))] + city: String, + /// Region name. A region can be a state, a province, a community, or + /// something similar depending on the country. If a country does not have + /// this concept, then the country name is used. + #[schema(examples("Antwerp"))] + region: Option, + /// Numerical city identifier given by the U.S. census, or 0 for non-US cities + #[schema(examples("4805000"))] + fips_code: String, + /// Consent status + #[schema(examples("true"))] + consent: bool, + /// Submission status, e.g. "Pending" + #[schema(examples("Pending"))] + status: String, +} + +#[derive(ToSchema, Serialize)] +pub(crate) struct Submissions(pub(crate) Vec); + +#[allow(dead_code)] +#[derive(Deserialize, IntoParams)] +#[into_params(parameter_in = Path)] +pub(crate) struct CityParams { + /// Country name + #[param(example = "Belgium")] + country: Country, + /// Region name. A region can be a state, a province, a community, or + /// something similar depending on the country. If a country does not have + /// this concept, then the country name is used. + #[param(example = "Antwerp")] + region: String, + /// City name + #[param(example = "Antwerp")] + name: String, +} diff --git a/lambdas/src/core/resource/mod.rs b/lambdas/src/core/resource/mod.rs index 1d724ef..723f541 100644 --- a/lambdas/src/core/resource/mod.rs +++ b/lambdas/src/core/resource/mod.rs @@ -1,3 +1,5 @@ pub mod cities; +pub mod pipelines; pub mod price; pub mod ratings; +pub mod schema; diff --git a/lambdas/src/core/resource/pipelines/adaptor.rs b/lambdas/src/core/resource/pipelines/adaptor.rs new file mode 100644 index 0000000..0620e60 --- /dev/null +++ b/lambdas/src/core/resource/pipelines/adaptor.rs @@ -0,0 +1,79 @@ +use super::db::{fetch_bna_pipeline, fetch_bna_pipelines}; +use crate::{database_connect, Context, ExecutionError, PageFlow, Paginatron}; +use entity::{ + bna_pipeline, + wrappers::bna_pipeline::{BNAPipelinePatch, BNAPipelinePost}, +}; +use sea_orm::{ActiveModelTrait, ActiveValue, IntoActiveModel}; +use tracing::info; +use uuid::Uuid; + +pub async fn get_pipelines_bna_adaptor( + pipeline_id: Uuid, + ctx: Context, +) -> Result { + // Set the database connection. + let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; + + // Fetch the model. + let model = fetch_bna_pipeline(&db, pipeline_id).await?; + match model { + Some(model) => Ok(model), + None => Err(ExecutionError::NotFound( + ctx.request_id(), + ctx.source(), + format!("cannot find a pipeline with the ID {pipeline_id}"), + )), + } +} + +pub async fn get_pipelines_bnas_adaptor( + page: u64, + page_size: u64, +) -> Result>, ExecutionError> { + // Set the database connection. + let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; + + // Fetch a page of summary. + let (total_items, models) = fetch_bna_pipelines(&db, page, page_size).await?; + + // Return the paginated response. + Ok(PageFlow::new( + Paginatron::new(None, total_items, page, page_size), + models, + )) +} + +pub async fn post_pipelines_bna_adaptor( + bna_pipeline: BNAPipelinePost, +) -> Result { + // Set the database connection. + let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; + + // Turn the post model into an active model. + let active_model = bna_pipeline.into_active_model(); + + // And insert a new entry. + info!( + "inserting Brokenspoke pipeline into database: {:?}", + active_model + ); + let model = active_model.insert(&db).await?; + Ok(model) +} + +pub async fn patch_pipelines_bna_adaptor( + bna_pipeline: BNAPipelinePatch, + analysis_id: Uuid, +) -> Result { + // Set the database connection. + let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; + + // Turn the patch model into an active model. + let mut active_model = bna_pipeline.into_active_model(); + active_model.state_machine_id = ActiveValue::Unchanged(analysis_id); + + // Update the entry. + let model = active_model.update(&db).await?; + Ok(model) +} diff --git a/lambdas/src/core/resource/pipelines/db.rs b/lambdas/src/core/resource/pipelines/db.rs new file mode 100644 index 0000000..c922c53 --- /dev/null +++ b/lambdas/src/core/resource/pipelines/db.rs @@ -0,0 +1,25 @@ +use entity::bna_pipeline; +use sea_orm::{DatabaseConnection, EntityTrait, PaginatorTrait}; +use uuid::Uuid; + +pub async fn fetch_bna_pipeline( + db: &DatabaseConnection, + pipeline_id: Uuid, +) -> Result, sea_orm::DbErr> { + bna_pipeline::Entity::find_by_id(pipeline_id).one(db).await +} + +pub async fn fetch_bna_pipelines( + db: &DatabaseConnection, + page: u64, + page_size: u64, +) -> Result<(u64, Vec), sea_orm::DbErr> { + let select = bna_pipeline::Entity::find(); + let models = select + .clone() + .paginate(db, page_size) + .fetch_page(page) + .await?; + let count = select.count(db).await?; + Ok((count, models)) +} diff --git a/lambdas/src/core/resource/pipelines/endpoint.rs b/lambdas/src/core/resource/pipelines/endpoint.rs new file mode 100644 index 0000000..e125b0b --- /dev/null +++ b/lambdas/src/core/resource/pipelines/endpoint.rs @@ -0,0 +1,123 @@ +use super::adaptor::{ + get_pipelines_bna_adaptor, get_pipelines_bnas_adaptor, patch_pipelines_bna_adaptor, + post_pipelines_bna_adaptor, +}; +use super::schema::{BnaPipeline, BnaPipelinePatch, BnaPipelinePost, BnaPipelines}; +use crate::{ + core::resource::schema::{ErrorResponses, PaginationParams}, + Context, ExecutionError, +}; +use axum::{ + extract::{Path, Query}, + http::StatusCode, + Json, +}; +use effortless::api::PaginationParameters; +use entity::wrappers::bna_pipeline::{BNAPipelinePatch, BNAPipelinePost}; +use serde_json::{json, Value}; +use tracing::debug; +use utoipa_axum::{router::OpenApiRouter, routes}; +use uuid::Uuid; + +const TAG: &str = "pipeline"; + +pub fn routes() -> OpenApiRouter { + OpenApiRouter::new() + .routes(routes!(get_pipelines_bna)) + .routes(routes!(get_pipelines_bnas)) + .routes(routes!(post_pipelines_bna)) + .routes(routes!(patch_pipelines_bna)) +} + +#[utoipa::path( + get, + path = "/pipelines/bna/{pipeline_id}", + description = "Get the details of a specific BNA pipeline", + tag = TAG, + params( + ("pipeline_id" = Uuid, Path, description = "Pipeline identifier") + ), + responses( + (status = OK, description = "Fetches the details of a BNA pipeline", body = BnaPipeline), + ErrorResponses, + ))] +async fn get_pipelines_bna( + Path(pipeline_id): Path, + ctx: Context, +) -> Result, ExecutionError> { + get_pipelines_bna_adaptor(pipeline_id, ctx) + .await + .map(BnaPipeline::from) + .map(Json) +} + +#[utoipa::path( + get, + path = "/pipelines/bna", + description = "Get the details of all BNA pipelines", + tag = TAG, + params( + PaginationParams, + ), + responses( + (status = OK, description = "Fetches the details of all BNA pipelines", body = BnaPipelines), + ErrorResponses, + ))] +async fn get_pipelines_bnas( + pagination: Option>, +) -> Result, ExecutionError> { + let Query(pagination) = pagination.unwrap_or_default(); + get_pipelines_bnas_adaptor(pagination.page, pagination.page_size()) + .await + .map(|v| Json(json!(v.payload()))) +} + +#[utoipa::path( + post, + path = "/pipelines/bna", + description = "Create a new BNA pipeline", + tag = TAG, + request_body = BnaPipelinePost, + responses( + (status = CREATED, description = "Creates a new city submission", body = BnaPipeline), + ErrorResponses, + ))] +async fn post_pipelines_bna( + Json(bna_pipeline): Json, +) -> Result<(StatusCode, Json), ExecutionError> { + post_pipelines_bna_adaptor(bna_pipeline) + .await + .map_err(|e| { + debug!("{e}"); + e + }) + .map(BnaPipeline::from) + .map(|v| (StatusCode::CREATED, Json(v))) +} + +#[utoipa::path( + patch, + path = "/pipelines/bna/{pipeline_id}", + description = "Update the details of a specific BNA pipeline", + tag = TAG, + request_body = BnaPipelinePatch, + params( + ("pipeline_id" = Uuid, Path, description = "Pipeline identifier") + ), + responses( + (status = OK, description = "Updates the details of a BNA pipeline", body = BnaPipeline), + ErrorResponses, + ))] +async fn patch_pipelines_bna( + Path(analysis_id): Path, + Json(bna_pipeline): Json, +) -> Result, ExecutionError> { + patch_pipelines_bna_adaptor(bna_pipeline, analysis_id) + .await + .map_err(|e| { + debug!("{e}"); + e + }) + .map(BnaPipeline::from) + .map(Json) +} diff --git a/lambdas/src/core/resource/pipelines/mod.rs b/lambdas/src/core/resource/pipelines/mod.rs new file mode 100644 index 0000000..5c891fd --- /dev/null +++ b/lambdas/src/core/resource/pipelines/mod.rs @@ -0,0 +1,5 @@ +//! Module for the /pipeline enpoint. +pub mod adaptor; +mod db; +pub mod endpoint; +mod schema; diff --git a/lambdas/src/core/resource/pipelines/schema.rs b/lambdas/src/core/resource/pipelines/schema.rs new file mode 100644 index 0000000..ebd3a88 --- /dev/null +++ b/lambdas/src/core/resource/pipelines/schema.rs @@ -0,0 +1,161 @@ +//! Describes the Pipeline schemas. +use std::{fmt::Display, str::FromStr}; + +use chrono::DateTime; +use sea_orm::prelude::Decimal; +use serde::{Deserialize, Serialize}; +use utoipa::ToSchema; +use uuid::Uuid; + +#[derive(ToSchema, Serialize, Deserialize)] +pub(crate) enum PipelineStatus { + Completed, + Pending, + Processing, +} + +impl FromStr for PipelineStatus { + type Err = serde_plain::Error; + + fn from_str(s: &str) -> Result { + serde_plain::from_str::(s) + } +} + +impl Display for PipelineStatus { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let value = serde_plain::to_string(&self).expect("cannot serialize value"); + write!(f, "{}", value) + } +} + +#[derive(ToSchema, Serialize, Deserialize)] +pub(crate) struct BnaPipeline { + /// Cost of an analysis in USD + #[schema(examples("6.8941"))] + cost: Option, + /// End time + end_time: Option>, + /// Fargate price identifier used to compute the cost + fargate_price_id: Option, + /// ARN of the Fargate task that performed the analysis + #[schema(examples( + "arn:aws:ecs:us-west-2:123456789012:task/bna/29f979fc9fca402d94b014aa23d2f6e0" + ))] + fargate_task_arn: Option, + /// Path of the S3 bucket where the results were stored + #[schema(examples("united states/new mexico/santa rosa/24.05.4"))] + s3_bucket: Option, + /// Copy of the JSON message that was sent for processing + #[schema(examples(json!({"country":"United States","city":"santa rosa","region":"new mexico","fips_code":"3570670"})))] + sqs_message: Option, + /// Start time + start_time: DateTime, + /// Pipeline identifier + /// This is the ID of the AWS state machine that was used to run the pipeline + state_machine_id: Uuid, + /// Pipeline status + status: PipelineStatus, + /// Last pipeline step that was completed + step: BnaPipelineStep, +} + +impl From for BnaPipeline { + fn from(value: entity::bna_pipeline::Model) -> Self { + Self { + cost: value.cost, + end_time: value.end_time, + fargate_price_id: value.fargate_price_id, + fargate_task_arn: value.fargate_task_arn, + s3_bucket: value.s3_bucket, + sqs_message: value + .sqs_message + .and_then(|v| serde_json::to_string(&v).ok()), + start_time: value.start_time, + state_machine_id: value.state_machine_id, + status: PipelineStatus::from_str(&value.status).expect("a valid status"), + step: BnaPipelineStep::from_str(&value.step).expect("a valid step"), + } + } +} + +#[allow(dead_code)] +#[derive(ToSchema)] +pub(crate) struct BnaPipelinePost { + /// Cost of an analysis in USD + #[schema(examples("6.8941"))] + cost: Option, + /// End time + end_time: Option>, + /// Fargate price identifier used to compute the cost + fargate_price_id: Option, + /// ARN of the Fargate task that performed the analysis + #[schema(examples( + "arn:aws:ecs:us-west-2:123456789012:task/bna/29f979fc9fca402d94b014aa23d2f6e0" + ))] + fargate_task_arn: Option, + /// Path of the S3 bucket where the results were stored + #[schema(examples("united states/new mexico/santa rosa/24.05.4"))] + s3_bucket: Option, + /// Copy of the JSON message that was sent for processing + #[schema(examples(json!({"country":"United States","city":"santa rosa","region":"new mexico","fips_code":"3570670"})))] + sqs_message: Option, + /// Last pipeline step that was completed + step: BnaPipelineStep, +} + +#[allow(dead_code)] +#[derive(ToSchema)] +pub(crate) struct BnaPipelinePatch { + /// Cost of an analysis in USD + #[schema(examples("6.8941"))] + cost: Option, + /// End time + end_time: Option>, + /// Fargate price identifier used to compute the cost + fargate_price_id: Option, + /// ARN of the Fargate task that performed the analysis + #[schema(examples( + "arn:aws:ecs:us-west-2:123456789012:task/bna/29f979fc9fca402d94b014aa23d2f6e0" + ))] + fargate_task_arn: Option, + /// Path of the S3 bucket where the results were stored + #[schema(examples("united states/new mexico/santa rosa/24.05.4"))] + s3_bucket: Option, + /// Copy of the JSON message that was sent for processing + #[schema(examples(json!({"country":"United States","city":"santa rosa","region":"new mexico","fips_code":"3570670"})))] + sqs_message: Option, + /// Start time + start_time: DateTime, + /// Pipeline status + status: PipelineStatus, + /// Last pipeline step that was completed + step: BnaPipelineStep, +} + +#[derive(ToSchema, Serialize, Deserialize)] +pub(crate) enum BnaPipelineStep { + SqsMessage, + Setup, + Analysis, + Cleanup, +} + +impl FromStr for BnaPipelineStep { + type Err = serde_plain::Error; + + fn from_str(s: &str) -> Result { + serde_plain::from_str::(s) + } +} + +impl Display for BnaPipelineStep { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let value = serde_plain::to_string(&self).expect("cannot serialize value"); + write!(f, "{}", value) + } +} + +#[allow(dead_code)] +#[derive(ToSchema)] +pub(crate) struct BnaPipelines(Vec); diff --git a/lambdas/src/core/resource/price/adaptor.rs b/lambdas/src/core/resource/price/adaptor.rs index f76c222..f41589b 100644 --- a/lambdas/src/core/resource/price/adaptor.rs +++ b/lambdas/src/core/resource/price/adaptor.rs @@ -3,6 +3,7 @@ use crate::{ core::resource::price::db::{fetch_fargate_price, fetch_fargate_prices}, database_connect, Context, ExecutionError, PageFlow, Paginatron, }; +use entity::fargate_price; use serde_json::{json, Value}; pub async fn get_price_fargate_adaptor(id: i32, ctx: Context) -> Result { @@ -21,11 +22,30 @@ pub async fn get_price_fargate_adaptor(id: i32, ctx: Context) -> Result Result { + // Set the database connection. + let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; + + // Fetch the city model. + let model = fetch_fargate_price(&db, id).await?; + match model { + Some(model) => Ok(model), + None => Err(ExecutionError::NotFound( + ctx.request_id(), + ctx.source(), + format!("cannot find a fargate price with ID {id}"), + )), + } +} + pub async fn get_prices_fargate_adaptor( params: PriceParameters, page: u64, page_size: u64, -) -> Result { +) -> Result>, ExecutionError> { // Set the database connection. let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; @@ -42,6 +62,27 @@ pub async fn get_prices_fargate_adaptor( // Return the paginated response. Ok(PageFlow::new( Paginatron::new(None, total_items, page, page_size), - json!(models), + models, )) } + +pub async fn get_prices_fargate_adaptor_model_( + params: PriceParameters, + page: u64, + page_size: u64, +) -> Result<(u64, Vec), ExecutionError> { + // Set the database connection. + let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; + + // Fetch a page of cities. + let (total_items, models) = fetch_fargate_prices( + &db, + params.sort.unwrap_or_default(), + params.latest, + page, + page_size, + ) + .await?; + + Ok((total_items, models)) +} diff --git a/lambdas/src/core/resource/price/endpoint.rs b/lambdas/src/core/resource/price/endpoint.rs index beebc8d..c861755 100644 --- a/lambdas/src/core/resource/price/endpoint.rs +++ b/lambdas/src/core/resource/price/endpoint.rs @@ -1,36 +1,79 @@ +use super::{ + adaptor::{get_price_fargate_adaptor_model_, get_prices_fargate_adaptor_model_}, + PriceParameters, +}; +use crate::{ + core::resource::{ + price::schema::{FargatePrice, FargatePrices}, + schema::{ErrorResponses, PaginationParams}, + }, + PageFlow, Paginatron, +}; +use crate::{Context, ExecutionError}; use axum::{ extract::{Path, Query}, - response::IntoResponse, - routing::get, - Json, Router, + Json, }; use effortless::api::PaginationParameters; -use serde_json::Value; +use utoipa_axum::{router::OpenApiRouter, routes}; -use crate::{Context, ExecutionError}; +const TAG: &str = "price"; -use super::{ - adaptor::{get_price_fargate_adaptor, get_prices_fargate_adaptor}, - PriceParameters, -}; - -pub fn routes() -> Router { - Router::new() - .route("/prices/fargate", get(get_prices_fargate)) - .route("/prices/fargate/:price_id", get(get_price_fargate)) +pub fn routes() -> OpenApiRouter { + OpenApiRouter::new() + .routes(routes!(get_prices_fargate)) + .routes(routes!(get_price_fargate)) } -pub async fn get_prices_fargate( +#[utoipa::path( + get, + path = "/prices/fargate", + description = "Get all the AWS Fargate prices used to compute analysis costs.", + tag = TAG, + params( + PaginationParams + ), + responses( + (status = OK, description = "Fetches a collection of Fargate prices", body = FargatePrices), + ))] +pub(crate) async fn get_prices_fargate( pagination: Option>, price_parameters: PriceParameters, -) -> impl IntoResponse { +) -> Result, ExecutionError> { let Query(pagination) = pagination.unwrap_or_default(); - get_prices_fargate_adaptor(price_parameters, pagination.page, pagination.page_size()).await + let (total_items, models) = get_prices_fargate_adaptor_model_( + price_parameters, + pagination.page, + pagination.page_size(), + ) + .await?; + let payload: FargatePrices = models.into(); + Ok(PageFlow::new( + Paginatron::new(None, total_items, pagination.page, pagination.page_size()), + payload, + )) } -pub async fn get_price_fargate( +#[utoipa::path( + get, + path = "/prices/fargate/{price_id}", + description = "Get a specific AWS Fargate price used to compute the cost of analysis cost.", + tag = TAG, + params( + ("price_id" = i32, Path, description = "Identifier of a Fargate price")), + responses( + (status = OK, description = "Fetches a Fargate price used to estimate the cost of an analysis", body = FargatePrice), + ErrorResponses, + ))] +pub(crate) async fn get_price_fargate( Path(price_id): Path, ctx: Context, -) -> Result, ExecutionError> { - get_price_fargate_adaptor(price_id, ctx).await.map(Json) +) -> Result, ExecutionError> { + get_price_fargate_adaptor_model_(price_id, ctx) + .await + .map(FargatePrice::from) + .map(Json) } + +// (status = BAD_REQUEST, description = "The request was formatted incorrectly or missing required parameters.", body = UserResponses::BadRequest), +// (status = NOT_FOUND, description = "The particular resource you are requesting was not found. This occurs, for example, if you request a resource by an id that does not exist.", body = APIErrorNotFound ), diff --git a/lambdas/src/core/resource/price/mod.rs b/lambdas/src/core/resource/price/mod.rs index cb0d94b..8737a1f 100644 --- a/lambdas/src/core/resource/price/mod.rs +++ b/lambdas/src/core/resource/price/mod.rs @@ -9,6 +9,7 @@ use query_map::QueryMap; pub mod adaptor; mod db; pub mod endpoint; +mod schema; pub struct PriceParameters { sort: Option, diff --git a/lambdas/src/core/resource/price/schema.rs b/lambdas/src/core/resource/price/schema.rs new file mode 100644 index 0000000..0b18e7c --- /dev/null +++ b/lambdas/src/core/resource/price/schema.rs @@ -0,0 +1,42 @@ +//! Describes the Price schemas. +use chrono::DateTime; +use sea_orm::prelude::Decimal; +use serde::Serialize; +use utoipa::ToSchema; + +#[derive(ToSchema, Serialize)] +#[schema(description = "A Fargate price used to estimate the cost of an analysis")] +pub(crate) struct FargatePrice { + /// Identifier of the Fargate Price rate used to compute the cost of the pipeline run + #[schema(examples("1"))] + id: i32, + /// Cost to run Fargate for 1 second + #[schema(examples("0.0023"))] + per_second: Decimal, + /// Creation date + created_at: DateTime, +} + +impl From for FargatePrice { + fn from(value: entity::fargate_price::Model) -> Self { + Self { + id: value.id, + per_second: value.per_second, + created_at: value.created_at, + } + } +} + +#[derive(ToSchema, Serialize)] +#[schema(description = "A collection of Fargate prices.")] +pub(crate) struct FargatePrices(Vec); + +impl From> for FargatePrices { + fn from(value: Vec) -> Self { + let prices = value + .into_iter() + .map(FargatePrice::from) + .collect::>(); + Self(prices) + } +} diff --git a/lambdas/src/core/resource/ratings/adaptor.rs b/lambdas/src/core/resource/ratings/adaptor.rs index a92b5df..b5d89ee 100644 --- a/lambdas/src/core/resource/ratings/adaptor.rs +++ b/lambdas/src/core/resource/ratings/adaptor.rs @@ -1,72 +1,35 @@ -use super::{ - db::{ - fetch_ratings_analyses, fetch_ratings_analysis, fetch_ratings_city, - fetch_ratings_summaries, fetch_ratings_summary_with_parts, - }, - BNAComponent, -}; -use crate::{database_connect, Context, ExecutionError, PageFlow, Paginatron}; +use super::db::{fetch_rating, fetch_ratings, fetch_ratings_city, fetch_ratings_summaries, Bna}; +use crate::{database_connect, Context, ExecutionError}; use entity::{ core_services, infrastructure, opportunity, people, recreation, retail, summary, transit, - wrappers::{ - bna::{BNAPost, RatingFlat}, - bna_pipeline::{BNAPipelinePatch, BNAPipelinePost}, - }, + wrappers::bna::BNAPost, }; -use sea_orm::{ActiveModelTrait, ActiveValue, DbErr, IntoActiveModel}; -use serde_json::{json, Value}; +use sea_orm::{ActiveModelTrait, ActiveValue}; use tracing::info; use uuid::Uuid; pub async fn get_ratings_summaries_adaptor( page: u64, page_size: u64, -) -> Result { +) -> Result<(u64, Vec), ExecutionError> { // Set the database connection. let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; // Fetch a page of summary. - let (total_items, models) = fetch_ratings_summaries(&db, page, page_size).await?; - - // Return the paginated response. - Ok(PageFlow::new( - Paginatron::new(None, total_items, page, page_size), - json!(models), - )) + Ok(fetch_ratings_summaries(&db, page, page_size).await?) } -pub async fn get_rating_adaptor( +pub(crate) async fn get_rating_adaptor( rating_id: Uuid, - component: Option, ctx: Context, -) -> Result { +) -> Result { // Set the database connection. let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; // Fetch the model. - let model = fetch_ratings_summary_with_parts(&db, rating_id, component).await?; + let model: Option = fetch_rating(&db, rating_id).await?; match model { - Some(model) => match model { - super::db::BNAComponentValue::All(bna) => Ok(json!(bna)), - super::db::BNAComponentValue::Summary(summary) => Ok(json!(summary)), - super::db::BNAComponentValue::Infrastructure(summary, infrastructure) => { - Ok(json!((summary, infrastructure))) - } - super::db::BNAComponentValue::Recreation(summary, recreation) => { - Ok(json!((summary, recreation))) - } - super::db::BNAComponentValue::Opportunity(summary, opportunity) => { - Ok(json!((summary, opportunity))) - } - super::db::BNAComponentValue::CoreServices(summary, core_services) => { - Ok(json!((summary, core_services))) - } - super::db::BNAComponentValue::People(summary, people) => Ok(json!((summary, people))), - super::db::BNAComponentValue::Retail(summary, retail) => Ok(json!((summary, retail))), - super::db::BNAComponentValue::Transit(summary, transit) => { - Ok(json!((summary, transit))) - } - }, + Some(model) => Ok(model), None => Err(ExecutionError::NotFound( ctx.request_id(), ctx.source(), @@ -75,66 +38,27 @@ pub async fn get_rating_adaptor( } } -pub async fn get_ratings_adaptor(page: u64, page_size: u64) -> Result { - // Set the database connection. - let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; - - // Fetch a page of summary. - let (total_items, models) = fetch_ratings_summaries(&db, page, page_size).await?; - - // Return the paginated response. - Ok(PageFlow::new( - Paginatron::new(None, total_items, page, page_size), - json!(models), - )) -} - -pub async fn get_ratings_analyses_adaptor( +pub(crate) async fn get_ratings_adaptor( page: u64, page_size: u64, -) -> Result { +) -> Result<(u64, Vec), ExecutionError> { // Set the database connection. let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; // Fetch a page of summary. - let (total_items, models) = fetch_ratings_analyses(&db, page, page_size).await?; - - // Return the paginated response. - Ok(PageFlow::new( - Paginatron::new(None, total_items, page, page_size), - json!(models), - )) -} - -pub async fn get_ratings_analysis_adaptor( - analysis_id: Uuid, - ctx: Context, -) -> Result { - // Set the database connection. - let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; - - // Fetch the model. - let model = fetch_ratings_analysis(&db, analysis_id).await?; - match model { - Some(model) => Ok(json!(model)), - None => Err(ExecutionError::NotFound( - ctx.request_id(), - ctx.source(), - format!("cannot find a rating with the ID {analysis_id}"), - )), - } + Ok(fetch_ratings(&db, page, page_size).await?) } -pub async fn get_ratings_city_adaptor( +pub(crate) async fn get_ratings_city_adaptor( rating_id: Uuid, ctx: Context, -) -> Result { +) -> Result<(Bna, entity::city::Model), ExecutionError> { let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; // Fetch the model. let model = fetch_ratings_city(&db, rating_id).await?; match model { - Some(model) => Ok(json!(model)), + Some((bna, city)) => Ok((bna, city)), None => Err(ExecutionError::NotFound( ctx.request_id(), ctx.source(), @@ -143,63 +67,13 @@ pub async fn get_ratings_city_adaptor( } } -pub async fn post_ratings_analysis_adaptor( - bna_pipeline: BNAPipelinePost, -) -> Result { - // Set the database connection. - let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; - - // Turn the post model into an active model. - let active_model = bna_pipeline.into_active_model(); - - // And insert a new entry. - info!( - "inserting Brokenspoke pipeline into database: {:?}", - active_model - ); - let model = active_model.insert(&db).await?; - Ok(json!(model)) -} - -pub async fn patch_ratings_analysis_adaptor( - bna_pipeline: BNAPipelinePatch, - analysis_id: Uuid, - ctx: Context, -) -> Result { - // Set the database connection. - let db = database_connect(Some("DATABASE_URL_SECRET_ID")).await?; - - // Turn the patch model into an active model. - let mut active_model = bna_pipeline.into_active_model(); - active_model.state_machine_id = ActiveValue::Unchanged(analysis_id); - - // Update the entry. - info!("Tartiflette!"); - let model = match active_model.update(&db).await { - Ok(m) => m, - Err(db_err) => { - dbg!(&db_err); - match db_err { - DbErr::RecordNotUpdated => { - match get_ratings_analysis_adaptor(analysis_id, ctx).await { - Ok(_) => return Err(ExecutionError::DatabaseError(db_err)), - Err(exec_err) => return Err(exec_err), - } - } - _ => return Err(ExecutionError::DatabaseError(db_err)), - } - } - }; - Ok(json!(model)) -} - -pub async fn post_ratings_adaptor(bna: BNAPost) -> Result { +pub(crate) async fn post_ratings_adaptor(bna: BNAPost) -> Result { // Turn the model wrapper into active models. let summary = summary::ActiveModel { - id: ActiveValue::Set(bna.summary.rating_id), + id: ActiveValue::NotSet, city_id: ActiveValue::Set(bna.summary.city_id), created_at: ActiveValue::NotSet, - score: ActiveValue::Set(bna.summary.score), + score: ActiveValue::NotSet, version: ActiveValue::Set(bna.summary.version), }; info!("{:?}", summary); @@ -268,16 +142,33 @@ pub async fn post_ratings_adaptor(bna: BNAPost) -> Result let recreation_model = recreation.insert(&db).await?; let retail_model = retail.insert(&db).await?; let transit_model = transit.insert(&db).await?; - let rating = RatingFlat { - core_services: core_services_model, - infrastructure: infrastructure_model, - opportunity: opportunity_model, - people: people_model, - recreation: recreation_model, - retail: retail_model, - summary: summary_model, - transit: transit_model, + let bna = Bna { + id: summary_model.id, + city_id: summary_model.city_id, + score: summary_model.score, + version: summary_model.version, + low_stress_miles: infrastructure_model.low_stress_miles, + high_stress_miles: infrastructure_model.high_stress_miles, + community_centers: recreation_model.community_centers, + parks: recreation_model.parks, + recreation_trails: recreation_model.recreation_trails, + recreation_score: recreation_model.score, + employment: opportunity_model.employment, + higher_education: opportunity_model.higher_education, + k12_education: opportunity_model.k12_education, + opportunity_score: opportunity_model.score, + technical_vocational_college: opportunity_model.technical_vocational_college, + dentists: core_services_model.dentists, + doctors: core_services_model.doctors, + grocery: core_services_model.grocery, + hospitals: core_services_model.hospitals, + pharmacies: core_services_model.pharmacies, + coreservices_score: core_services_model.score, + social_services: core_services_model.social_services, + people: people_model.score, + retail: retail_model.score, + transit: transit_model.score, }; - info!("{:?}", rating); - Ok(json!(rating)) + info!("{:?}", bna); + Ok(bna) } diff --git a/lambdas/src/core/resource/ratings/db.rs b/lambdas/src/core/resource/ratings/db.rs index d026640..481bbe7 100644 --- a/lambdas/src/core/resource/ratings/db.rs +++ b/lambdas/src/core/resource/ratings/db.rs @@ -1,7 +1,4 @@ -use entity::{ - bna_pipeline, city, core_services, infrastructure, opportunity, people, recreation, retail, - summary, transit, -}; +use entity::{city, summary}; use sea_orm::{ DatabaseConnection, EntityTrait, FromQueryResult, JoinType, PaginatorTrait, QuerySelect, RelationTrait, @@ -9,50 +6,48 @@ use sea_orm::{ use serde::{Deserialize, Serialize}; use uuid::Uuid; -use super::BNAComponent; - #[derive(Debug, FromQueryResult, Clone, PartialEq, Serialize, Deserialize)] -pub struct Bna { +pub(crate) struct Bna { // BNA Summary - id: Uuid, - city_id: Uuid, - score: f64, - version: String, + pub(crate) id: Uuid, + pub(crate) city_id: Uuid, + pub(crate) score: f64, + pub(crate) version: String, // BNAInfrastructure - low_stress_miles: Option, - high_stress_miles: Option, + pub(crate) low_stress_miles: Option, + pub(crate) high_stress_miles: Option, // BNA Recreation - community_centers: Option, - parks: Option, - recreation_trails: Option, - recreation_score: Option, + pub(crate) community_centers: Option, + pub(crate) parks: Option, + pub(crate) recreation_trails: Option, + pub(crate) recreation_score: Option, // BNA Opportunity - employment: Option, - higher_education: Option, - k12_education: Option, - opportunity_score: Option, - technical_vocational_college: Option, + pub(crate) employment: Option, + pub(crate) higher_education: Option, + pub(crate) k12_education: Option, + pub(crate) opportunity_score: Option, + pub(crate) technical_vocational_college: Option, // BNA Core Services - dentists: Option, - doctors: Option, - grocery: Option, - hospitals: Option, - pharmacies: Option, - coreservices_score: Option, - social_services: Option, + pub(crate) dentists: Option, + pub(crate) doctors: Option, + pub(crate) grocery: Option, + pub(crate) hospitals: Option, + pub(crate) pharmacies: Option, + pub(crate) coreservices_score: Option, + pub(crate) social_services: Option, // BNA People - people: Option, + pub(crate) people: Option, // BNA Retail - retail: Option, + pub(crate) retail: Option, // BNA Transit - transit: Option, + pub(crate) transit: Option, } #[derive(Debug, FromQueryResult, Deserialize, Serialize)] @@ -112,18 +107,18 @@ pub struct Transit { transit: Option, } -#[derive(Debug)] -pub enum BNAComponentValue { - All(Bna), - Summary(Summary), - Infrastructure(Summary, Option), - Recreation(Summary, Option), - Opportunity(Summary, Option), - CoreServices(Summary, Option), - People(Summary, Option), - Retail(Summary, Option), - Transit(Summary, Option), -} +// #[derive(Debug)] +// pub enum BNAComponentValue { +// All(Bna), +// Summary(Summary), +// Infrastructure(Summary, Option), +// Recreation(Summary, Option), +// Opportunity(Summary, Option), +// CoreServices(Summary, Option), +// People(Summary, Option), +// Retail(Summary, Option), +// Transit(Summary, Option), +// } pub async fn fetch_ratings_summaries( db: &DatabaseConnection, @@ -140,165 +135,330 @@ pub async fn fetch_ratings_summaries( Ok((count, models)) } -pub async fn fetch_ratings_summary_with_parts( +// pub async fn fetch_ratings_summary_with_parts( +// db: &DatabaseConnection, +// rating_id: Uuid, +// component: Option, +// ) -> Result, sea_orm::DbErr> { +// let select = summary::Entity::find_by_id(rating_id); +// let component = component.unwrap_or(BNAComponent::All); +// dbg!(&component); +// let res = match component { +// BNAComponent::All => select +// .clone() +// .columns([ +// entity::core_services::Column::Dentists, +// entity::core_services::Column::Doctors, +// entity::core_services::Column::Grocery, +// entity::core_services::Column::Hospitals, +// entity::core_services::Column::Pharmacies, +// entity::core_services::Column::SocialServices, +// ]) +// .column_as(entity::core_services::Column::Score, "coreservices_score") +// .columns([ +// entity::infrastructure::Column::HighStressMiles, +// entity::infrastructure::Column::LowStressMiles, +// ]) +// .columns([ +// entity::recreation::Column::CommunityCenters, +// entity::recreation::Column::Parks, +// entity::recreation::Column::RecreationTrails, +// ]) +// .column_as(entity::recreation::Column::Score, "recreation_score") +// .columns([ +// entity::opportunity::Column::Employment, +// entity::opportunity::Column::HigherEducation, +// entity::opportunity::Column::K12Education, +// entity::opportunity::Column::TechnicalVocationalCollege, +// ]) +// .column_as(entity::opportunity::Column::Score, "opportunity_score") +// .column_as(entity::people::Column::Score, "people_score") +// .column_as(entity::retail::Column::Score, "retail_score") +// .column_as(entity::transit::Column::Score, "transit_score") +// .join( +// JoinType::InnerJoin, +// entity::summary::Relation::CoreServices.def(), +// ) +// .join( +// JoinType::InnerJoin, +// entity::summary::Relation::Infrastructure.def(), +// ) +// .join( +// JoinType::InnerJoin, +// entity::summary::Relation::Recreation.def(), +// ) +// .join( +// JoinType::InnerJoin, +// entity::summary::Relation::Opportunity.def(), +// ) +// .join( +// sea_orm::JoinType::InnerJoin, +// entity::summary::Relation::People.def(), +// ) +// .join( +// sea_orm::JoinType::InnerJoin, +// entity::summary::Relation::Retail.def(), +// ) +// .join( +// sea_orm::JoinType::InnerJoin, +// entity::summary::Relation::Transit.def(), +// ) +// .into_model::() +// .one(db) +// .await? +// .map(BNAComponentValue::All), +// BNAComponent::Summary => select +// .clone() +// .into_model::() +// .one(db) +// .await? +// .map(BNAComponentValue::Summary), +// BNAComponent::Infratructure => select +// .clone() +// .find_also_related(infrastructure::Entity) +// .into_model::() +// .one(db) +// .await? +// .map(|m| BNAComponentValue::Infrastructure(m.0, m.1)), +// BNAComponent::Recreation => select +// .clone() +// .find_also_related(recreation::Entity) +// .into_model::() +// .one(db) +// .await? +// .map(|m| BNAComponentValue::Recreation(m.0, m.1)), +// BNAComponent::Opportunity => select +// .clone() +// .find_also_related(opportunity::Entity) +// .into_model::() +// .one(db) +// .await? +// .map(|m| BNAComponentValue::Opportunity(m.0, m.1)), +// BNAComponent::CoreServices => select +// .clone() +// .find_also_related(core_services::Entity) +// .into_model::() +// .one(db) +// .await? +// .map(|m| BNAComponentValue::CoreServices(m.0, m.1)), +// BNAComponent::People => select +// .clone() +// .find_also_related(people::Entity) +// .into_model::() +// .one(db) +// .await? +// .map(|m| BNAComponentValue::People(m.0, m.1)), +// BNAComponent::Retail => select +// .clone() +// .find_also_related(retail::Entity) +// .into_model::() +// .one(db) +// .await? +// .map(|m| BNAComponentValue::Retail(m.0, m.1)), +// BNAComponent::Transit => select +// .clone() +// .find_also_related(transit::Entity) +// .into_model::() +// .one(db) +// .await? +// .map(|m| BNAComponentValue::Transit(m.0, m.1)), +// }; +// Ok(res) +// } + +// pub async fn fetch_ratings_analyses( +// db: &DatabaseConnection, +// page: u64, +// page_size: u64, +// ) -> Result<(u64, Vec), sea_orm::DbErr> { +// let select = bna_pipeline::Entity::find(); +// let models = select +// .clone() +// .paginate(db, page_size) +// .fetch_page(page) +// .await?; +// let count = select.count(db).await?; +// Ok((count, models)) +// } + +// pub async fn fetch_ratings_analysis( +// db: &DatabaseConnection, +// analysis_id: Uuid, +// ) -> Result, sea_orm::DbErr> { +// bna_pipeline::Entity::find_by_id(analysis_id).one(db).await +// } + +pub async fn fetch_ratings_city( + db: &DatabaseConnection, + rating_id: Uuid, +) -> Result, sea_orm::DbErr> { + match summary::Entity::find_by_id(rating_id) + .find_also_related(city::Entity) + .one(db) + .await? + { + Some((_, city)) => { + let bna = fetch_rating(db, rating_id).await?; + Ok(Some(( + bna.expect("we already found this bna so it must exist"), + city.expect("a city must be attached to a rating"), + ))) + } + None => Ok(None), + } + // let bna = fetch_rating(db, rating_id).await?; + // match bna { + // Some(bna) => { + // let a = summary::Entity::find_by_id(rating_id) + // .find_also_related(city::Entity) + // .one(db) + // .await?; + // Ok((bna, city: city.expect("a city must be attached to a rating"))) + // } + // None => Err(ExecutionError::NotFound( + // ctx.request_id(), + // ctx.source(), + // format!("cannot find a rating with id {rating_id}"), + // )), +} + +pub async fn fetch_rating( db: &DatabaseConnection, rating_id: Uuid, - component: Option, -) -> Result, sea_orm::DbErr> { - let select = summary::Entity::find_by_id(rating_id); - let component = component.unwrap_or(BNAComponent::All); - dbg!(&component); - let res = match component { - BNAComponent::All => select - .clone() - .columns([ - entity::core_services::Column::Dentists, - entity::core_services::Column::Doctors, - entity::core_services::Column::Grocery, - entity::core_services::Column::Hospitals, - entity::core_services::Column::Pharmacies, - entity::core_services::Column::SocialServices, - ]) - .column_as(entity::core_services::Column::Score, "coreservices_score") - .columns([ - entity::infrastructure::Column::HighStressMiles, - entity::infrastructure::Column::LowStressMiles, - ]) - .columns([ - entity::recreation::Column::CommunityCenters, - entity::recreation::Column::Parks, - entity::recreation::Column::RecreationTrails, - ]) - .column_as(entity::recreation::Column::Score, "recreation_score") - .columns([ - entity::opportunity::Column::Employment, - entity::opportunity::Column::HigherEducation, - entity::opportunity::Column::K12Education, - entity::opportunity::Column::TechnicalVocationalCollege, - ]) - .column_as(entity::opportunity::Column::Score, "opportunity_score") - .column_as(entity::people::Column::Score, "people_score") - .column_as(entity::retail::Column::Score, "retail_score") - .column_as(entity::transit::Column::Score, "transit_score") - .join( - JoinType::InnerJoin, - entity::summary::Relation::CoreServices.def(), - ) - .join( - JoinType::InnerJoin, - entity::summary::Relation::Infrastructure.def(), - ) - .join( - JoinType::InnerJoin, - entity::summary::Relation::Recreation.def(), - ) - .join( - JoinType::InnerJoin, - entity::summary::Relation::Opportunity.def(), - ) - .join( - sea_orm::JoinType::InnerJoin, - entity::summary::Relation::People.def(), - ) - .join( - sea_orm::JoinType::InnerJoin, - entity::summary::Relation::Retail.def(), - ) - .join( - sea_orm::JoinType::InnerJoin, - entity::summary::Relation::Transit.def(), - ) - .into_model::() - .one(db) - .await? - .map(BNAComponentValue::All), - BNAComponent::Summary => select - .clone() - .into_model::() - .one(db) - .await? - .map(BNAComponentValue::Summary), - BNAComponent::Infratructure => select - .clone() - .find_also_related(infrastructure::Entity) - .into_model::() - .one(db) - .await? - .map(|m| BNAComponentValue::Infrastructure(m.0, m.1)), - BNAComponent::Recreation => select - .clone() - .find_also_related(recreation::Entity) - .into_model::() - .one(db) - .await? - .map(|m| BNAComponentValue::Recreation(m.0, m.1)), - BNAComponent::Opportunity => select - .clone() - .find_also_related(opportunity::Entity) - .into_model::() - .one(db) - .await? - .map(|m| BNAComponentValue::Opportunity(m.0, m.1)), - BNAComponent::CoreServices => select - .clone() - .find_also_related(core_services::Entity) - .into_model::() - .one(db) - .await? - .map(|m| BNAComponentValue::CoreServices(m.0, m.1)), - BNAComponent::People => select - .clone() - .find_also_related(people::Entity) - .into_model::() - .one(db) - .await? - .map(|m| BNAComponentValue::People(m.0, m.1)), - BNAComponent::Retail => select - .clone() - .find_also_related(retail::Entity) - .into_model::() - .one(db) - .await? - .map(|m| BNAComponentValue::Retail(m.0, m.1)), - BNAComponent::Transit => select - .clone() - .find_also_related(transit::Entity) - .into_model::() - .one(db) - .await? - .map(|m| BNAComponentValue::Transit(m.0, m.1)), - }; +) -> Result, sea_orm::DbErr> { + let res = summary::Entity::find_by_id(rating_id) + .columns([ + entity::core_services::Column::Dentists, + entity::core_services::Column::Doctors, + entity::core_services::Column::Grocery, + entity::core_services::Column::Hospitals, + entity::core_services::Column::Pharmacies, + entity::core_services::Column::SocialServices, + ]) + .column_as(entity::core_services::Column::Score, "coreservices_score") + .columns([ + entity::infrastructure::Column::HighStressMiles, + entity::infrastructure::Column::LowStressMiles, + ]) + .columns([ + entity::recreation::Column::CommunityCenters, + entity::recreation::Column::Parks, + entity::recreation::Column::RecreationTrails, + ]) + .column_as(entity::recreation::Column::Score, "recreation_score") + .columns([ + entity::opportunity::Column::Employment, + entity::opportunity::Column::HigherEducation, + entity::opportunity::Column::K12Education, + entity::opportunity::Column::TechnicalVocationalCollege, + ]) + .column_as(entity::opportunity::Column::Score, "opportunity_score") + .column_as(entity::people::Column::Score, "people_score") + .column_as(entity::retail::Column::Score, "retail_score") + .column_as(entity::transit::Column::Score, "transit_score") + .join( + JoinType::InnerJoin, + entity::summary::Relation::CoreServices.def(), + ) + .join( + JoinType::InnerJoin, + entity::summary::Relation::Infrastructure.def(), + ) + .join( + JoinType::InnerJoin, + entity::summary::Relation::Recreation.def(), + ) + .join( + JoinType::InnerJoin, + entity::summary::Relation::Opportunity.def(), + ) + .join( + sea_orm::JoinType::InnerJoin, + entity::summary::Relation::People.def(), + ) + .join( + sea_orm::JoinType::InnerJoin, + entity::summary::Relation::Retail.def(), + ) + .join( + sea_orm::JoinType::InnerJoin, + entity::summary::Relation::Transit.def(), + ) + .into_model::() + .one(db) + .await?; Ok(res) } -pub async fn fetch_ratings_analyses( +pub async fn fetch_ratings( db: &DatabaseConnection, page: u64, page_size: u64, -) -> Result<(u64, Vec), sea_orm::DbErr> { - let select = bna_pipeline::Entity::find(); +) -> Result<(u64, Vec), sea_orm::DbErr> { + let select = summary::Entity::find() + .columns([ + entity::core_services::Column::Dentists, + entity::core_services::Column::Doctors, + entity::core_services::Column::Grocery, + entity::core_services::Column::Hospitals, + entity::core_services::Column::Pharmacies, + entity::core_services::Column::SocialServices, + ]) + .column_as(entity::core_services::Column::Score, "coreservices_score") + .columns([ + entity::infrastructure::Column::HighStressMiles, + entity::infrastructure::Column::LowStressMiles, + ]) + .columns([ + entity::recreation::Column::CommunityCenters, + entity::recreation::Column::Parks, + entity::recreation::Column::RecreationTrails, + ]) + .column_as(entity::recreation::Column::Score, "recreation_score") + .columns([ + entity::opportunity::Column::Employment, + entity::opportunity::Column::HigherEducation, + entity::opportunity::Column::K12Education, + entity::opportunity::Column::TechnicalVocationalCollege, + ]) + .column_as(entity::opportunity::Column::Score, "opportunity_score") + .column_as(entity::people::Column::Score, "people_score") + .column_as(entity::retail::Column::Score, "retail_score") + .column_as(entity::transit::Column::Score, "transit_score") + .join( + JoinType::InnerJoin, + entity::summary::Relation::CoreServices.def(), + ) + .join( + JoinType::InnerJoin, + entity::summary::Relation::Infrastructure.def(), + ) + .join( + JoinType::InnerJoin, + entity::summary::Relation::Recreation.def(), + ) + .join( + JoinType::InnerJoin, + entity::summary::Relation::Opportunity.def(), + ) + .join( + sea_orm::JoinType::InnerJoin, + entity::summary::Relation::People.def(), + ) + .join( + sea_orm::JoinType::InnerJoin, + entity::summary::Relation::Retail.def(), + ) + .join( + sea_orm::JoinType::InnerJoin, + entity::summary::Relation::Transit.def(), + ); let models = select .clone() + .into_model::() .paginate(db, page_size) .fetch_page(page) .await?; let count = select.count(db).await?; Ok((count, models)) } - -pub async fn fetch_ratings_analysis( - db: &DatabaseConnection, - analysis_id: Uuid, -) -> Result, sea_orm::DbErr> { - bna_pipeline::Entity::find_by_id(analysis_id).one(db).await -} - -pub async fn fetch_ratings_city( - db: &DatabaseConnection, - rating_id: Uuid, -) -> Result)>, sea_orm::DbErr> { - summary::Entity::find_by_id(rating_id) - .find_also_related(city::Entity) - .one(db) - .await -} diff --git a/lambdas/src/core/resource/ratings/endpoint.rs b/lambdas/src/core/resource/ratings/endpoint.rs index 61763ec..5aa1f1d 100644 --- a/lambdas/src/core/resource/ratings/endpoint.rs +++ b/lambdas/src/core/resource/ratings/endpoint.rs @@ -1,137 +1,129 @@ use super::{ adaptor::{ - get_rating_adaptor, get_ratings_analyses_adaptor, get_ratings_analysis_adaptor, - get_ratings_city_adaptor, get_ratings_summaries_adaptor, patch_ratings_analysis_adaptor, - post_ratings_adaptor, post_ratings_analysis_adaptor, + get_rating_adaptor, get_ratings_adaptor, get_ratings_city_adaptor, post_ratings_adaptor, }, - BNAComponent, + schema::{Rating, RatingPost, RatingWithCity, Ratings}, +}; +use crate::{ + core::resource::schema::{ErrorResponses, PaginationParams}, + Context, ExecutionError, PageFlow, Paginatron, }; -use crate::{Context, ExecutionError}; use axum::{ - debug_handler, extract::{Path, Query}, http::StatusCode, - response::IntoResponse, - routing::get, - Json, Router, + Json, }; use effortless::api::PaginationParameters; -use entity::wrappers::{ - bna::BNAPost, - bna_pipeline::{BNAPipelinePatch, BNAPipelinePost}, -}; -use serde_json::{json, Value}; +use entity::wrappers::bna::BNAPost; use tracing::debug; +use utoipa_axum::{router::OpenApiRouter, routes}; use uuid::Uuid; -pub fn routes() -> Router { - Router::new() - .route("/ratings", get(get_ratings).post(post_ratings)) - .route("/ratings/:rating_id", get(get_rating)) - .route("/ratings/:rating_id/city", get(get_ratings_city)) - .route( - "/ratings/analyses", - get(get_ratings_analyses).post(post_ratings_analysis), - ) - .route( - "/ratings/analyses/:analysis_id", - get(get_ratings_analysis).patch(patch_ratings_analysis), - ) -} +const TAG: &str = "rating"; -async fn get_ratings(pagination: Option>) -> impl IntoResponse { - let Query(pagination) = pagination.unwrap_or_default(); - get_ratings_summaries_adaptor(pagination.page, pagination.page_size()).await +pub fn routes() -> OpenApiRouter { + OpenApiRouter::new() + .routes(routes!(get_rating)) + .routes(routes!(get_ratings)) + .routes(routes!(post_rating)) + .routes(routes!(get_ratings_city)) } +#[utoipa::path( + get, + path = "/ratings/{rating_id}", + description = "Get the details of a specific city rating", + tag = TAG, + params( + ("rating_id" = Uuid, Path, description = "Rating identifier") + ), + responses( + (status = OK, description = "Fetches the details of a city rating", body = Rating ), + ErrorResponses, + ))] async fn get_rating( Path(rating_id): Path, - component: Option>, ctx: Context, -) -> Result, ExecutionError> { - let component = match component { - Some(c) => { - let Query(c) = c; - Some(c) - } - None => None, - }; - - get_rating_adaptor(rating_id, component, ctx) +) -> Result, ExecutionError> { + get_rating_adaptor(rating_id, ctx) .await .map_err(|e| { debug!("{e}"); e }) - .map(|v| Json(json!(v))) -} - -async fn get_ratings_city( - Path(rating_id): Path, - ctx: Context, -) -> Result, ExecutionError> { - get_ratings_city_adaptor(rating_id, ctx).await.map(Json) + .map(Rating::from) + .map(Json) } -async fn get_ratings_analyses( +#[utoipa::path( + get, + path = "/ratings", + description = "Get city ratings", + tag = TAG, + params( + PaginationParams, + ), + responses( + (status = OK, description = "Fetches the city ratings", body = Ratings), + ))] +async fn get_ratings( pagination: Option>, -) -> Result, ExecutionError> { +) -> Result, ExecutionError> { let Query(pagination) = pagination.unwrap_or_default(); - get_ratings_analyses_adaptor(pagination.page, pagination.page_size()) - .await - .map(|v| Json(json!(v.payload()))) -} + let (total_items, models) = + get_ratings_adaptor(pagination.page, pagination.page_size()).await?; -async fn get_ratings_analysis( - Path(analysis_id): Path, - ctx: Context, -) -> Result, ExecutionError> { - get_ratings_analysis_adaptor(analysis_id, ctx) - .await - .map(Json) + let payload: Ratings = models.into(); + Ok(PageFlow::new( + Paginatron::new(None, total_items, pagination.page, pagination.page_size()), + payload, + )) } -async fn post_ratings_analysis( - Json(bna_pipeline): Json, -) -> Result<(StatusCode, Json), ExecutionError> { - post_ratings_analysis_adaptor(bna_pipeline) +#[utoipa::path( + post, + path = "/ratings", + description = "Create a new city rating", + tag = TAG, + request_body = RatingPost, + responses( + (status = CREATED, description = "Creates a new city rating", body = Rating ), + ErrorResponses, + ))] +async fn post_rating( + Json(bna): Json, +) -> Result<(StatusCode, Json), ExecutionError> { + post_ratings_adaptor(bna) .await .map_err(|e| { debug!("{e}"); e }) + .map(Rating::from) .map(|v| (StatusCode::CREATED, Json(v))) } -#[debug_handler] -async fn patch_ratings_analysis( - Path(analysis_id): Path, - Json(bna_pipeline): Json, -) -> Result, ExecutionError> { - patch_ratings_analysis_adaptor( - bna_pipeline, - analysis_id, - Context { - request_id: None, - source: format!("/ratings/analyses/{analysis_id}"), - }, - ) - .await - .map_err(|e| { - debug!("{e}"); - e - }) - .map(Json) -} - -async fn post_ratings( - Json(bna): Json, -) -> Result<(StatusCode, Json), ExecutionError> { - post_ratings_adaptor(bna) +#[utoipa::path( + get, + path = "/ratings/{rating_id}/city", + description = "Get a city rating and its associated city details", + tag = TAG, + params( + ("rating_id" = Uuid, Path, description = "Rating identifier") + ), + responses( + (status = OK, description = "Fetches a city rating and its associated city details" , body = RatingWithCity ), + ErrorResponses, + ))] +async fn get_ratings_city( + Path(rating_id): Path, + ctx: Context, +) -> Result, ExecutionError> { + get_ratings_city_adaptor(rating_id, ctx) .await - .map_err(|e| { - debug!("{e}"); - e + .map(|(rating, model)| RatingWithCity { + rating: rating.into(), + city: model.into(), }) - .map(|v| (StatusCode::CREATED, Json(v))) + .map(Json) } diff --git a/lambdas/src/core/resource/ratings/mod.rs b/lambdas/src/core/resource/ratings/mod.rs index 5790d4c..fb009f2 100644 --- a/lambdas/src/core/resource/ratings/mod.rs +++ b/lambdas/src/core/resource/ratings/mod.rs @@ -10,6 +10,7 @@ use uuid::Uuid; pub mod adaptor; mod db; pub mod endpoint; +mod schema; #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub enum BNAComponent { diff --git a/lambdas/src/core/resource/ratings/schema.rs b/lambdas/src/core/resource/ratings/schema.rs new file mode 100644 index 0000000..11ddcf5 --- /dev/null +++ b/lambdas/src/core/resource/ratings/schema.rs @@ -0,0 +1,227 @@ +//! Describes the Ratings schemas. +use super::db::Bna; +use crate::core::resource::schema::City; +use serde::Serialize; +use utoipa::ToSchema; +use uuid::Uuid; + +#[derive(ToSchema, Serialize)] +pub(crate) struct Rating { + // BNA Summary + /// Rating identifier + id: Uuid, + /// City identifier + city_id: Uuid, + /// Total rating score + #[schema(minimum = 0, maximum = 100)] + score: f64, + /// Rating version + /// The format follows the [calver](https://calver.org) specification with + /// the YY.0M[.Minor] scheme. + version: String, + + /// BNAInfrastructure + infrastructure: Infrastructure, + + /// BNA Recreation + recreation: Recreation, + + /// BNA Opportunity + opportunity: Opportunity, + + /// BNA Core Services + core_services: CoreServices, + + /// BNA People + people: People, + + /// BNA Retail + retail: Retail, + + /// BNA Transit + transit: Transit, +} + +impl From for Rating { + fn from(value: Bna) -> Self { + Self { + id: value.id, + city_id: value.city_id, + score: value.score, + version: value.version, + infrastructure: Infrastructure { + low_stress_miles: value.low_stress_miles, + high_stress_miles: value.high_stress_miles, + }, + recreation: Recreation { + community_centers: value.community_centers, + parks: value.parks, + trails: value.recreation_trails, + score: Some(value.score), + }, + opportunity: Opportunity { + employment: value.employment, + higher_education: value.higher_education, + k12_education: value.k12_education, + score: Some(value.score), + technical_vocational_college: value.technical_vocational_college, + }, + core_services: CoreServices { + dentists: value.dentists, + doctors: value.doctors, + grocery: value.grocery, + hospitals: value.hospitals, + pharmacies: value.pharmacies, + score: Some(value.score), + social_services: value.social_services, + }, + people: People { + people: value.people, + }, + retail: Retail { + retail: value.retail, + }, + transit: Transit { + transit: value.transit, + }, + } + } +} + +#[derive(ToSchema, Serialize)] +pub(crate) struct Infrastructure { + /// Total miles of low-stress streets and paths in the measured area. + #[schema(examples(127))] + low_stress_miles: Option, + /// Total miles of high-stress streets in the measured area. + #[schema(examples(253))] + high_stress_miles: Option, +} + +#[derive(ToSchema, Serialize)] +pub(crate) struct Recreation { + /// BNA category subscore for access to community centers. + #[schema(minimum = 0, maximum = 100)] + community_centers: Option, + /// BNA category subscore for access to parks. + #[schema(minimum = 0, maximum = 100)] + parks: Option, + /// BNA category subscore for access to bikeable trails. + #[schema(minimum = 0, maximum = 100)] + trails: Option, + /// BNA category score for access to recreational facilities. + #[schema(minimum = 0, maximum = 100)] + score: Option, +} + +#[derive(ToSchema, Serialize)] +pub(crate) struct Opportunity { + /// BNA category subscore for access to job location areas. + #[schema(minimum = 0, maximum = 100)] + employment: Option, + /// BNA category subscore for access to universities and colleges. + #[schema(minimum = 0, maximum = 100)] + higher_education: Option, + /// BNA category subscore for access to k12 schools + #[schema(minimum = 0, maximum = 100)] + k12_education: Option, + /// BNA category score for access to education and jobs. + #[schema(minimum = 0, maximum = 100)] + score: Option, + /// BNA category subscore for access to technical and vocational colleges. + #[schema(minimum = 0, maximum = 100)] + technical_vocational_college: Option, +} + +#[derive(ToSchema, Serialize)] +pub(crate) struct CoreServices { + /// BNA category subscore for access to dentists. + #[schema(minimum = 0, maximum = 100)] + dentists: Option, + /// BNA category subscore for access to doctors. + #[schema(minimum = 0, maximum = 100)] + doctors: Option, + /// BNA category subscore for access to grocery stores. + #[schema(minimum = 0, maximum = 100)] + grocery: Option, + /// BNA category subscore for access to hospitals. + #[schema(minimum = 0, maximum = 100)] + hospitals: Option, + /// BNA category subscore for access to pharmacies. + #[schema(minimum = 0, maximum = 100)] + pharmacies: Option, + /// BNA category score for access to core services. + #[schema(minimum = 0, maximum = 100)] + score: Option, + /// BNA category subscore for access to social services. + #[schema(minimum = 0, maximum = 100)] + social_services: Option, +} + +#[derive(ToSchema, Serialize)] +pub(crate) struct People { + /// BNA category score for access to residential areas. + #[schema(minimum = 0, maximum = 100)] + people: Option, +} + +#[derive(ToSchema, Serialize)] +pub(crate) struct Retail { + /// BNA category score for access to major retail centers. + #[schema(minimum = 0, maximum = 100)] + retail: Option, +} + +#[derive(ToSchema, Serialize)] +pub(crate) struct Transit { + /// BNA category score for access to major transit stops. + #[schema(minimum = 0, maximum = 100)] + transit: Option, +} + +#[derive(ToSchema, Serialize)] +pub(crate) struct Ratings(Vec); + +impl From> for Ratings { + fn from(value: Vec) -> Self { + let ratings = value.into_iter().map(Rating::from).collect::>(); + Self(ratings) + } +} + +#[derive(ToSchema, Serialize)] +pub(crate) struct RatingWithCity { + pub(crate) rating: Rating, + pub(crate) city: City, +} + +#[derive(ToSchema, Serialize)] +pub(crate) struct RatingPost { + /// City identifier + city_id: Uuid, + /// Rating version + /// The format follows the [calver](https://calver.org) specification with + /// the YY.0M[.Minor] scheme. + version: String, + + /// BNAInfrastructure + infrastructure: Infrastructure, + + /// BNA Recreation + recreation: Recreation, + + /// BNA Opportunity + opportunity: Opportunity, + + /// BNA Core Services + core_services: CoreServices, + + /// BNA People + people: People, + + /// BNA Retail + retail: Retail, + + /// BNA Transit + transit: Transit, +} diff --git a/lambdas/src/core/resource/schema.rs b/lambdas/src/core/resource/schema.rs new file mode 100644 index 0000000..dd6e272 --- /dev/null +++ b/lambdas/src/core/resource/schema.rs @@ -0,0 +1,246 @@ +//! Describes the schemas shared accross resources. +use chrono::DateTime; +use serde::{Deserialize, Serialize}; +use serde_with::skip_serializing_none; +use std::{fmt::Display, str::FromStr}; +use utoipa::{IntoParams, IntoResponses, ToSchema}; +use uuid::Uuid; + +#[derive(ToSchema, Serialize, Deserialize)] +pub(crate) enum Country { + Australia, + Belgium, + Brazil, + Canada, + Chile, + Colombia, + Croatia, + Cuba, + England, + France, + Germany, + Greece, + Guatemala, + Iran, + Iraq, + Ireland, + Italy, + Mexico, + Netherlands, + #[serde(rename = "New Zealand")] + NewZealand, + #[serde(rename = "Northern Ireland")] + NorthernIreland, + Portugal, + Scotland, + Spain, + #[serde(rename = "United States")] + UnitedStates, + Vietnam, + Wales, +} + +impl FromStr for Country { + type Err = serde_plain::Error; + + fn from_str(s: &str) -> Result { + serde_plain::from_str::(s) + } +} + +impl From for Country { + fn from(value: String) -> Self { + Country::from_str(value.as_str()).expect("cannot serialize value") + } +} + +impl Display for Country { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let value = serde_plain::to_string(&self).expect("cannot serialize value"); + write!(f, "{}", value) + } +} + +#[derive(ToSchema, Serialize)] +#[schema(description = "Detailed information of a city")] +pub(crate) struct City { + /// City identifier + id: Uuid, + /// Country name + #[schema(examples("Belgium"))] + country: Country, + /// State name + #[schema(examples("Antwerp"))] + state: String, + /// City name + #[schema(examples("Antwerp"))] + name: String, + /// Geographic coordinate that specifies the north-south position of a point + /// on the surface of the Earth. + #[schema(examples("51.260197"))] + latitude: Option, + /// Geographic coordinate that specifies the east–west position of a point + /// on the surface of the Earth. + #[schema(examples("4.402771"))] + longitude: Option, + /// Region name. A region can be a state, a province, a community, or + /// something similar depending on the country. If a country does not have + /// this concept, then the country name is used. + #[schema(examples("Antwerp"))] + region: Option, + /// A short version of the state name, usually 2 or 3 character long + #[schema(examples("VAN"))] + state_abbrev: Option, + /// Speed limit in kilometer per hour (km/h). + #[schema(examples("50"))] + speed_limit: Option, + /// Creation date + created_at: DateTime, + /// Update date + updated_at: Option>, +} + +impl From for City { + fn from(value: entity::city::Model) -> Self { + Self { + id: value.id, + country: value.country.into(), + state: value.state, + name: value.name, + latitude: value.latitude, + longitude: value.latitude, + region: value.region, + state_abbrev: value.state_abbrev, + speed_limit: value.speed_limit, + created_at: value.created_at, + updated_at: value.updated_at, + } + } +} + +/// An object containing references to the primary source of the error. +/// +/// It SHOULD include one of the following members or be omitted: +/// +/// - pointer: a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901) to the +/// value in the request document that caused the error [e.g. "/data" for a primary +/// data object, or "/data/attributes/title" for a specific attribute]. +/// This MUST point to a value in the request document that exists; if it doesn’t, +/// the client SHOULD simply ignore the pointer. +/// - parameter: a string indicating which URI query parameter caused the error. +/// - header: a string indicating the name of a single request header which caused the +/// error. +#[derive(Deserialize, Serialize, ToSchema)] +#[serde(rename_all = "snake_case")] +pub enum APIErrorSource { + /// A JSON Pointer [RFC6901] to the value in the request document that caused the error. + #[schema(examples(json!({"pointer": "/data/attributes/title"})))] + Pointer(String), + /// A string indicating which URI query parameter caused the error. + #[schema(examples(json!({ "parameter": "include" })))] + Parameter(String), + /// A string indicating the name of a single request header which caused the error. + #[schema(examples(json!({ "header": "Content-Type" })))] + Header(String), +} + +/// Single API Error object as described in . +#[skip_serializing_none] +#[derive(Deserialize, Serialize, ToSchema)] +pub struct APIError { + /// A unique identifier for this particular occurrence of the problem. + #[schema(examples("blfwkg8nvHcEJnQ="))] + id: Option, + /// The HTTP status code applicable to this problem, expressed as a string value. + #[schema(examples("404"))] + status: String, + /// A short, human-readable summary of the problem + #[schema(examples("Item Not Found"))] + title: String, + /// A human-readable explanation specific to this occurrence of the problem + #[schema(examples("the entry was not found"))] + details: String, + /// An object containing references to the primary source of the error. + /// + /// This field may be omitted in some situation. For instance, if the server cannot + /// parse the request as valid JSON, including source doesn’t make sense + /// (because there’s no JSON document for source to refer to). + #[schema(examples(json!("pointer": "/bnas/analysis/e6aade5a-b343-120b-dbaa-bd916cd99221")))] + source: APIErrorSource, +} + +/// Error objects MUST be returned as an array keyed by errors in the top level of a +/// JSON:API document. +#[derive(Deserialize, Serialize, ToSchema)] +pub(crate) struct APIErrors { + pub errors: Vec, +} + +#[allow(dead_code)] +#[derive(Serialize, IntoResponses, ToSchema)] +pub(crate) enum ErrorResponses { + /// Bad Request + #[response( + status = 400, + description = "The request was formatted incorrectly or missing required parameters.", + example = json!([{ + "details": "the request was formatted incorrectly or missing required parameters", + "id": "blfwkg8nvHcEJnQ=", + "source": {"parameter": "status"}, + "status": "400", + "title": "Bad Request" + }]) + )] + BadRequest(#[to_schema] APIErrors), + /// Unauthorized + #[response( + status = 401, + description = "The request has not been fulfilled because it lacks valid authentication credentials for the target resource.", + example = json!([{ + "details": "invalid authentication credentials to access the specified resource", + "id": "blfwkg8nvHcEJnQ=", + "source": {"pointer": "/bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221"}, + "status": "401", + "title": "Unauthorized" + }]) + )] + Unauthorized(#[to_schema] APIErrors), + /// Forbidden + #[response( + status = 403, + description = "Forbidden to make the request. Most likely this indicates an issue with the credentials or permissions.", + example = json!([{ + "details": "access to the requested resource is forbidden", + "id": "blfwkg8nvHcEJnQ=", + "source": {"pointer": "/bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221"}, + "status": "403", + "title": "Forbidden" + }]) + )] + Forbidden(#[to_schema] APIErrors), + /// Item Not Found + #[response( + status = 404, + description = "The particular resource requested was not found. This occurs, for example, when the id of the requested resource does not exist.", + example = json!([{ + "details": "the resource was not found", + "id": "blfwkg8nvHcEJnQ=", + "source": {"pointer": "/bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221"}, + "status": "404", + "title": "Item Not Found" + }]) + )] + NotFound(#[to_schema] APIErrors), +} + +#[allow(dead_code)] +#[derive(Deserialize, IntoParams)] +#[into_params(parameter_in = Query)] +pub(crate) struct PaginationParams { + /// The number of items per page + #[param(minimum = 1, maximum = 65536, example = 25)] + page_size: Option, + /// The result page being returned + #[param(minimum = 1, maximum = 65536, example = 5)] + page: Option, +} diff --git a/lambdas/src/lib.rs b/lambdas/src/lib.rs index 17138f2..56ab473 100644 --- a/lambdas/src/lib.rs +++ b/lambdas/src/lib.rs @@ -217,26 +217,35 @@ impl Paginatron { } #[derive(Serialize)] -pub struct PageFlow { +pub struct PageFlow +where + T: Serialize, +{ paginatron: Paginatron, - payload: Value, + payload: T, } -impl PageFlow { - pub fn new(paginatron: Paginatron, payload: Value) -> Self { +impl PageFlow +where + T: Serialize, +{ + pub fn new(paginatron: Paginatron, payload: T) -> Self { Self { paginatron, payload, } } - pub fn payload(&self) -> Value { - self.payload.clone() + pub fn payload(&self) -> &T { + &self.payload } } -impl From for Response { - fn from(value: PageFlow) -> Self { +impl From> for Response +where + T: Serialize, +{ + fn from(value: PageFlow) -> Self { let nav = value.paginatron.navigation(); Response::builder() .header( @@ -250,12 +259,17 @@ impl From for Response { .header("x-total", value.paginatron.total_items) .header("x-total-pages", nav.last()) .header(header::CONTENT_TYPE, "application/json") - .body(Body::from(value.payload.to_string())) + .body(Body::from( + serde_json::to_string(&value.payload).expect("payload must serialize"), + )) .expect("failed to build response") } } -impl IntoResponse for PageFlow { +impl IntoResponse for PageFlow +where + T: Serialize, +{ fn into_response(self) -> axum::response::Response { let nav = self.paginatron.navigation(); let r: Response = axum::response::Response::builder() @@ -267,7 +281,9 @@ impl IntoResponse for PageFlow { .header("x-total", self.paginatron.total_items) .header("x-total-pages", nav.last()) .header(header::CONTENT_TYPE, "application/json") - .body(axum::body::Body::from(self.payload.to_string())) + .body(axum::body::Body::from( + serde_json::to_string(&self.payload).expect("payload must serialize"), + )) .expect("failed to build response"); r } diff --git a/lambdas/src/main.rs b/lambdas/src/main.rs index 199a185..70c3c99 100644 --- a/lambdas/src/main.rs +++ b/lambdas/src/main.rs @@ -1,9 +1,20 @@ -use ::tracing::debug; -use axum::Router; +use ::tracing::{debug, info}; use lambda_http::{run, tracing, Error}; -use lambdas::core::resource::{cities, price, ratings}; -use std::env::{self, set_var}; +use lambdas::core::resource::{ + cities, pipelines, price, ratings, + schema::{APIError, APIErrorSource}, +}; +use std::{ + env::{self, set_var}, + fs, +}; use tower_http::trace::TraceLayer; +use utoipa::{ + openapi::{Components, ContactBuilder, Info, OpenApiBuilder, Server, Tag}, + schema, +}; +use utoipa_axum::router::OpenApiRouter; +use utoipa_swagger_ui::SwaggerUi; #[tokio::main] async fn main() -> Result<(), Error> { @@ -34,12 +45,92 @@ async fn main() -> Result<(), Error> { .init(); debug!(loglevel= ?log_level); + // Define the OpenApi Specification. + let api = OpenApiBuilder::new() + .info( + Info::builder() + .title("BNA REST API") + .version("1.0.0") + .description(Some( + "Provides a way to retrieve the BNA results programmatically.", + )) + .contact(Some( + ContactBuilder::new() + .name(Some("The BNA Mechanics team")) + .url(Some("https://peopleforbikes.github.io/")) + .build(), + )) + .build(), + ) + .servers(Some(vec![ + Server::builder() + .description(Some("Local development API")) + .url("https://localhost:3000") + .build(), + Server::builder() + .description(Some("Staging API")) + .url("https://api.peopleforbikes.xyz") + .build(), + ])) + .tags(Some(vec![ + Tag::builder() + .name("city") + .description(Some("City API endpoints")) + .build(), + Tag::builder() + .name("pipeline") + .description(Some("Pipeline API endpoints")) + .build(), + Tag::builder() + .name("price") + .description(Some("Price API endpoints")) + .build(), + Tag::builder() + .name("rating") + .description(Some("Rating API endpoints")) + .build(), + ])) + .components(Some( + Components::builder() + .schema( + "APIError", + schema!( + #[inline] + APIError + ), + ) + .schema( + "APIErrorSource", + schema!( + #[inline] + APIErrorSource + ), + ) + .build(), + )) + .build(); + // Create the app router. - let app = Router::new() + let (app, api) = OpenApiRouter::with_openapi(api) .merge(cities::endpoint::routes()) + .merge(pipelines::endpoint::routes()) .merge(price::endpoint::routes()) .merge(ratings::endpoint::routes()) - .layer(TraceLayer::new_for_http()); + .layer(TraceLayer::new_for_http()) + .split_for_parts(); + + // Write the specification file to disk. + if env::var("BNA_API_GENERATE_ONLY") + .ok() + .map_or(false, |v| v == *"1") + { + info!("Regenerating the OpenAPI specification file."); + let _ = fs::write("./openapi-3.1.yaml", api.to_yaml().unwrap()); + return Ok(()); + } + + // Add the Swagger UI. + let app = app.merge(SwaggerUi::new("/swagger-ui").url("/apidoc/openapi.json", api)); // Lookup for the standalone flag. let standalone = env::var("BNA_API_STANDALONE") diff --git a/lambdas/tests/endpoints/cities.hurl b/lambdas/tests/endpoints/cities.hurl index 0b1fb0e..1b93872 100644 --- a/lambdas/tests/endpoints/cities.hurl +++ b/lambdas/tests/endpoints/cities.hurl @@ -28,7 +28,7 @@ GET {{host}}/cities/{{country}}/{{region}}/{{name}}/ratings HTTP 200 [Asserts] -jsonpath "$" count > 0 +jsonpath "$.ratings" count > 0 # Queries all the BNAs of a non-existing city. GET {{host}}/cities/{{country}}/{{region}}/unknown_city/ratings diff --git a/lambdas/tests/endpoints/ratings.hurl b/lambdas/tests/endpoints/ratings.hurl index 16064cd..ed0f67d 100644 --- a/lambdas/tests/endpoints/ratings.hurl +++ b/lambdas/tests/endpoints/ratings.hurl @@ -31,7 +31,6 @@ GET {{host}}/ratings/{{rating_id}}/city HTTP 200 [Asserts] -jsonpath "$" count > 0 # Queries a non-existing bna run and its associated city. GET {{host}}/ratings/{{fake_rating_id}}/city diff --git a/lambdas/tests/justfile b/lambdas/tests/justfile index ba14e7e..745ebf1 100644 --- a/lambdas/tests/justfile +++ b/lambdas/tests/justfile @@ -43,12 +43,12 @@ test-localhost-schemathesis: --generation-allow-x00 false \ --exclude-method 'POST' \ --exclude-method 'PATCH' \ - {{top_dir}}/openapi.yaml + {{top_dir}}/openapi-3.0.yaml # Run the schemathesis tests again the openapi schema. test-staging-schemathesis: uv run st run \ - {{top_dir}}/openapi.yaml \ + {{top_dir}}/openapi-3.0.yaml \ --exclude-method 'POST' \ --exclude-method 'PATCH' \ --base-url https://api.peopleforbikes.xyz/ diff --git a/migration/src/m20240202_004130_brokenspoke_analyzer_pipeline.rs b/migration/src/m20240202_004130_brokenspoke_analyzer_pipeline.rs index 85d7572..2ce5cf7 100644 --- a/migration/src/m20240202_004130_brokenspoke_analyzer_pipeline.rs +++ b/migration/src/m20240202_004130_brokenspoke_analyzer_pipeline.rs @@ -1,7 +1,7 @@ use sea_orm_migration::{ prelude::*, schema::{ - boolean_null, decimal, decimal_null, integer_null, json_null, pk_auto, string, string_null, + decimal, decimal_null, integer_null, json_null, pk_auto, string, string_null, timestamp_with_time_zone, timestamp_with_time_zone_null, uuid, }, }; @@ -80,7 +80,7 @@ impl MigrationTrait for Migration { .table(BNAPipeline::Table) .if_not_exists() .col(uuid(BNAPipeline::StateMachineId).primary_key()) - .col(string_null(BNAPipeline::Step)) + .col(string(BNAPipeline::Step)) .col(json_null(BNAPipeline::SqsMessage)) .col(integer_null(BNAPipeline::FargatePriceId)) .col(string_null(BNAPipeline::FargateTaskARN)) @@ -88,8 +88,6 @@ impl MigrationTrait for Migration { .col(string(BNAPipeline::Status).default("Pending".to_string())) .col(timestamp_with_time_zone(BNAPipeline::StartTime)) .col(timestamp_with_time_zone_null(BNAPipeline::EndTime)) - .col(boolean_null(BNAPipeline::TornDown)) - .col(boolean_null(BNAPipeline::ResultsPosted)) .col(decimal_null(BNAPipeline::Cost)) .foreign_key( ForeignKey::create() @@ -137,14 +135,12 @@ enum BNAPipeline { EndTime, FargatePriceId, FargateTaskARN, - ResultsPosted, S3Bucket, SqsMessage, StartTime, StateMachineId, Status, Step, - TornDown, } /// Lookup table for the brokenspoke statuses. diff --git a/openapi-3.0.yaml b/openapi-3.0.yaml new file mode 100644 index 0000000..08726e8 --- /dev/null +++ b/openapi-3.0.yaml @@ -0,0 +1,3610 @@ +openapi: 3.0.3 +info: + title: BNA REST API + description: Provides a way to retrieve the BNA results programmatically. + contact: + name: The BNA Mechanics team + url: https://peopleforbikes.github.io/ + version: 1.0.0 +servers: + - url: https://localhost:3000 + description: Local development API + - url: https://api.peopleforbikes.xyz + description: Staging API +paths: + /cities: + get: + tags: + - city + description: Get the details of all cities where an BNA analysis was performed. + operationId: get_cities + parameters: + - name: page_size + in: query + description: The number of items per page + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 25 + - name: page + in: query + description: The result page being returned + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 5 + responses: + '200': + description: Fetches cities + content: + application/json: + schema: + $ref: '#/components/schemas/Cities' + post: + tags: + - city + description: Create a new city. + operationId: post_city + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CityPost' + required: true + responses: + '201': + description: Creates a new city + content: + application/json: + schema: + $ref: '#/components/schemas/City' + '400': + description: >- + The request was formatted incorrectly or missing required + parameters. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + the request was formatted incorrectly or missing required + parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: >- + The request has not been fulfilled because it lacks valid + authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + invalid authentication credentials to access the specified + resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: >- + Forbidden to make the request. Most likely this indicates an issue + with the credentials or permissions. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: >- + The particular resource requested was not found. This occurs, for + example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + /cities/submissions: + get: + tags: + - city + description: Get the submissions details. + operationId: get_cities_submissions + parameters: + - name: status + in: query + description: Filter for the submission status + required: false + schema: + type: string + example: Pending + - name: page_size + in: query + description: The number of items per page + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 25 + - name: page + in: query + description: The result page being returned + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 5 + responses: + '200': + description: Fetches submissions + content: + application/json: + schema: + $ref: '#/components/schemas/Submissions' + '400': + description: >- + The request was formatted incorrectly or missing required + parameters. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + the request was formatted incorrectly or missing required + parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: >- + The request has not been fulfilled because it lacks valid + authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + invalid authentication credentials to access the specified + resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: >- + Forbidden to make the request. Most likely this indicates an issue + with the credentials or permissions. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: >- + The particular resource requested was not found. This occurs, for + example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + post: + tags: + - city + description: Create a new city submission. + operationId: post_cities_submission + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SubmissionPost' + required: true + responses: + '201': + description: Creates a new city submission + content: + application/json: + schema: + $ref: '#/components/schemas/Submission' + '400': + description: >- + The request was formatted incorrectly or missing required + parameters. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + the request was formatted incorrectly or missing required + parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: >- + The request has not been fulfilled because it lacks valid + authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + invalid authentication credentials to access the specified + resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: >- + Forbidden to make the request. Most likely this indicates an issue + with the credentials or permissions. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: >- + The particular resource requested was not found. This occurs, for + example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + /cities/submissions/{submission_id}: + get: + tags: + - city + description: Get the details of a specific sumission. + operationId: get_cities_submission + parameters: + - name: submission_id + in: path + description: Submission identifier + required: true + schema: + type: integer + format: int32 + example: '1' + - name: status + in: query + description: Filter for the submission status + required: false + schema: + type: string + example: Pending + responses: + '200': + description: Fetches a submission + content: + application/json: + schema: + $ref: '#/components/schemas/Submission' + '400': + description: >- + The request was formatted incorrectly or missing required + parameters. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + the request was formatted incorrectly or missing required + parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: >- + The request has not been fulfilled because it lacks valid + authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + invalid authentication credentials to access the specified + resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: >- + Forbidden to make the request. Most likely this indicates an issue + with the credentials or permissions. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: >- + The particular resource requested was not found. This occurs, for + example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + patch: + tags: + - city + description: Update a city submission. + operationId: patch_cities_submission + parameters: + - name: submission_id + in: path + description: Submission identifier + required: true + schema: + type: integer + format: int32 + example: '1' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SubmissionPatch' + required: true + responses: + '200': + description: Updates a city submission + content: + application/json: + schema: + $ref: '#/components/schemas/Submission' + '400': + description: >- + The request was formatted incorrectly or missing required + parameters. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + the request was formatted incorrectly or missing required + parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: >- + The request has not been fulfilled because it lacks valid + authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + invalid authentication credentials to access the specified + resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: >- + Forbidden to make the request. Most likely this indicates an issue + with the credentials or permissions. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: >- + The particular resource requested was not found. This occurs, for + example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + /cities/{country}/{region}/{name}: + get: + tags: + - city + description: Get the details of a specific city where an BNA analysis was computed. + operationId: get_city + parameters: + - name: country + in: path + description: Country name + required: true + schema: + $ref: '#/components/schemas/Country' + example: Belgium + - name: region + in: path + description: >- + Region name. A region can be a state, a province, a community, or + + something similar depending on the country. If a country does not + have + + this concept, then the country name is used. + required: true + schema: + type: string + example: Antwerp + - name: name + in: path + description: City name + required: true + schema: + type: string + example: Antwerp + responses: + '200': + description: Fetches a city + content: + application/json: + schema: + $ref: '#/components/schemas/City' + '400': + description: >- + The request was formatted incorrectly or missing required + parameters. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + the request was formatted incorrectly or missing required + parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: >- + The request has not been fulfilled because it lacks valid + authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + invalid authentication credentials to access the specified + resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: >- + Forbidden to make the request. Most likely this indicates an issue + with the credentials or permissions. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: >- + The particular resource requested was not found. This occurs, for + example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + /cities/{country}/{region}/{name}/census: + get: + tags: + - city + description: >- + Get the details of a specific city with its associated census + information. + operationId: get_city_censuses + parameters: + - name: country + in: path + description: Country name + required: true + schema: + $ref: '#/components/schemas/Country' + example: Belgium + - name: region + in: path + description: >- + Region name. A region can be a state, a province, a community, or + + something similar depending on the country. If a country does not + have + + this concept, then the country name is used. + required: true + schema: + type: string + example: Antwerp + - name: name + in: path + description: City name + required: true + schema: + type: string + example: Antwerp + - name: page_size + in: query + description: The number of items per page + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 25 + - name: page + in: query + description: The result page being returned + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 5 + responses: + '200': + description: Fetches city censuses + content: + application/json: + schema: + $ref: '#/components/schemas/CityCensuses' + '400': + description: >- + The request was formatted incorrectly or missing required + parameters. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + the request was formatted incorrectly or missing required + parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: >- + The request has not been fulfilled because it lacks valid + authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + invalid authentication credentials to access the specified + resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: >- + Forbidden to make the request. Most likely this indicates an issue + with the credentials or permissions. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: >- + The particular resource requested was not found. This occurs, for + example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + post: + tags: + - city + description: Create census information for a specific city. + operationId: post_city_census + parameters: + - name: country + in: path + description: Country name + required: true + schema: + $ref: '#/components/schemas/Country' + example: Belgium + - name: region + in: path + description: >- + Region name. A region can be a state, a province, a community, or + + something similar depending on the country. If a country does not + have + + this concept, then the country name is used. + required: true + schema: + type: string + example: Antwerp + - name: name + in: path + description: City name + required: true + schema: + type: string + example: Antwerp + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CensusPost' + required: true + responses: + '201': + description: Creates a new census entry for a city + content: + application/json: + schema: + $ref: '#/components/schemas/Census' + '400': + description: >- + The request was formatted incorrectly or missing required + parameters. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + the request was formatted incorrectly or missing required + parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: >- + The request has not been fulfilled because it lacks valid + authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + invalid authentication credentials to access the specified + resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: >- + Forbidden to make the request. Most likely this indicates an issue + with the credentials or permissions. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: >- + The particular resource requested was not found. This occurs, for + example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + /cities/{country}/{region}/{name}/ratings: + get: + tags: + - city + description: >- + Get the details of a specific city with all the analysis that were + performed against it. + operationId: get_city_ratings + parameters: + - name: country + in: path + description: Country name + required: true + schema: + $ref: '#/components/schemas/Country' + example: Belgium + - name: region + in: path + description: >- + Region name. A region can be a state, a province, a community, or + + something similar depending on the country. If a country does not + have + + this concept, then the country name is used. + required: true + schema: + type: string + example: Antwerp + - name: name + in: path + description: City name + required: true + schema: + type: string + example: Antwerp + - name: page_size + in: query + description: The number of items per page + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 25 + - name: page + in: query + description: The result page being returned + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 5 + responses: + '200': + description: Fetches city ratings + content: + application/json: + schema: + $ref: '#/components/schemas/CityRatings' + '400': + description: >- + The request was formatted incorrectly or missing required + parameters. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + the request was formatted incorrectly or missing required + parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: >- + The request has not been fulfilled because it lacks valid + authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + invalid authentication credentials to access the specified + resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: >- + Forbidden to make the request. Most likely this indicates an issue + with the credentials or permissions. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: >- + The particular resource requested was not found. This occurs, for + example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + /pipelines/bna: + get: + tags: + - pipeline + description: Get the details of all BNA pipelines + operationId: get_pipelines_bnas + parameters: + - name: page_size + in: query + description: The number of items per page + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 25 + - name: page + in: query + description: The result page being returned + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 5 + responses: + '200': + description: Fetches the details of all BNA pipelines + content: + application/json: + schema: + $ref: '#/components/schemas/BnaPipelines' + '400': + description: >- + The request was formatted incorrectly or missing required + parameters. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + the request was formatted incorrectly or missing required + parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: >- + The request has not been fulfilled because it lacks valid + authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + invalid authentication credentials to access the specified + resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: >- + Forbidden to make the request. Most likely this indicates an issue + with the credentials or permissions. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: >- + The particular resource requested was not found. This occurs, for + example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + post: + tags: + - pipeline + description: Create a new BNA pipeline + operationId: post_pipelines_bna + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BnaPipelinePost' + required: true + responses: + '201': + description: Creates a new city submission + content: + application/json: + schema: + $ref: '#/components/schemas/BnaPipeline' + '400': + description: >- + The request was formatted incorrectly or missing required + parameters. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + the request was formatted incorrectly or missing required + parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: >- + The request has not been fulfilled because it lacks valid + authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + invalid authentication credentials to access the specified + resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: >- + Forbidden to make the request. Most likely this indicates an issue + with the credentials or permissions. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: >- + The particular resource requested was not found. This occurs, for + example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + /pipelines/bna/{pipeline_id}: + get: + tags: + - pipeline + description: Get the details of a specific BNA pipeline + operationId: get_pipelines_bna + parameters: + - name: pipeline_id + in: path + description: Pipeline identifier + required: true + schema: + type: string + format: uuid + responses: + '200': + description: Fetches the details of a BNA pipeline + content: + application/json: + schema: + $ref: '#/components/schemas/BnaPipeline' + '400': + description: >- + The request was formatted incorrectly or missing required + parameters. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + the request was formatted incorrectly or missing required + parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: >- + The request has not been fulfilled because it lacks valid + authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + invalid authentication credentials to access the specified + resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: >- + Forbidden to make the request. Most likely this indicates an issue + with the credentials or permissions. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: >- + The particular resource requested was not found. This occurs, for + example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + patch: + tags: + - pipeline + description: Update the details of a specific BNA pipeline + operationId: patch_pipelines_bna + parameters: + - name: pipeline_id + in: path + description: Pipeline identifier + required: true + schema: + type: string + format: uuid + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BnaPipelinePatch' + required: true + responses: + '200': + description: Updates the details of a BNA pipeline + content: + application/json: + schema: + $ref: '#/components/schemas/BnaPipeline' + '400': + description: >- + The request was formatted incorrectly or missing required + parameters. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + the request was formatted incorrectly or missing required + parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: >- + The request has not been fulfilled because it lacks valid + authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + invalid authentication credentials to access the specified + resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: >- + Forbidden to make the request. Most likely this indicates an issue + with the credentials or permissions. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: >- + The particular resource requested was not found. This occurs, for + example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + /prices/fargate: + get: + tags: + - price + description: Get all the AWS Fargate prices used to compute analysis costs. + operationId: get_prices_fargate + parameters: + - name: page_size + in: query + description: The number of items per page + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 25 + - name: page + in: query + description: The result page being returned + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 5 + responses: + '200': + description: Fetches a collection of Fargate prices + content: + application/json: + schema: + $ref: '#/components/schemas/FargatePrices' + /prices/fargate/{price_id}: + get: + tags: + - price + description: >- + Get a specific AWS Fargate price used to compute the cost of analysis + cost. + operationId: get_price_fargate + parameters: + - name: price_id + in: path + description: Identifier of a Fargate price + required: true + schema: + type: integer + format: int32 + responses: + '200': + description: Fetches a Fargate price used to estimate the cost of an analysis + content: + application/json: + schema: + $ref: '#/components/schemas/FargatePrice' + '400': + description: >- + The request was formatted incorrectly or missing required + parameters. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + the request was formatted incorrectly or missing required + parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: >- + The request has not been fulfilled because it lacks valid + authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + invalid authentication credentials to access the specified + resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: >- + Forbidden to make the request. Most likely this indicates an issue + with the credentials or permissions. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: >- + The particular resource requested was not found. This occurs, for + example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + /ratings: + get: + tags: + - rating + description: Get city ratings + operationId: get_ratings + parameters: + - name: page_size + in: query + description: The number of items per page + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 25 + - name: page + in: query + description: The result page being returned + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 5 + responses: + '200': + description: Fetches the city ratings + content: + application/json: + schema: + $ref: '#/components/schemas/Ratings' + post: + tags: + - rating + description: Create a new city rating + operationId: post_rating + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RatingPost' + required: true + responses: + '201': + description: Creates a new city rating + content: + application/json: + schema: + $ref: '#/components/schemas/Rating' + '400': + description: >- + The request was formatted incorrectly or missing required + parameters. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + the request was formatted incorrectly or missing required + parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: >- + The request has not been fulfilled because it lacks valid + authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + invalid authentication credentials to access the specified + resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: >- + Forbidden to make the request. Most likely this indicates an issue + with the credentials or permissions. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: >- + The particular resource requested was not found. This occurs, for + example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + /ratings/{rating_id}: + get: + tags: + - rating + description: Get the details of a specific city rating + operationId: get_rating + parameters: + - name: rating_id + in: path + description: Rating identifier + required: true + schema: + type: string + format: uuid + responses: + '200': + description: Fetches the details of a city rating + content: + application/json: + schema: + $ref: '#/components/schemas/Rating' + '400': + description: >- + The request was formatted incorrectly or missing required + parameters. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + the request was formatted incorrectly or missing required + parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: >- + The request has not been fulfilled because it lacks valid + authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + invalid authentication credentials to access the specified + resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: >- + Forbidden to make the request. Most likely this indicates an issue + with the credentials or permissions. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: >- + The particular resource requested was not found. This occurs, for + example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + /ratings/{rating_id}/city: + get: + tags: + - rating + description: Get a city rating and its associated city details + operationId: get_ratings_city + parameters: + - name: rating_id + in: path + description: Rating identifier + required: true + schema: + type: string + format: uuid + responses: + '200': + description: Fetches a city rating and its associated city details + content: + application/json: + schema: + $ref: '#/components/schemas/RatingWithCity' + '400': + description: >- + The request was formatted incorrectly or missing required + parameters. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + the request was formatted incorrectly or missing required + parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: >- + The request has not been fulfilled because it lacks valid + authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: >- + invalid authentication credentials to access the specified + resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: >- + Forbidden to make the request. Most likely this indicates an issue + with the credentials or permissions. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: >- + The particular resource requested was not found. This occurs, for + example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: >- + Error objects MUST be returned as an array keyed by errors in + the top level of a + + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found +components: + schemas: + APIError: + type: object + description: >- + Single API Error object as described in + . + required: + - status + - title + - details + - source + properties: + details: + type: string + description: >- + A human-readable explanation specific to this occurrence of the + problem + example: the entry was not found + id: + type: string + description: A unique identifier for this particular occurrence of the problem. + example: blfwkg8nvHcEJnQ= + nullable: true + source: + $ref: '#/components/schemas/APIErrorSource' + status: + type: string + description: >- + The HTTP status code applicable to this problem, expressed as a + string value. + example: '404' + title: + type: string + description: A short, human-readable summary of the problem + example: Item Not Found + APIErrorSource: + oneOf: + - type: object + description: >- + A JSON Pointer [RFC6901] to the value in the request document that + caused the error. + required: + - pointer + properties: + pointer: + type: string + description: >- + A JSON Pointer [RFC6901] to the value in the request document + that caused the error. + example: + pointer: /data/attributes/title + - type: object + description: A string indicating which URI query parameter caused the error. + required: + - parameter + properties: + parameter: + type: string + description: A string indicating which URI query parameter caused the error. + example: + parameter: include + - type: object + description: >- + A string indicating the name of a single request header which caused + the error. + required: + - header + properties: + header: + type: string + description: >- + A string indicating the name of a single request header which + caused the error. + example: + header: Content-Type + description: |- + An object containing references to the primary source of the error. + + It SHOULD include one of the following members or be omitted: + + - pointer: a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901) to the + value in the request document that caused the error [e.g. "/data" for a primary + data object, or "/data/attributes/title" for a specific attribute]. + This MUST point to a value in the request document that exists; if it doesn’t, + the client SHOULD simply ignore the pointer. + - parameter: a string indicating which URI query parameter caused the error. + - header: a string indicating the name of a single request header which caused the + error. + BnaPipeline: + type: object + required: + - start_time + - state_machine_id + - status + - step + properties: + cost: + type: string + description: Cost of an analysis in USD + example: '6.8941' + nullable: true + end_time: + type: string + format: date-time + description: End time + nullable: true + fargate_price_id: + type: integer + format: int32 + description: Fargate price identifier used to compute the cost + nullable: true + fargate_task_arn: + type: string + description: ARN of the Fargate task that performed the analysis + example: >- + arn:aws:ecs:us-west-2:123456789012:task/bna/29f979fc9fca402d94b014aa23d2f6e0 + nullable: true + s3_bucket: + type: string + description: Path of the S3 bucket where the results were stored + example: united states/new mexico/santa rosa/24.05.4 + nullable: true + sqs_message: + type: string + description: Copy of the JSON message that was sent for processing + example: + city: santa rosa + country: United States + fips_code: '3570670' + region: new mexico + nullable: true + start_time: + type: string + format: date-time + description: Start time + state_machine_id: + type: string + format: uuid + description: >- + Pipeline identifier + + This is the ID of the AWS state machine that was used to run the + pipeline + status: + $ref: '#/components/schemas/PipelineStatus' + step: + $ref: '#/components/schemas/BnaPipelineStep' + BnaPipelinePatch: + type: object + required: + - start_time + - status + - step + properties: + cost: + type: string + description: Cost of an analysis in USD + example: '6.8941' + nullable: true + end_time: + type: string + format: date-time + description: End time + nullable: true + fargate_price_id: + type: integer + format: int32 + description: Fargate price identifier used to compute the cost + nullable: true + fargate_task_arn: + type: string + description: ARN of the Fargate task that performed the analysis + example: >- + arn:aws:ecs:us-west-2:123456789012:task/bna/29f979fc9fca402d94b014aa23d2f6e0 + nullable: true + s3_bucket: + type: string + description: Path of the S3 bucket where the results were stored + example: united states/new mexico/santa rosa/24.05.4 + nullable: true + sqs_message: + type: string + description: Copy of the JSON message that was sent for processing + example: + city: santa rosa + country: United States + fips_code: '3570670' + region: new mexico + nullable: true + start_time: + type: string + format: date-time + description: Start time + status: + $ref: '#/components/schemas/PipelineStatus' + step: + $ref: '#/components/schemas/BnaPipelineStep' + BnaPipelinePost: + type: object + required: + - step + properties: + cost: + type: string + description: Cost of an analysis in USD + example: '6.8941' + nullable: true + end_time: + type: string + format: date-time + description: End time + nullable: true + fargate_price_id: + type: integer + format: int32 + description: Fargate price identifier used to compute the cost + nullable: true + fargate_task_arn: + type: string + description: ARN of the Fargate task that performed the analysis + example: >- + arn:aws:ecs:us-west-2:123456789012:task/bna/29f979fc9fca402d94b014aa23d2f6e0 + nullable: true + s3_bucket: + type: string + description: Path of the S3 bucket where the results were stored + example: united states/new mexico/santa rosa/24.05.4 + nullable: true + sqs_message: + type: string + description: Copy of the JSON message that was sent for processing + example: + city: santa rosa + country: United States + fips_code: '3570670' + region: new mexico + nullable: true + step: + $ref: '#/components/schemas/BnaPipelineStep' + BnaPipelineStep: + type: string + enum: + - SqsMessage + - Setup + - Analysis + - Cleanup + BnaPipelines: + type: array + items: + $ref: '#/components/schemas/BnaPipeline' + Census: + type: object + description: Census information of a city + required: + - id + - city_id + - created_at + - fips_code + - pop_size + - population + properties: + city_id: + type: string + format: uuid + description: City identifier + created_at: + type: string + format: date-time + description: Creation date + fips_code: + type: string + description: >- + Numerical city identifier given by the U.S. census, or 0 for non-US + cities + example: '4805000' + id: + type: integer + format: int32 + description: Census identifier + pop_size: + type: integer + format: int32 + description: City population size category (small (0), medium (1), large (2)) + example: '1' + population: + type: integer + format: int32 + description: City population + example: '907779' + CensusPost: + type: object + required: + - fips_code + - pop_size + - population + properties: + fips_code: + type: string + description: >- + Numerical city identifier given by the U.S. census, or 0 for non-US + cities + example: '4805000' + pop_size: + type: integer + format: int32 + description: City population size category (small (0), medium (1), large (2)) + example: '1' + population: + type: integer + format: int32 + description: City population + example: '907779' + Cities: + type: array + items: + $ref: '#/components/schemas/City' + City: + type: object + description: Detailed information of a city + required: + - id + - country + - state + - name + - created_at + properties: + country: + $ref: '#/components/schemas/Country' + created_at: + type: string + format: date-time + description: Creation date + id: + type: string + format: uuid + description: City identifier + latitude: + type: number + format: double + description: >- + Geographic coordinate that specifies the north-south position of a + point + + on the surface of the Earth. + example: '51.260197' + nullable: true + longitude: + type: number + format: double + description: >- + Geographic coordinate that specifies the east–west position of a + point + + on the surface of the Earth. + example: '4.402771' + nullable: true + name: + type: string + description: City name + example: Antwerp + region: + type: string + description: >- + Region name. A region can be a state, a province, a community, or + + something similar depending on the country. If a country does not + have + + this concept, then the country name is used. + example: Antwerp + nullable: true + speed_limit: + type: integer + format: int32 + description: Speed limit in kilometer per hour (km/h). + example: '50' + nullable: true + state: + type: string + description: State name + example: Antwerp + state_abbrev: + type: string + description: A short version of the state name, usually 2 or 3 character long + example: VAN + nullable: true + updated_at: + type: string + format: date-time + description: Update date + nullable: true + CityCensuses: + type: object + required: + - city + - censuses + properties: + censuses: + type: array + items: + $ref: '#/components/schemas/Census' + city: + $ref: '#/components/schemas/City' + CityPost: + type: object + required: + - country + - name + - state + properties: + country: + $ref: '#/components/schemas/Country' + latitude: + type: number + format: double + description: >- + Geographic coordinate that specifies the north-south position of a + point + + on the surface of the Earth. + example: '51.260197' + nullable: true + longitude: + type: number + format: double + description: >- + Geographic coordinate that specifies the east–west position of a + point + + on the surface of the Earth. + example: '4.402771' + nullable: true + name: + type: string + description: City name + example: Antwerp + region: + type: string + description: >- + Region name. A region can be a state, a province, a community, or + + something similar depending on the country. If a country does not + have + + this concept, then the country name is used. + example: Antwerp + nullable: true + speed_limit: + type: integer + format: int32 + description: Speed limit in kilometer per hour (km/h). + example: '50' + nullable: true + state: + type: string + description: A short version of the state name, usually 2 or 3 character long + example: VAN + state_abbrev: + type: string + description: A short version of the state name, usually 2 or 3 character long + example: VAN + nullable: true + CityRatings: + type: object + required: + - city + - ratings + properties: + city: + $ref: '#/components/schemas/City' + ratings: + type: array + items: + $ref: '#/components/schemas/RatingSummary' + CoreServices: + type: object + properties: + dentists: + type: number + format: double + description: BNA category subscore for access to dentists. + maximum: 100 + minimum: 0 + nullable: true + doctors: + type: number + format: double + description: BNA category subscore for access to doctors. + maximum: 100 + minimum: 0 + nullable: true + grocery: + type: number + format: double + description: BNA category subscore for access to grocery stores. + maximum: 100 + minimum: 0 + nullable: true + hospitals: + type: number + format: double + description: BNA category subscore for access to hospitals. + maximum: 100 + minimum: 0 + nullable: true + pharmacies: + type: number + format: double + description: BNA category subscore for access to pharmacies. + maximum: 100 + minimum: 0 + nullable: true + score: + type: number + format: double + description: BNA category score for access to core services. + maximum: 100 + minimum: 0 + nullable: true + social_services: + type: number + format: double + description: BNA category subscore for access to social services. + maximum: 100 + minimum: 0 + nullable: true + Country: + type: string + enum: + - Australia + - Belgium + - Brazil + - Canada + - Chile + - Colombia + - Croatia + - Cuba + - England + - France + - Germany + - Greece + - Guatemala + - Iran + - Iraq + - Ireland + - Italy + - Mexico + - Netherlands + - New Zealand + - Northern Ireland + - Portugal + - Scotland + - Spain + - United States + - Vietnam + - Wales + FargatePrice: + type: object + description: A Fargate price used to estimate the cost of an analysis + required: + - id + - per_second + - created_at + properties: + created_at: + type: string + format: date-time + description: Creation date + id: + type: integer + format: int32 + description: >- + Identifier of the Fargate Price rate used to compute the cost of the + pipeline run + example: '1' + per_second: + type: string + description: Cost to run Fargate for 1 second + example: '0.0023' + FargatePrices: + type: array + items: + $ref: '#/components/schemas/FargatePrice' + description: A collection of Fargate prices. + Infrastructure: + type: object + properties: + high_stress_miles: + type: number + format: double + description: Total miles of high-stress streets in the measured area. + example: 253 + nullable: true + low_stress_miles: + type: number + format: double + description: Total miles of low-stress streets and paths in the measured area. + example: 127 + nullable: true + Opportunity: + type: object + properties: + employment: + type: number + format: double + description: BNA category subscore for access to job location areas. + maximum: 100 + minimum: 0 + nullable: true + higher_education: + type: number + format: double + description: BNA category subscore for access to universities and colleges. + maximum: 100 + minimum: 0 + nullable: true + k12_education: + type: number + format: double + description: BNA category subscore for access to k12 schools + maximum: 100 + minimum: 0 + nullable: true + score: + type: number + format: double + description: BNA category score for access to education and jobs. + maximum: 100 + minimum: 0 + nullable: true + technical_vocational_college: + type: number + format: double + description: >- + BNA category subscore for access to technical and vocational + colleges. + maximum: 100 + minimum: 0 + nullable: true + People: + type: object + properties: + people: + type: number + format: double + description: BNA category score for access to residential areas. + maximum: 100 + minimum: 0 + nullable: true + PipelineStatus: + type: string + enum: + - Completed + - Pending + - Processing + Rating: + type: object + required: + - id + - city_id + - score + - version + - infrastructure + - recreation + - opportunity + - core_services + - people + - retail + - transit + properties: + city_id: + type: string + format: uuid + description: City identifier + core_services: + $ref: '#/components/schemas/CoreServices' + id: + type: string + format: uuid + description: Rating identifier + infrastructure: + $ref: '#/components/schemas/Infrastructure' + opportunity: + $ref: '#/components/schemas/Opportunity' + people: + $ref: '#/components/schemas/People' + recreation: + $ref: '#/components/schemas/Recreation' + retail: + $ref: '#/components/schemas/Retail' + score: + type: number + format: double + description: Total rating score + maximum: 100 + minimum: 0 + transit: + $ref: '#/components/schemas/Transit' + version: + type: string + description: >- + Rating version + + The format follows the [calver](https://calver.org) specification + with + + the YY.0M[.Minor] scheme. + RatingPost: + type: object + required: + - city_id + - version + - infrastructure + - recreation + - opportunity + - core_services + - people + - retail + - transit + properties: + city_id: + type: string + format: uuid + description: City identifier + core_services: + $ref: '#/components/schemas/CoreServices' + infrastructure: + $ref: '#/components/schemas/Infrastructure' + opportunity: + $ref: '#/components/schemas/Opportunity' + people: + $ref: '#/components/schemas/People' + recreation: + $ref: '#/components/schemas/Recreation' + retail: + $ref: '#/components/schemas/Retail' + transit: + $ref: '#/components/schemas/Transit' + version: + type: string + description: >- + Rating version + + The format follows the [calver](https://calver.org) specification + with + + the YY.0M[.Minor] scheme. + RatingSummary: + type: object + required: + - id + - city_id + - created_at + - score + - version + properties: + city_id: + type: string + format: uuid + description: City identifier + created_at: + type: string + format: date-time + description: Creation date + id: + type: string + format: uuid + description: Analysis identifier + score: + type: number + format: double + description: BNA score + example: '77.0' + version: + type: string + description: >- + Analysis version. The format follows the + [calver](https://calver.org) + + specification with the YY.0M[.Minor] scheme. + example: '23.12' + RatingWithCity: + type: object + required: + - rating + - city + properties: + city: + $ref: '#/components/schemas/City' + rating: + $ref: '#/components/schemas/Rating' + Ratings: + type: array + items: + $ref: '#/components/schemas/Rating' + Recreation: + type: object + properties: + community_centers: + type: number + format: double + description: BNA category subscore for access to community centers. + maximum: 100 + minimum: 0 + nullable: true + parks: + type: number + format: double + description: BNA category subscore for access to parks. + maximum: 100 + minimum: 0 + nullable: true + score: + type: number + format: double + description: BNA category score for access to recreational facilities. + maximum: 100 + minimum: 0 + nullable: true + trails: + type: number + format: double + description: BNA category subscore for access to bikeable trails. + maximum: 100 + minimum: 0 + nullable: true + Retail: + type: object + properties: + retail: + type: number + format: double + description: BNA category score for access to major retail centers. + maximum: 100 + minimum: 0 + nullable: true + Submission: + type: object + required: + - id + - first_name + - last_name + - email + - country + - city + - fips_code + - consent + - status + - created_at + properties: + city: + type: string + description: City name + example: Antwerp + consent: + type: boolean + description: Consent status + example: 'true' + country: + $ref: '#/components/schemas/Country' + created_at: + type: string + format: date-time + description: Creation date + email: + type: string + description: email address + example: jane.doe@orgllc.com + fips_code: + type: string + description: >- + Numerical city identifier given by the U.S. census, or 0 for non-US + cities + example: '4805000' + first_name: + type: string + description: First name + example: Jane + id: + type: integer + format: int32 + description: Submission identifier + last_name: + type: string + description: Last name + occupation: + type: string + description: Job title or position + example: CTO + nullable: true + organization: + type: string + description: Organization or company + example: Organization LLC + nullable: true + region: + type: string + description: >- + Region name. A region can be a state, a province, a community, or + + something similar depending on the country. If a country does not + have + + this concept, then the country name is used. + example: Antwerp + nullable: true + status: + type: string + description: Submission status, e.g. "Pending" + example: Pending + SubmissionPatch: + type: object + required: + - first_name + - last_name + - email + - country + - city + - fips_code + - consent + - status + properties: + city: + type: string + description: City name + example: Antwerp + consent: + type: boolean + description: Consent status + example: 'true' + country: + $ref: '#/components/schemas/Country' + email: + type: string + description: email address + example: jane.doe@orgllc.com + fips_code: + type: string + description: >- + Numerical city identifier given by the U.S. census, or 0 for non-US + cities + example: '4805000' + first_name: + type: string + description: First name + example: Jane + last_name: + type: string + description: Last name + occupation: + type: string + description: Job title or position + example: CTO + nullable: true + organization: + type: string + description: Organization or company + example: Organization LLC + nullable: true + region: + type: string + description: >- + Region name. A region can be a state, a province, a community, or + + something similar depending on the country. If a country does not + have + + this concept, then the country name is used. + example: Antwerp + nullable: true + status: + type: string + description: Submission status, e.g. "Pending" + example: Pending + SubmissionPost: + type: object + required: + - first_name + - last_name + - email + - country + - city + - fips_code + - consent + - status + properties: + city: + type: string + description: City name + example: Antwerp + consent: + type: boolean + description: Consent status + example: 'true' + country: + $ref: '#/components/schemas/Country' + email: + type: string + description: email address + example: jane.doe@orgllc.com + fips_code: + type: string + description: >- + Numerical city identifier given by the U.S. census, or 0 for non-US + cities + example: '4805000' + first_name: + type: string + description: First name + example: Jane + last_name: + type: string + description: Last name + occupation: + type: string + description: Job title or position + example: CTO + nullable: true + organization: + type: string + description: Organization or company + example: Organization LLC + nullable: true + region: + type: string + description: >- + Region name. A region can be a state, a province, a community, or + + something similar depending on the country. If a country does not + have + + this concept, then the country name is used. + example: Antwerp + nullable: true + status: + type: string + description: Submission status, e.g. "Pending" + example: Pending + Submissions: + type: array + items: + $ref: '#/components/schemas/Submission' + Transit: + type: object + properties: + transit: + type: number + format: double + description: BNA category score for access to major transit stops. + maximum: 100 + minimum: 0 + nullable: true +tags: + - name: city + description: City API endpoints + - name: pipeline + description: Pipeline API endpoints + - name: price + description: Price API endpoints + - name: rating + description: Rating API endpoints diff --git a/openapi-3.1.yaml b/openapi-3.1.yaml new file mode 100644 index 0000000..d1f08cb --- /dev/null +++ b/openapi-3.1.yaml @@ -0,0 +1,3344 @@ +openapi: 3.1.0 +info: + title: BNA REST API + description: Provides a way to retrieve the BNA results programmatically. + contact: + name: The BNA Mechanics team + url: https://peopleforbikes.github.io/ + version: 1.0.0 +servers: +- url: https://localhost:3000 + description: Local development API +- url: https://api.peopleforbikes.xyz + description: Staging API +paths: + /cities: + get: + tags: + - city + description: Get the details of all cities where an BNA analysis was performed. + operationId: get_cities + parameters: + - name: page_size + in: query + description: The number of items per page + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 25 + - name: page + in: query + description: The result page being returned + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 5 + responses: + '200': + description: Fetches cities + content: + application/json: + schema: + $ref: '#/components/schemas/Cities' + post: + tags: + - city + description: Create a new city. + operationId: post_city + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CityPost' + required: true + responses: + '201': + description: Creates a new city + content: + application/json: + schema: + $ref: '#/components/schemas/City' + '400': + description: The request was formatted incorrectly or missing required parameters. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the request was formatted incorrectly or missing required parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: The request has not been fulfilled because it lacks valid authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: invalid authentication credentials to access the specified resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: Forbidden to make the request. Most likely this indicates an issue with the credentials or permissions. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: The particular resource requested was not found. This occurs, for example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + /cities/submissions: + get: + tags: + - city + description: Get the submissions details. + operationId: get_cities_submissions + parameters: + - name: status + in: query + description: Filter for the submission status + required: false + schema: + type: string + example: Pending + - name: page_size + in: query + description: The number of items per page + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 25 + - name: page + in: query + description: The result page being returned + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 5 + responses: + '200': + description: Fetches submissions + content: + application/json: + schema: + $ref: '#/components/schemas/Submissions' + '400': + description: The request was formatted incorrectly or missing required parameters. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the request was formatted incorrectly or missing required parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: The request has not been fulfilled because it lacks valid authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: invalid authentication credentials to access the specified resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: Forbidden to make the request. Most likely this indicates an issue with the credentials or permissions. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: The particular resource requested was not found. This occurs, for example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + post: + tags: + - city + description: Create a new city submission. + operationId: post_cities_submission + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SubmissionPost' + required: true + responses: + '201': + description: Creates a new city submission + content: + application/json: + schema: + $ref: '#/components/schemas/Submission' + '400': + description: The request was formatted incorrectly or missing required parameters. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the request was formatted incorrectly or missing required parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: The request has not been fulfilled because it lacks valid authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: invalid authentication credentials to access the specified resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: Forbidden to make the request. Most likely this indicates an issue with the credentials or permissions. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: The particular resource requested was not found. This occurs, for example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + /cities/submissions/{submission_id}: + get: + tags: + - city + description: Get the details of a specific sumission. + operationId: get_cities_submission + parameters: + - name: submission_id + in: path + description: Submission identifier + required: true + schema: + type: integer + format: int32 + example: '1' + - name: status + in: query + description: Filter for the submission status + required: false + schema: + type: string + example: Pending + responses: + '200': + description: Fetches a submission + content: + application/json: + schema: + $ref: '#/components/schemas/Submission' + '400': + description: The request was formatted incorrectly or missing required parameters. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the request was formatted incorrectly or missing required parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: The request has not been fulfilled because it lacks valid authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: invalid authentication credentials to access the specified resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: Forbidden to make the request. Most likely this indicates an issue with the credentials or permissions. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: The particular resource requested was not found. This occurs, for example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + patch: + tags: + - city + description: Update a city submission. + operationId: patch_cities_submission + parameters: + - name: submission_id + in: path + description: Submission identifier + required: true + schema: + type: integer + format: int32 + example: '1' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SubmissionPatch' + required: true + responses: + '200': + description: Updates a city submission + content: + application/json: + schema: + $ref: '#/components/schemas/Submission' + '400': + description: The request was formatted incorrectly or missing required parameters. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the request was formatted incorrectly or missing required parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: The request has not been fulfilled because it lacks valid authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: invalid authentication credentials to access the specified resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: Forbidden to make the request. Most likely this indicates an issue with the credentials or permissions. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: The particular resource requested was not found. This occurs, for example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + /cities/{country}/{region}/{name}: + get: + tags: + - city + description: Get the details of a specific city where an BNA analysis was computed. + operationId: get_city + parameters: + - name: country + in: path + description: Country name + required: true + schema: + $ref: '#/components/schemas/Country' + example: Belgium + - name: region + in: path + description: |- + Region name. A region can be a state, a province, a community, or + something similar depending on the country. If a country does not have + this concept, then the country name is used. + required: true + schema: + type: string + example: Antwerp + - name: name + in: path + description: City name + required: true + schema: + type: string + example: Antwerp + responses: + '200': + description: Fetches a city + content: + application/json: + schema: + $ref: '#/components/schemas/City' + '400': + description: The request was formatted incorrectly or missing required parameters. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the request was formatted incorrectly or missing required parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: The request has not been fulfilled because it lacks valid authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: invalid authentication credentials to access the specified resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: Forbidden to make the request. Most likely this indicates an issue with the credentials or permissions. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: The particular resource requested was not found. This occurs, for example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + /cities/{country}/{region}/{name}/census: + get: + tags: + - city + description: Get the details of a specific city with its associated census information. + operationId: get_city_censuses + parameters: + - name: country + in: path + description: Country name + required: true + schema: + $ref: '#/components/schemas/Country' + example: Belgium + - name: region + in: path + description: |- + Region name. A region can be a state, a province, a community, or + something similar depending on the country. If a country does not have + this concept, then the country name is used. + required: true + schema: + type: string + example: Antwerp + - name: name + in: path + description: City name + required: true + schema: + type: string + example: Antwerp + - name: page_size + in: query + description: The number of items per page + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 25 + - name: page + in: query + description: The result page being returned + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 5 + responses: + '200': + description: Fetches city censuses + content: + application/json: + schema: + $ref: '#/components/schemas/CityCensuses' + '400': + description: The request was formatted incorrectly or missing required parameters. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the request was formatted incorrectly or missing required parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: The request has not been fulfilled because it lacks valid authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: invalid authentication credentials to access the specified resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: Forbidden to make the request. Most likely this indicates an issue with the credentials or permissions. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: The particular resource requested was not found. This occurs, for example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + post: + tags: + - city + description: Create census information for a specific city. + operationId: post_city_census + parameters: + - name: country + in: path + description: Country name + required: true + schema: + $ref: '#/components/schemas/Country' + example: Belgium + - name: region + in: path + description: |- + Region name. A region can be a state, a province, a community, or + something similar depending on the country. If a country does not have + this concept, then the country name is used. + required: true + schema: + type: string + example: Antwerp + - name: name + in: path + description: City name + required: true + schema: + type: string + example: Antwerp + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CensusPost' + required: true + responses: + '201': + description: Creates a new census entry for a city + content: + application/json: + schema: + $ref: '#/components/schemas/Census' + '400': + description: The request was formatted incorrectly or missing required parameters. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the request was formatted incorrectly or missing required parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: The request has not been fulfilled because it lacks valid authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: invalid authentication credentials to access the specified resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: Forbidden to make the request. Most likely this indicates an issue with the credentials or permissions. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: The particular resource requested was not found. This occurs, for example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + /cities/{country}/{region}/{name}/ratings: + get: + tags: + - city + description: Get the details of a specific city with all the analysis that were performed against it. + operationId: get_city_ratings + parameters: + - name: country + in: path + description: Country name + required: true + schema: + $ref: '#/components/schemas/Country' + example: Belgium + - name: region + in: path + description: |- + Region name. A region can be a state, a province, a community, or + something similar depending on the country. If a country does not have + this concept, then the country name is used. + required: true + schema: + type: string + example: Antwerp + - name: name + in: path + description: City name + required: true + schema: + type: string + example: Antwerp + - name: page_size + in: query + description: The number of items per page + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 25 + - name: page + in: query + description: The result page being returned + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 5 + responses: + '200': + description: Fetches city ratings + content: + application/json: + schema: + $ref: '#/components/schemas/CityRatings' + '400': + description: The request was formatted incorrectly or missing required parameters. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the request was formatted incorrectly or missing required parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: The request has not been fulfilled because it lacks valid authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: invalid authentication credentials to access the specified resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: Forbidden to make the request. Most likely this indicates an issue with the credentials or permissions. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: The particular resource requested was not found. This occurs, for example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + /pipelines/bna: + get: + tags: + - pipeline + description: Get the details of all BNA pipelines + operationId: get_pipelines_bnas + parameters: + - name: page_size + in: query + description: The number of items per page + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 25 + - name: page + in: query + description: The result page being returned + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 5 + responses: + '200': + description: Fetches the details of all BNA pipelines + content: + application/json: + schema: + $ref: '#/components/schemas/BnaPipelines' + '400': + description: The request was formatted incorrectly or missing required parameters. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the request was formatted incorrectly or missing required parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: The request has not been fulfilled because it lacks valid authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: invalid authentication credentials to access the specified resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: Forbidden to make the request. Most likely this indicates an issue with the credentials or permissions. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: The particular resource requested was not found. This occurs, for example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + post: + tags: + - pipeline + description: Create a new BNA pipeline + operationId: post_pipelines_bna + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BnaPipelinePost' + required: true + responses: + '201': + description: Creates a new city submission + content: + application/json: + schema: + $ref: '#/components/schemas/BnaPipeline' + '400': + description: The request was formatted incorrectly or missing required parameters. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the request was formatted incorrectly or missing required parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: The request has not been fulfilled because it lacks valid authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: invalid authentication credentials to access the specified resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: Forbidden to make the request. Most likely this indicates an issue with the credentials or permissions. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: The particular resource requested was not found. This occurs, for example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + /pipelines/bna/{pipeline_id}: + get: + tags: + - pipeline + description: Get the details of a specific BNA pipeline + operationId: get_pipelines_bna + parameters: + - name: pipeline_id + in: path + description: Pipeline identifier + required: true + schema: + type: string + format: uuid + responses: + '200': + description: Fetches the details of a BNA pipeline + content: + application/json: + schema: + $ref: '#/components/schemas/BnaPipeline' + '400': + description: The request was formatted incorrectly or missing required parameters. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the request was formatted incorrectly or missing required parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: The request has not been fulfilled because it lacks valid authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: invalid authentication credentials to access the specified resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: Forbidden to make the request. Most likely this indicates an issue with the credentials or permissions. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: The particular resource requested was not found. This occurs, for example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + patch: + tags: + - pipeline + description: Update the details of a specific BNA pipeline + operationId: patch_pipelines_bna + parameters: + - name: pipeline_id + in: path + description: Pipeline identifier + required: true + schema: + type: string + format: uuid + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BnaPipelinePatch' + required: true + responses: + '200': + description: Updates the details of a BNA pipeline + content: + application/json: + schema: + $ref: '#/components/schemas/BnaPipeline' + '400': + description: The request was formatted incorrectly or missing required parameters. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the request was formatted incorrectly or missing required parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: The request has not been fulfilled because it lacks valid authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: invalid authentication credentials to access the specified resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: Forbidden to make the request. Most likely this indicates an issue with the credentials or permissions. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: The particular resource requested was not found. This occurs, for example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + /prices/fargate: + get: + tags: + - price + description: Get all the AWS Fargate prices used to compute analysis costs. + operationId: get_prices_fargate + parameters: + - name: page_size + in: query + description: The number of items per page + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 25 + - name: page + in: query + description: The result page being returned + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 5 + responses: + '200': + description: Fetches a collection of Fargate prices + content: + application/json: + schema: + $ref: '#/components/schemas/FargatePrices' + /prices/fargate/{price_id}: + get: + tags: + - price + description: Get a specific AWS Fargate price used to compute the cost of analysis cost. + operationId: get_price_fargate + parameters: + - name: price_id + in: path + description: Identifier of a Fargate price + required: true + schema: + type: integer + format: int32 + responses: + '200': + description: Fetches a Fargate price used to estimate the cost of an analysis + content: + application/json: + schema: + $ref: '#/components/schemas/FargatePrice' + '400': + description: The request was formatted incorrectly or missing required parameters. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the request was formatted incorrectly or missing required parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: The request has not been fulfilled because it lacks valid authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: invalid authentication credentials to access the specified resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: Forbidden to make the request. Most likely this indicates an issue with the credentials or permissions. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: The particular resource requested was not found. This occurs, for example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + /ratings: + get: + tags: + - rating + description: Get city ratings + operationId: get_ratings + parameters: + - name: page_size + in: query + description: The number of items per page + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 25 + - name: page + in: query + description: The result page being returned + required: false + schema: + type: integer + format: int64 + maximum: 65536 + minimum: 1 + example: 5 + responses: + '200': + description: Fetches the city ratings + content: + application/json: + schema: + $ref: '#/components/schemas/Ratings' + post: + tags: + - rating + description: Create a new city rating + operationId: post_rating + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RatingPost' + required: true + responses: + '201': + description: Creates a new city rating + content: + application/json: + schema: + $ref: '#/components/schemas/Rating' + '400': + description: The request was formatted incorrectly or missing required parameters. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the request was formatted incorrectly or missing required parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: The request has not been fulfilled because it lacks valid authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: invalid authentication credentials to access the specified resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: Forbidden to make the request. Most likely this indicates an issue with the credentials or permissions. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: The particular resource requested was not found. This occurs, for example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + /ratings/{rating_id}: + get: + tags: + - rating + description: Get the details of a specific city rating + operationId: get_rating + parameters: + - name: rating_id + in: path + description: Rating identifier + required: true + schema: + type: string + format: uuid + responses: + '200': + description: Fetches the details of a city rating + content: + application/json: + schema: + $ref: '#/components/schemas/Rating' + '400': + description: The request was formatted incorrectly or missing required parameters. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the request was formatted incorrectly or missing required parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: The request has not been fulfilled because it lacks valid authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: invalid authentication credentials to access the specified resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: Forbidden to make the request. Most likely this indicates an issue with the credentials or permissions. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: The particular resource requested was not found. This occurs, for example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found + /ratings/{rating_id}/city: + get: + tags: + - rating + description: Get a city rating and its associated city details + operationId: get_ratings_city + parameters: + - name: rating_id + in: path + description: Rating identifier + required: true + schema: + type: string + format: uuid + responses: + '200': + description: Fetches a city rating and its associated city details + content: + application/json: + schema: + $ref: '#/components/schemas/RatingWithCity' + '400': + description: The request was formatted incorrectly or missing required parameters. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the request was formatted incorrectly or missing required parameters + id: blfwkg8nvHcEJnQ= + source: + parameter: status + status: '400' + title: Bad Request + '401': + description: The request has not been fulfilled because it lacks valid authentication credentials for the target resource. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: invalid authentication credentials to access the specified resource + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '401' + title: Unauthorized + '403': + description: Forbidden to make the request. Most likely this indicates an issue with the credentials or permissions. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: access to the requested resource is forbidden + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '403' + title: Forbidden + '404': + description: The particular resource requested was not found. This occurs, for example, when the id of the requested resource does not exist. + content: + application/json: + schema: + type: object + description: |- + Error objects MUST be returned as an array keyed by errors in the top level of a + JSON:API document. + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/APIError' + example: + - details: the resource was not found + id: blfwkg8nvHcEJnQ= + source: + pointer: /bnas/ratings/e6aade5a-b343-120b-dbaa-bd916cd99221 + status: '404' + title: Item Not Found +components: + schemas: + APIError: + type: object + description: Single API Error object as described in . + required: + - status + - title + - details + - source + properties: + details: + type: string + description: A human-readable explanation specific to this occurrence of the problem + examples: + - the entry was not found + id: + type: + - string + - 'null' + description: A unique identifier for this particular occurrence of the problem. + examples: + - blfwkg8nvHcEJnQ= + source: + $ref: '#/components/schemas/APIErrorSource' + description: |- + An object containing references to the primary source of the error. + + This field may be omitted in some situation. For instance, if the server cannot + parse the request as valid JSON, including source doesn’t make sense + (because there’s no JSON document for source to refer to). + status: + type: string + description: The HTTP status code applicable to this problem, expressed as a string value. + examples: + - '404' + title: + type: string + description: A short, human-readable summary of the problem + examples: + - Item Not Found + APIErrorSource: + oneOf: + - type: object + description: A JSON Pointer [RFC6901] to the value in the request document that caused the error. + required: + - pointer + properties: + pointer: + type: string + description: A JSON Pointer [RFC6901] to the value in the request document that caused the error. + examples: + - pointer: /data/attributes/title + - type: object + description: A string indicating which URI query parameter caused the error. + required: + - parameter + properties: + parameter: + type: string + description: A string indicating which URI query parameter caused the error. + examples: + - parameter: include + - type: object + description: A string indicating the name of a single request header which caused the error. + required: + - header + properties: + header: + type: string + description: A string indicating the name of a single request header which caused the error. + examples: + - header: Content-Type + description: |- + An object containing references to the primary source of the error. + + It SHOULD include one of the following members or be omitted: + + - pointer: a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901) to the + value in the request document that caused the error [e.g. "/data" for a primary + data object, or "/data/attributes/title" for a specific attribute]. + This MUST point to a value in the request document that exists; if it doesn’t, + the client SHOULD simply ignore the pointer. + - parameter: a string indicating which URI query parameter caused the error. + - header: a string indicating the name of a single request header which caused the + error. + BnaPipeline: + type: object + required: + - start_time + - state_machine_id + - status + - step + properties: + cost: + type: + - string + - 'null' + description: Cost of an analysis in USD + examples: + - '6.8941' + end_time: + type: + - string + - 'null' + format: date-time + description: End time + fargate_price_id: + type: + - integer + - 'null' + format: int32 + description: Fargate price identifier used to compute the cost + fargate_task_arn: + type: + - string + - 'null' + description: ARN of the Fargate task that performed the analysis + examples: + - arn:aws:ecs:us-west-2:123456789012:task/bna/29f979fc9fca402d94b014aa23d2f6e0 + s3_bucket: + type: + - string + - 'null' + description: Path of the S3 bucket where the results were stored + examples: + - united states/new mexico/santa rosa/24.05.4 + sqs_message: + type: + - string + - 'null' + description: Copy of the JSON message that was sent for processing + examples: + - city: santa rosa + country: United States + fips_code: '3570670' + region: new mexico + start_time: + type: string + format: date-time + description: Start time + state_machine_id: + type: string + format: uuid + description: |- + Pipeline identifier + This is the ID of the AWS state machine that was used to run the pipeline + status: + $ref: '#/components/schemas/PipelineStatus' + description: Pipeline status + step: + $ref: '#/components/schemas/BnaPipelineStep' + description: Last pipeline step that was completed + BnaPipelinePatch: + type: object + required: + - start_time + - status + - step + properties: + cost: + type: + - string + - 'null' + description: Cost of an analysis in USD + examples: + - '6.8941' + end_time: + type: + - string + - 'null' + format: date-time + description: End time + fargate_price_id: + type: + - integer + - 'null' + format: int32 + description: Fargate price identifier used to compute the cost + fargate_task_arn: + type: + - string + - 'null' + description: ARN of the Fargate task that performed the analysis + examples: + - arn:aws:ecs:us-west-2:123456789012:task/bna/29f979fc9fca402d94b014aa23d2f6e0 + s3_bucket: + type: + - string + - 'null' + description: Path of the S3 bucket where the results were stored + examples: + - united states/new mexico/santa rosa/24.05.4 + sqs_message: + type: + - string + - 'null' + description: Copy of the JSON message that was sent for processing + examples: + - city: santa rosa + country: United States + fips_code: '3570670' + region: new mexico + start_time: + type: string + format: date-time + description: Start time + status: + $ref: '#/components/schemas/PipelineStatus' + description: Pipeline status + step: + $ref: '#/components/schemas/BnaPipelineStep' + description: Last pipeline step that was completed + BnaPipelinePost: + type: object + required: + - step + properties: + cost: + type: + - string + - 'null' + description: Cost of an analysis in USD + examples: + - '6.8941' + end_time: + type: + - string + - 'null' + format: date-time + description: End time + fargate_price_id: + type: + - integer + - 'null' + format: int32 + description: Fargate price identifier used to compute the cost + fargate_task_arn: + type: + - string + - 'null' + description: ARN of the Fargate task that performed the analysis + examples: + - arn:aws:ecs:us-west-2:123456789012:task/bna/29f979fc9fca402d94b014aa23d2f6e0 + s3_bucket: + type: + - string + - 'null' + description: Path of the S3 bucket where the results were stored + examples: + - united states/new mexico/santa rosa/24.05.4 + sqs_message: + type: + - string + - 'null' + description: Copy of the JSON message that was sent for processing + examples: + - city: santa rosa + country: United States + fips_code: '3570670' + region: new mexico + step: + $ref: '#/components/schemas/BnaPipelineStep' + description: Last pipeline step that was completed + BnaPipelineStep: + type: string + enum: + - SqsMessage + - Setup + - Analysis + - Cleanup + BnaPipelines: + type: array + items: + $ref: '#/components/schemas/BnaPipeline' + Census: + type: object + description: Census information of a city + required: + - id + - city_id + - created_at + - fips_code + - pop_size + - population + properties: + city_id: + type: string + format: uuid + description: City identifier + created_at: + type: string + format: date-time + description: Creation date + fips_code: + type: string + description: Numerical city identifier given by the U.S. census, or 0 for non-US cities + examples: + - '4805000' + id: + type: integer + format: int32 + description: Census identifier + pop_size: + type: integer + format: int32 + description: City population size category (small (0), medium (1), large (2)) + examples: + - '1' + population: + type: integer + format: int32 + description: City population + examples: + - '907779' + CensusPost: + type: object + required: + - fips_code + - pop_size + - population + properties: + fips_code: + type: string + description: Numerical city identifier given by the U.S. census, or 0 for non-US cities + examples: + - '4805000' + pop_size: + type: integer + format: int32 + description: City population size category (small (0), medium (1), large (2)) + examples: + - '1' + population: + type: integer + format: int32 + description: City population + examples: + - '907779' + Cities: + type: array + items: + $ref: '#/components/schemas/City' + City: + type: object + description: Detailed information of a city + required: + - id + - country + - state + - name + - created_at + properties: + country: + $ref: '#/components/schemas/Country' + description: Country name + created_at: + type: string + format: date-time + description: Creation date + id: + type: string + format: uuid + description: City identifier + latitude: + type: + - number + - 'null' + format: double + description: |- + Geographic coordinate that specifies the north-south position of a point + on the surface of the Earth. + examples: + - '51.260197' + longitude: + type: + - number + - 'null' + format: double + description: |- + Geographic coordinate that specifies the east–west position of a point + on the surface of the Earth. + examples: + - '4.402771' + name: + type: string + description: City name + examples: + - Antwerp + region: + type: + - string + - 'null' + description: |- + Region name. A region can be a state, a province, a community, or + something similar depending on the country. If a country does not have + this concept, then the country name is used. + examples: + - Antwerp + speed_limit: + type: + - integer + - 'null' + format: int32 + description: Speed limit in kilometer per hour (km/h). + examples: + - '50' + state: + type: string + description: State name + examples: + - Antwerp + state_abbrev: + type: + - string + - 'null' + description: A short version of the state name, usually 2 or 3 character long + examples: + - VAN + updated_at: + type: + - string + - 'null' + format: date-time + description: Update date + CityCensuses: + type: object + required: + - city + - censuses + properties: + censuses: + type: array + items: + $ref: '#/components/schemas/Census' + city: + $ref: '#/components/schemas/City' + CityPost: + type: object + required: + - country + - name + - state + properties: + country: + $ref: '#/components/schemas/Country' + description: Country name + latitude: + type: + - number + - 'null' + format: double + description: |- + Geographic coordinate that specifies the north-south position of a point + on the surface of the Earth. + examples: + - '51.260197' + longitude: + type: + - number + - 'null' + format: double + description: |- + Geographic coordinate that specifies the east–west position of a point + on the surface of the Earth. + examples: + - '4.402771' + name: + type: string + description: City name + examples: + - Antwerp + region: + type: + - string + - 'null' + description: |- + Region name. A region can be a state, a province, a community, or + something similar depending on the country. If a country does not have + this concept, then the country name is used. + examples: + - Antwerp + speed_limit: + type: + - integer + - 'null' + format: int32 + description: Speed limit in kilometer per hour (km/h). + examples: + - '50' + state: + type: string + description: A short version of the state name, usually 2 or 3 character long + examples: + - VAN + state_abbrev: + type: + - string + - 'null' + description: A short version of the state name, usually 2 or 3 character long + examples: + - VAN + CityRatings: + type: object + required: + - city + - ratings + properties: + city: + $ref: '#/components/schemas/City' + ratings: + type: array + items: + $ref: '#/components/schemas/RatingSummary' + CoreServices: + type: object + properties: + dentists: + type: + - number + - 'null' + format: double + description: BNA category subscore for access to dentists. + maximum: 100 + minimum: 0 + doctors: + type: + - number + - 'null' + format: double + description: BNA category subscore for access to doctors. + maximum: 100 + minimum: 0 + grocery: + type: + - number + - 'null' + format: double + description: BNA category subscore for access to grocery stores. + maximum: 100 + minimum: 0 + hospitals: + type: + - number + - 'null' + format: double + description: BNA category subscore for access to hospitals. + maximum: 100 + minimum: 0 + pharmacies: + type: + - number + - 'null' + format: double + description: BNA category subscore for access to pharmacies. + maximum: 100 + minimum: 0 + score: + type: + - number + - 'null' + format: double + description: BNA category score for access to core services. + maximum: 100 + minimum: 0 + social_services: + type: + - number + - 'null' + format: double + description: BNA category subscore for access to social services. + maximum: 100 + minimum: 0 + Country: + type: string + enum: + - Australia + - Belgium + - Brazil + - Canada + - Chile + - Colombia + - Croatia + - Cuba + - England + - France + - Germany + - Greece + - Guatemala + - Iran + - Iraq + - Ireland + - Italy + - Mexico + - Netherlands + - New Zealand + - Northern Ireland + - Portugal + - Scotland + - Spain + - United States + - Vietnam + - Wales + FargatePrice: + type: object + description: A Fargate price used to estimate the cost of an analysis + required: + - id + - per_second + - created_at + properties: + created_at: + type: string + format: date-time + description: Creation date + id: + type: integer + format: int32 + description: Identifier of the Fargate Price rate used to compute the cost of the pipeline run + examples: + - '1' + per_second: + type: string + description: Cost to run Fargate for 1 second + examples: + - '0.0023' + FargatePrices: + type: array + items: + $ref: '#/components/schemas/FargatePrice' + description: A collection of Fargate prices. + Infrastructure: + type: object + properties: + high_stress_miles: + type: + - number + - 'null' + format: double + description: Total miles of high-stress streets in the measured area. + examples: + - 253 + low_stress_miles: + type: + - number + - 'null' + format: double + description: Total miles of low-stress streets and paths in the measured area. + examples: + - 127 + Opportunity: + type: object + properties: + employment: + type: + - number + - 'null' + format: double + description: BNA category subscore for access to job location areas. + maximum: 100 + minimum: 0 + higher_education: + type: + - number + - 'null' + format: double + description: BNA category subscore for access to universities and colleges. + maximum: 100 + minimum: 0 + k12_education: + type: + - number + - 'null' + format: double + description: BNA category subscore for access to k12 schools + maximum: 100 + minimum: 0 + score: + type: + - number + - 'null' + format: double + description: BNA category score for access to education and jobs. + maximum: 100 + minimum: 0 + technical_vocational_college: + type: + - number + - 'null' + format: double + description: BNA category subscore for access to technical and vocational colleges. + maximum: 100 + minimum: 0 + People: + type: object + properties: + people: + type: + - number + - 'null' + format: double + description: BNA category score for access to residential areas. + maximum: 100 + minimum: 0 + PipelineStatus: + type: string + enum: + - Completed + - Pending + - Processing + Rating: + type: object + required: + - id + - city_id + - score + - version + - infrastructure + - recreation + - opportunity + - core_services + - people + - retail + - transit + properties: + city_id: + type: string + format: uuid + description: City identifier + core_services: + $ref: '#/components/schemas/CoreServices' + description: BNA Core Services + id: + type: string + format: uuid + description: Rating identifier + infrastructure: + $ref: '#/components/schemas/Infrastructure' + description: BNAInfrastructure + opportunity: + $ref: '#/components/schemas/Opportunity' + description: BNA Opportunity + people: + $ref: '#/components/schemas/People' + description: BNA People + recreation: + $ref: '#/components/schemas/Recreation' + description: BNA Recreation + retail: + $ref: '#/components/schemas/Retail' + description: BNA Retail + score: + type: number + format: double + description: Total rating score + maximum: 100 + minimum: 0 + transit: + $ref: '#/components/schemas/Transit' + description: BNA Transit + version: + type: string + description: |- + Rating version + The format follows the [calver](https://calver.org) specification with + the YY.0M[.Minor] scheme. + RatingPost: + type: object + required: + - city_id + - version + - infrastructure + - recreation + - opportunity + - core_services + - people + - retail + - transit + properties: + city_id: + type: string + format: uuid + description: City identifier + core_services: + $ref: '#/components/schemas/CoreServices' + description: BNA Core Services + infrastructure: + $ref: '#/components/schemas/Infrastructure' + description: BNAInfrastructure + opportunity: + $ref: '#/components/schemas/Opportunity' + description: BNA Opportunity + people: + $ref: '#/components/schemas/People' + description: BNA People + recreation: + $ref: '#/components/schemas/Recreation' + description: BNA Recreation + retail: + $ref: '#/components/schemas/Retail' + description: BNA Retail + transit: + $ref: '#/components/schemas/Transit' + description: BNA Transit + version: + type: string + description: |- + Rating version + The format follows the [calver](https://calver.org) specification with + the YY.0M[.Minor] scheme. + RatingSummary: + type: object + required: + - id + - city_id + - created_at + - score + - version + properties: + city_id: + type: string + format: uuid + description: City identifier + created_at: + type: string + format: date-time + description: Creation date + id: + type: string + format: uuid + description: Analysis identifier + score: + type: number + format: double + description: BNA score + examples: + - '77.0' + version: + type: string + description: |- + Analysis version. The format follows the [calver](https://calver.org) + specification with the YY.0M[.Minor] scheme. + examples: + - '23.12' + RatingWithCity: + type: object + required: + - rating + - city + properties: + city: + $ref: '#/components/schemas/City' + rating: + $ref: '#/components/schemas/Rating' + Ratings: + type: array + items: + $ref: '#/components/schemas/Rating' + Recreation: + type: object + properties: + community_centers: + type: + - number + - 'null' + format: double + description: BNA category subscore for access to community centers. + maximum: 100 + minimum: 0 + parks: + type: + - number + - 'null' + format: double + description: BNA category subscore for access to parks. + maximum: 100 + minimum: 0 + score: + type: + - number + - 'null' + format: double + description: BNA category score for access to recreational facilities. + maximum: 100 + minimum: 0 + trails: + type: + - number + - 'null' + format: double + description: BNA category subscore for access to bikeable trails. + maximum: 100 + minimum: 0 + Retail: + type: object + properties: + retail: + type: + - number + - 'null' + format: double + description: BNA category score for access to major retail centers. + maximum: 100 + minimum: 0 + Submission: + type: object + required: + - id + - first_name + - last_name + - email + - country + - city + - fips_code + - consent + - status + - created_at + properties: + city: + type: string + description: City name + examples: + - Antwerp + consent: + type: boolean + description: Consent status + examples: + - 'true' + country: + $ref: '#/components/schemas/Country' + description: Country + created_at: + type: string + format: date-time + description: Creation date + email: + type: string + description: email address + examples: + - jane.doe@orgllc.com + fips_code: + type: string + description: Numerical city identifier given by the U.S. census, or 0 for non-US cities + examples: + - '4805000' + first_name: + type: string + description: First name + examples: + - Jane + id: + type: integer + format: int32 + description: Submission identifier + last_name: + type: string + description: Last name + occupation: + type: + - string + - 'null' + description: Job title or position + examples: + - CTO + organization: + type: + - string + - 'null' + description: Organization or company + examples: + - Organization LLC + region: + type: + - string + - 'null' + description: |- + Region name. A region can be a state, a province, a community, or + something similar depending on the country. If a country does not have + this concept, then the country name is used. + examples: + - Antwerp + status: + type: string + description: Submission status, e.g. "Pending" + examples: + - Pending + SubmissionPatch: + type: object + required: + - first_name + - last_name + - email + - country + - city + - fips_code + - consent + - status + properties: + city: + type: string + description: City name + examples: + - Antwerp + consent: + type: boolean + description: Consent status + examples: + - 'true' + country: + $ref: '#/components/schemas/Country' + description: Country + email: + type: string + description: email address + examples: + - jane.doe@orgllc.com + fips_code: + type: string + description: Numerical city identifier given by the U.S. census, or 0 for non-US cities + examples: + - '4805000' + first_name: + type: string + description: First name + examples: + - Jane + last_name: + type: string + description: Last name + occupation: + type: + - string + - 'null' + description: Job title or position + examples: + - CTO + organization: + type: + - string + - 'null' + description: Organization or company + examples: + - Organization LLC + region: + type: + - string + - 'null' + description: |- + Region name. A region can be a state, a province, a community, or + something similar depending on the country. If a country does not have + this concept, then the country name is used. + examples: + - Antwerp + status: + type: string + description: Submission status, e.g. "Pending" + examples: + - Pending + SubmissionPost: + type: object + required: + - first_name + - last_name + - email + - country + - city + - fips_code + - consent + - status + properties: + city: + type: string + description: City name + examples: + - Antwerp + consent: + type: boolean + description: Consent status + examples: + - 'true' + country: + $ref: '#/components/schemas/Country' + description: Country + email: + type: string + description: email address + examples: + - jane.doe@orgllc.com + fips_code: + type: string + description: Numerical city identifier given by the U.S. census, or 0 for non-US cities + examples: + - '4805000' + first_name: + type: string + description: First name + examples: + - Jane + last_name: + type: string + description: Last name + occupation: + type: + - string + - 'null' + description: Job title or position + examples: + - CTO + organization: + type: + - string + - 'null' + description: Organization or company + examples: + - Organization LLC + region: + type: + - string + - 'null' + description: |- + Region name. A region can be a state, a province, a community, or + something similar depending on the country. If a country does not have + this concept, then the country name is used. + examples: + - Antwerp + status: + type: string + description: Submission status, e.g. "Pending" + examples: + - Pending + Submissions: + type: array + items: + $ref: '#/components/schemas/Submission' + Transit: + type: object + properties: + transit: + type: + - number + - 'null' + format: double + description: BNA category score for access to major transit stops. + maximum: 100 + minimum: 0 +tags: +- name: city + description: City API endpoints +- name: pipeline + description: Pipeline API endpoints +- name: price + description: Price API endpoints +- name: rating + description: Rating API endpoints diff --git a/openapi.yaml b/openapi.yaml deleted file mode 100644 index dac812d..0000000 --- a/openapi.yaml +++ /dev/null @@ -1,1654 +0,0 @@ -openapi: 3.0.3 -info: - title: "BNA REST API" - description: "Provides a way to retrieve the BNA results programmatically." - version: "1.0.0" - contact: - name: The BNA Mechanics team - url: https://peopleforbikes.github.io/ -servers: - - url: "https://api.peopleforbikes.xyz" - description: Staging API - - url: "https://localhost:3000" - description: Local development API -tags: - - name: city - - name: price - - name: rating -paths: - /ratings: - get: - operationId: getRatings - summary: Get city rating summaries - description: Get city rating summaries. - tags: - - rating - responses: - 200: - $ref: "#/components/responses/rating_summaries" - parameters: - - $ref: "#/components/parameters/page" - - $ref: "#/components/parameters/page_size" - post: - operationId: postRatings - summary: Create new city rating - description: Create a new city rating - tags: - - rating - requestBody: - description: Create bna - content: - application/json: - schema: - $ref: "#/components/schemas/bna_post" - responses: - 201: - $ref: "#/components/responses/rating" - 403: - $ref: "#/components/responses/forbidden" - security: - - Authorize: [] - /ratings/analyses: - get: - operationId: getRatingsAnalyses - summary: "Get the city rating analys details" - description: "Get the city rating analys details" - tags: - - rating - responses: - 200: - $ref: "#/components/responses/analyses" - 403: - $ref: "#/components/responses/forbidden" - parameters: - - $ref: "#/components/parameters/page" - - $ref: "#/components/parameters/page_size" - security: - - Authorize: [] - post: - operationId: postRatingsAnalyses - summary: Submit a new city to analyze - description: Submit a new city to analyze - tags: - - rating - requestBody: - description: Create a new analysis performed by the brokenspoke-analyzer - content: - application/json: - schema: - $ref: "#/components/schemas/analysis_post" - responses: - 201: - $ref: "#/components/responses/analysis" - 400: - $ref: "#/components/responses/bad_request" - security: - - Authorize: [] - /ratings/analyses/{analysis_id}: - get: - operationId: getAnalysis - summary: Get the summary of a specific analysis - description: Get the summary of a specific analysis . - tags: - - rating - parameters: - - $ref: "#/components/parameters/analysis_id" - responses: - 200: - $ref: "#/components/responses/analysis" - 400: - $ref: "#/components/responses/bad_request" - 403: - $ref: "#/components/responses/forbidden" - 404: - $ref: "#/components/responses/not_found" - security: - - Authorize: [] - patch: - operationId: patchAnalysis - summary: Update an analysis - description: Update an analysis - tags: - - rating - requestBody: - description: Update a new analysis performed by the brokenspoke-analyzer - content: - application/json: - schema: - $ref: "#/components/schemas/analysis_patch" - responses: - 200: - $ref: "#/components/responses/analysis" - 400: - $ref: "#/components/responses/bad_request" - 403: - $ref: "#/components/responses/forbidden" - 404: - $ref: "#/components/responses/not_found" - security: - - Authorize: [] - parameters: - - $ref: "#/components/parameters/analysis_id" - /ratings/{rating_id}: - get: - operationId: getRating - summary: Get a specific city rating summary - description: Get a specific city rating summary. - tags: - - rating - responses: - 200: - $ref: "#/components/responses/rating" - 400: - $ref: "#/components/responses/bad_request" - 404: - $ref: "#/components/responses/not_found" - parameters: - - $ref: "#/components/parameters/rating_id" - - $ref: "#/components/parameters/component" - /ratings/{rating_id}/city: - get: - operationId: getRatingCity - summary: Get a specific city rating summary and its associated city details - description: Get a specific city rating summary and its associated city details. - tags: - - rating - responses: - 200: - $ref: "#/components/responses/rating_summary_with_city" - 400: - $ref: "#/components/responses/bad_request" - 404: - $ref: "#/components/responses/not_found" - parameters: - - $ref: "#/components/parameters/rating_id" - /cities: - get: - operationId: getCities - summary: Get city details - description: Get the details of all cities where an BNA analysis was performed. - tags: - - city - responses: - 200: - $ref: "#/components/responses/cities" - parameters: - - $ref: "#/components/parameters/page" - - $ref: "#/components/parameters/page_size" - post: - operationId: postCity - summary: Create a new city - description: Create a new city. - tags: - - city - requestBody: - description: Create a new city. - content: - application/json: - schema: - $ref: "#/components/schemas/city_post" - responses: - 201: - $ref: "#/components/responses/city" - 400: - $ref: "#/components/responses/bad_request" - parameters: - - $ref: "#/components/parameters/page" - - $ref: "#/components/parameters/page_size" - security: - - Authorize: [write] - /cities/submissions: - get: - operationId: getCitySubmissions - summary: Get the cities that were submitted for analysis - description: Get the cities that were submitted for analysis. - tags: - - city - responses: - 200: - $ref: "#/components/responses/submissions" - parameters: - - $ref: "#/components/parameters/page" - - $ref: "#/components/parameters/page_size" - post: - operationId: postCitySubmission - summary: Submit a new city for analysis - description: Submit a new city for analysis. - tags: - - city - requestBody: - description: Create a new analysis to be performed by the brokenspoke-analyzer - content: - application/json: - schema: - $ref: "#/components/schemas/submission_post" - responses: - 201: - $ref: "#/components/responses/submission" - 400: - $ref: "#/components/responses/bad_request" - /cities/submissions/{submission_id}: - get: - operationId: getCitySubmission - summary: Get the details of a specific sumission - description: Get the details of a specific sumission. - tags: - - city - responses: - 200: - $ref: "#/components/responses/submission" - 400: - $ref: "#/components/responses/bad_request" - 404: - $ref: "#/components/responses/not_found" - patch: - operationId: patchCitySubmissions - summary: Update the details of a specific sumission - description: Update the details of a specific sumission. - tags: - - city - requestBody: - description: Update the details of a specific sumission. - content: - application/json: - schema: - $ref: "#/components/schemas/submission_patch" - responses: - 200: - $ref: "#/components/responses/submission" - 400: - $ref: "#/components/responses/bad_request" - 403: - $ref: "#/components/responses/forbidden" - 404: - $ref: "#/components/responses/not_found" - security: - - Authorize: [] - parameters: - - $ref: "#/components/parameters/submission_id" - /cities/{country}/{region}/{name}: - get: - operationId: getCity - summary: Get the details of specific city - description: > - Get the details of a specific city where an BNA analysis was computed. - - tags: - - city - responses: - 200: - $ref: "#/components/responses/city" - 400: - $ref: "#/components/responses/bad_request" - 404: - $ref: "#/components/responses/not_found" - parameters: - - $ref: "#/components/parameters/country" - - $ref: "#/components/parameters/region" - - $ref: "#/components/parameters/name" - /cities/{country}/{region}/{name}/ratings: - get: - operationId: getCityRatings - summary: > - Get the details of a specific city with all the analysis that were performed - against it - - description: > - Get the details of a specific city with all the analysis that were performed - against it. - - tags: - - city - responses: - 200: - $ref: "#/components/responses/city_with_ratings" - 400: - $ref: "#/components/responses/bad_request" - 404: - $ref: "#/components/responses/not_found" - parameters: - - $ref: "#/components/parameters/country" - - $ref: "#/components/parameters/region" - - $ref: "#/components/parameters/name" - /cities/{country}/{region}/{name}/census: - get: - operationId: getCityCensus - summary: > - Get the details of a specific city with its associated census information. - - description: > - Get the details of a specific city with its associated census information. - - tags: - - city - responses: - 200: - $ref: "#/components/responses/city_with_census" - 400: - $ref: "#/components/responses/bad_request" - 404: - $ref: "#/components/responses/not_found" - post: - operationId: patchCityCensus - summary: Create census information for a specific city. - description: Create census information for a specific city. - tags: - - city - requestBody: - description: Create the census information for a specific city. - content: - application/json: - schema: - $ref: "#/components/schemas/census_post" - responses: - 201: - $ref: "#/components/responses/city_with_census" - 400: - $ref: "#/components/responses/bad_request" - 404: - $ref: "#/components/responses/not_found" - security: - - Authorize: [] - parameters: - - $ref: "#/components/parameters/country" - - $ref: "#/components/parameters/region" - - $ref: "#/components/parameters/name" - /ratings/enqueue: - post: - operationId: postRatingEnqueue - summary: Enqueue a city to process - description: Enqueue a city to process. - tags: - - rating - requestBody: - description: Create a new city to enqueue. - content: - application/json: - schema: - $ref: "#/components/schemas/enqueue_post" - responses: - 201: - $ref: "#/components/responses/enqueue" - 400: - $ref: "#/components/responses/bad_request" - 403: - $ref: "#/components/responses/forbidden" - security: - - Authorize: [] - /price/fargate: - get: - operationId: getPricesFargate - summary: "Get all the AWS Fargate prices used to compute analysis costs." - description: "Get all the AWS Fargate prices used to compute analysis costs." - tags: - - price - responses: - 200: - $ref: "#/components/responses/fargate_prices" - /price/fargate/{fargate_price_id}: - get: - operationId: getPriceFargate - summary: "Get a AWS Fargate price used to compute the cost of an analysis." - description: "Get a AWS Fargate price used to compute the cost of analysis cost." - tags: - - price - parameters: - - $ref: "#/components/parameters/fargate_price_id" - responses: - 200: - $ref: "#/components/responses/fargate_price" - 404: - $ref: "#/components/responses/not_found" -components: - schemas: - analysis: - type: object - properties: - cost: - type: string - format: decimal - description: "Cost of an analysis in USD" - example: "6.8941" - nullable: true - end_time: - type: string - format: date-time - description: "Date and time" - nullable: true - fargate_price_id: - type: integer - description: "Fargate price identifier" - example: 1 - nullable: true - fargate_task_arn: - type: string - description: "The ARN of the Fargate task that performed the analysis" - example: > - arn:aws:ecs:us-west-2:123456789012:task/bna/29f979fc9fca402d94b014aa23d2f6e0 - nullable: true - results_posted: - type: boolean - nullable: true - s3_bucket: - type: string - description: "the path of the S3 bucket where the results were stored" - example: "united states/new mexico/santa rosa/24.05.4" - nullable: true - sqs_message: - type: string - description: "Copy of the JSON message that was sent for processing" - example: >- - {"country":"United States","city":"santa rosa","region":"new mexico", - "fips_code":"3570670"} - nullable: true - start_time: - type: string - format: date-time - description: "Date and time" - nullable: true - state_machine_id: - $ref: "#/components/schemas/state_machine_id" - status: - $ref: "#/components/schemas/analysis_status" - step: - $ref: "#/components/schemas/step" - torn_down: - type: boolean - description: > - Flag indicating wether the resources were torn down or not at the end of the - analysis - nullable: true - required: - - state_machine_id - analysis_patch: - type: object - properties: - cost: - type: number - format: double - description: "Cost of an analysis in USD" - example: 6.8941 - nullable: true - end_time: - type: string - format: date-time - description: "Date and time" - nullable: true - fargate_task_arn: - type: string - description: "The ARN of the Fargate task that performed the analysis" - example: > - arn:aws:ecs:us-west-2:123456789012:task/bna/29f979fc9fca402d94b014aa23d2f6e0 - nullable: true - results_posted: - type: boolean - nullable: true - s3_bucket: - type: string - description: "the path of the S3 bucket where the results were stored" - example: "united states/new mexico/santa rosa/24.05.4" - nullable: true - sqs_message: - type: string - description: "Copy of the JSON message that was sent for processing" - example: >- - {"country":"United States","city":"santa rosa","region":"new mexico", - "fips_code":"3570670"} - nullable: true - start_time: - type: string - format: date-time - description: "Date and time" - nullable: true - status: - $ref: "#/components/schemas/analysis_status" - step: - $ref: "#/components/schemas/step" - torn_down: - type: boolean - description: > - Flag indicating wether the resources were torn down or not at the end of the - analysis - nullable: true - analysis_post: - type: object - properties: - cost: - type: number - format: double - description: "Cost of an analysis in USD" - example: 6.8941 - nullable: true - end_time: - type: string - format: date-time - description: "Date and time" - nullable: true - fargate_task_arn: - type: string - description: "The ARN of the Fargate task that performed the analysis" - example: > - arn:aws:ecs:us-west-2:123456789012:task/bna/29f979fc9fca402d94b014aa23d2f6e0 - nullable: true - result_posted: - type: boolean - nullable: true - s3_bucket: - type: string - description: "the path of the S3 bucket where the results were stored" - example: "united states/new mexico/santa rosa/24.05.4" - nullable: true - sqs_message: - type: string - description: "Copy of the JSON message that was sent for processing" - example: >- - {"country":"United States","city":"santa rosa","region":"new mexico", - "fips_code":"3570670"} - nullable: true - start_time: - type: string - format: date-time - description: "Date and time" - nullable: true - step: - $ref: "#/components/schemas/step" - torn_down: - type: boolean - description: > - Flag indicating wether the resources were torn down or not at the end of the - analysis - nullable: true - state_machine_id: - $ref: "#/components/schemas/state_machine_id" - fargate_price_id: - type: number - description: > - Identifier of the Fargate Price rate used to compute the cost of the pipeline - run. - status: - $ref: "#/components/schemas/analysis_status" - analysis_status: - type: string - enum: - - Completed - - Pending - - Processing - description: "BNA Pipeline status" - example: "Pending" - api_gateway_id: - type: string - description: "API Gateway ID associated with the request " - example: "blfwkg8nvHcEJnQ=" - bna: - type: object - properties: - id: - type: string - format: uuid - description: "Analysis identifier" - example: "1a759b85-cd87-4bb1-9efa-5789e38e9982" - nullable: false - city_id: - type: string - format: uuid - description: "City identifier" - example: "6d1927b4-3474-4ce0-9b2e-2a1f5a7d91bd" - community_centers: - type: number - description: "BNA category subscore for access to community centers" - example: 70.7 - nullable: true - coreservices_score: - type: number - description: "BNA category score for access to core services" - example: 78.15 - nullable: true - dentists: - type: number - description: "BNA category subscore for access to dentists" - example: 68.69 - nullable: true - doctors: - type: number - description: "BNA category subscore for access to doctors" - example: 73.51 - nullable: true - employment: - type: number - description: "BNA category subscore for access to job location areas" - example: 0.0 - nullable: true - grocery: - type: number - description: "BNA category subscore for access to grocery stores" - example: 83.02 - nullable: true - high_stress_miles: - type: number - description: "Total miles of high-stress streets in the measured area" - example: 437.8 - nullable: true - higher_education: - type: number - description: "BNA category subscore for access to universities and colleges" - example: 84.76 - nullable: true - hospitals: - type: number - description: "BNA category subscore for access to hospitals" - example: 82.43 - nullable: true - k12_education: - type: number - description: "BNA category subscore for access to k12 schools" - example: 6.63 - nullable: true - low_stress_miles: - type: number - description: "Total miles of low-stress streets and paths in the measured area" - example: 1862.2 - nullable: true - opportunity_score: - type: number - description: BNA category score for access to education and jobs"" - example: 79.91 - nullable: true - parks: - type: number - description: "BNA category subscore for access to parks" - example: 78.49 - nullable: true - people: - type: number - description: "BNA category score for access to residential areas" - example: 75.81 - nullable: true - pharmacies: - type: number - description: "BNA category subscore for access to pharmacies" - example: 76.62 - nullable: true - recreation_score: - type: number - description: "BNA category score for access to recreational facilities" - example: 82.13 - nullable: true - recreation_trails: - type: number - description: "BNA category subscore for access to bikeable trails" - example: 94.45 - nullable: true - retail: - type: number - description: "BNA category score for access to major retail centers" - example: 73.71 - nullable: true - score: - type: number - description: "BNA total score" - example: 77.0 - social_services: - type: number - description: "BNA category subscore for access to social services" - example: 77.82 - nullable: true - technical_vocational_college: - type: number - description: "BNA category subscore for access to technical and vocational colleges" - example: 81.67 - nullable: true - transit: - type: number - description: "BNA category score for access to major transit stops" - example: 71.59 - nullable: true - version: - type: string - description: > - Analysis version. The format follows the [calver](https://calver.org) - specification with the YY.0M[.Minor] scheme. - - example: "23.02" - required: - - id - - city_id - - score - - version - bna_post: - type: object - properties: - core_services: - $ref: "#/components/schemas/core_services" - infrastructure: - $ref: "#/components/schemas/infrastructure" - opportunity: - $ref: "#/components/schemas/opportunity" - people: - $ref: "#/components/schemas/people" - recreation: - $ref: "#/components/schemas/recreation" - retail: - $ref: "#/components/schemas/retail" - summary: - $ref: "#/components/schemas/bna_summary" - transit: - $ref: "#/components/schemas/transit" - required: - - core_services - - infrastructure - - opportunity - - people - - recreation - - retail - - summary - - transit - bna_summary: - type: object - properties: - rating_id: - type: string - format: uuid - description: "Analysis identifier" - example: "1a759b85-cd87-4bb1-9efa-5789e38e9982" - city_id: - type: string - format: uuid - description: "City identifier" - example: "6d1927b4-3474-4ce0-9b2e-2a1f5a7d91bd" - created_at: - type: string - format: date-time - description: "Date and time" - score: - type: number - description: "BNA score" - example: 77.0 - version: - type: string - description: > - Analysis version. The format follows the [calver](https://calver.org) - specification with the YY.0M[.Minor] scheme. - - example: "23.02" - required: - - city_id - - rating_id - - score - - version - bna_summary_with_city: - type: array - items: - allOf: - - $ref: "#/components/schemas/bna_summary" - - $ref: "#/components/schemas/city" - census: - type: object - description: "Census information" - properties: - census_id: - type: integer - example: 788 - city_id: - type: string - format: uuid - description: "City identifier" - example: "6d1927b4-3474-4ce0-9b2e-2a1f5a7d91bd" - created_at: - type: string - format: date-time - description: "Date and time" - fips_code: - type: string - description: > - Numerical city identifier given by the U.S. census, or 0 for non-US cities - example: "4805000" - pop_size: - type: integer - description: > - City population size category (small (0), medium (1), large (2)) - - enum: - - 0 - - 1 - - 2 - example: 2 - population: - type: integer - description: "City population" - example: 907779 - census_post: - type: object - properties: - fips_code: - type: string - description: > - Numerical city identifier given by the U.S. census, or 0 for non-US cities - example: "4805000" - pop_size: - type: integer - description: > - City population size category (small (0), medium (1), large (2)) - - enum: - - 0 - - 1 - - 2 - example: 2 - population: - type: integer - description: "City population" - example: 907779 - city: - type: object - properties: - id: - type: string - format: uuid - description: "City identifier" - example: "6d1927b4-3474-4ce0-9b2e-2a1f5a7d91bd" - nullable: false - country: - $ref: "#/components/schemas/country" - created_at: - type: string - format: date-time - description: "Date and time" - latitude: - type: number - description: > - Geographic coordinate that specifies the north-south position of a point on the - surface of the Earth. - example: 51.2194 - longitude: - type: number - description: > - Geographic coordinate that specifies the east–west position of a point on the - surface of the Earth. - - example: 4.4025 - name: - type: string - description: "City name" - example: "Antwerp" - region: - type: string - description: > - Region name. A region can be a state, a province, a community, or something - similar depending on the country. If a country does not have this concept, then - the country name is used. - - example: "Belgium" - speed_limit: - type: number - description: "Speed limit in kilometer per hour (km/h)." - example: 50 - state: - type: string - description: "State name" - example: "Antwerp" - state_abbrev: - type: string - description: "A short version of the state name, usually 2 or 3 character long." - example: "VAN" - updated_at: - type: string - format: date-time - description: "Date and time" - required: - - country - - created_at - - id - - name - - state - city_post: - type: object - properties: - country: - $ref: "#/components/schemas/country" - latitude: - type: number - description: > - Geographic coordinate that specifies the north-south position of a point on the - surface of the Earth. - example: 51.2194 - nullable: true - longitude: - type: number - description: > - Geographic coordinate that specifies the east–west position of a point on the - surface of the Earth. - - example: 4.4025 - nullable: true - name: - type: string - description: "City name" - example: "Antwerp" - state: - type: string - description: "State name" - example: "Antwerp" - state_abbrev: - type: string - description: "A short version of the state name, usually 2 or 3 character long." - example: "VAN" - speed_limit: - type: number - description: "Speed limit in kilometer per hour (km/h)." - example: 50 - nullable: true - required: - - country - - name - core_services: - type: object - properties: - dentists: - type: number - description: "BNA category subscore for access to dentists" - example: 68.69 - doctors: - type: number - description: "BNA category subscore for access to doctors" - example: 73.51 - grocery: - type: number - description: "BNA category subscore for access to grocery stores" - example: 83.02 - hospitals: - type: number - description: "BNA category subscore for access to hospitals" - example: 82.43 - pharmacies: - type: number - description: "BNA category subscore for access to pharmacies" - example: 76.62 - score: - type: number - description: "BNA total score" - example: 77.0 - social_services: - type: number - description: "BNA category subscore for access to social services" - example: 77.82 - country: - type: string - enum: - - Australia - - Belgium - - Brazil - - Canada - - Chile - - Colombia - - Croatia - - Cuba - - England - - France - - Germany - - Greece - - Guatemala - - Iran - - Iraq - - Ireland - - Italy - - Mexico - - Netherlands - - New Zealand - - Northern Ireland - - Portugal - - Scotland - - Spain - - United States - - Vietnam - - Wales - enqueue: - type: object - properties: - country: - $ref: "#/components/schemas/country" - city: - type: string - description: "City name" - example: "Antwerp" - region: - type: string - description: > - Region name. A region can be a state, a province, a community, or something - similar depending on the country. If a country does not have this concept, then - the country name is used. - - example: "Belgium" - fips_code: - type: string - description: > - Numerical city identifier given by the U.S. census, or 0 for non-US cities - example: "4805000" - enqueue_post: - type: object - properties: - country: - $ref: "#/components/schemas/country" - city: - type: string - description: "City name" - example: "Antwerp" - region: - type: string - description: > - Region name. A region can be a state, a province, a community, or something - similar depending on the country. If a country does not have this concept, then - the country name is used. - - example: "Belgium" - fips_code: - type: string - description: > - Numerical city identifier given by the U.S. census, or 0 for non-US cities - example: "4805000" - error: - type: object - description: > - API Error object as described in - - properties: - id: - $ref: "#/components/schemas/api_gateway_id" - details: - type: string - description: "detailed error message" - example: "the entry was not found" - status: - type: integer - description: "HTTP status associated with the error" - minimum: 400 - example: 404 - title: - type: string - description: "Error title" - example: "Item Not Found" - source: - $ref: "#/components/schemas/source" - errors: - type: array - description: "A collection of errors" - items: - $ref: "#/components/schemas/error" - header: - type: string - description: "The name of a single request header which caused the error" - example: "Authorization" - infrastructure: - type: object - properties: - low_stress_miles: - type: number - description: "Total miles of low-stress streets and paths in the measured area" - example: 1862.2 - high_stress_miles: - type: number - description: "Total miles of high-stress streets in the measured area" - example: 437.8 - opportunity: - type: object - properties: - employment: - type: number - description: "BNA category subscore for access to job location areas" - example: 0.0 - higher_education: - type: number - description: "BNA category subscore for access to universities and colleges" - example: 84.76 - k12_education: - type: number - description: "BNA category subscore for access to k12 schools" - example: 6.63 - score: - type: number - description: BNA category score for access to education and jobs"" - example: 79.91 - technical_vocational_college: - type: number - description: "BNA category subscore for access to technical and vocational colleges" - example: 81.67 - parameter: - type: string - description: "The URI query parameter caused the error" - example: "/bnas/analysis/e6aade5a-b343-120b-dbaa-bd916cd99221?" - pointer: - type: string - description: > - A JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901) to the value in - the request document that caused the error [e.g. "/data" for a primary data - object, or "/data/attributes/title" for a specific attribute]. - - example: "/data" - recreation: - type: object - properties: - community_centers: - type: number - description: "BNA category subscore for access to community centers" - example: 70.7 - parks: - type: number - description: "BNA category subscore for access to parks" - example: 78.49 - recreation_trails: - type: number - description: "BNA category subscore for access to bikeable trails" - example: 94.45 - score: - type: number - description: "BNA total score" - example: 77.0 - source: - type: object - description: "An object containing references to the primary source of the error." - oneOf: - - $ref: "#/components/schemas/parameter" - - $ref: "#/components/schemas/pointer" - - $ref: "#/components/schemas/header" - example: - source: Parameter "/bnas/analysis/e6aade5a-b343-120b-dbaa-bd916cd99221?" - state_machine_id: - type: string - format: uuid - description: "ID of the AWS state machine that was used to run the pipeline" - example: "38f4f54e-98d6-4048-8c0f-99cde05a7e76" - step: - type: string - enum: - - SqsMessage - - Setup - - Analysis - - Cleanup - description: "Indicate the last step of the pipeline that completed successfully" - example: "Cleanup" - submission: - type: object - properties: - city: - type: string - description: "City name" - example: "Antwerp" - consent: - type: boolean - nullable: true - description: "Consent status" - example: true - country: - $ref: "#/components/schemas/country" - created_at: - type: string - format: date-time - description: "Date and time" - email: - type: string - description: Email address - example: "jane.doe@orgllc.com" - fips_code: - type: string - description: > - Numerical city identifier given by the U.S. census, or 0 for non-US cities - example: "4805000" - first_name: - type: string - description: "First name" - example: "Jane" - id: - type: integer - description: "Submission identifier" - example: 1 - last_name: - type: string - description: "Last name" - example: "Doe" - organization: - type: string - description: "Name of the organization" - example: "Organization LLC" - region: - type: string - description: > - Region name. A region can be a state, a province, a community, or something - similar depending on the country. If a country does not have this concept, then - the country name is used. - - example: "Belgium" - submission_status: - type: string - description: "The current status of the submission" - example: "Pending" - occupation: - type: string - description: "Job title or position" - example: "CTO" - submission_patch: - type: object - properties: - first_name: - type: string - description: "First name" - example: "Jane" - nullable: true - last_name: - type: string - description: "Last name" - example: "Doe" - nullable: true - occupation: - type: string - description: "Job title or position" - example: "CTO" - nullable: true - organization: - type: string - description: "Name of the organization" - example: "Organization LLC" - nullable: true - email: - type: string - description: Email address - example: "jane.doe@orgllc.com" - nullable: true - country: - $ref: "#/components/schemas/country" - city: - type: string - description: "City name" - example: "Antwerp" - nullable: true - region: - type: string - description: > - Region name. A region can be a state, a province, a community, or something - similar depending on the country. If a country does not have this concept, then - the country name is used. - - example: "Belgium" - nullable: true - fips_code: - type: string - description: > - Numerical city identifier given by the U.S. census, or 0 for non-US cities - example: "4805000" - nullable: true - consent: - type: boolean - description: "Consent status" - example: true - nullable: true - submission_status: - type: string - description: "The current status of the submission" - example: "Pending" - nullable: true - submission_post: - type: object - properties: - first_name: - type: string - description: "First name" - example: "Jane" - last_name: - type: string - description: "Last name" - example: "Doe" - occupation: - type: string - description: "Job title or position" - example: "CTO" - nullable: true - organization: - type: string - description: "Name of the organization" - example: "Organization LLC" - nullable: true - email: - type: string - description: Email address - example: "jane.doe@orgllc.com" - country: - $ref: "#/components/schemas/country" - city: - type: string - description: "City name" - example: "Antwerp" - region: - type: string - description: > - Region name. A region can be a state, a province, a community, or something - similar depending on the country. If a country does not have this concept, then - the country name is used. - - example: "Belgium" - nullable: true - fips_code: - type: string - description: > - Numerical city identifier given by the U.S. census, or 0 for non-US cities - example: "4805000" - consent: - type: boolean - description: "Consent status" - example: true - submission_status: - type: string - description: "The current status of the submission" - example: "Pending" - required: - - city - - consent - - country - - email - - fips_code - - first_name - - last_name - submissions: - type: array - description: "A collection of submissions" - items: - $ref: "#/components/schemas/submission" - people: - type: object - properties: - score: - type: number - retail: - type: object - properties: - score: - type: number - transit: - type: object - properties: - score: - type: number - fargate_price: - type: object - properties: - fargate_price_id: - type: number - description: > - Identifier of the Fargate Price rate used to compute the cost of the pipeline - run. - example: 1 - per_second: - type: string - format: decimal - description: Cost to run Fargate for 1 second - example: "0.0023" - created_at: - type: string - format: date-time - description: "Date and time" - - parameters: - rating_id: - name: "rating_id" - in: "path" - description: "Analysis identifier" - required: true - schema: - type: string - format: uuid - description: "Analysis identifier" - example: "1a759b85-cd87-4bb1-9efa-5789e38e9982" - country: - name: "country" - in: "path" - description: "Country name" - required: true - schema: - $ref: "#/components/schemas/country" - name: - name: "name" - in: "path" - description: "City name" - required: true - schema: - type: string - description: "City name" - example: "Antwerp" - region: - name: "region" - in: "path" - description: > - Region name. A region can be a state, a province, a community, or something - similar depending on the country. If a country does not have this concept, then - the country name is used. - - required: true - schema: - type: string - description: > - Region name. A region can be a state, a province, a community, or something - similar depending on the country. If a country does not have this concept, then - the country name is used. - - example: "Belgium" - analysis_id: - name: analysis_id - in: path - required: true - description: State Machine Identifier - schema: - $ref: "#/components/schemas/state_machine_id" - submission_id: - name: "submission_id" - in: "path" - description: "Submission identifier" - required: true - schema: - type: integer - description: "Submission identifier" - example: 1 - component: - name: component - in: query - required: false - description: > - Select a component to retrieve alongside the BNA summary. If none is specified, - all the components are returned. - schema: - type: string - enum: - - All - - CoreServices - - Infratructure - - Opportunity - - People - - Recreation - - Retail - - Summary - - Transit - example: All - page: - name: page - in: query - required: false - description: "Page index (starting at 0)" - schema: - type: integer - default: 1 - example: 1 - minimum: 1 - maximum: 65535 - page_size: - name: page_size - in: query - required: false - description: "The number of items to be returned per page (1..50)" - schema: - type: integer - default: 25 - example: 25 - minimum: 1 - maximum: 65535 - fargate_price_id: - name: fargate_price_id - in: path - required: true - description: "Identifier of a Fargate price" - schema: - type: integer - responses: - analyses: - description: "A collection of BNA analysis" - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/analysis" - analysis: - description: "An analysis" - content: - application/json: - schema: - $ref: "#/components/schemas/analysis" - bad_request: - description: > - Your request was formatted incorrectly or missing required parameters. - content: - application/json: - schema: - $ref: "#/components/schemas/errors" - - rating: - description: "A city rating" - content: - application/json: - schema: - $ref: "#/components/schemas/bna" - rating_summaries: - description: "A collection of city rating summaries" - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/bna_summary" - rating_summary: - description: "A city rating Summary object" - content: - application/json: - schema: - $ref: "#/components/schemas/bna_summary" - rating_summary_with_city: - description: "A city rating summary object and its associated city" - content: - application/json: - schema: - type: array - items: - anyOf: - - $ref: "#/components/schemas/bna_summary_with_city" - - $ref: "#/components/schemas/city" - ratings: - description: "A collection of city ratings" - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/bna" - cities: - description: "Array of cities" - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/city" - city: - description: "A city" - content: - application/json: - schema: - $ref: "#/components/schemas/city" - city_with_ratings: - description: "A city with its associated BNA analyses" - content: - application/json: - schema: - type: array - items: - anyOf: - - $ref: "#/components/schemas/city" - - $ref: "#/components/schemas/bna_summary" - city_with_census: - description: "A city with its census information" - content: - application/json: - schema: - type: array - items: - anyOf: - - $ref: "#/components/schemas/city" - - $ref: "#/components/schemas/census" - enqueue: - description: "An entry to enqueue a city to process " - content: - application/json: - schema: - $ref: "#/components/schemas/enqueue" - forbidden: - description: > - You weren't authorized to make your request; most likely this indicates an issue - with your credentials or permissions. - content: - application/json: - schema: - $ref: "#/components/schemas/errors" - - not_found: - description: > - The particular resource you are requesting was not found. This occurs, for - example, if you request a resource by an id that does not exist. - content: - application/json: - schema: - $ref: "#/components/schemas/errors" - - submission: - description: "A submission" - content: - application/json: - schema: - $ref: "#/components/schemas/submission" - submissions: - description: "A collection of submission" - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/submission" - fargate_price: - description: "Fargate price used to estimate the cost of an analysis." - content: - application/json: - schema: - $ref: "#/components/schemas/fargate_price" - fargate_prices: - description: "A collection of Fargate prices" - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/fargate_price" - - securitySchemes: - Authorize: - description: | - Bearer token using a JWT. - - Authenticate against AWS Cognito using the AWS CLI to obtain the token (replace the placeholders): - - `aws cognito-idp initiate-auth --auth-flow USER_PASSWORD_AUTH --client-id --auth-parameters USERNAME=,PASSWORD=` - type: http - scheme: bearer - bearerFormat: JWT