GraphQL client
You can use the graphql
namespace of the Runnable API to make GraphQL queries from your Runnable code. GraphQL is a common way of exposing external APIs, and makes connecting to external services very straightforward.
- Rust
- JavaScript/TypeScript
- AssemblyScript
In Rust these methods are available under the graphql
module:
# Use the "graphql" module
use suborbital::graphql;
# Invoke the "Query" method
graphql::query(…)
In JavaScript and TypeScript the methods live on the graphql
import:
import { graphql } from "@suborbital/runnable"
graphql.query(…)
In AssemblyScript all methods are prefixed with graphQL
:
// Import then invoke "Get" method
import { graphQLQuery } from '@suborbital/suborbital'
graphQLQuery(…)
The following namespace methods are available:
QUERY
Performs a graphQL query:
- Rust
- JavaScript & TypeScript
- AssemblyScript
STATUS: STABLE
pub fn query(endpoint: &str, query: &str) -> Result<Vec<u8>,super::runnable::RunErr>
STATUS: BETA
graphql.query(
endpoint: string,
query: string,
headers?: { [key: string]: string }
): string
STATUS: BETA
function graphQLQuery(endpoint: string, query: string): ArrayBuffer