aboutsummaryrefslogtreecommitdiffstats
path: root/rust/fatcat-api-spec/src/models.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-01-08 16:28:27 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-01-08 16:28:27 -0800
commit16f2e78298dbd2231f5f337ea17c89a6a131a052 (patch)
tree6e72581e625e73c97cbab72d0f9c35665c99e5d7 /rust/fatcat-api-spec/src/models.rs
parenteb40a5f274f3608db34309cfd16739a7642ef5e7 (diff)
parentffb721f90c5d97ee80885209bf45feb85ca9625c (diff)
downloadfatcat-16f2e78298dbd2231f5f337ea17c89a6a131a052.tar.gz
fatcat-16f2e78298dbd2231f5f337ea17c89a6a131a052.zip
Merge branch 'bnewbold-crude-auth'
Fixed a conflict in: python/fatcat_export.py
Diffstat (limited to 'rust/fatcat-api-spec/src/models.rs')
-rw-r--r--rust/fatcat-api-spec/src/models.rs68
1 files changed, 64 insertions, 4 deletions
diff --git a/rust/fatcat-api-spec/src/models.rs b/rust/fatcat-api-spec/src/models.rs
index 01b4c28e..536bdd24 100644
--- a/rust/fatcat-api-spec/src/models.rs
+++ b/rust/fatcat-api-spec/src/models.rs
@@ -10,6 +10,47 @@ use std::collections::HashMap;
use swagger;
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
+pub struct AuthOidc {
+ #[serde(rename = "provider")]
+ pub provider: String,
+
+ #[serde(rename = "sub")]
+ pub sub: String,
+
+ #[serde(rename = "iss")]
+ pub iss: String,
+
+ #[serde(rename = "preferred_username")]
+ pub preferred_username: String,
+}
+
+impl AuthOidc {
+ pub fn new(provider: String, sub: String, iss: String, preferred_username: String) -> AuthOidc {
+ AuthOidc {
+ provider: provider,
+ sub: sub,
+ iss: iss,
+ preferred_username: preferred_username,
+ }
+ }
+}
+
+#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
+pub struct AuthOidcResult {
+ #[serde(rename = "editor")]
+ pub editor: models::Editor,
+
+ #[serde(rename = "token")]
+ pub token: String,
+}
+
+impl AuthOidcResult {
+ pub fn new(editor: models::Editor, token: String) -> AuthOidcResult {
+ AuthOidcResult { editor: editor, token: token }
+ }
+}
+
+#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ChangelogEntry {
#[serde(rename = "index")]
pub index: i64,
@@ -190,7 +231,8 @@ pub struct Editgroup {
/// base32-encoded unique identifier
#[serde(rename = "editor_id")]
- pub editor_id: String,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub editor_id: Option<String>,
#[serde(rename = "description")]
#[serde(skip_serializing_if = "Option::is_none")]
@@ -206,10 +248,10 @@ pub struct Editgroup {
}
impl Editgroup {
- pub fn new(editor_id: String) -> Editgroup {
+ pub fn new() -> Editgroup {
Editgroup {
editgroup_id: None,
- editor_id: editor_id,
+ editor_id: None,
description: None,
extra: None,
edits: None,
@@ -271,11 +313,29 @@ pub struct Editor {
#[serde(rename = "username")]
pub username: String,
+
+ #[serde(rename = "is_admin")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub is_admin: Option<bool>,
+
+ #[serde(rename = "is_bot")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub is_bot: Option<bool>,
+
+ #[serde(rename = "is_active")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub is_active: Option<bool>,
}
impl Editor {
pub fn new(username: String) -> Editor {
- Editor { editor_id: None, username: username }
+ Editor {
+ editor_id: None,
+ username: username,
+ is_admin: None,
+ is_bot: None,
+ is_active: None,
+ }
}
}