GraphQL

Send GraphQL requests with the GraphQL built-in.

Request

Perform a request against a GraphQL resource.
typescript
Copied
1
import airplane from "airplane";
2
3
export default airplane.task(
4
{
5
slug: "get_user_profiles",
6
// Attach graphql resource to task
7
resources: ["profile_api"],
8
},
9
async (params) => {
10
const run = await airplane.graphql.request<{ { userId: string; avatar: string } }>(
11
// The slug of the GraphQL resource to query
12
"profile_api",
13
// The operation to execute
14
`query {
15
users {
16
id
17
name
18
email
19
}
20
}`
21
);
22
return run.output.data;
23
}
24
);
API