Skip to main content

shopify_client/admin/shopify_functions/
remote.rs

1use crate::common::ServiceContext;
2use crate::{
3    common::{http::execute_graphql, types::APIError},
4    types::shopify_functions::ShopifyFunctionsResp,
5};
6
7use serde_json::json;
8
9pub async fn list_shopify_functions(
10    ctx: &ServiceContext,
11) -> Result<ShopifyFunctionsResp, APIError> {
12    let query = r#"
13        query shopifyFunctions {
14            shopifyFunctions(first: 25) {
15                nodes {
16                    id
17                    title
18                    description
19                    apiType
20                    apiVersion
21                    handle
22                    app {
23                        id
24                        title
25                    }
26                }
27            }
28        }
29    "#;
30
31    let variables = json!({});
32
33    execute_graphql(ctx, query, variables).await
34}