From 0ba79827d71d33b542ec71e4542c2be3ebbb66e7 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Fri, 18 Jan 2019 14:37:26 -0800 Subject: rust codegen --- rust/fatcat-api-spec/README.md | 2 +- rust/fatcat-api-spec/api.yaml | 7 +++++-- rust/fatcat-api-spec/api/swagger.yaml | 21 +++++++++++++-------- rust/fatcat-api-spec/src/models.rs | 6 ++++-- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/rust/fatcat-api-spec/README.md b/rust/fatcat-api-spec/README.md index ae2181c6..99522241 100644 --- a/rust/fatcat-api-spec/README.md +++ b/rust/fatcat-api-spec/README.md @@ -13,7 +13,7 @@ To see how to make this your own, look here: [README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md) - API version: 0.1.0 -- Build date: 2019-01-18T00:35:05.824Z +- Build date: 2019-01-18T22:02:14.046Z This autogenerated project defines an API crate `fatcat` which contains: * An `Api` trait defining the API in Rust. diff --git a/rust/fatcat-api-spec/api.yaml b/rust/fatcat-api-spec/api.yaml index 70a27b76..b35d918e 100644 --- a/rust/fatcat-api-spec/api.yaml +++ b/rust/fatcat-api-spec/api.yaml @@ -249,7 +249,7 @@ definitions: properties: <<: *ENTITYPROPS cdx: - # limit of 200 CDX lines, at least to start + # limit of 200 CDX lines, at least to start? type: array items: type: object @@ -264,7 +264,9 @@ definitions: example: "org,asheesh)/apus/ch1/node15.html" timestamp: type: string - example: "20020429162520" + format: date-time + example: "2016-09-19T17:20:24Z" + description: "UTC, 'Z'-terminated, second (or better) precision" url: type: string # NOTE: not format:url to allow alternatives @@ -302,6 +304,7 @@ definitions: timestamp: type: string format: date-time + description: "same format as CDX line timestamp (UTC, etc). Corresponds to the overall capture timestamp. Can be the earliest or average of CDX timestamps if that makes sense." release_ids: type: array items: diff --git a/rust/fatcat-api-spec/api/swagger.yaml b/rust/fatcat-api-spec/api/swagger.yaml index 7a1c2755..98f34751 100644 --- a/rust/fatcat-api-spec/api/swagger.yaml +++ b/rust/fatcat-api-spec/api/swagger.yaml @@ -7592,6 +7592,9 @@ definitions: timestamp: type: "string" format: "date-time" + description: "same format as CDX line timestamp (UTC, etc). Corresponds to\ + \ the overall capture timestamp. Can be the earliest or average of CDX timestamps\ + \ if that makes sense." original_url: type: "string" format: "url" @@ -7651,14 +7654,14 @@ definitions: sha256: "cb1c378f464d5935ddaa8de28446d82638396c61f042295d7fb85e3cccc9e452" mimetype: "text/html" url: "http://www.asheesh.org:80/APUS/ch1/node15.html" - timestamp: "20020429162520" + timestamp: "2016-09-19T17:20:24Z" - sha1: "e9dd75237c94b209dc3ccd52722de6931a310ba3" surt: "org,asheesh)/apus/ch1/node15.html" status_code: 200 sha256: "cb1c378f464d5935ddaa8de28446d82638396c61f042295d7fb85e3cccc9e452" mimetype: "text/html" url: "http://www.asheesh.org:80/APUS/ch1/node15.html" - timestamp: "20020429162520" + timestamp: "2016-09-19T17:20:24Z" ident: "q3nouwy3nnbsvo3h5klxsx4a7y" extra: "{}" state: "wip" @@ -7810,14 +7813,14 @@ definitions: sha256: "cb1c378f464d5935ddaa8de28446d82638396c61f042295d7fb85e3cccc9e452" mimetype: "text/html" url: "http://www.asheesh.org:80/APUS/ch1/node15.html" - timestamp: "20020429162520" + timestamp: "2016-09-19T17:20:24Z" - sha1: "e9dd75237c94b209dc3ccd52722de6931a310ba3" surt: "org,asheesh)/apus/ch1/node15.html" status_code: 200 sha256: "cb1c378f464d5935ddaa8de28446d82638396c61f042295d7fb85e3cccc9e452" mimetype: "text/html" url: "http://www.asheesh.org:80/APUS/ch1/node15.html" - timestamp: "20020429162520" + timestamp: "2016-09-19T17:20:24Z" ident: "q3nouwy3nnbsvo3h5klxsx4a7y" extra: "{}" state: "wip" @@ -7841,14 +7844,14 @@ definitions: sha256: "cb1c378f464d5935ddaa8de28446d82638396c61f042295d7fb85e3cccc9e452" mimetype: "text/html" url: "http://www.asheesh.org:80/APUS/ch1/node15.html" - timestamp: "20020429162520" + timestamp: "2016-09-19T17:20:24Z" - sha1: "e9dd75237c94b209dc3ccd52722de6931a310ba3" surt: "org,asheesh)/apus/ch1/node15.html" status_code: 200 sha256: "cb1c378f464d5935ddaa8de28446d82638396c61f042295d7fb85e3cccc9e452" mimetype: "text/html" url: "http://www.asheesh.org:80/APUS/ch1/node15.html" - timestamp: "20020429162520" + timestamp: "2016-09-19T17:20:24Z" ident: "q3nouwy3nnbsvo3h5klxsx4a7y" extra: "{}" state: "wip" @@ -9072,7 +9075,9 @@ definitions: example: "org,asheesh)/apus/ch1/node15.html" timestamp: type: "string" - example: "20020429162520" + format: "date-time" + example: "2016-09-19T17:20:24Z" + description: "UTC, 'Z'-terminated, second (or better) precision" url: type: "string" example: "http://www.asheesh.org:80/APUS/ch1/node15.html" @@ -9102,7 +9107,7 @@ definitions: sha256: "cb1c378f464d5935ddaa8de28446d82638396c61f042295d7fb85e3cccc9e452" mimetype: "text/html" url: "http://www.asheesh.org:80/APUS/ch1/node15.html" - timestamp: "20020429162520" + timestamp: "2016-09-19T17:20:24Z" upperCaseName: "WEBCAPTURE_ENTITY_CDX" release_entity_abstracts: properties: diff --git a/rust/fatcat-api-spec/src/models.rs b/rust/fatcat-api-spec/src/models.rs index 5d05b737..1a34dd48 100644 --- a/rust/fatcat-api-spec/src/models.rs +++ b/rust/fatcat-api-spec/src/models.rs @@ -1008,6 +1008,7 @@ pub struct WebcaptureEntity { #[serde(skip_serializing_if = "Option::is_none")] pub release_ids: Option>, + /// same format as CDX line timestamp (UTC, etc). Corresponds to the overall capture timestamp. Can be the earliest or average of CDX timestamps if that makes sense. #[serde(rename = "timestamp")] #[serde(skip_serializing_if = "Option::is_none")] pub timestamp: Option>, @@ -1091,8 +1092,9 @@ pub struct WebcaptureEntityCdx { #[serde(rename = "surt")] pub surt: String, + /// UTC, 'Z'-terminated, second (or better) precision #[serde(rename = "timestamp")] - pub timestamp: String, + pub timestamp: chrono::DateTime, #[serde(rename = "url")] pub url: String, @@ -1114,7 +1116,7 @@ pub struct WebcaptureEntityCdx { } impl WebcaptureEntityCdx { - pub fn new(surt: String, timestamp: String, url: String, sha1: String) -> WebcaptureEntityCdx { + pub fn new(surt: String, timestamp: chrono::DateTime, url: String, sha1: String) -> WebcaptureEntityCdx { WebcaptureEntityCdx { surt: surt, timestamp: timestamp, -- cgit v1.2.3