shopify_client/services/shopify_functions/
mod.rs

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