import { WaffoPancake } from "@waffo/pancake-ts";const client = new WaffoPancake({ merchantId: process.env.WAFFO_MERCHANT_ID!, privateKey: process.env.WAFFO_PRIVATE_KEY!,});interface StoresQuery { stores: Array<{ id: string; name: string; status: string }>;}const result = await client.graphql.query<StoresQuery>({ query: `{ stores { id name status } }`,});console.log(result.stores);// => [{ id: "STO_2aUyqjCzEIiEcYMKj7TZtw", name: "My Store", status: "active" }]
// Uses callApi() helper from authentication.mdxconst result = await callApi("POST", "/v1/graphql", { query: "query { stores { id name status } }", variables: {},});console.log(result.data.stores);// => [{ id: "STO_2aUyqjCzEIiEcYMKj7TZtw", name: "My Store", status: "active" }]
// Uses callApi() helper from authentication.mdxString body = """ {"query":"query { stores { id name status } }","variables":{}}""";String response = callApi("POST", "/v1/graphql", body);System.out.println(response);// => {"data":{"stores":[{"id":"STO_2aUyqjCzEIiEcYMKj7TZtw","name":"My Store","status":"active"}]}}
# Uses call_api() helper from authentication.mdxresult = call_api("POST", "/v1/graphql", { "query": "query { stores { id name status } }", "variables": {},})stores = result["data"]["stores"]print(stores)# => [{"id": "STO_2aUyqjCzEIiEcYMKj7TZtw", "name": "My Store", "status": "active"}]
// Uses callAPI() helper from authentication.mdxbody := map[string]interface{}{ "query": "query { stores { id name status } }", "variables": map[string]interface{}{},}result, err := callAPI("POST", "/v1/graphql", body)if err != nil { log.Fatal(err)}fmt.Println(string(result))// => {"data":{"stores":[{"id":"STO_2aUyqjCzEIiEcYMKj7TZtw","name":"My Store","status":"active"}]}}
// Uses call_api() helper from authentication.mdxlet body = serde_json::json!({ "query": "query { stores { id name status } }", "variables": {}});let result = call_api("POST", "/v1/graphql", &body).await?;println!("{}", result);// => {"data":{"stores":[{"id":"STO_2aUyqjCzEIiEcYMKj7TZtw","name":"My Store","status":"active"}]}}
/* Uses call_api() helper from authentication.mdx */const char *body = "{\"query\":\"query { stores { id name status } }\",\"variables\":{}}";char *response = call_api("POST", "/v1/graphql", body);printf("%s\n", response);free(response);
// Uses callApi() helper from authentication.mdxstd::string body = R"({"query":"query { stores { id name status } }","variables":{}})";std::string response = callApi("POST", "/v1/graphql", body);std::cout << response << std::endl;// => {"data":{"stores":[{"id":"STO_2aUyqjCzEIiEcYMKj7TZtw","name":"My Store","status":"active"}]}}