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