Skip to main content

shopify_client/services/shop/
mod.rs

1pub mod remote;
2
3use std::sync::Arc;
4
5use crate::{
6    common::types::{APIError, RequestCallbacks},
7    types::shop::GetShopResp,
8};
9
10pub struct Shop {
11    pub shop_url: Arc<String>,
12    pub version: Arc<String>,
13    pub access_token: Arc<String>,
14    pub callbacks: Arc<RequestCallbacks>,
15}
16
17impl Shop {
18    pub fn new(
19        shop_url: Arc<String>,
20        version: Arc<String>,
21        access_token: Arc<String>,
22        callbacks: Arc<RequestCallbacks>,
23    ) -> Self {
24        Shop {
25            shop_url,
26            version,
27            access_token,
28            callbacks,
29        }
30    }
31
32    pub async fn get(&self) -> Result<GetShopResp, APIError> {
33        remote::get_shop(
34            &self.shop_url,
35            &self.version,
36            &self.access_token,
37            &self.callbacks,
38        )
39        .await
40    }
41}