cleaning up the api spec

This commit is contained in:
Copple committed 2022-08-03 21:51:50 +02:00
1 parent 9e1c9e9be1
commit f0ef1e33cd
5 files changed
+561 -48

No files matched your search

+467 -19
View File
@@ -1,8 +1,13 @@
---
id: usage
title: Usage
toc_max_heading_level: 2
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
API documentation for Supabase Storage
@@ -14,176 +19,619 @@ API documentation for Supabase Storage
### Create a bucket
## Create a bucket {#create-a-bucket}
```
/bucket/
```
### Responses
### Gets all buckets
<Tabs>
<TabItem value="200">
```
200
```
</TabItem>
<TabItem value="400">
```
400
```
</TabItem>
</Tabs>
<br />
## Gets all buckets {#gets-all-buckets}
```
/bucket/
```
### Responses
<Tabs>
<TabItem value="200">
```
200
```
</TabItem>
<TabItem value="400">
```
400
```
</TabItem>
</Tabs>
<br />
### Empty a bucket
## Empty a bucket {#empty-a-bucket}
```
/bucket/{bucketId}/empty
```
### Responses
<Tabs>
<TabItem value="200">
```
200
```
</TabItem>
<TabItem value="400">
```
400
```
</TabItem>
</Tabs>
<br />
### Get details of a bucket
## Get details of a bucket {#get-details-of-a-bucket}
```
/bucket/{bucketId}
```
### Responses
### Update properties of a bucket
<Tabs>
<TabItem value="200">
```
200
```
</TabItem>
<TabItem value="400">
```
400
```
</TabItem>
</Tabs>
<br />
## Update properties of a bucket {#update-properties-of-a-bucket}
```
/bucket/{bucketId}
```
### Responses
### Delete a bucket
<Tabs>
<TabItem value="200">
```
200
```
</TabItem>
<TabItem value="400">
```
400
```
</TabItem>
</Tabs>
<br />
## Delete a bucket {#delete-a-bucket}
```
/bucket/{bucketId}
```
### Responses
<Tabs>
<TabItem value="200">
```
200
```
</TabItem>
<TabItem value="400">
```
400
```
</TabItem>
</Tabs>
<br />
### Delete an object
## Delete an object {#delete-an-object}
```
/object/{bucketName}/{wildcard}
```
### Responses
### Deprecated (use GET /object/authenticated/{bucketName} instead): Retrieve an object
<Tabs>
<TabItem value="200">
```
200
```
</TabItem>
<TabItem value="400">
```
400
```
</TabItem>
</Tabs>
<br />
## Deprecated (use GET /object/authenticated/{bucketName} instead): Retrieve an object {#deprecated-use-get-objectauthenticatedbucketname-instead-retrieve-an-object}
```
/object/{bucketName}/{wildcard}
```
### Responses
### Update the object at an existing key
<Tabs>
<TabItem value="400">
```
400
```
</TabItem>
</Tabs>
<br />
## Update the object at an existing key {#update-the-object-at-an-existing-key}
```
/object/{bucketName}/{wildcard}
```
### Responses
### Upload a new object
<Tabs>
<TabItem value="200">
```
200
```
</TabItem>
<TabItem value="400">
```
400
```
</TabItem>
</Tabs>
<br />
## Upload a new object {#upload-a-new-object}
```
/object/{bucketName}/{wildcard}
```
### Responses
<Tabs>
<TabItem value="200">
```
200
```
</TabItem>
<TabItem value="400">
```
400
```
</TabItem>
</Tabs>
<br />
### Delete multiple objects
## Delete multiple objects {#delete-multiple-objects}
```
/object/{bucketName}
```
### Responses
<Tabs>
<TabItem value="200">
```
200
```
</TabItem>
<TabItem value="400">
```
400
```
</TabItem>
</Tabs>
<br />
### Retrieve an object
## Retrieve an object {#retrieve-an-object}
```
/object/authenticated/{bucketName}/{wildcard}
```
### Responses
<Tabs>
<TabItem value="400">
```
400
```
</TabItem>
</Tabs>
<br />
### Generate a presigned url to retrieve an object
## Generate a presigned url to retrieve an object {#generate-a-presigned-url-to-retrieve-an-object}
```
/object/sign/{bucketName}/{wildcard}
```
### Responses
### Retrieve an object via a presigned URL
<Tabs>
<TabItem value="200">
```
200
```
</TabItem>
<TabItem value="400">
```
400
```
</TabItem>
</Tabs>
<br />
## Retrieve an object via a presigned URL {#retrieve-an-object-via-a-presigned-url}
```
/object/sign/{bucketName}/{wildcard}
```
### Responses
<Tabs>
<TabItem value="400">
```
400
```
</TabItem>
</Tabs>
<br />
### Generate presigned urls to retrieve objects
## Generate presigned urls to retrieve objects {#generate-presigned-urls-to-retrieve-objects}
```
/object/sign/{bucketName}
```
### Responses
<Tabs>
<TabItem value="200">
```
200
```
</TabItem>
<TabItem value="400">
```
400
```
</TabItem>
</Tabs>
<br />
### Moves an object
## Moves an object {#moves-an-object}
```
/object/move
```
### Responses
<Tabs>
<TabItem value="200">
```
200
```
</TabItem>
<TabItem value="400">
```
400
```
</TabItem>
</Tabs>
<br />
### Search for objects under a prefix
## Search for objects under a prefix {#search-for-objects-under-a-prefix}
```
/object/list/{bucketName}
```
### Responses
<Tabs>
<TabItem value="200">
```
200
```
</TabItem>
<TabItem value="400">
```
400
```
</TabItem>
</Tabs>
<br />
### Copies an object
## Copies an object {#copies-an-object}
```
/object/copy
```
### Responses
<Tabs>
<TabItem value="200">
```
200
```
</TabItem>
<TabItem value="400">
```
400
```
</TabItem>
</Tabs>
<br />
### Retrieve an object from a public bucket
## Retrieve an object from a public bucket {#retrieve-an-object-from-a-public-bucket}
```
/object/public/{bucketName}/{wildcard}
```
### Responses
<Tabs>
<TabItem value="400">
```
400
```
</TabItem>
</Tabs>
<br />
+58 -25
View File
@@ -123,11 +123,48 @@ const config = {
footer: {
links: [
{
title: 'Reference',
title: 'Company',
items: [
{
label: 'Supabase CLI',
to: '/cli',
label: 'Blog',
to: 'https://supabase.com/blog',
},
{
label: 'Open source',
to: '/oss',
},
{
label: 'Humans.txt',
to: 'https://supabase.com/humans.txt',
},
{
label: 'Lawyers.txt',
to: 'https://supabase.com/lawyers.txt',
},
],
},
{
title: 'Resources',
items: [
{
label: 'Brand Assets',
to: 'https://supabase.com/brand-assets',
},
{
label: 'Docs',
to: 'https://supabase.com/docs',
},
{
label: 'Pricing',
to: 'https://supabase.com/pricing',
},
{
label: 'Support',
to: '/support',
},
{
label: 'System Status',
to: 'https://status.supabase.com/',
},
],
},
@@ -135,42 +172,38 @@ const config = {
title: 'Community',
items: [
{
label: 'Stack Overflow',
href: 'https://stackoverflow.com/questions/tagged/supabase',
},
{
label: 'Discord',
href: 'https://discord.supabase.com',
label: 'GitHub',
href: 'https://github.com/supabase/supabase',
},
{
label: 'Twitter',
href: 'https://twitter.com/supabase',
},
{
label: 'DevTo',
href: 'https://dev.to/supabase',
},
{
label: 'RSS',
href: 'https://supabase.com/rss.xml',
},
{
label: 'Discord',
href: 'https://discord.supabase.com',
},
],
},
{
title: 'More',
title: 'Beta',
items: [
{
label: 'Supabase Website',
href: 'https://supabase.com',
},
{
label: 'Supabase Docs',
href: 'https://supabase.com/docs',
},
{
label: 'Supabase GitHub',
href: 'https://github.com/supabase/supabase',
},
{
label: 'Supabase Community GitHub',
href: 'https://github.com/supabase-community/supabase',
label: 'Join our beta',
href: 'https://app.supabase.com',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} Supabase, Inc.`,
copyright: `Copyright © ${new Date().getFullYear()} Supabase.`,
},
prism: {
additionalLanguages: ['dart'],
+2 -1
View File
@@ -5,9 +5,10 @@ const navbar = [
position: 'left',
},
{
href: 'https://supabase.com/docs/guides',
href: '/',
label: 'Reference',
position: 'left',
// activeLinkRegex: '',
},
{ href: 'https://app.supabase.com', label: 'Login', position: 'right' },
+12 -3
View File
@@ -1,5 +1,5 @@
import template from './templates/ApiTemplate'
import { toArrayWithKey } from './helpers'
import { slugify, toArrayWithKey } from './helpers'
import { OpenAPIV3, OpenAPIV2 } from 'openapi-types'
const fs = require('fs')
const ejs = require('ejs')
@@ -51,10 +51,19 @@ async function gen_v3(spec: OpenAPIV3.Document, dest: string) {
// OPENAPI-SPEC-VERSION: 2.0
async function gen_v2(spec: OpenAPIV2.Document, dest: string) {
const paths = Object.entries(spec.paths).map(([key, path], i) => {
const paths = Object.entries(spec.paths).map(([key, path]) => {
return {
path: key,
operations: toArrayWithKey(path!, 'operation'),
operations: toArrayWithKey(path!, 'operation').map((o) => {
const operation = o as OpenAPIV2.OperationObject & {
path: string
}
return {
...operation,
operationId: slugify(operation.summary!),
responses: toArrayWithKey(operation.responses!, 'responseCode'),
}
}),
}
})
+22
View File
@@ -2,8 +2,13 @@ const template = `
---
id: usage
title: Usage
toc_max_heading_level: 2
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<%- info.description %>
@@ -15,12 +20,29 @@ title: Usage
<% paths.forEach(function(path){ %>
<% path.operations.forEach(function(operation){ %>
## <%- operation.summary %> {#<%- operation.operationId %>}
\`\`\`
<%- path.path %>
\`\`\`
### Responses
<Tabs>
<% operation.responses.forEach(function(response){ %>
<TabItem value="<%- response.responseCode %>">
\`\`\`
<%- response.responseCode %>
\`\`\`
</TabItem>
<% }); %>
</Tabs>
<br />
<% }); %>
<% }); %>