diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-24 01:31:44 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-24 15:21:32 -0700 |
commit | 63db335123d8dde1c4e701668c07805094ff88e8 (patch) | |
tree | 83f0387b6568d09c525330d414b8e21c21d43e03 /rust/fatcat-api | |
parent | eb094c1829d1fc9bb48e687921eeff656b69e2c2 (diff) | |
download | fatcat-63db335123d8dde1c4e701668c07805094ff88e8.tar.gz fatcat-63db335123d8dde1c4e701668c07805094ff88e8.zip |
WIP on API spec improvements
Fixes a bunch of i64/i32/isize stuff
Diffstat (limited to 'rust/fatcat-api')
-rw-r--r-- | rust/fatcat-api/README.md | 2 | ||||
-rw-r--r-- | rust/fatcat-api/api.yaml | 56 | ||||
-rw-r--r-- | rust/fatcat-api/api/swagger.yaml | 38 | ||||
-rw-r--r-- | rust/fatcat-api/examples/client.rs | 4 | ||||
-rw-r--r-- | rust/fatcat-api/examples/server_lib/server.rs | 4 | ||||
-rw-r--r-- | rust/fatcat-api/src/client.rs | 4 | ||||
-rw-r--r-- | rust/fatcat-api/src/lib.rs | 12 | ||||
-rw-r--r-- | rust/fatcat-api/src/models.rs | 50 |
8 files changed, 134 insertions, 36 deletions
diff --git a/rust/fatcat-api/README.md b/rust/fatcat-api/README.md index 39037531..03472ac3 100644 --- a/rust/fatcat-api/README.md +++ b/rust/fatcat-api/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: 2018-05-24T01:24:11.840Z +- Build date: 2018-05-24T08:29:24.065Z This autogenerated project defines an API crate `fatcat` which contains: * An `Api` trait defining the API in Rust. diff --git a/rust/fatcat-api/api.yaml b/rust/fatcat-api/api.yaml index 0ecb0285..3fd7a213 100644 --- a/rust/fatcat-api/api.yaml +++ b/rust/fatcat-api/api.yaml @@ -26,6 +26,7 @@ x-entity-props: &ENTITYPROPS revision: type: integer example: 42 + format: int64 redirect: type: string #format: uuid @@ -33,19 +34,23 @@ x-entity-props: &ENTITYPROPS editgroup_id: type: integer example: 16 + format: int64 x-entity-edit-props: &ENTITYEDITPROPS edit_id: type: integer example: 847 + format: int64 ident: type: string example: "f1f046a3-45c9-4b99-adce-000000000001" revision: type: integer example: 42 + format: int64 editgroup_id: type: integer example: 16 + format: int64 definitions: @@ -101,6 +106,7 @@ definitions: size: type: integer example: 1048576 + format: int64 sha1: type: string #format: custom @@ -165,11 +171,55 @@ definitions: properties: id: type: integer + format: int64 editor_id: type: integer + format: int64 description: type: string - # TODO: work_edits array, etc. ["edits"]["work"] or ["work_edits"]? + container_edits: + type: array + item: + type: integer + format: int64 +# properties: +# edit_id: +# type: integer +# example: 847 +# format: int64 +# type: array +# items: +# type: object +# proposeties: +# <<: *ENTITYEDITPROPS +# creators: +# type: array +# items: +# type: object +# proposeties: +# <<: *ENTITYEDITPROPS +# files: +# type: array +# items: +# type: object +# proposeties: +# <<: *ENTITYEDITPROPS +# releases: +# type: array +# items: +# type: object +# proposeties: +# <<: *ENTITYEDITPROPS +# works: +# type: array +# items: +# type: object +# proposeties: +# <<: *ENTITYEDITPROPS + extra: + type: object + additionalProperties: + type: string changelogentries: type: array items: @@ -181,8 +231,10 @@ definitions: properties: index: type: integer + format: int64 editgroup_id: type: integer + format: int64 timestamp: type: string format: date-time @@ -455,6 +507,7 @@ paths: - name: id in: path type: integer + format: int64 required: true get: responses: @@ -479,6 +532,7 @@ paths: - name: id in: path type: integer + format: int64 required: true post: responses: diff --git a/rust/fatcat-api/api/swagger.yaml b/rust/fatcat-api/api/swagger.yaml index f5391925..a6f7a0fe 100644 --- a/rust/fatcat-api/api/swagger.yaml +++ b/rust/fatcat-api/api/swagger.yaml @@ -902,8 +902,9 @@ paths: in: "path" required: true type: "integer" + format: "int64" formatString: "{}" - example: "56" + example: "789" responses: 200: description: "Found Entity" @@ -953,8 +954,9 @@ paths: in: "path" required: true type: "integer" + format: "int64" formatString: "{}" - example: "56" + example: "789" responses: 200: description: "Merged Successfully" @@ -1031,12 +1033,14 @@ definitions: example: "Grace Hopper" editgroup_id: type: "integer" + format: "int64" example: 16 redirect: type: "string" example: "f1f046a3-45c9-4b99-adce-000000000002" revision: type: "integer" + format: "int64" example: 42 ident: type: "string" @@ -1083,12 +1087,14 @@ definitions: example: "f1f046a3-45c9-4b99-adce-000000000001" revision: type: "integer" + format: "int64" example: 42 redirect: type: "string" example: "f1f046a3-45c9-4b99-adce-000000000002" editgroup_id: type: "integer" + format: "int64" example: 16 example: redirect: "f1f046a3-45c9-4b99-adce-000000000002" @@ -1112,15 +1118,18 @@ definitions: example: "f013d66c7f6817d08b7eb2a93e6d0440c1f3e7f8" size: type: "integer" + format: "int64" example: 1048576 editgroup_id: type: "integer" + format: "int64" example: 16 redirect: type: "string" example: "f1f046a3-45c9-4b99-adce-000000000002" revision: type: "integer" + format: "int64" example: 42 ident: type: "string" @@ -1181,12 +1190,14 @@ definitions: example: "f1f046a3-45c9-4b99-adce-000000000001" revision: type: "integer" + format: "int64" example: 42 redirect: type: "string" example: "f1f046a3-45c9-4b99-adce-000000000002" editgroup_id: type: "integer" + format: "int64" example: 16 example: redirect: "f1f046a3-45c9-4b99-adce-000000000002" @@ -1210,12 +1221,14 @@ definitions: type: "string" editgroup_id: type: "integer" + format: "int64" example: 16 redirect: type: "string" example: "f1f046a3-45c9-4b99-adce-000000000002" revision: type: "integer" + format: "int64" example: 42 ident: type: "string" @@ -1240,15 +1253,18 @@ definitions: properties: editgroup_id: type: "integer" + format: "int64" example: 16 revision: type: "integer" + format: "int64" example: 42 ident: type: "string" example: "f1f046a3-45c9-4b99-adce-000000000001" edit_id: type: "integer" + format: "int64" example: 847 example: ident: "f1f046a3-45c9-4b99-adce-000000000001" @@ -1274,14 +1290,25 @@ definitions: properties: id: type: "integer" + format: "int64" editor_id: type: "integer" + format: "int64" description: type: "string" + container_edits: + type: "array" + extra: + type: "object" + additionalProperties: + type: "string" example: + extra: + key: "extra" description: "description" editor_id: 6 id: 0 + container_edits: "" upperCaseName: "EDITGROUP" changelogentries: type: "array" @@ -1296,8 +1323,10 @@ definitions: properties: index: type: "integer" + format: "int64" editgroup_id: type: "integer" + format: "int64" timestamp: type: "string" format: "date-time" @@ -1316,25 +1345,30 @@ x-entity-props: revision: type: "integer" example: 42 + format: "int64" redirect: type: "string" example: "f1f046a3-45c9-4b99-adce-000000000002" editgroup_id: type: "integer" example: 16 + format: "int64" x-entity-edit-props: edit_id: type: "integer" example: 847 + format: "int64" ident: type: "string" example: "f1f046a3-45c9-4b99-adce-000000000001" revision: type: "integer" example: 42 + format: "int64" editgroup_id: type: "integer" example: 16 + format: "int64" x-entity-responses: 400: description: "Bad Request" diff --git a/rust/fatcat-api/examples/client.rs b/rust/fatcat-api/examples/client.rs index a818a5c7..396cf3d1 100644 --- a/rust/fatcat-api/examples/client.rs +++ b/rust/fatcat-api/examples/client.rs @@ -95,12 +95,12 @@ fn main() { // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); // }, Some("EditgroupIdAcceptPost") => { - let result = client.editgroup_id_accept_post(56).wait(); + let result = client.editgroup_id_accept_post(789).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } Some("EditgroupIdGet") => { - let result = client.editgroup_id_get(56).wait(); + let result = client.editgroup_id_get(789).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } diff --git a/rust/fatcat-api/examples/server_lib/server.rs b/rust/fatcat-api/examples/server_lib/server.rs index b81af0f8..68670c07 100644 --- a/rust/fatcat-api/examples/server_lib/server.rs +++ b/rust/fatcat-api/examples/server_lib/server.rs @@ -54,13 +54,13 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn editgroup_id_accept_post(&self, id: i32, context: &Context) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send> { + fn editgroup_id_accept_post(&self, id: i64, context: &Context) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send> { let context = context.clone(); println!("editgroup_id_accept_post({}) - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); Box::new(futures::failed("Generic failure".into())) } - fn editgroup_id_get(&self, id: i32, context: &Context) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send> { + fn editgroup_id_get(&self, id: i64, context: &Context) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send> { let context = context.clone(); println!("editgroup_id_get({}) - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); Box::new(futures::failed("Generic failure".into())) diff --git a/rust/fatcat-api/src/client.rs b/rust/fatcat-api/src/client.rs index 4fa084f9..517d9705 100644 --- a/rust/fatcat-api/src/client.rs +++ b/rust/fatcat-api/src/client.rs @@ -537,7 +537,7 @@ impl Api for Client { Box::new(futures::done(result)) } - fn editgroup_id_accept_post(&self, param_id: i32, context: &Context) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send> { + fn editgroup_id_accept_post(&self, param_id: i64, context: &Context) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send> { let url = format!("{}/v0/editgroup/{id}/accept", self.base_path, id = utf8_percent_encode(¶m_id.to_string(), PATH_SEGMENT_ENCODE_SET)); let hyper_client = (self.hyper_client)(); @@ -597,7 +597,7 @@ impl Api for Client { Box::new(futures::done(result)) } - fn editgroup_id_get(&self, param_id: i32, context: &Context) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send> { + fn editgroup_id_get(&self, param_id: i64, context: &Context) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send> { let url = format!("{}/v0/editgroup/{id}", self.base_path, id = utf8_percent_encode(¶m_id.to_string(), PATH_SEGMENT_ENCODE_SET)); let hyper_client = (self.hyper_client)(); diff --git a/rust/fatcat-api/src/lib.rs b/rust/fatcat-api/src/lib.rs index abd68f04..94633e00 100644 --- a/rust/fatcat-api/src/lib.rs +++ b/rust/fatcat-api/src/lib.rs @@ -268,9 +268,9 @@ pub trait Api { fn creator_post(&self, body: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send>; - fn editgroup_id_accept_post(&self, id: i32, context: &Context) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send>; + fn editgroup_id_accept_post(&self, id: i64, context: &Context) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send>; - fn editgroup_id_get(&self, id: i32, context: &Context) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send>; + fn editgroup_id_get(&self, id: i64, context: &Context) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send>; fn editgroup_post(&self, body: models::Editgroup, context: &Context) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send>; @@ -309,9 +309,9 @@ pub trait ApiNoContext { fn creator_post(&self, body: models::CreatorEntity) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send>; - fn editgroup_id_accept_post(&self, id: i32) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send>; + fn editgroup_id_accept_post(&self, id: i64) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send>; - fn editgroup_id_get(&self, id: i32) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send>; + fn editgroup_id_get(&self, id: i64) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send>; fn editgroup_post(&self, body: models::Editgroup) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send>; @@ -376,11 +376,11 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().creator_post(body, &self.context()) } - fn editgroup_id_accept_post(&self, id: i32) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send> { + fn editgroup_id_accept_post(&self, id: i64) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send> { self.api().editgroup_id_accept_post(id, &self.context()) } - fn editgroup_id_get(&self, id: i32) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send> { + fn editgroup_id_get(&self, id: i64) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send> { self.api().editgroup_id_get(id, &self.context()) } diff --git a/rust/fatcat-api/src/models.rs b/rust/fatcat-api/src/models.rs index 784068e3..9609e5ec 100644 --- a/rust/fatcat-api/src/models.rs +++ b/rust/fatcat-api/src/models.rs @@ -72,17 +72,17 @@ impl ::std::ops::DerefMut for Changelogentries { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ChangelogentriesInner { #[serde(rename = "index")] - pub index: isize, + pub index: i64, #[serde(rename = "editgroup_id")] - pub editgroup_id: isize, + pub editgroup_id: i64, #[serde(rename = "timestamp")] pub timestamp: chrono::DateTime<chrono::Utc>, } impl ChangelogentriesInner { - pub fn new(index: isize, editgroup_id: isize, timestamp: chrono::DateTime<chrono::Utc>) -> ChangelogentriesInner { + pub fn new(index: i64, editgroup_id: i64, timestamp: chrono::DateTime<chrono::Utc>) -> ChangelogentriesInner { ChangelogentriesInner { index: index, editgroup_id: editgroup_id, @@ -115,7 +115,7 @@ pub struct ContainerEntity { #[serde(rename = "revision")] #[serde(skip_serializing_if = "Option::is_none")] - pub revision: Option<isize>, + pub revision: Option<i64>, #[serde(rename = "redirect")] #[serde(skip_serializing_if = "Option::is_none")] @@ -123,7 +123,7 @@ pub struct ContainerEntity { #[serde(rename = "editgroup_id")] #[serde(skip_serializing_if = "Option::is_none")] - pub editgroup_id: Option<isize>, + pub editgroup_id: Option<i64>, } impl ContainerEntity { @@ -152,7 +152,7 @@ pub struct CreatorEntity { #[serde(rename = "editgroup_id")] #[serde(skip_serializing_if = "Option::is_none")] - pub editgroup_id: Option<isize>, + pub editgroup_id: Option<i64>, #[serde(rename = "redirect")] #[serde(skip_serializing_if = "Option::is_none")] @@ -160,7 +160,7 @@ pub struct CreatorEntity { #[serde(rename = "revision")] #[serde(skip_serializing_if = "Option::is_none")] - pub revision: Option<isize>, + pub revision: Option<i64>, #[serde(rename = "ident")] #[serde(skip_serializing_if = "Option::is_none")] @@ -190,22 +190,32 @@ impl CreatorEntity { pub struct Editgroup { #[serde(rename = "id")] #[serde(skip_serializing_if = "Option::is_none")] - pub id: Option<isize>, + pub id: Option<i64>, #[serde(rename = "editor_id")] - pub editor_id: isize, + pub editor_id: i64, #[serde(rename = "description")] #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<String>, + + #[serde(rename = "container_edits")] + #[serde(skip_serializing_if = "Option::is_none")] + pub container_edits: Option<Vec>, + + #[serde(rename = "extra")] + #[serde(skip_serializing_if = "Option::is_none")] + pub extra: Option<HashMap<String, String>>, } impl Editgroup { - pub fn new(editor_id: isize) -> Editgroup { + pub fn new(editor_id: i64) -> Editgroup { Editgroup { id: None, editor_id: editor_id, description: None, + container_edits: None, + extra: None, } } } @@ -226,11 +236,11 @@ impl Editor { pub struct EntityEdit { #[serde(rename = "editgroup_id")] #[serde(skip_serializing_if = "Option::is_none")] - pub editgroup_id: Option<isize>, + pub editgroup_id: Option<i64>, #[serde(rename = "revision")] #[serde(skip_serializing_if = "Option::is_none")] - pub revision: Option<isize>, + pub revision: Option<i64>, #[serde(rename = "ident")] #[serde(skip_serializing_if = "Option::is_none")] @@ -238,7 +248,7 @@ pub struct EntityEdit { #[serde(rename = "edit_id")] #[serde(skip_serializing_if = "Option::is_none")] - pub edit_id: Option<isize>, + pub edit_id: Option<i64>, } impl EntityEdit { @@ -276,11 +286,11 @@ pub struct FileEntity { #[serde(rename = "size")] #[serde(skip_serializing_if = "Option::is_none")] - pub size: Option<isize>, + pub size: Option<i64>, #[serde(rename = "editgroup_id")] #[serde(skip_serializing_if = "Option::is_none")] - pub editgroup_id: Option<isize>, + pub editgroup_id: Option<i64>, #[serde(rename = "redirect")] #[serde(skip_serializing_if = "Option::is_none")] @@ -288,7 +298,7 @@ pub struct FileEntity { #[serde(rename = "revision")] #[serde(skip_serializing_if = "Option::is_none")] - pub revision: Option<isize>, + pub revision: Option<i64>, #[serde(rename = "ident")] #[serde(skip_serializing_if = "Option::is_none")] @@ -358,7 +368,7 @@ pub struct ReleaseEntity { #[serde(rename = "revision")] #[serde(skip_serializing_if = "Option::is_none")] - pub revision: Option<isize>, + pub revision: Option<i64>, #[serde(rename = "redirect")] #[serde(skip_serializing_if = "Option::is_none")] @@ -366,7 +376,7 @@ pub struct ReleaseEntity { #[serde(rename = "editgroup_id")] #[serde(skip_serializing_if = "Option::is_none")] - pub editgroup_id: Option<isize>, + pub editgroup_id: Option<i64>, } impl ReleaseEntity { @@ -409,7 +419,7 @@ pub struct WorkEntity { #[serde(rename = "editgroup_id")] #[serde(skip_serializing_if = "Option::is_none")] - pub editgroup_id: Option<isize>, + pub editgroup_id: Option<i64>, #[serde(rename = "redirect")] #[serde(skip_serializing_if = "Option::is_none")] @@ -417,7 +427,7 @@ pub struct WorkEntity { #[serde(rename = "revision")] #[serde(skip_serializing_if = "Option::is_none")] - pub revision: Option<isize>, + pub revision: Option<i64>, #[serde(rename = "ident")] #[serde(skip_serializing_if = "Option::is_none")] |