pub struct ShopifyConfig { /* private fields */ }Expand description
Configuration for the Shopify API SDK.
This struct holds all configuration needed for SDK operations, including API credentials, OAuth scopes, and API version settings.
§Thread Safety
ShopifyConfig is Clone, Send, and Sync, making it safe to share
across threads and async tasks.
§Key Rotation
The old_api_secret_key field supports seamless key rotation. When
validating OAuth HMAC signatures, the SDK will try the primary key first,
then fall back to the old key if configured. This allows in-flight OAuth
flows to complete during key rotation.
§Example
use shopify_sdk::{ShopifyConfig, ApiKey, ApiSecretKey};
let config = ShopifyConfig::builder()
.api_key(ApiKey::new("your-api-key").unwrap())
.api_secret_key(ApiSecretKey::new("your-secret").unwrap())
.is_embedded(true)
.build()
.unwrap();
assert!(config.is_embedded());Implementations§
Source§impl ShopifyConfig
impl ShopifyConfig
Sourcepub fn builder() -> ShopifyConfigBuilder
pub fn builder() -> ShopifyConfigBuilder
Creates a new builder for constructing a ShopifyConfig.
§Example
use shopify_sdk::{ShopifyConfig, ApiKey, ApiSecretKey};
let config = ShopifyConfig::builder()
.api_key(ApiKey::new("key").unwrap())
.api_secret_key(ApiSecretKey::new("secret").unwrap())
.build()
.unwrap();Sourcepub const fn api_secret_key(&self) -> &ApiSecretKey
pub const fn api_secret_key(&self) -> &ApiSecretKey
Returns the API secret key.
Sourcepub const fn old_api_secret_key(&self) -> Option<&ApiSecretKey>
pub const fn old_api_secret_key(&self) -> Option<&ApiSecretKey>
Returns the old API secret key, if configured.
This is used during key rotation to validate HMAC signatures created with the previous secret key.
Sourcepub const fn scopes(&self) -> &AuthScopes
pub const fn scopes(&self) -> &AuthScopes
Returns the OAuth scopes.
Sourcepub const fn api_version(&self) -> &ApiVersion
pub const fn api_version(&self) -> &ApiVersion
Returns the API version.
Sourcepub const fn is_embedded(&self) -> bool
pub const fn is_embedded(&self) -> bool
Returns whether the app is embedded.
Sourcepub fn user_agent_prefix(&self) -> Option<&str>
pub fn user_agent_prefix(&self) -> Option<&str>
Returns the user agent prefix, if configured.
Sourcepub fn deprecation_callback(&self) -> Option<&DeprecationCallback>
pub fn deprecation_callback(&self) -> Option<&DeprecationCallback>
Returns the deprecation callback, if configured.
This callback is invoked when the SDK receives a response indicating that an API endpoint is deprecated.
Trait Implementations§
Source§impl Clone for ShopifyConfig
impl Clone for ShopifyConfig
Source§fn clone(&self) -> ShopifyConfig
fn clone(&self) -> ShopifyConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more