Skip to main content

systemprompt_cloud/
lib.rs

1pub mod api_client;
2pub mod auth;
3pub mod checkout;
4pub mod cli_session;
5pub mod constants;
6pub mod context;
7pub mod credentials;
8pub mod credentials_bootstrap;
9pub mod error;
10pub mod oauth;
11pub mod paths;
12pub mod tenants;
13
14pub use api_client::{
15    CheckoutEvent, CheckoutResponse, CloudApiClient, DeployResponse, ListSecretsResponse, Plan,
16    ProvisioningEvent, ProvisioningEventType, RegistryToken, StatusResponse, SubscriptionStatus,
17    Tenant, TenantInfo, TenantSecrets, TenantStatus, UserInfo, UserMeResponse,
18};
19pub use checkout::{
20    CheckoutCallbackResult, CheckoutTemplates, run_checkout_callback_flow, wait_for_provisioning,
21};
22pub use cli_session::{CliSession, LOCAL_SESSION_KEY, SessionKey, SessionStore};
23pub use constants::api::{PRODUCTION_URL, SANDBOX_URL};
24pub use context::{CloudContext, ResolvedTenant};
25pub use credentials::CloudCredentials;
26pub use credentials_bootstrap::{CredentialsBootstrap, CredentialsBootstrapError};
27pub use error::{CloudError, CloudResult};
28pub use oauth::{OAuthTemplates, run_oauth_flow};
29pub use paths::{
30    CloudPath, CloudPaths, DiscoveredProject, ProfilePath, ProjectContext, ProjectPath,
31    UnifiedContext, expand_home, get_cloud_paths, resolve_path,
32};
33pub use tenants::{StoredTenant, TenantStore, TenantType};
34
35use clap::ValueEnum;
36
37#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, ValueEnum)]
38pub enum Environment {
39    #[default]
40    Production,
41    Sandbox,
42}
43
44impl Environment {
45    #[must_use]
46    pub const fn api_url(&self) -> &'static str {
47        match self {
48            Self::Production => PRODUCTION_URL,
49            Self::Sandbox => SANDBOX_URL,
50        }
51    }
52}
53
54#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
55pub enum OAuthProvider {
56    Github,
57    Google,
58}
59
60impl OAuthProvider {
61    #[must_use]
62    pub const fn as_str(&self) -> &'static str {
63        match self {
64            Self::Github => "github",
65            Self::Google => "google",
66        }
67    }
68
69    #[must_use]
70    pub const fn display_name(&self) -> &'static str {
71        match self {
72            Self::Github => "GitHub",
73            Self::Google => "Google",
74        }
75    }
76}