diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-12-26 15:15:44 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-12-26 15:15:44 -0800 |
commit | 8e179c13a28b0f647b76fc05c5d6b25522866882 (patch) | |
tree | 84e40078528d3b3e649f266e8fa079e65cabbb3a /rust/fatcat-api-spec/src/models.rs | |
parent | 0028ee3278cd274565e1a9459337835aa4bafb06 (diff) | |
download | fatcat-8e179c13a28b0f647b76fc05c5d6b25522866882.tar.gz fatcat-8e179c13a28b0f647b76fc05c5d6b25522866882.zip |
rust codegen
Diffstat (limited to 'rust/fatcat-api-spec/src/models.rs')
-rw-r--r-- | rust/fatcat-api-spec/src/models.rs | 243 |
1 files changed, 243 insertions, 0 deletions
diff --git a/rust/fatcat-api-spec/src/models.rs b/rust/fatcat-api-spec/src/models.rs index 8f3e525a..c6fc3ae1 100644 --- a/rust/fatcat-api-spec/src/models.rs +++ b/rust/fatcat-api-spec/src/models.rs @@ -231,6 +231,14 @@ pub struct EditgroupEdits { #[serde(skip_serializing_if = "Option::is_none")] pub files: Option<Vec<models::EntityEdit>>, + #[serde(rename = "filesets")] + #[serde(skip_serializing_if = "Option::is_none")] + pub filesets: Option<Vec<models::EntityEdit>>, + + #[serde(rename = "webcaptures")] + #[serde(skip_serializing_if = "Option::is_none")] + pub webcaptures: Option<Vec<models::EntityEdit>>, + #[serde(rename = "releases")] #[serde(skip_serializing_if = "Option::is_none")] pub releases: Option<Vec<models::EntityEdit>>, @@ -246,6 +254,8 @@ impl EditgroupEdits { containers: None, creators: None, files: None, + filesets: None, + webcaptures: None, releases: None, works: None, } @@ -439,6 +449,103 @@ impl FileEntityUrls { } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct FilesetEntity { + #[serde(rename = "release_ids")] + #[serde(skip_serializing_if = "Option::is_none")] + pub release_ids: Option<Vec<String>>, + + #[serde(rename = "urls")] + #[serde(skip_serializing_if = "Option::is_none")] + pub urls: Option<Vec<models::FileEntityUrls>>, + + #[serde(rename = "manifest")] + #[serde(skip_serializing_if = "Option::is_none")] + pub manifest: Option<Vec<models::FilesetEntityManifest>>, + + // Note: inline enums are not fully supported by swagger-codegen + #[serde(rename = "state")] + #[serde(skip_serializing_if = "Option::is_none")] + pub state: Option<String>, + + /// base32-encoded unique identifier + #[serde(rename = "ident")] + #[serde(skip_serializing_if = "Option::is_none")] + pub ident: Option<String>, + + /// UUID (lower-case, dash-separated, hex-encoded 128-bit) + #[serde(rename = "revision")] + #[serde(skip_serializing_if = "Option::is_none")] + pub revision: Option<String>, + + /// base32-encoded unique identifier + #[serde(rename = "redirect")] + #[serde(skip_serializing_if = "Option::is_none")] + pub redirect: Option<String>, + + #[serde(rename = "extra")] + #[serde(skip_serializing_if = "Option::is_none")] + pub extra: Option<serde_json::Value>, + + #[serde(rename = "edit_extra")] + #[serde(skip_serializing_if = "Option::is_none")] + pub edit_extra: Option<serde_json::Value>, +} + +impl FilesetEntity { + pub fn new() -> FilesetEntity { + FilesetEntity { + release_ids: None, + urls: None, + manifest: None, + state: None, + ident: None, + revision: None, + redirect: None, + extra: None, + edit_extra: None, + } + } +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct FilesetEntityManifest { + #[serde(rename = "path")] + pub path: String, + + #[serde(rename = "size")] + pub size: i64, + + #[serde(rename = "md5")] + #[serde(skip_serializing_if = "Option::is_none")] + pub md5: Option<String>, + + #[serde(rename = "sha1")] + #[serde(skip_serializing_if = "Option::is_none")] + pub sha1: Option<String>, + + #[serde(rename = "sha256")] + #[serde(skip_serializing_if = "Option::is_none")] + pub sha256: Option<String>, + + #[serde(rename = "extra")] + #[serde(skip_serializing_if = "Option::is_none")] + pub extra: Option<serde_json::Value>, +} + +impl FilesetEntityManifest { + pub fn new(path: String, size: i64) -> FilesetEntityManifest { + FilesetEntityManifest { + path: path, + size: size, + md5: None, + sha1: None, + sha256: None, + extra: None, + } + } +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ReleaseContrib { #[serde(rename = "index")] #[serde(skip_serializing_if = "Option::is_none")] @@ -559,6 +666,16 @@ pub struct ReleaseEntity { pub container_id: Option<String>, /// Optional; GET-only + #[serde(rename = "webcaptures")] + #[serde(skip_serializing_if = "Option::is_none")] + pub webcaptures: Option<Vec<models::WebcaptureEntity>>, + + /// Optional; GET-only + #[serde(rename = "filesets")] + #[serde(skip_serializing_if = "Option::is_none")] + pub filesets: Option<Vec<models::FilesetEntity>>, + + /// Optional; GET-only #[serde(rename = "files")] #[serde(skip_serializing_if = "Option::is_none")] pub files: Option<Vec<models::FileEntity>>, @@ -628,6 +745,8 @@ impl ReleaseEntity { release_status: None, release_type: None, container_id: None, + webcaptures: None, + filesets: None, files: None, container: None, work_id: None, @@ -735,6 +854,130 @@ impl Success { } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct WebcaptureEntity { + #[serde(rename = "release_ids")] + #[serde(skip_serializing_if = "Option::is_none")] + pub release_ids: Option<Vec<String>>, + + #[serde(rename = "timestamp")] + #[serde(skip_serializing_if = "Option::is_none")] + pub timestamp: Option<chrono::DateTime<chrono::Utc>>, + + #[serde(rename = "original_url")] + #[serde(skip_serializing_if = "Option::is_none")] + pub original_url: Option<String>, + + #[serde(rename = "archive_urls")] + #[serde(skip_serializing_if = "Option::is_none")] + pub archive_urls: Option<Vec<models::WebcaptureEntityArchiveUrls>>, + + #[serde(rename = "cdx")] + #[serde(skip_serializing_if = "Option::is_none")] + pub cdx: Option<Vec<models::WebcaptureEntityCdx>>, + + #[serde(rename = "edit_extra")] + #[serde(skip_serializing_if = "Option::is_none")] + pub edit_extra: Option<serde_json::Value>, + + #[serde(rename = "extra")] + #[serde(skip_serializing_if = "Option::is_none")] + pub extra: Option<serde_json::Value>, + + /// base32-encoded unique identifier + #[serde(rename = "redirect")] + #[serde(skip_serializing_if = "Option::is_none")] + pub redirect: Option<String>, + + /// UUID (lower-case, dash-separated, hex-encoded 128-bit) + #[serde(rename = "revision")] + #[serde(skip_serializing_if = "Option::is_none")] + pub revision: Option<String>, + + /// base32-encoded unique identifier + #[serde(rename = "ident")] + #[serde(skip_serializing_if = "Option::is_none")] + pub ident: Option<String>, + + // Note: inline enums are not fully supported by swagger-codegen + #[serde(rename = "state")] + #[serde(skip_serializing_if = "Option::is_none")] + pub state: Option<String>, +} + +impl WebcaptureEntity { + pub fn new() -> WebcaptureEntity { + WebcaptureEntity { + release_ids: None, + timestamp: None, + original_url: None, + archive_urls: None, + cdx: None, + edit_extra: None, + extra: None, + redirect: None, + revision: None, + ident: None, + state: None, + } + } +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct WebcaptureEntityArchiveUrls { + #[serde(rename = "url")] + pub url: String, + + #[serde(rename = "rel")] + pub rel: String, +} + +impl WebcaptureEntityArchiveUrls { + pub fn new(url: String, rel: String) -> WebcaptureEntityArchiveUrls { + WebcaptureEntityArchiveUrls { url: url, rel: rel } + } +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct WebcaptureEntityCdx { + #[serde(rename = "surt")] + pub surt: String, + + #[serde(rename = "timestamp")] + pub timestamp: i64, + + #[serde(rename = "url")] + pub url: String, + + #[serde(rename = "mimetype")] + #[serde(skip_serializing_if = "Option::is_none")] + pub mimetype: Option<String>, + + #[serde(rename = "status_code")] + pub status_code: i64, + + #[serde(rename = "sha1")] + pub sha1: String, + + #[serde(rename = "sha256")] + #[serde(skip_serializing_if = "Option::is_none")] + pub sha256: Option<String>, +} + +impl WebcaptureEntityCdx { + pub fn new(surt: String, timestamp: i64, url: String, status_code: i64, sha1: String) -> WebcaptureEntityCdx { + WebcaptureEntityCdx { + surt: surt, + timestamp: timestamp, + url: url, + mimetype: None, + status_code: status_code, + sha1: sha1, + sha256: None, + } + } +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct WorkEntity { #[serde(rename = "edit_extra")] #[serde(skip_serializing_if = "Option::is_none")] |