storyteller api credentials WIP, but need to switch gears

This commit is contained in:
Brandon Thomas committed 2025-04-30 18:32:52 -04:00
1 parent 826cf00cbb
commit e5749f0e77
7 files changed
+88 -1

No files matched your search

@@ -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;
Whitespace-only changes.
@@ -0,0 +1,3 @@
pub mod storyteller_avt_cookie;
pub mod storyteller_credential_set;
pub mod storyteller_session_cookie;
@@ -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()
}
}
@@ -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<StorytellerSessionCookie>,
pub avt: Option<StorytellerAvtCookie>,
}
impl StorytellerCredentialSet {
pub fn initialize(
cookie: Option<StorytellerSessionCookie>,
avt: Option<StorytellerAvtCookie>,
) -> 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),
}
}
}
@@ -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()
}
}
@@ -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;