1.1.3 • Published 8 months ago

@codesandbox/api v1.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

@codesandbox/api

What still needs to be done

  • Write hook tests for GQL
  • Write hook tests for Rest
  • Provide WebSocket connection for GQL subscriptions
  • More documentation

Get started

import { CodeSandboxApi, onBrowserRequest } from "@codesandbox/api";

const api = new CodeSandboxApi({
  // Which endpoint to use
  development: true,
  // If it should start in an authenticated state, verifying
  // the user
  authenticate: true,
  // Callback for making requests
  onRequest: onBrowserRequest,
});

GQL queries

import { createQuery, createMutation } from "@codesandbox/api";

const sandboxQuery = createQuery("Sandbox", {
  sandbox: [{ sandboxId: "new" }, { isFrozen: true }],
});