Add app server account session protocol

This commit is contained in:
Dhruv
2026-06-01 06:11:19 +05:30
parent 966932124c
commit b7bce9beb7
24 changed files with 1100 additions and 1 deletions
+11
View File
@@ -1,3 +1,4 @@
use crate::types::AccountsCheckResponse;
use crate::types::CodeTaskDetailsResponse;
use crate::types::ConfigFileResponse;
use crate::types::PaginatedListTaskListItem;
@@ -301,6 +302,16 @@ impl Client {
Ok(Self::rate_limit_snapshots_from_payload(payload))
}
pub async fn get_accounts_check(&self) -> Result<AccountsCheckResponse> {
let url = match self.path_style {
PathStyle::CodexApi => format!("{}/api/codex/accounts/check", self.base_url),
PathStyle::ChatGptApi => format!("{}/wham/accounts/check", self.base_url),
};
let req = self.http.get(&url).headers(self.headers());
let (body, ct) = self.exec_request(req, "GET", &url).await?;
self.decode_json(&url, &ct, &body)
}
pub async fn send_add_credits_nudge_email(
&self,
credit_type: AddCreditsNudgeCreditType,
+2
View File
@@ -4,6 +4,8 @@ pub(crate) mod types;
pub use client::AddCreditsNudgeCreditType;
pub use client::Client;
pub use client::RequestError;
pub use types::AccountEntry;
pub use types::AccountsCheckResponse;
pub use types::CodeTaskDetailsResponse;
pub use types::CodeTaskDetailsResponseExt;
pub use types::ConfigFileResponse;
+21
View File
@@ -13,6 +13,27 @@ use serde::de::Deserializer;
use serde_json::Value;
use std::collections::HashMap;
#[derive(Clone, Debug, Deserialize)]
pub struct AccountsCheckResponse {
#[serde(default)]
pub accounts: Vec<AccountEntry>,
#[serde(default)]
pub account_ordering: Vec<String>,
#[serde(default)]
pub default_account_id: Option<String>,
}
#[derive(Clone, Debug, Deserialize)]
pub struct AccountEntry {
pub id: String,
#[serde(default)]
pub name: Option<String>,
#[serde(default)]
pub profile_picture_url: Option<String>,
#[serde(default)]
pub structure: String,
}
/// Hand-rolled models for the Cloud Tasks task-details response.
/// The generated OpenAPI models are pretty bad. This is a half-step
/// towards hand-rolling them.