CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/pages/api/v2/index.ts
Views: 687
1
import { docsApiRoute } from "next-rest-framework";
2
import { join } from "node:path";
3
4
import basePath from "lib/base-path";
5
6
7
export default docsApiRoute({
8
// deniedPaths: [...] // Ignore endpoints from the generated OpenAPI spec.
9
// allowedPaths: [...], // Explicitly set which endpoints to include in the generated OpenAPI spec.
10
openApiObject: {
11
info: {
12
title: "CoCalc API",
13
version: "1.0.0",
14
summary: `This is the CoCalc HTTP API. To get started, you'll need to
15
[create an API key](https://doc.cocalc.com/apikeys.html).`,
16
description: `This is the CoCalc HTTP API. To get started, you'll need to
17
[create an API key](https://doc.cocalc.com/apikeys.html).`,
18
},
19
externalDocs: {
20
url: "https://doc.cocalc.com",
21
description: "Check out the CoCalc documentation and user guide.",
22
},
23
components: {
24
securitySchemes: {
25
BasicAuth: {
26
type: "http",
27
scheme: "basic",
28
description: `The \`password\` field should be left blank, and the \`username\`
29
field should contain the client's API key.`,
30
},
31
},
32
},
33
security: [
34
{
35
BasicAuth: [],
36
},
37
],
38
servers: [
39
{
40
description: "CoCalc Production",
41
url: "https://cocalc.com",
42
variables: {
43
apiKey: {
44
default: "",
45
description: `API key to use for the request. An account-wide key may be
46
obtained by visiting https://cocalc.com/settings/account`,
47
},
48
},
49
},
50
{
51
description: "CoCalc Dev",
52
url: "http://localhost:5000",
53
variables: {
54
apiKey: {
55
default: "",
56
description: `API key to use for the request. An account-wide key may be
57
obtained by visiting http://localhost:5000/settings/account`,
58
},
59
},
60
},
61
],
62
},
63
openApiJsonPath: join(basePath, "openapi.json"),
64
docsConfig: {
65
provider: "redoc", // redoc | swagger-ui
66
title: "CoCalc API",
67
description: "",
68
logoUrl: "https://cocalc.com/_next/static/media/full.0a70e50d.svg",
69
ogConfig: {
70
title: "CoCalc HTTP API (v2)",
71
type: "website",
72
url: "https://cocalc.com/api/v2",
73
imageUrl: "https://cocalc.com/webapp/favicon.ico",
74
},
75
},
76
});
77
78