Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Adds a section for storage

Copple9a3824c8a669
diff --git a/apps/reference/_gotrue/intro.mdx b/apps/reference/_gotrue/intro.mdx
index c64a74c26f9..bad7efda6d7 100644
--- a/apps/reference/_gotrue/intro.mdx
+++ b/apps/reference/_gotrue/intro.mdx
@@ -4,6 +4,6 @@ sidebar_position: 1
sidebar_label: Introduction
---
-# GoTrue - Supabase Auth
+# Supabase Auth Server
Some docs
diff --git a/apps/reference/_gotrue_versioned_docs/version-0.0.1/intro.md b/apps/reference/_gotrue_versioned_docs/version-0.0.1/intro.md
deleted file mode 100644
index b2c9b7bbc47..00000000000
--- a/apps/reference/_gotrue_versioned_docs/version-0.0.1/intro.md
+++ /dev/null
@@ -1,8 +0,0 @@
----
-slug: /
-sidebar_position: 1
----
-
-# GoTrue - Supabase Auth
-
-Some docs
diff --git a/apps/reference/_gotrue_versioned_docs/version-0.0.1/intro.mdx b/apps/reference/_gotrue_versioned_docs/version-0.0.1/intro.mdx
deleted file mode 100644
index 14302fb108b..00000000000
--- a/apps/reference/_gotrue_versioned_docs/version-0.0.1/intro.mdx
+++ /dev/null
@@ -1,8 +0,0 @@
----
-slug: /
-sidebar_position: 1
----
-
-# GoTrue - Supabase Auth
-
-Some docs
\ No newline at end of file
diff --git a/apps/reference/_gotrue_versioned_docs/version-0.0.1/release-notes.md b/apps/reference/_gotrue_versioned_docs/version-0.0.1/release-notes.md
deleted file mode 100644
index 30c0f23e7c6..00000000000
--- a/apps/reference/_gotrue_versioned_docs/version-0.0.1/release-notes.md
+++ /dev/null
@@ -1,7 +0,0 @@
----
-id: release-notes
----
-
-# Release Notes
-
-Start your release notes here.
diff --git a/apps/reference/_gotrue_versioned_sidebars/version-0.0.1-sidebars.json b/apps/reference/_gotrue_versioned_sidebars/version-0.0.1-sidebars.json
deleted file mode 100644
index a8aadd1b7f9..00000000000
--- a/apps/reference/_gotrue_versioned_sidebars/version-0.0.1-sidebars.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "goTrueSidebar": ["intro", "config", "release-notes"]
-}
diff --git a/apps/reference/_gotrue_versions.json b/apps/reference/_gotrue_versions.json
index e0c9dfb7d99..fe51488c706 100644
--- a/apps/reference/_gotrue_versions.json
+++ b/apps/reference/_gotrue_versions.json
@@ -1 +1 @@
-["0.0.1"]
+[]
diff --git a/apps/reference/_gotrue_versioned_docs/version-0.0.1/config.mdx b/apps/reference/_storage/config.mdx
similarity index 100%
rename from apps/reference/_gotrue_versioned_docs/version-0.0.1/config.mdx
rename to apps/reference/_storage/config.mdx
diff --git a/apps/reference/_storage/intro.mdx b/apps/reference/_storage/intro.mdx
new file mode 100644
index 00000000000..e6a5130bb2d
--- /dev/null
+++ b/apps/reference/_storage/intro.mdx
@@ -0,0 +1,9 @@
+---
+slug: /
+sidebar_position: 1
+sidebar_label: Introduction
+---
+
+# Supabase Storage Server
+
+Some docs
diff --git a/apps/reference/_gotrue_versioned_docs/version-0.0.1/release-notes.mdx b/apps/reference/_storage/release-notes.mdx
similarity index 100%
rename from apps/reference/_gotrue_versioned_docs/version-0.0.1/release-notes.mdx
rename to apps/reference/_storage/release-notes.mdx
diff --git a/apps/reference/_storage/usage.mdx b/apps/reference/_storage/usage.mdx
new file mode 100644
index 00000000000..a686b95168a
--- /dev/null
+++ b/apps/reference/_storage/usage.mdx
@@ -0,0 +1,189 @@
+---
+id: usage
+title: Usage
+---
+
+<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
+
+API documentation for Supabase Storage
+
+
+<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
+
+
+
+
+
+### Create a bucket
+
+```
+/bucket/
+```
+
+
+
+### Gets all buckets
+
+```
+/bucket/
+```
+
+
+
+
+
+### Empty a bucket
+
+```
+/bucket/{bucketId}/empty
+```
+
+
+
+
+
+### Get details of a bucket
+
+```
+/bucket/{bucketId}
+```
+
+
+
+### Update properties of a bucket
+
+```
+/bucket/{bucketId}
+```
+
+
+
+### Delete a bucket
+
+```
+/bucket/{bucketId}
+```
+
+
+
+
+
+### Delete an object
+
+```
+/object/{bucketName}/{wildcard}
+```
+
+
+
+### Deprecated (use GET /object/authenticated/{bucketName} instead): Retrieve an object
+
+```
+/object/{bucketName}/{wildcard}
+```
+
+
+
+### Update the object at an existing key
+
+```
+/object/{bucketName}/{wildcard}
+```
+
+
+
+### Upload a new object
+
+```
+/object/{bucketName}/{wildcard}
+```
+
+
+
+
+
+### Delete multiple objects
+
+```
+/object/{bucketName}
+```
+
+
+
+
+
+### Retrieve an object
+
+```
+/object/authenticated/{bucketName}/{wildcard}
+```
+
+
+
+
+
+### Generate a presigned url to retrieve an object
+
+```
+/object/sign/{bucketName}/{wildcard}
+```
+
+
+
+### Retrieve an object via a presigned URL
+
+```
+/object/sign/{bucketName}/{wildcard}
+```
+
+
+
+
+
+### Generate presigned urls to retrieve objects
+
+```
+/object/sign/{bucketName}
+```
+
+
+
+
+
+### Moves an object
+
+```
+/object/move
+```
+
+
+
+
+
+### Search for objects under a prefix
+
+```
+/object/list/{bucketName}
+```
+
+
+
+
+
+### Copies an object
+
+```
+/object/copy
+```
+
+
+
+
+
+### Retrieve an object from a public bucket
+
+```
+/object/public/{bucketName}/{wildcard}
+```
+
+
diff --git a/apps/reference/_storage_versioned_docs/.gitkeep b/apps/reference/_storage_versioned_docs/.gitkeep
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/apps/reference/_storage_versioned_sidebars/.gitkeep b/apps/reference/_storage_versioned_sidebars/.gitkeep
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/apps/reference/_storage_versions.json b/apps/reference/_storage_versions.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/apps/reference/_storage_versions.json
@@ -0,0 +1 @@
+[]
diff --git a/apps/reference/docusaurus.config.js b/apps/reference/docusaurus.config.js
index 3861316d229..0f640f5610f 100644
--- a/apps/reference/docusaurus.config.js
+++ b/apps/reference/docusaurus.config.js
@@ -58,6 +58,16 @@ const config = {
breadcrumbs: false,
},
],
+ [
+ '@docusaurus/plugin-content-docs',
+ {
+ id: '_storage',
+ path: '_storage',
+ routeBasePath: 'storage',
+ sidebarPath: require.resolve('./nav/storage_sidebars.js'),
+ breadcrumbs: false,
+ },
+ ],
[
'@docusaurus/plugin-content-docs',
{
diff --git a/apps/reference/nav/_referenceNavbar.js b/apps/reference/nav/_referenceNavbar.js
index 93c31ae8cc6..20d8a3fe8af 100644
--- a/apps/reference/nav/_referenceNavbar.js
+++ b/apps/reference/nav/_referenceNavbar.js
@@ -91,6 +91,20 @@ const navbar = [
supabaseCustomNavBarRegex: '(^/gotrue$|gotrue/)',
},
+ // Storage
+ {
+ to: 'storage',
+ position: 'left',
+ label: 'GoTrue Auth Server',
+ supabaseCustomNavBarRegex: '(^/storage$|storage/)',
+ },
+ {
+ type: 'docsVersionDropdown',
+ position: 'left',
+ docsPluginId: '_storage',
+ supabaseCustomNavBarRegex: '(^/storage$|storage/)',
+ },
+
/**
* COMMUNITY
*/
diff --git a/apps/reference/nav/_referenceSidebars.js b/apps/reference/nav/_referenceSidebars.js
index 140d75fad40..d6eb8b17a53 100644
--- a/apps/reference/nav/_referenceSidebars.js
+++ b/apps/reference/nav/_referenceSidebars.js
@@ -41,7 +41,10 @@ const sidebars = {
type: 'category',
label: 'Tools',
collapsed: false,
- items: [{ type: 'link', label: 'GoTrue Auth Server', href: '/gotrue' }],
+ items: [
+ { type: 'link', label: 'Auth Server', href: '/gotrue' },
+ { type: 'link', label: 'Storage Server', href: '/storage' },
+ ],
},
// {
// type: 'category',
diff --git a/apps/reference/nav/storage_sidebars.js b/apps/reference/nav/storage_sidebars.js
new file mode 100644
index 00000000000..e2cc7c2182c
--- /dev/null
+++ b/apps/reference/nav/storage_sidebars.js
@@ -0,0 +1,32 @@
+/**
+ * Creating a sidebar enables you to:
+ - create an ordered group of docs
+ - render a sidebar for each doc of that group
+ - provide next/previous navigation
+
+ The sidebars can be generated from the filesystem, or explicitly defined here.
+
+ Create as many sidebars as you want.
+ */
+
+// @ts-check
+
+/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
+const sidebars = {
+ // By default, Docusaurus generates a sidebar from the docs folder structure
+ // tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],
+
+ goTrueSidebar: [
+ 'intro',
+ 'usage',
+ 'config',
+ 'release-notes',
+ // {
+ // type: "category",
+ // label: "Release Notes",
+ // items: ["release-notes"],
+ // },
+ ],
+}
+
+module.exports = sidebars
diff --git a/apps/reference/package.json b/apps/reference/package.json
index aa9dee67d0f..4da7d3ccb70 100644
--- a/apps/reference/package.json
+++ b/apps/reference/package.json
@@ -11,7 +11,12 @@
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
- "prettier": "prettier --write \"./**/*.{ts,tsx,md,js,jsx,json}\""
+ "prettier": "prettier --write \"./**/*.{ts,tsx,md,js,jsx,json}\"",
+ "cli:version": "docusaurus docs:version:_cli",
+ "gotrue:version": "docusaurus docs:version:_gotrue",
+ "storage:version": "docusaurus docs:version:_storage",
+ "supabase-js:version": "docusaurus docs:version:_supabase-js",
+ "supabase-dart:version": "docusaurus docs:version:_supabase_dart"
},
"dependencies": {
"@docusaurus/core": "2.0.0-rc.1",
diff --git a/apps/reference/src/theme/DocSidebar/Desktop/Content/index.js b/apps/reference/src/theme/DocSidebar/Desktop/Content/index.js
index 283ec91666c..02cac10e226 100644
--- a/apps/reference/src/theme/DocSidebar/Desktop/Content/index.js
+++ b/apps/reference/src/theme/DocSidebar/Desktop/Content/index.js
@@ -8,6 +8,7 @@ const subNavRoutes = [
'/api',
'/cli',
'/gotrue',
+ '/storage',
'/supabase-js',
'/supabase-dart',
]
diff --git a/packages/spec/package.json b/packages/spec/package.json
index b8edf824beb..9eeb012b9b3 100644
--- a/packages/spec/package.json
+++ b/packages/spec/package.json
@@ -5,13 +5,15 @@
"types": "./index.tsx",
"license": "MIT",
"scripts": {
- "api:gen": "npm run api:gen:paths",
- "api:gen:paths": "ts-node ./index.ts gen --type api --input ../../spec/api_v0_openapi.json --output ../../apps/reference/_api/usage.mdx",
+ "api:gen": "npm run api:gen:api",
+ "api:gen:api": "ts-node ./index.ts gen --type api --input ../../spec/api_v0_openapi.json --output ../../apps/reference/_api/usage.mdx",
"cli:gen": "npm run cli:gen:commands && npm run cli:gen:config",
"cli:gen:commands": "ts-node ./index.ts gen --type command --input ../../spec/cli_v1_commands.yaml --output ../../apps/reference/_cli/usage.mdx ",
"cli:gen:config": "ts-node ./index.ts gen --type config --input ../../spec/cli_v1_config.yaml --output ../../apps/reference/_cli/config.mdx",
"gotrue:gen": "npm run gotrue:gen:config",
- "gotrue:gen:config": "ts-node ./index.ts gen --type config --input ../../spec/gotrue_v1_config.yaml --output ../../apps/reference/_gotrue/config.mdx ",
+ "gotrue:gen:config": "ts-node ./index.ts gen --type config --input ../../spec/gotrue_v1_config.yaml --output ../../apps/reference/_gotrue/config.mdx",
+ "storage:gen": "npm run storage:gen:api",
+ "storage:gen:api": "ts-node ./index.ts gen --type api --input ../../spec/storage_v0_openapi.json --output ../../apps/reference/_storage/usage.mdx",
"supabase-js:gen": "npm run supabase-js:gen:sdk",
"supabase-js:gen:sdk": "ts-node ./index.ts gen --type sdk --input ../../spec/supabase_js_sdk.yaml --output ../../apps/reference/_supabase_js/usage.mdx",
"supabase-dart:gen": "npm run supabase-dart:gen:sdk",
diff --git a/packages/spec/src/docs/api.ts b/packages/spec/src/docs/api.ts
index b317e3f3cd2..70557093d58 100644
--- a/packages/spec/src/docs/api.ts
+++ b/packages/spec/src/docs/api.ts
@@ -1,6 +1,6 @@
import template from './templates/ApiTemplate'
import { toArrayWithKey } from './helpers'
-import { OpenAPIV3 } from 'openapi-types'
+import { OpenAPIV3, OpenAPIV2 } from 'openapi-types'
const fs = require('fs')
const ejs = require('ejs')
const Helpers = require('./Helpers')
@@ -9,15 +9,19 @@ const { writeToDisk } = Helpers
export default async function gen(inputFileName: string, outputDir: string) {
const specRaw = fs.readFileSync(inputFileName, 'utf8')
const spec = JSON.parse(specRaw)
- // console.log('spec', spec.openapi)
+ // console.log('spec', spec)
- switch (spec.openapi) {
+ switch (spec.openapi || spec.swagger) {
case '3.0.0':
await gen_v3(spec, outputDir)
break
+ case '2.0':
+ await gen_v2(spec, outputDir)
+ break
+
default:
- console.log('Unrecognized specification version:', spec.clispec)
+ console.log('Unrecognized specification version:', spec.openapi)
break
}
}
@@ -25,15 +29,34 @@ export default async function gen(inputFileName: string, outputDir: string) {
/**
* Versioned Generator
*/
+
+// OPENAPI-SPEC-VERSION: 3.0.0
async function gen_v3(spec: OpenAPIV3.Document, dest: string) {
- const paths = Object.entries(spec.paths)
- .map(([key, path], i) => {
- return {
- path: key,
- operations: toArrayWithKey(path!, 'operation'),
- }
- })
- .filter((x) => x.path.indexOf('/v1') === 0)
+ const paths = Object.entries(spec.paths).map(([key, path], i) => {
+ return {
+ path: key,
+ operations: toArrayWithKey(path!, 'operation'),
+ }
+ })
+
+ const content = ejs.render(template, {
+ info: spec.info,
+ paths,
+ })
+ // console.log(content)
+ // Write to disk
+ await writeToDisk(dest, content)
+ console.log('Saved: ', dest)
+}
+
+// OPENAPI-SPEC-VERSION: 2.0
+async function gen_v2(spec: OpenAPIV2.Document, dest: string) {
+ const paths = Object.entries(spec.paths).map(([key, path], i) => {
+ return {
+ path: key,
+ operations: toArrayWithKey(path!, 'operation'),
+ }
+ })
const content = ejs.render(template, {
info: spec.info,
diff --git a/spec/storage_v0_openapi.json b/spec/storage_v0_openapi.json
new file mode 100644
index 00000000000..e388411b196
--- /dev/null
+++ b/spec/storage_v0_openapi.json
@@ -0,0 +1,826 @@
+{
+ "swagger": "2.0",
+ "info": {
+ "title": "Supabase Storage API",
+ "description": "API documentation for Supabase Storage",
+ "version": "0.0.1"
+ },
+ "definitions": {
+ "def-0": {
+ "type": "object",
+ "properties": { "authorization": { "type": "string" } },
+ "required": ["authorization"],
+ "title": "authSchema"
+ },
+ "def-1": {
+ "type": "object",
+ "properties": {
+ "statusCode": { "type": "string" },
+ "error": { "type": "string" },
+ "message": { "type": "string" }
+ },
+ "required": ["statusCode", "error", "message"],
+ "title": "errorSchema"
+ }
+ },
+ "paths": {
+ "/bucket/": {
+ "post": {
+ "summary": "Create a bucket",
+ "tags": ["bucket"],
+ "parameters": [
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "type": "object",
+ "properties": {
+ "name": { "type": "string", "examples": ["avatars"] },
+ "id": { "type": "string", "examples": ["avatars"] },
+ "public": { "type": "boolean", "examples": [false] }
+ },
+ "required": ["name"]
+ }
+ },
+ { "in": "header", "name": "authorization", "required": true, "type": "string" }
+ ],
+ "responses": {
+ "200": {
+ "description": "Default Response",
+ "schema": {
+ "type": "object",
+ "properties": { "name": { "type": "string", "examples": ["avatars"] } },
+ "required": ["name"]
+ }
+ },
+ "400": { "description": "Default Response", "schema": { "$ref": "#/definitions/def-1" } }
+ }
+ },
+ "get": {
+ "summary": "Gets all buckets",
+ "tags": ["bucket"],
+ "parameters": [
+ { "in": "header", "name": "authorization", "required": true, "type": "string" }
+ ],
+ "responses": {
+ "200": {
+ "description": "Default Response",
+ "schema": {
+ "type": "array",
+ "items": {
+ "$id": "bucketSchema",
+ "type": "object",
+ "properties": {
+ "id": { "type": "string" },
+ "name": { "type": "string" },
+ "owner": { "type": "string" },
+ "public": { "type": "boolean" },
+ "created_at": { "type": "string" },
+ "updated_at": { "type": "string" }
+ },
+ "required": ["id", "name"],
+ "additionalProperties": false,
+ "examples": [
+ {
+ "id": "bucket2",
+ "name": "bucket2",
+ "owner": "4d56e902-f0a0-4662-8448-a4d9e643c142",
+ "created_at": "2021-02-17T04:43:32.770206+00:00",
+ "updated_at": "2021-02-17T04:43:32.770206+00:00"
+ }
+ ],
+ "title": "bucketSchema"
+ },
+ "examples": [
+ [
+ {
+ "id": "bucket2",
+ "name": "bucket2",
+ "owner": "4d56e902-f0a0-4662-8448-a4d9e643c142",
+ "created_at": "2021-02-17T04:43:32.770206+00:00",
+ "updated_at": "2021-02-17T04:43:32.770206+00:00"
+ }
+ ]
+ ]
+ }
+ },
+ "400": { "description": "Default Response", "schema": { "$ref": "#/definitions/def-1" } }
+ }
+ }
+ },
+ "/bucket/{bucketId}/empty": {
+ "post": {
+ "summary": "Empty a bucket",
+ "tags": ["bucket"],
+ "parameters": [
+ {
+ "type": "string",
+ "examples": ["avatars"],
+ "required": true,
+ "in": "path",
+ "name": "bucketId"
+ },
+ { "in": "header", "name": "authorization", "required": true, "type": "string" }
+ ],
+ "responses": {
+ "200": {
+ "description": "Default Response",
+ "schema": {
+ "type": "object",
+ "properties": {
+ "message": { "type": "string", "examples": ["Successfully emptied"] }
+ }
+ }
+ },
+ "400": { "description": "Default Response", "schema": { "$ref": "#/definitions/def-1" } }
+ }
+ }
+ },
+ "/bucket/{bucketId}": {
+ "get": {
+ "summary": "Get details of a bucket",
+ "tags": ["bucket"],
+ "parameters": [
+ {
+ "type": "string",
+ "examples": ["avatars"],
+ "required": true,
+ "in": "path",
+ "name": "bucketId"
+ },
+ { "in": "header", "name": "authorization", "required": true, "type": "string" }
+ ],
+ "responses": {
+ "200": {
+ "description": "Default Response",
+ "schema": {
+ "$id": "todo.com",
+ "type": "object",
+ "properties": {
+ "id": { "type": "string" },
+ "name": { "type": "string" },
+ "owner": { "type": "string" },
+ "public": { "type": "boolean" },
+ "created_at": { "type": "string" },
+ "updated_at": { "type": "string" }
+ },
+ "required": ["id", "name"],
+ "additionalProperties": false,
+ "examples": [
+ {
+ "id": "bucket2",
+ "name": "bucket2",
+ "owner": "4d56e902-f0a0-4662-8448-a4d9e643c142",
+ "created_at": "2021-02-17T04:43:32.770206+00:00",
+ "updated_at": "2021-02-17T04:43:32.770206+00:00"
+ }
+ ]
+ }
+ },
+ "400": { "description": "Default Response", "schema": { "$ref": "#/definitions/def-1" } }
+ }
+ },
+ "put": {
+ "summary": "Update properties of a bucket",
+ "tags": ["bucket"],
+ "parameters": [
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "type": "object",
+ "properties": { "public": { "type": "boolean", "examples": [false] } }
+ }
+ },
+ { "in": "header", "name": "authorization", "required": true, "type": "string" }
+ ],
+ "responses": {
+ "200": {
+ "description": "Default Response",
+ "schema": {
+ "type": "object",
+ "properties": {
+ "message": { "type": "string", "examples": ["Successfully updated"] }
+ },
+ "required": ["message"]
+ }
+ },
+ "400": { "description": "Default Response", "schema": { "$ref": "#/definitions/def-1" } }
+ }
+ },
+ "delete": {
+ "summary": "Delete a bucket",
+ "tags": ["bucket"],
+ "parameters": [
+ {
+ "type": "string",
+ "examples": ["avatars"],
+ "required": true,
+ "in": "path",
+ "name": "bucketId"
+ },
+ { "in": "header", "name": "authorization", "required": true, "type": "string" }
+ ],
+ "responses": {
+ "200": {
+ "description": "Default Response",
+ "schema": {
+ "type": "object",
+ "properties": {
+ "message": { "type": "string", "examples": ["Successfully deleted"] }
+ }
+ }
+ },
+ "400": { "description": "Default Response", "schema": { "$ref": "#/definitions/def-1" } }
+ }
+ }
+ },
+ "/object/{bucketName}/{wildcard}": {
+ "delete": {
+ "summary": "Delete an object",
+ "tags": ["object"],
+ "parameters": [
+ {
+ "type": "string",
+ "examples": ["avatars"],
+ "required": true,
+ "in": "path",
+ "name": "bucketName"
+ },
+ {
+ "type": "string",
+ "examples": ["folder/cat.png"],
+ "required": true,
+ "in": "path",
+ "name": "*"
+ },
+ { "in": "header", "name": "authorization", "required": true, "type": "string" }
+ ],
+ "responses": {
+ "200": {
+ "description": "Default Response",
+ "schema": {
+ "type": "object",
+ "properties": {
+ "message": { "type": "string", "examples": ["Successfully deleted"] }
+ }
+ }
+ },
+ "400": { "description": "Default Response", "schema": { "$ref": "#/definitions/def-1" } }
+ }
+ },
+ "get": {
+ "summary": "Deprecated (use GET /object/authenticated/{bucketName} instead): Retrieve an object",
+ "tags": ["object"],
+ "parameters": [
+ {
+ "type": "string",
+ "examples": ["avatars"],
+ "required": true,
+ "in": "path",
+ "name": "bucketName"
+ },
+ {
+ "type": "string",
+ "examples": ["folder/cat.png"],
+ "required": true,
+ "in": "path",
+ "name": "*"
+ },
+ { "in": "header", "name": "authorization", "required": true, "type": "string" }
+ ],
+ "responses": {
+ "400": { "description": "Default Response", "schema": { "$ref": "#/definitions/def-1" } }
+ }
+ },
+ "put": {
+ "summary": "Update the object at an existing key",
+ "tags": ["object"],
+ "parameters": [
+ {
+ "type": "string",
+ "examples": ["avatars"],
+ "required": true,
+ "in": "path",
+ "name": "bucketName"
+ },
+ {
+ "type": "string",
+ "examples": ["folder/cat.png"],
+ "required": true,
+ "in": "path",
+ "name": "*"
+ },
+ { "in": "header", "name": "authorization", "required": true, "type": "string" }
+ ],
+ "responses": {
+ "200": {
+ "description": "Default Response",
+ "schema": {
+ "type": "object",
+ "properties": {
+ "Key": { "type": "string", "examples": ["projectref/avatars/folder/cat.png"] }
+ },
+ "required": ["Key"]
+ }
+ },
+ "400": { "description": "Default Response", "schema": { "$ref": "#/definitions/def-1" } }
+ }
+ },
+ "post": {
+ "summary": "Upload a new object",
+ "tags": ["object"],
+ "parameters": [
+ {
+ "type": "string",
+ "examples": ["avatars"],
+ "required": true,
+ "in": "path",
+ "name": "bucketName"
+ },
+ {
+ "type": "string",
+ "examples": ["folder/cat.png"],
+ "required": true,
+ "in": "path",
+ "name": "*"
+ },
+ { "in": "header", "name": "authorization", "required": true, "type": "string" }
+ ],
+ "responses": {
+ "200": {
+ "description": "Default Response",
+ "schema": {
+ "type": "object",
+ "properties": { "Key": { "type": "string", "examples": ["avatars/folder/cat.png"] } },
+ "required": ["Key"]
+ }
+ },
+ "400": { "description": "Default Response", "schema": { "$ref": "#/definitions/def-1" } }
+ }
+ }
+ },
+ "/object/{bucketName}": {
+ "delete": {
+ "summary": "Delete multiple objects",
+ "tags": ["object"],
+ "parameters": [
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "type": "object",
+ "properties": {
+ "prefixes": {
+ "type": "array",
+ "items": { "type": "string" },
+ "minItems": 1,
+ "examples": [["folder/cat.png", "folder/morecats.png"]]
+ }
+ },
+ "required": ["prefixes"]
+ }
+ },
+ {
+ "type": "string",
+ "examples": ["avatars"],
+ "required": true,
+ "in": "path",
+ "name": "bucketName"
+ },
+ { "in": "header", "name": "authorization", "required": true, "type": "string" }
+ ],
+ "responses": {
+ "200": {
+ "description": "Default Response",
+ "schema": {
+ "type": "array",
+ "items": {
+ "$id": "objectSchema",
+ "type": "object",
+ "properties": {
+ "name": { "type": "string" },
+ "bucket_id": { "type": "string" },
+ "owner": { "type": "string" },
+ "id": { "anyOf": [{ "type": "string" }, { "type": "null" }] },
+ "updated_at": { "anyOf": [{ "type": "string" }, { "type": "null" }] },
+ "created_at": { "anyOf": [{ "type": "string" }, { "type": "null" }] },
+ "last_accessed_at": { "anyOf": [{ "type": "string" }, { "type": "null" }] },
+ "metadata": {
+ "anyOf": [
+ { "type": "object", "additionalProperties": true },
+ { "type": "null" }
+ ]
+ },
+ "buckets": {
+ "$id": "bucketSchema",
+ "type": "object",
+ "properties": {
+ "id": { "type": "string" },
+ "name": { "type": "string" },
+ "owner": { "type": "string" },
+ "public": { "type": "boolean" },
+ "created_at": { "type": "string" },
+ "updated_at": { "type": "string" }
+ },
+ "required": ["id", "name"],
+ "additionalProperties": false,
+ "examples": [
+ {
+ "id": "bucket2",
+ "name": "bucket2",
+ "owner": "4d56e902-f0a0-4662-8448-a4d9e643c142",
+ "created_at": "2021-02-17T04:43:32.770206+00:00",
+ "updated_at": "2021-02-17T04:43:32.770206+00:00"
+ }
+ ]
+ }
+ },
+ "required": ["name"],
+ "additionalProperties": false,
+ "examples": [
+ {
+ "name": "folder/cat.png",
+ "bucket_id": "avatars",
+ "owner": "317eadce-631a-4429-a0bb-f19a7a517b4a",
+ "id": "eaa8bdb5-2e00-4767-b5a9-d2502efe2196",
+ "updated_at": "2021-04-06T16:30:35.394674+00:00",
+ "created_at": "2021-04-06T16:30:35.394674+00:00",
+ "last_accessed_at": "2021-04-06T16:30:35.394674+00:00",
+ "metadata": { "size": 1234 }
+ }
+ ],
+ "title": "objectSchema"
+ }
+ }
+ },
+ "400": { "description": "Default Response", "schema": { "$ref": "#/definitions/def-1" } }
+ }
+ }
+ },
+ "/object/authenticated/{bucketName}/{wildcard}": {
+ "get": {
+ "summary": "Retrieve an object",
+ "tags": ["object"],
+ "parameters": [
+ {
+ "type": "string",
+ "examples": ["avatars"],
+ "required": true,
+ "in": "path",
+ "name": "bucketName"
+ },
+ {
+ "type": "string",
+ "examples": ["folder/cat.png"],
+ "required": true,
+ "in": "path",
+ "name": "*"
+ },
+ { "in": "header", "name": "authorization", "required": true, "type": "string" }
+ ],
+ "responses": {
+ "400": { "description": "Default Response", "schema": { "$ref": "#/definitions/def-1" } }
+ }
+ }
+ },
+ "/object/sign/{bucketName}/{wildcard}": {
+ "post": {
+ "summary": "Generate a presigned url to retrieve an object",
+ "tags": ["object"],
+ "parameters": [
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "type": "object",
+ "properties": {
+ "expiresIn": { "type": "integer", "minimum": 1, "examples": [60000] }
+ },
+ "required": ["expiresIn"]
+ }
+ },
+ {
+ "type": "string",
+ "examples": ["avatars"],
+ "required": true,
+ "in": "path",
+ "name": "bucketName"
+ },
+ {
+ "type": "string",
+ "examples": ["folder/cat.png"],
+ "required": true,
+ "in": "path",
+ "name": "*"
+ },
+ { "in": "header", "name": "authorization", "required": true, "type": "string" }
+ ],
+ "responses": {
+ "200": {
+ "description": "Default Response",
+ "schema": {
+ "type": "object",
+ "properties": {
+ "signedURL": {
+ "type": "string",
+ "examples": [
+ "/object/sign/avatars/folder/cat.png?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cmwiOiJhdmF0YXJzL2ZvbGRlci9jYXQucG5nIiwiaWF0IjoxNjE3NzI2MjczLCJleHAiOjE2MTc3MjcyNzN9.s7Gt8ME80iREVxPhH01ZNv8oUn4XtaWsmiQ5csiUHn4"
+ ]
+ }
+ },
+ "required": ["signedURL"]
+ }
+ },
+ "400": { "description": "Default Response", "schema": { "$ref": "#/definitions/def-1" } }
+ }
+ },
+ "get": {
+ "summary": "Retrieve an object via a presigned URL",
+ "tags": ["object"],
+ "parameters": [
+ {
+ "type": "string",
+ "examples": [
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cmwiOiJidWNrZXQyL3B1YmxpYy9zYWRjYXQtdXBsb2FkMjMucG5nIiwiaWF0IjoxNjE3NzI2MjczLCJleHAiOjE2MTc3MjcyNzN9.uBQcXzuvXxfw-9WgzWMBfE_nR3VOgpvfZe032sfLSSk"
+ ],
+ "required": true,
+ "in": "query",
+ "name": "token"
+ },
+ {
+ "type": "string",
+ "examples": ["avatars"],
+ "required": true,
+ "in": "path",
+ "name": "bucketName"
+ },
+ {
+ "type": "string",
+ "examples": ["folder/cat.png"],
+ "required": true,
+ "in": "path",
+ "name": "*"
+ }
+ ],
+ "responses": {
+ "400": { "description": "Default Response", "schema": { "$ref": "#/definitions/def-1" } }
+ }
+ }
+ },
+ "/object/sign/{bucketName}": {
+ "post": {
+ "summary": "Generate presigned urls to retrieve objects",
+ "tags": ["object"],
+ "parameters": [
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "type": "object",
+ "properties": {
+ "expiresIn": { "type": "integer", "minimum": 1, "examples": [60000] },
+ "paths": {
+ "type": "array",
+ "items": { "type": "string" },
+ "minItems": 1,
+ "examples": [["folder/cat.png", "folder/morecats.png"]]
+ }
+ },
+ "required": ["expiresIn", "paths"]
+ }
+ },
+ {
+ "type": "string",
+ "examples": ["avatars"],
+ "required": true,
+ "in": "path",
+ "name": "bucketName"
+ },
+ { "in": "header", "name": "authorization", "required": true, "type": "string" }
+ ],
+ "responses": {
+ "200": {
+ "description": "Default Response",
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "error": ["string", "null"],
+ "examples": ["Either the object does not exist or you do not have access to it"]
+ },
+ "path": { "type": "string", "examples": ["folder/cat.png"] },
+ "signedURL": {
+ "type": ["string", "null"],
+ "examples": [
+ "/object/sign/avatars/folder/cat.png?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cmwiOiJhdmF0YXJzL2ZvbGRlci9jYXQucG5nIiwiaWF0IjoxNjE3NzI2MjczLCJleHAiOjE2MTc3MjcyNzN9.s7Gt8ME80iREVxPhH01ZNv8oUn4XtaWsmiQ5csiUHn4"
+ ]
+ }
+ },
+ "required": ["error", "path", "signedURL"]
+ }
+ }
+ },
+ "400": { "description": "Default Response", "schema": { "$ref": "#/definitions/def-1" } }
+ }
+ }
+ },
+ "/object/move": {
+ "post": {
+ "summary": "Moves an object",
+ "tags": ["object"],
+ "parameters": [
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "type": "object",
+ "properties": {
+ "bucketId": { "type": "string", "examples": ["avatars"] },
+ "sourceKey": { "type": "string", "examples": ["folder/cat.png"] },
+ "destinationKey": { "type": "string", "examples": ["folder/newcat.png"] }
+ },
+ "required": ["bucketId", "sourceKey", "destinationKey"]
+ }
+ },
+ { "in": "header", "name": "authorization", "required": true, "type": "string" }
+ ],
+ "responses": {
+ "200": {
+ "description": "Default Response",
+ "schema": {
+ "type": "object",
+ "properties": { "message": { "type": "string", "examples": ["Successfully moved"] } },
+ "required": ["message"]
+ }
+ },
+ "400": { "description": "Default Response", "schema": { "$ref": "#/definitions/def-1" } }
+ }
+ }
+ },
+ "/object/list/{bucketName}": {
+ "post": {
+ "summary": "Search for objects under a prefix",
+ "tags": ["object"],
+ "parameters": [
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "type": "object",
+ "properties": {
+ "prefix": { "type": "string", "examples": ["folder/subfolder"] },
+ "limit": { "type": "integer", "minimum": 1, "examples": [10] },
+ "offset": { "type": "integer", "minimum": 0, "examples": [0] },
+ "sortBy": {
+ "type": "object",
+ "properties": {
+ "column": {
+ "type": "string",
+ "enum": ["name", "updated_at", "created_at", "last_accessed_at"]
+ },
+ "order": { "type": "string", "enum": ["asc", "desc"] }
+ },
+ "required": ["column"]
+ },
+ "search": { "type": "string" }
+ },
+ "required": ["prefix"]
+ }
+ },
+ { "type": "string", "required": true, "in": "path", "name": "bucketName" },
+ { "in": "header", "name": "authorization", "required": true, "type": "string" }
+ ],
+ "responses": {
+ "200": {
+ "description": "Default Response",
+ "schema": {
+ "type": "array",
+ "items": {
+ "$id": "objectSchema",
+ "type": "object",
+ "properties": {
+ "name": { "type": "string" },
+ "bucket_id": { "type": "string" },
+ "owner": { "type": "string" },
+ "id": { "anyOf": [{ "type": "string" }, { "type": "null" }] },
+ "updated_at": { "anyOf": [{ "type": "string" }, { "type": "null" }] },
+ "created_at": { "anyOf": [{ "type": "string" }, { "type": "null" }] },
+ "last_accessed_at": { "anyOf": [{ "type": "string" }, { "type": "null" }] },
+ "metadata": {
+ "anyOf": [
+ { "type": "object", "additionalProperties": true },
+ { "type": "null" }
+ ]
+ },
+ "buckets": {
+ "$id": "bucketSchema",
+ "type": "object",
+ "properties": {
+ "id": { "type": "string" },
+ "name": { "type": "string" },
+ "owner": { "type": "string" },
+ "public": { "type": "boolean" },
+ "created_at": { "type": "string" },
+ "updated_at": { "type": "string" }
+ },
+ "required": ["id", "name"],
+ "additionalProperties": false,
+ "examples": [
+ {
+ "id": "bucket2",
+ "name": "bucket2",
+ "owner": "4d56e902-f0a0-4662-8448-a4d9e643c142",
+ "created_at": "2021-02-17T04:43:32.770206+00:00",
+ "updated_at": "2021-02-17T04:43:32.770206+00:00"
+ }
+ ]
+ }
+ },
+ "required": ["name"],
+ "additionalProperties": false,
+ "examples": [
+ {
+ "name": "folder/cat.png",
+ "bucket_id": "avatars",
+ "owner": "317eadce-631a-4429-a0bb-f19a7a517b4a",
+ "id": "eaa8bdb5-2e00-4767-b5a9-d2502efe2196",
+ "updated_at": "2021-04-06T16:30:35.394674+00:00",
+ "created_at": "2021-04-06T16:30:35.394674+00:00",
+ "last_accessed_at": "2021-04-06T16:30:35.394674+00:00",
+ "metadata": { "size": 1234 }
+ }
+ ]
+ }
+ }
+ },
+ "400": { "description": "Default Response", "schema": { "$ref": "#/definitions/def-1" } }
+ }
+ }
+ },
+ "/object/copy": {
+ "post": {
+ "summary": "Copies an object",
+ "tags": ["object"],
+ "parameters": [
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "type": "object",
+ "properties": {
+ "sourceKey": { "type": "string", "examples": ["folder/source.png"] },
+ "bucketId": { "type": "string", "examples": ["avatars"] },
+ "destinationKey": { "type": "string", "examples": ["folder/destination.png"] }
+ },
+ "required": ["sourceKey", "bucketId", "destinationKey"]
+ }
+ },
+ { "in": "header", "name": "authorization", "required": true, "type": "string" }
+ ],
+ "responses": {
+ "200": {
+ "description": "Default Response",
+ "schema": {
+ "type": "object",
+ "properties": { "Key": { "type": "string", "examples": ["folder/destination.png"] } },
+ "required": ["Key"]
+ }
+ },
+ "400": { "description": "Default Response", "schema": { "$ref": "#/definitions/def-1" } }
+ }
+ }
+ },
+ "/object/public/{bucketName}/{wildcard}": {
+ "get": {
+ "summary": "Retrieve an object from a public bucket",
+ "tags": ["object"],
+ "parameters": [
+ {
+ "type": "string",
+ "examples": ["avatars"],
+ "required": true,
+ "in": "path",
+ "name": "bucketName"
+ },
+ {
+ "type": "string",
+ "examples": ["folder/cat.png"],
+ "required": true,
+ "in": "path",
+ "name": "*"
+ }
+ ],
+ "responses": {
+ "400": { "description": "Default Response", "schema": { "$ref": "#/definitions/def-1" } }
+ }
+ }
+ }
+ },
+ "tags": [
+ { "name": "object", "description": "Object end-points" },
+ { "name": "bucket", "description": "Bucket end-points" }
+ ]
+}