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}
14
15impl Environment {
16    pub fn base_url(&self) -> String {
17        match self {
18            Environment::Production => "https://api.storekit.itunes.apple.com".to_string(),
19            Environment::Sandbox => "https://api.storekit-sandbox.itunes.apple.com".to_string(),
20            Environment::LocalTesting => "https://local-testing-base-url".to_string(),
21            _ => "https://api.storekit-sandbox.itunes.apple.com".to_string(),
22        }
23    }
24}