app_store_server_library/primitives/
environment.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Deserialize, Serialize, Hash, PartialEq, Eq)]
4pub enum Environment {
5    #[serde(rename = "Sandbox")]
6    Sandbox,
7    #[serde(rename = "Production")]
8    Production,
9    #[serde(rename = "Xcode")]
10    Xcode,
11    #[serde(rename = "LocalTesting")]
12    LocalTesting, // Used for unit testing
13    #[serde(other)]
14    Unknown
15}
16
17impl Environment {
18    pub fn base_url(&self) -> String {
19        match self {
20            Environment::Production => "https://api.storekit.itunes.apple.com".to_string(),
21            Environment::Sandbox => "https://api.storekit-sandbox.itunes.apple.com".to_string(),
22            Environment::LocalTesting => "https://local-testing-base-url".to_string(),
23            _ => "https://api.storekit-sandbox.itunes.apple.com".to_string(),
24        }
25    }
26}