diff --git a/crates/desktop/tauri-artcraft/src/state/mod.rs b/crates/desktop/tauri-artcraft/src/state/mod.rs index 7552564a46..552f0fcd20 100644 --- a/crates/desktop/tauri-artcraft/src/state/mod.rs +++ b/crates/desktop/tauri-artcraft/src/state/mod.rs @@ -4,4 +4,5 @@ pub mod expanduser; pub mod main_window_size; pub mod os_platform; pub mod sora; +pub mod storyteller; pub mod yaml_config; \ No newline at end of file diff --git a/crates/desktop/tauri-artcraft/src/state/storyteller/mod.rs b/crates/desktop/tauri-artcraft/src/state/storyteller/mod.rs new file mode 100644 index 0000000000..e69de29bb2 diff --git a/crates/lib/api_clients/storyteller_client/src/credentials/mod.rs b/crates/lib/api_clients/storyteller_client/src/credentials/mod.rs new file mode 100644 index 0000000000..3ea64976fa --- /dev/null +++ b/crates/lib/api_clients/storyteller_client/src/credentials/mod.rs @@ -0,0 +1,3 @@ +pub mod storyteller_avt_cookie; +pub mod storyteller_credential_set; +pub mod storyteller_session_cookie; \ No newline at end of file diff --git a/crates/lib/api_clients/storyteller_client/src/credentials/storyteller_avt_cookie.rs b/crates/lib/api_clients/storyteller_client/src/credentials/storyteller_avt_cookie.rs new file mode 100644 index 0000000000..a4b13dc276 --- /dev/null +++ b/crates/lib/api_clients/storyteller_client/src/credentials/storyteller_avt_cookie.rs @@ -0,0 +1,25 @@ + +/// The "anonymous visitor token" cookie allows users to interact with +/// the service in a logged-out state with some continuity. +#[derive(Clone)] +pub struct StorytellerAvtCookie { + cookie: String, +} + +impl StorytellerAvtCookie { + pub fn new(cookie: String) -> Self { + Self { cookie } + } + + pub fn as_str(&self) -> &str { + &self.cookie + } + + pub fn as_bytes(&self) -> &[u8] { + self.cookie.as_bytes() + } + + pub fn to_string(&self) -> String { + self.cookie.clone() + } +} diff --git a/crates/lib/api_clients/storyteller_client/src/credentials/storyteller_credential_set.rs b/crates/lib/api_clients/storyteller_client/src/credentials/storyteller_credential_set.rs new file mode 100644 index 0000000000..e37c2ab53f --- /dev/null +++ b/crates/lib/api_clients/storyteller_client/src/credentials/storyteller_credential_set.rs @@ -0,0 +1,31 @@ +use crate::credentials::storyteller_avt_cookie::StorytellerAvtCookie; +use crate::credentials::storyteller_session_cookie::StorytellerSessionCookie; + +#[derive(Clone)] +pub struct StorytellerCredentialSet { + pub cookie: Option, + pub avt: Option, +} + +impl StorytellerCredentialSet { + pub fn initialize( + cookie: Option, + avt: Option, + ) -> Self { + Self { cookie, avt } + } + + pub fn initialize_with_just_cookie(cookie: StorytellerSessionCookie) -> Self { + Self { + cookie: Some(cookie), + avt: None, + } + } + + pub fn initialize_with_just_avt(avt: StorytellerAvtCookie) -> Self { + Self { + cookie: None, + avt: Some(avt), + } + } +} diff --git a/crates/lib/api_clients/storyteller_client/src/credentials/storyteller_session_cookie.rs b/crates/lib/api_clients/storyteller_client/src/credentials/storyteller_session_cookie.rs new file mode 100644 index 0000000000..638605f941 --- /dev/null +++ b/crates/lib/api_clients/storyteller_client/src/credentials/storyteller_session_cookie.rs @@ -0,0 +1,24 @@ + +/// The primary FakeYou / Storyteller / Artcraft backend session identifier. +#[derive(Clone)] +pub struct StorytellerSessionCookie { + cookie: String, +} + +impl StorytellerSessionCookie { + pub fn new(cookie: String) -> Self { + Self { cookie } + } + + pub fn as_str(&self) -> &str { + &self.cookie + } + + pub fn as_bytes(&self) -> &[u8] { + self.cookie.as_bytes() + } + + pub fn to_string(&self) -> String { + self.cookie.clone() + } +} diff --git a/crates/lib/api_clients/storyteller_client/src/lib.rs b/crates/lib/api_clients/storyteller_client/src/lib.rs index 9e97c1c209..d0b6be4a4e 100644 --- a/crates/lib/api_clients/storyteller_client/src/lib.rs +++ b/crates/lib/api_clients/storyteller_client/src/lib.rs @@ -1,4 +1,7 @@ +//! An API client for Storyteller / FakeYou + +pub mod api_error; +pub mod credentials; pub mod media_files; pub mod shared_response_types; pub mod utils; -mod api_error; \ No newline at end of file