Skip to content

Latest commit

 

History

History
163 lines (116 loc) · 4.08 KB

File metadata and controls

163 lines (116 loc) · 4.08 KB

Scalar Galaxy TypeScript API

Complete reference of every operation, grouped by resource. See the README for usage and configuration.

Contents

Setup

import ScalarGalaxy from "@scalar/galaxy-sdk";

const client = new ScalarGalaxy({
  bearerAuth: process.env["BEARER_AUTH"], // defaults to the BEARER_AUTH env var
  environment: "production",
});

Planets

Get all planets

It's easy to say you know them all, but do you really? Retrieve all the planets and check whether you missed one.

Direction Type
Request PlanetListAllDataParams
Response PlanetListAllDataResponse
const listAllData = await client.planets.listAllData({
  limit: 10,
  offset: 0,
});

Create a planet

Time to play god and create a new planet. What do you think? Ah, don't think too much. What could go wrong anyway?

Direction Type
Request PlanetCreateParams
Response Planet
const planet = await client.planets.create();

Get a planet

You'll better learn a little bit more about the planets. It might come in handy once space travel is available for everyone.

Direction Type
Response Planet
const planet = await client.planets.retrieve(1);

Update a planet

Sometimes you make mistakes, that's fine. No worries, you can update all planets.

Direction Type
Request PlanetUpdateParams
Response Planet
const planet = await client.planets.update(1);

Delete a planet

This endpoint was used to delete planets. Unfortunately, that caused a lot of trouble for planets with life. So, this endpoint is now deprecated and should not be used anymore.

await client.planets.delete(1);

Upload an image to a planet

Got a crazy good photo of a planet? Share it with the world!

Direction Type
Request PlanetUploadImageParams
Response PlanetUploadImageResponse
const uploadImage = await client.planets.uploadImage(1);

CelestialBodies

Create a celestial body

Direction Type
Request CelestialBodyCreateParams
Response CelestialBody
const celestialBody = await client.celestialBodies.create({
  name: "",
  type: "planet",
});

Authentication

Create a user

Time to create a user account, eh?

Direction Type
Request AuthenticationCreateUserParams
Response User
const user = await client.authentication.createUser();

Get a token

Yeah, this is the boring security stuff. Just get your super secret token and move on.

Direction Type
Request AuthenticationCreateTokenParams
Response AuthenticationCreateTokenResponse
const createToken = await client.authentication.createToken();

Get authenticated user

Find yourself they say. That's what you can do here.

Direction Type
Response User
const user = await client.authentication.listMe();