@codesandbox/api
v0.1.0
Published
The CodeSandbox API
Downloads
85
Readme
@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 }],
});