Repository navigation
Expand file tree
/
Copy pathv2.ts
More file actions
39 lines (38 loc) · 1.41 KB
/
Copy pathv2.ts
File metadata and controls
39 lines (38 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* Type definitions for the Square Cloud REST API, version 2.
*
* Use these types to describe the requests you send to and the responses you
* get from `https://api.squarecloud.app/v2` when you call the API without an
* SDK. The package ships types and a few constant objects only, and it makes
* no requests itself.
*
* Types that start with `API` describe what the API returns. Types that start
* with `REST` are named after a route and describe its query, body or
* response. Every JSON response uses the {@link APIPayload} envelope, and a
* failed call carries one of the {@link APIErrorCode} values in `code`.
*
* Application routes also accept a workspace application: pass its id as
* `<appId>-<workspaceId>` wherever a route takes an `appId`.
*
* @example
* ```ts
* import type { APIApplicationStatusPayload } from "@squarecloud/api-types/v2";
*
* const res = await fetch(`https://api.squarecloud.app/v2/apps/${appId}/status`, {
* headers: { Authorization: process.env.SQUARECLOUD_API_KEY ?? "" },
* });
* const payload = (await res.json()) as APIApplicationStatusPayload;
*
* if (payload.status === "success") {
* console.log(payload.response.cpu, payload.response.ram);
* } else {
* console.error(payload.code, payload.message);
* }
* ```
*
* @packageDocumentation
*/
export * from "./common/v2";
export * from "./payloads/v2/index";
export * from "./rest/v2/index";
export * from "./utils";