memos/api/docs.go
Lincoln Nogueira 4491c75135
feat: add SwaggerUI and v1 API docs (#2115)
* - Refactor several API routes from anonymous functions to regular definitions. Required to add parseable documentation comments.

- Add API documentation comments using Swag Declarative Comments Format

- Add echo-swagger to serve Swagger-UI at /api/index.html

- Fix error response from extraneous parameter resourceId to relatedMemoId in DELETE("/memo/:memoId/relation/:relatedMemoId/type/:relationType")

- Add an auto-generated ./docs/api/v1.md for quick reference on repo (generated by swagger-markdown)

- Add auxiliary scripts to generate docs.go and swagger.yaml

* fix: golangci-lint errors

* fix: go fmt flag in swag scripts
2023-08-09 21:53:06 +08:00

3406 lines
113 KiB
Go

// Code generated by swaggo/swag. DO NOT EDIT.
package api
import "github.com/swaggo/swag"
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"contact": {
"name": "API Support",
"url": "https://github.com/orgs/usememos/discussions"
},
"license": {
"name": "MIT License",
"url": "https://github.com/usememos/memos/blob/main/LICENSE"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/api/v1/auth/signin": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Sign-in to memos.",
"parameters": [
{
"description": "Sign-in object",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1.SignIn"
}
}
],
"responses": {
"200": {
"description": "User information",
"schema": {
"$ref": "#/definitions/store.User"
}
},
"400": {
"description": "Malformatted signin request"
},
"401": {
"description": "Password login is deactivated | Incorrect login credentials, please try again"
},
"403": {
"description": "User has been archived with username %s"
},
"500": {
"description": "Failed to find system setting | Failed to unmarshal system setting | Incorrect login credentials, please try again | Failed to generate tokens | Failed to create activity"
}
}
}
},
"/api/v1/auth/signin/sso": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Sign-in to memos using SSO.",
"parameters": [
{
"description": "SSO sign-in object",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1.SSOSignIn"
}
}
],
"responses": {
"200": {
"description": "User information",
"schema": {
"$ref": "#/definitions/store.User"
}
},
"400": {
"description": "Malformatted signin request"
},
"401": {
"description": "Access denied, identifier does not match the filter."
},
"403": {
"description": "User has been archived with username {username}"
},
"404": {
"description": "Identity provider not found"
},
"500": {
"description": "Failed to find identity provider | Failed to create identity provider instance | Failed to exchange token | Failed to get user info | Failed to compile identifier filter | Incorrect login credentials, please try again | Failed to generate random password | Failed to generate password hash | Failed to create user | Failed to generate tokens | Failed to create activity"
}
}
}
},
"/api/v1/auth/signout": {
"post": {
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Sign-out from memos.",
"responses": {
"200": {
"description": "Sign-out success",
"schema": {
"type": "boolean"
}
}
}
}
},
"/api/v1/auth/signup": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Sign-up to memos.",
"parameters": [
{
"description": "Sign-up object",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1.SignUp"
}
}
],
"responses": {
"200": {
"description": "User information",
"schema": {
"$ref": "#/definitions/store.User"
}
},
"400": {
"description": "Malformatted signup request | Failed to find users"
},
"401": {
"description": "signup is disabled"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not found"
},
"500": {
"description": "Failed to find system setting | Failed to unmarshal system setting allow signup | Failed to generate password hash | Failed to create user | Failed to generate tokens | Failed to create activity"
}
}
}
},
"/api/v1/idp": {
"get": {
"description": "*clientSecret is only available for host user",
"produces": [
"application/json"
],
"tags": [
"idp"
],
"summary": "Get a list of identity providers",
"responses": {
"200": {
"description": "List of available identity providers",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/v1.IdentityProvider"
}
}
},
"500": {
"description": "Failed to find identity provider list | Failed to find user"
}
}
},
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"idp"
],
"summary": "Create Identity Provider",
"parameters": [
{
"description": "Identity provider information",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1.CreateIdentityProviderRequest"
}
}
],
"responses": {
"200": {
"description": "Identity provider information",
"schema": {
"$ref": "#/definitions/store.IdentityProvider"
}
},
"400": {
"description": "Malformatted post identity provider request"
},
"401": {
"description": "Missing user in session | Unauthorized"
},
"500": {
"description": "Failed to find user | Failed to create identity provider"
}
}
}
},
"/api/v1/idp/{idpId}": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"idp"
],
"summary": "Get an identity provider by ID",
"parameters": [
{
"type": "integer",
"description": "Identity provider ID",
"name": "idpId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Requested identity provider",
"schema": {
"$ref": "#/definitions/store.IdentityProvider"
}
},
"400": {
"description": "ID is not a number: %s"
},
"401": {
"description": "Missing user in session | Unauthorized"
},
"404": {
"description": "Identity provider not found"
},
"500": {
"description": "Failed to find identity provider list | Failed to find user"
}
}
},
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"idp"
],
"summary": "Delete an identity provider by ID",
"parameters": [
{
"type": "integer",
"description": "Identity Provider ID",
"name": "idpId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Identity Provider deleted",
"schema": {
"type": "boolean"
}
},
"400": {
"description": "ID is not a number: %s | Malformatted patch identity provider request"
},
"401": {
"description": "Missing user in session | Unauthorized"
},
"500": {
"description": "Failed to find user | Failed to patch identity provider"
}
}
},
"patch": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"idp"
],
"summary": "Update an identity provider by ID",
"parameters": [
{
"type": "integer",
"description": "Identity Provider ID",
"name": "idpId",
"in": "path",
"required": true
},
{
"description": "Patched identity provider information",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1.UpdateIdentityProviderRequest"
}
}
],
"responses": {
"200": {
"description": "Patched identity provider",
"schema": {
"$ref": "#/definitions/store.IdentityProvider"
}
},
"400": {
"description": "ID is not a number: %s | Malformatted patch identity provider request"
},
"401": {
"description": "Missing user in session | Unauthorized"
},
"500": {
"description": "Failed to find user | Failed to patch identity provider"
}
}
}
},
"/api/v1/memo": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"memo"
],
"summary": "Get a list of memos matching optional filters",
"parameters": [
{
"type": "integer",
"description": "Creator ID",
"name": "creatorId",
"in": "query"
},
{
"type": "string",
"description": "Creator username",
"name": "creatorUsername",
"in": "query"
},
{
"enum": [
"NORMAL",
"ARCHIVED"
],
"type": "string",
"description": "Row status",
"name": "rowStatus",
"in": "query"
},
{
"type": "boolean",
"description": "Pinned",
"name": "pinned",
"in": "query"
},
{
"type": "string",
"description": "Search for tag. Do not append #",
"name": "tag",
"in": "query"
},
{
"type": "string",
"description": "Search for content",
"name": "content",
"in": "query"
},
{
"type": "integer",
"description": "Limit",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"description": "Offset",
"name": "offset",
"in": "query"
}
],
"responses": {
"200": {
"description": "Memo list",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/store.Memo"
}
}
},
"400": {
"description": "Missing user to find memo"
},
"500": {
"description": "Failed to get memo display with updated ts setting value | Failed to fetch memo list | Failed to compose memo response"
}
}
},
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Visibility can be PUBLIC, PROTECTED or PRIVATE\n*You should omit fields to use their default values",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"memo"
],
"summary": "Create a memo",
"parameters": [
{
"description": "Request object.",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1.CreateMemoRequest"
}
}
],
"responses": {
"200": {
"description": "Stored memo",
"schema": {
"$ref": "#/definitions/store.Memo"
}
},
"400": {
"description": "Malformatted post memo request | Content size overflow, up to 1MB"
},
"401": {
"description": "Missing user in session"
},
"404": {
"description": "User not found | Memo not found: %d"
},
"500": {
"description": "Failed to find user setting | Failed to unmarshal user setting value | Failed to find system setting | Failed to unmarshal system setting | Failed to find user | Failed to create memo | Failed to create activity | Failed to upsert memo resource | Failed to upsert memo relation | Failed to compose memo | Failed to compose memo response"
}
}
}
},
"/api/v1/memo/all": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "This should also list protected memos if the user is logged in\nAuthentication is optional",
"produces": [
"application/json"
],
"tags": [
"memo"
],
"summary": "Get a list of public memos matching optional filters",
"parameters": [
{
"type": "integer",
"description": "Limit",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"description": "Offset",
"name": "offset",
"in": "query"
}
],
"responses": {
"200": {
"description": "Memo list",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/store.Memo"
}
}
},
"500": {
"description": "Failed to get memo display with updated ts setting value | Failed to fetch all memo list | Failed to compose memo response"
}
}
}
},
"/api/v1/memo/stats": {
"get": {
"description": "Used to generate the heatmap",
"produces": [
"application/json"
],
"tags": [
"memo"
],
"summary": "Get memo stats by creator ID or username",
"parameters": [
{
"type": "integer",
"description": "Creator ID",
"name": "creatorId",
"in": "query"
},
{
"type": "string",
"description": "Creator username",
"name": "creatorUsername",
"in": "query"
}
],
"responses": {
"200": {
"description": "Memo createdTs list",
"schema": {
"type": "array",
"items": {
"type": "integer"
}
}
},
"400": {
"description": "Missing user id to find memo"
},
"500": {
"description": "Failed to get memo display with updated ts setting value | Failed to find memo list | Failed to compose memo response"
}
}
}
},
"/api/v1/memo/{memoId}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"memo"
],
"summary": "Get memo by ID",
"parameters": [
{
"type": "integer",
"description": "Memo ID",
"name": "memoId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Memo list",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/store.Memo"
}
}
},
"400": {
"description": "ID is not a number: %s"
},
"401": {
"description": "Missing user in session"
},
"403": {
"description": "this memo is private only | this memo is protected, missing user in session"
},
"404": {
"description": "Memo not found: %d"
},
"500": {
"description": "Failed to find memo by ID: %v | Failed to compose memo response"
}
}
},
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"memo"
],
"summary": "Delete memo by ID",
"parameters": [
{
"type": "integer",
"description": "Memo ID to delete",
"name": "memoId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Memo deleted",
"schema": {
"type": "boolean"
}
},
"400": {
"description": "ID is not a number: %s"
},
"401": {
"description": "Missing user in session | Unauthorized"
},
"404": {
"description": "Memo not found: %d"
},
"500": {
"description": "Failed to find memo | Failed to delete memo ID: %v"
}
}
},
"patch": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Visibility can be PUBLIC, PROTECTED or PRIVATE\n*You should omit fields to use their default values",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"memo"
],
"summary": "Update a memo",
"parameters": [
{
"type": "integer",
"description": "ID of memo to update",
"name": "memoId",
"in": "path",
"required": true
},
{
"description": "Patched object.",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1.PatchMemoRequest"
}
}
],
"responses": {
"200": {
"description": "Stored memo",
"schema": {
"$ref": "#/definitions/store.Memo"
}
},
"400": {
"description": "ID is not a number: %s | Malformatted patch memo request | Content size overflow, up to 1MB"
},
"401": {
"description": "Missing user in session | Unauthorized"
},
"404": {
"description": "Memo not found: %d"
},
"500": {
"description": "Failed to find memo | Failed to patch memo | Failed to upsert memo resource | Failed to delete memo resource | Failed to compose memo response"
}
}
}
},
"/api/v1/memo/{memoId}/organizer": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"memo-organizer"
],
"summary": "Organize memo (pin/unpin)",
"parameters": [
{
"type": "integer",
"description": "ID of memo to organize",
"name": "memoId",
"in": "path",
"required": true
},
{
"description": "Memo organizer object",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1.UpsertMemoOrganizerRequest"
}
}
],
"responses": {
"200": {
"description": "Memo information",
"schema": {
"$ref": "#/definitions/store.Memo"
}
},
"400": {
"description": "ID is not a number: %s | Malformatted post memo organizer request"
},
"401": {
"description": "Missing user in session | Unauthorized"
},
"404": {
"description": "Memo not found: %v"
},
"500": {
"description": "Failed to find memo | Failed to upsert memo organizer | Failed to find memo by ID: %v | Failed to compose memo response"
}
}
}
},
"/api/v1/memo/{memoId}/relation": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"memo-relation"
],
"summary": "Get a list of Memo Relations",
"parameters": [
{
"type": "integer",
"description": "ID of memo to find relations",
"name": "memoId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Memo relation information list",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/store.MemoRelation"
}
}
},
"400": {
"description": "ID is not a number: %s"
},
"500": {
"description": "Failed to list memo relations"
}
}
},
"post": {
"description": "Create a relation between two memos",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"memo-relation"
],
"summary": "Create Memo Relation",
"parameters": [
{
"type": "integer",
"description": "ID of memo to relate",
"name": "memoId",
"in": "path",
"required": true
},
{
"description": "Memo relation object",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1.UpsertMemoRelationRequest"
}
}
],
"responses": {
"200": {
"description": "Memo relation information",
"schema": {
"$ref": "#/definitions/store.MemoRelation"
}
},
"400": {
"description": "ID is not a number: %s | Malformatted post memo relation request"
},
"500": {
"description": "Failed to upsert memo relation"
}
}
}
},
"/api/v1/memo/{memoId}/relation/{relatedMemoId}/type/{relationType}": {
"delete": {
"description": "Removes a relation between two memos",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"memo-relation"
],
"summary": "Delete a Memo Relation",
"parameters": [
{
"type": "integer",
"description": "ID of memo to find relations",
"name": "memoId",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "ID of memo to remove relation to",
"name": "relatedMemoId",
"in": "path",
"required": true
},
{
"enum": [
"REFERENCE",
"ADDITIONAL"
],
"type": "string",
"description": "Type of relation to remove",
"name": "relationType",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Memo relation deleted",
"schema": {
"type": "boolean"
}
},
"400": {
"description": "Memo ID is not a number: %s | Related memo ID is not a number: %s"
},
"500": {
"description": "Failed to delete memo relation"
}
}
}
},
"/api/v1/memo/{memoId}/resource": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"memo-resource"
],
"summary": "Get resource list of a memo",
"parameters": [
{
"type": "integer",
"description": "ID of memo to fetch resource list from",
"name": "memoId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Memo resource list",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/v1.Resource"
}
}
},
"400": {
"description": "ID is not a number: %s"
},
"500": {
"description": "Failed to fetch resource list"
}
}
},
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"memo-resource"
],
"summary": "Bind resource to memo",
"parameters": [
{
"type": "integer",
"description": "ID of memo to bind resource to",
"name": "memoId",
"in": "path",
"required": true
},
{
"description": "Memo resource request object",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1.UpsertMemoResourceRequest"
}
}
],
"responses": {
"200": {
"description": "Memo resource binded",
"schema": {
"type": "boolean"
}
},
"400": {
"description": "ID is not a number: %s | Malformatted post memo resource request | Resource not found"
},
"401": {
"description": "Missing user in session | Unauthorized to bind this resource"
},
"500": {
"description": "Failed to fetch resource | Failed to upsert memo resource"
}
}
}
},
"/api/v1/memo/{memoId}/resource/{resourceId}": {
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"memo-resource"
],
"summary": "Unbind resource from memo",
"parameters": [
{
"type": "integer",
"description": "ID of memo to unbind resource from",
"name": "memoId",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "ID of resource to unbind from memo",
"name": "resourceId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Memo resource unbinded. *200 is returned even if the reference doesn't exists ",
"schema": {
"type": "boolean"
}
},
"400": {
"description": "Memo ID is not a number: %s | Resource ID is not a number: %s | Memo not found"
},
"401": {
"description": "Missing user in session | Unauthorized"
},
"500": {
"description": "Failed to find memo | Failed to fetch resource list"
}
}
}
},
"/api/v1/ping": {
"get": {
"produces": [
"application/json"
],
"tags": [
"system"
],
"summary": "Ping the system",
"responses": {
"200": {
"description": "System profile",
"schema": {
"$ref": "#/definitions/profile.Profile"
}
}
}
}
},
"/api/v1/resource": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"resource"
],
"summary": "Get a list of resources",
"parameters": [
{
"type": "integer",
"description": "Limit",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"description": "Offset",
"name": "offset",
"in": "query"
}
],
"responses": {
"200": {
"description": "Resource list",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/store.Resource"
}
}
},
"401": {
"description": "Missing user in session"
},
"500": {
"description": "Failed to fetch resource list"
}
}
},
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"resource"
],
"summary": "Create resource",
"parameters": [
{
"description": "Request object.",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1.CreateResourceRequest"
}
}
],
"responses": {
"200": {
"description": "Created resource",
"schema": {
"$ref": "#/definitions/store.Resource"
}
},
"400": {
"description": "Malformatted post resource request | Invalid external link | Invalid external link scheme | Failed to request %s | Failed to read %s | Failed to read mime from %s"
},
"401": {
"description": "Missing user in session"
},
"500": {
"description": "Failed to save resource | Failed to create resource | Failed to create activity"
}
}
}
},
"/api/v1/resource/blob": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"multipart/form-data"
],
"produces": [
"application/json"
],
"tags": [
"resource"
],
"summary": "Upload resource",
"parameters": [
{
"type": "file",
"description": "File to upload",
"name": "file",
"in": "formData",
"required": true
}
],
"responses": {
"200": {
"description": "Created resource",
"schema": {
"$ref": "#/definitions/store.Resource"
}
},
"400": {
"description": "Upload file not found | File size exceeds allowed limit of %d MiB | Failed to parse upload data"
},
"401": {
"description": "Missing user in session"
},
"500": {
"description": "Failed to get uploading file | Failed to open file | Failed to save resource | Failed to create resource | Failed to create activity"
}
}
}
},
"/api/v1/resource/{resourceId}": {
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"resource"
],
"summary": "Delete a resource",
"parameters": [
{
"type": "integer",
"description": "Resource ID",
"name": "resourceId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Resource deleted",
"schema": {
"type": "boolean"
}
},
"400": {
"description": "ID is not a number: %s"
},
"401": {
"description": "Missing user in session"
},
"404": {
"description": "Resource not found: %d"
},
"500": {
"description": "Failed to find resource | Failed to delete resource"
}
}
},
"patch": {
"security": [
{
"ApiKeyAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"resource"
],
"summary": "Update a resource",
"parameters": [
{
"type": "integer",
"description": "Resource ID",
"name": "resourceId",
"in": "path",
"required": true
},
{
"description": "Patch resource request",
"name": "patch",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1.UpdateResourceRequest"
}
}
],
"responses": {
"200": {
"description": "Updated resource",
"schema": {
"$ref": "#/definitions/store.Resource"
}
},
"400": {
"description": "ID is not a number: %s | Malformatted patch resource request"
},
"401": {
"description": "Missing user in session | Unauthorized"
},
"404": {
"description": "Resource not found: %d"
},
"500": {
"description": "Failed to find resource | Failed to patch resource"
}
}
}
},
"/api/v1/status": {
"get": {
"produces": [
"application/json"
],
"tags": [
"system"
],
"summary": "Get system status",
"responses": {
"200": {
"description": "System status",
"schema": {
"$ref": "#/definitions/v1.SystemStatus"
}
},
"401": {
"description": "Missing user in session | Unauthorized"
},
"500": {
"description": "Failed to find host user | Failed to find system setting list | Failed to unmarshal system setting customized profile value"
}
}
}
},
"/api/v1/storage": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"storage"
],
"summary": "Get a list of storages",
"responses": {
"200": {
"description": "List of storages",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/store.Storage"
}
}
},
"401": {
"description": "Missing user in session | Unauthorized"
},
"500": {
"description": "Failed to find user | Failed to convert storage"
}
}
},
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"storage"
],
"summary": "Create storage",
"parameters": [
{
"description": "Request object.",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1.CreateStorageRequest"
}
}
],
"responses": {
"200": {
"description": "Created storage",
"schema": {
"$ref": "#/definitions/store.Storage"
}
},
"400": {
"description": "Malformatted post storage request"
},
"401": {
"description": "Missing user in session"
},
"500": {
"description": "Failed to find user | Failed to create storage | Failed to convert storage"
}
}
}
},
"/api/v1/storage/{storageId}": {
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"storage"
],
"summary": "Delete a storage",
"parameters": [
{
"type": "integer",
"description": "Storage ID",
"name": "storageId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Storage deleted",
"schema": {
"type": "boolean"
}
},
"400": {
"description": "ID is not a number: %s | Storage service %d is using"
},
"401": {
"description": "Missing user in session | Unauthorized"
},
"500": {
"description": "Failed to find user | Failed to find storage | Failed to unmarshal storage service id | Failed to delete storage"
}
}
},
"patch": {
"security": [
{
"ApiKeyAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"storage"
],
"summary": "Update a storage",
"parameters": [
{
"type": "integer",
"description": "Storage ID",
"name": "storageId",
"in": "path",
"required": true
},
{
"description": "Patch request",
"name": "patch",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1.UpdateStorageRequest"
}
}
],
"responses": {
"200": {
"description": "Updated resource",
"schema": {
"$ref": "#/definitions/store.Storage"
}
},
"400": {
"description": "ID is not a number: %s | Malformatted patch storage request | Malformatted post storage request"
},
"401": {
"description": "Missing user in session | Unauthorized"
},
"500": {
"description": "Failed to find user | Failed to patch storage | Failed to convert storage"
}
}
}
},
"/api/v1/system/setting": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"system-setting"
],
"summary": "Get a list of system settings",
"responses": {
"200": {
"description": "System setting list",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/v1.SystemSetting"
}
}
},
"401": {
"description": "Missing user in session | Unauthorized"
},
"500": {
"description": "Failed to find user | Failed to find system setting list"
}
}
},
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"system-setting"
],
"summary": "Create system setting",
"parameters": [
{
"description": "Request object.",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1.UpsertSystemSettingRequest"
}
}
],
"responses": {
"200": {
"description": "Created system setting",
"schema": {
"$ref": "#/definitions/store.SystemSetting"
}
},
"400": {
"description": "Malformatted post system setting request | invalid system setting"
},
"401": {
"description": "Missing user in session | Unauthorized"
},
"403": {
"description": "Cannot disable passwords if no SSO identity provider is configured."
},
"500": {
"description": "Failed to find user | Failed to upsert system setting"
}
}
}
},
"/api/v1/system/vacuum": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"system"
],
"summary": "Vacuum the database",
"responses": {
"200": {
"description": "Database vacuumed",
"schema": {
"type": "boolean"
}
},
"401": {
"description": "Missing user in session | Unauthorized"
},
"500": {
"description": "Failed to find user | Failed to vacuum database"
}
}
}
},
"/api/v1/tag": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"tag"
],
"summary": "Get a list of tags",
"responses": {
"200": {
"description": "Tag list",
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
},
"400": {
"description": "Missing user id to find tag"
},
"500": {
"description": "Failed to find tag list"
}
}
},
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"tag"
],
"summary": "Create a tag",
"parameters": [
{
"description": "Request object.",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1.UpsertTagRequest"
}
}
],
"responses": {
"200": {
"description": "Created tag name",
"schema": {
"type": "string"
}
},
"400": {
"description": "Malformatted post tag request | Tag name shouldn't be empty"
},
"401": {
"description": "Missing user in session"
},
"500": {
"description": "Failed to upsert tag | Failed to create activity"
}
}
}
},
"/api/v1/tag/delete": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"tag"
],
"summary": "Delete a tag",
"parameters": [
{
"description": "Request object.",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1.DeleteTagRequest"
}
}
],
"responses": {
"200": {
"description": "Tag deleted",
"schema": {
"type": "boolean"
}
},
"400": {
"description": "Malformatted post tag request | Tag name shouldn't be empty"
},
"401": {
"description": "Missing user in session"
},
"500": {
"description": "Failed to delete tag name: %v"
}
}
}
},
"/api/v1/tag/suggestion": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"tag"
],
"summary": "Get a list of tags suggested from other memos contents",
"responses": {
"200": {
"description": "Tag list",
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
},
"400": {
"description": "Missing user session"
},
"500": {
"description": "Failed to find memo list | Failed to find tag list"
}
}
}
},
"/api/v1/user": {
"get": {
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Get a list of users",
"responses": {
"200": {
"description": "User list",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/store.User"
}
}
},
"500": {
"description": "Failed to fetch user list"
}
}
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Create a user",
"parameters": [
{
"description": "Request object",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1.CreateUserRequest"
}
}
],
"responses": {
"200": {
"description": "Created user",
"schema": {
"$ref": "#/definitions/store.User"
}
},
"400": {
"description": "Malformatted post user request | Invalid user create format"
},
"401": {
"description": "Missing auth session | Unauthorized to create user"
},
"403": {
"description": "Could not create host user"
},
"500": {
"description": "Failed to find user by id | Failed to generate password hash | Failed to create user | Failed to create activity"
}
}
}
},
"/api/v1/user/me": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Get current user",
"responses": {
"200": {
"description": "Current user",
"schema": {
"$ref": "#/definitions/store.User"
}
},
"401": {
"description": "Missing auth session"
},
"500": {
"description": "Failed to find user | Failed to find userSettingList"
}
}
}
},
"/api/v1/user/name/{username}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Get user by username",
"parameters": [
{
"type": "string",
"description": "Username",
"name": "username",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Requested user",
"schema": {
"$ref": "#/definitions/store.User"
}
},
"404": {
"description": "User not found"
},
"500": {
"description": "Failed to find user"
}
}
}
},
"/api/v1/user/setting": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"user-setting"
],
"summary": "Create user setting",
"parameters": [
{
"description": "Request object.",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1.UpsertUserSettingRequest"
}
}
],
"responses": {
"200": {
"description": "Created user setting",
"schema": {
"$ref": "#/definitions/store.UserSetting"
}
},
"400": {
"description": "Malformatted post user setting upsert request | Invalid user setting format"
},
"401": {
"description": "Missing auth session"
},
"500": {
"description": "Failed to upsert user setting"
}
}
}
},
"/api/v1/user/{id}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Get user by id",
"parameters": [
{
"type": "integer",
"description": "User ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Requested user",
"schema": {
"$ref": "#/definitions/store.User"
}
},
"400": {
"description": "Malformatted user id"
},
"404": {
"description": "User not found"
},
"500": {
"description": "Failed to find user"
}
}
},
"delete": {
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Delete a user",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "User deleted",
"schema": {
"type": "boolean"
}
},
"400": {
"description": "ID is not a number: %s | Current session user not found with ID: %d"
},
"401": {
"description": "Missing user in session"
},
"403": {
"description": "Unauthorized to delete user"
},
"500": {
"description": "Failed to find user | Failed to delete user"
}
}
},
"patch": {
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Update a user",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Patch request",
"name": "patch",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1.UpdateUserRequest"
}
}
],
"responses": {
"200": {
"description": "Updated user",
"schema": {
"$ref": "#/definitions/store.User"
}
},
"400": {
"description": "ID is not a number: %s | Current session user not found with ID: %d | Malformatted patch user request | Invalid update user request"
},
"401": {
"description": "Missing user in session"
},
"403": {
"description": "Unauthorized to update user"
},
"500": {
"description": "Failed to find user | Failed to generate password hash | Failed to patch user | Failed to find userSettingList"
}
}
}
},
"/explore/rss.xml": {
"get": {
"produces": [
"text/xml"
],
"tags": [
"rss"
],
"summary": "Get RSS",
"responses": {
"200": {
"description": "RSS"
},
"500": {
"description": "Failed to get system customized profile | Failed to find memo list | Failed to generate rss"
}
}
}
},
"/o/get/httpmeta": {
"get": {
"produces": [
"application/json"
],
"tags": [
"get"
],
"summary": "Get website metadata",
"parameters": [
{
"type": "string",
"description": "Website URL",
"name": "url",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "Extracted metadata",
"schema": {
"$ref": "#/definitions/getter.HTMLMeta"
}
},
"400": {
"description": "Missing website url | Wrong url"
},
"406": {
"description": "Failed to get website meta with url: %s"
}
}
}
},
"/o/get/image": {
"get": {
"produces": [
"image/*"
],
"tags": [
"get"
],
"summary": "Get image from URL",
"parameters": [
{
"type": "string",
"description": "Image url",
"name": "url",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "Image"
},
"400": {
"description": "Missing image url | Wrong url | Failed to get image url: %s"
},
"500": {
"description": "Failed to write image blob"
}
}
}
},
"/o/r/{resourceId}": {
"get": {
"description": "*Swagger UI may have problems displaying other file types than images",
"produces": [
"application/octet-stream"
],
"tags": [
"resource"
],
"summary": "Stream a resource",
"parameters": [
{
"type": "integer",
"description": "Resource ID",
"name": "resourceId",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "Thumbnail",
"name": "thumbnail",
"in": "query"
}
],
"responses": {
"200": {
"description": "Requested resource"
},
"400": {
"description": "ID is not a number: %s | Failed to get resource visibility"
},
"401": {
"description": "Resource visibility not match"
},
"404": {
"description": "Resource not found: %d"
},
"500": {
"description": "Failed to find resource by ID: %v | Failed to open the local resource: %s | Failed to read the local resource: %s"
}
}
}
},
"/u/{id}/rss.xml": {
"get": {
"produces": [
"text/xml"
],
"tags": [
"rss"
],
"summary": "Get RSS for a user",
"parameters": [
{
"type": "integer",
"description": "User ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "RSS"
},
"400": {
"description": "User id is not a number"
},
"500": {
"description": "Failed to get system customized profile | Failed to find memo list | Failed to generate rss"
}
}
}
}
},
"definitions": {
"getter.HTMLMeta": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"image": {
"type": "string"
},
"title": {
"type": "string"
}
}
},
"profile.Profile": {
"type": "object",
"properties": {
"mode": {
"description": "Mode can be \"prod\" or \"dev\" or \"demo\"",
"type": "string"
},
"version": {
"description": "Version is the current version of server",
"type": "string"
}
}
},
"store.FieldMapping": {
"type": "object",
"properties": {
"displayName": {
"type": "string"
},
"email": {
"type": "string"
},
"identifier": {
"type": "string"
}
}
},
"store.IdentityProvider": {
"type": "object",
"properties": {
"config": {
"$ref": "#/definitions/store.IdentityProviderConfig"
},
"id": {
"type": "integer"
},
"identifierFilter": {
"type": "string"
},
"name": {
"type": "string"
},
"type": {
"$ref": "#/definitions/store.IdentityProviderType"
}
}
},
"store.IdentityProviderConfig": {
"type": "object",
"properties": {
"oauth2Config": {
"$ref": "#/definitions/store.IdentityProviderOAuth2Config"
}
}
},
"store.IdentityProviderOAuth2Config": {
"type": "object",
"properties": {
"authUrl": {
"type": "string"
},
"clientId": {
"type": "string"
},
"clientSecret": {
"type": "string"
},
"fieldMapping": {
"$ref": "#/definitions/store.FieldMapping"
},
"scopes": {
"type": "array",
"items": {
"type": "string"
}
},
"tokenUrl": {
"type": "string"
},
"userInfoUrl": {
"type": "string"
}
}
},
"store.IdentityProviderType": {
"type": "string",
"enum": [
"OAUTH2"
],
"x-enum-varnames": [
"IdentityProviderOAuth2Type"
]
},
"store.Memo": {
"type": "object",
"properties": {
"content": {
"description": "Domain specific fields",
"type": "string"
},
"createdTs": {
"type": "integer"
},
"creatorID": {
"type": "integer"
},
"id": {
"type": "integer"
},
"pinned": {
"description": "Composed fields",
"type": "boolean"
},
"relationList": {
"type": "array",
"items": {
"$ref": "#/definitions/store.MemoRelation"
}
},
"resourceIDList": {
"type": "array",
"items": {
"type": "integer"
}
},
"rowStatus": {
"description": "Standard fields",
"allOf": [
{
"$ref": "#/definitions/store.RowStatus"
}
]
},
"updatedTs": {
"type": "integer"
},
"visibility": {
"$ref": "#/definitions/store.Visibility"
}
}
},
"store.MemoRelation": {
"type": "object",
"properties": {
"memoID": {
"type": "integer"
},
"relatedMemoID": {
"type": "integer"
},
"type": {
"$ref": "#/definitions/store.MemoRelationType"
}
}
},
"store.MemoRelationType": {
"type": "string",
"enum": [
"REFERENCE",
"ADDITIONAL"
],
"x-enum-varnames": [
"MemoRelationReference",
"MemoRelationAdditional"
]
},
"store.Resource": {
"type": "object",
"properties": {
"blob": {
"type": "array",
"items": {
"type": "integer"
}
},
"createdTs": {
"type": "integer"
},
"creatorID": {
"description": "Standard fields",
"type": "integer"
},
"externalLink": {
"type": "string"
},
"filename": {
"description": "Domain specific fields",
"type": "string"
},
"id": {
"type": "integer"
},
"internalPath": {
"type": "string"
},
"linkedMemoAmount": {
"type": "integer"
},
"size": {
"type": "integer"
},
"type": {
"type": "string"
},
"updatedTs": {
"type": "integer"
}
}
},
"store.Role": {
"type": "string",
"enum": [
"HOST",
"ADMIN",
"USER"
],
"x-enum-varnames": [
"RoleHost",
"RoleAdmin",
"RoleUser"
]
},
"store.RowStatus": {
"type": "string",
"enum": [
"NORMAL",
"ARCHIVED"
],
"x-enum-varnames": [
"Normal",
"Archived"
]
},
"store.Storage": {
"type": "object",
"properties": {
"config": {
"type": "string"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"store.SystemSetting": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"store.User": {
"type": "object",
"properties": {
"avatarURL": {
"type": "string"
},
"createdTs": {
"type": "integer"
},
"email": {
"type": "string"
},
"id": {
"type": "integer"
},
"nickname": {
"type": "string"
},
"openID": {
"type": "string"
},
"passwordHash": {
"type": "string"
},
"role": {
"$ref": "#/definitions/store.Role"
},
"rowStatus": {
"description": "Standard fields",
"allOf": [
{
"$ref": "#/definitions/store.RowStatus"
}
]
},
"updatedTs": {
"type": "integer"
},
"username": {
"description": "Domain specific fields",
"type": "string"
}
}
},
"store.UserSetting": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"userID": {
"type": "integer"
},
"value": {
"type": "string"
}
}
},
"store.Visibility": {
"type": "string",
"enum": [
"PUBLIC",
"PROTECTED",
"PRIVATE"
],
"x-enum-varnames": [
"Public",
"Protected",
"Private"
]
},
"v1.CreateIdentityProviderRequest": {
"type": "object",
"properties": {
"config": {
"$ref": "#/definitions/v1.IdentityProviderConfig"
},
"identifierFilter": {
"type": "string"
},
"name": {
"type": "string"
},
"type": {
"$ref": "#/definitions/v1.IdentityProviderType"
}
}
},
"v1.CreateMemoRequest": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"createdTs": {
"type": "integer"
},
"relationList": {
"type": "array",
"items": {
"$ref": "#/definitions/v1.UpsertMemoRelationRequest"
}
},
"resourceIdList": {
"description": "Related fields",
"type": "array",
"items": {
"type": "integer"
}
},
"visibility": {
"description": "Domain specific fields",
"allOf": [
{
"$ref": "#/definitions/v1.Visibility"
}
]
}
}
},
"v1.CreateResourceRequest": {
"type": "object",
"properties": {
"downloadToLocal": {
"type": "boolean"
},
"externalLink": {
"type": "string"
},
"filename": {
"type": "string"
},
"internalPath": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"v1.CreateStorageRequest": {
"type": "object",
"properties": {
"config": {
"$ref": "#/definitions/v1.StorageConfig"
},
"name": {
"type": "string"
},
"type": {
"$ref": "#/definitions/v1.StorageType"
}
}
},
"v1.CreateUserRequest": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"nickname": {
"type": "string"
},
"password": {
"type": "string"
},
"role": {
"$ref": "#/definitions/v1.Role"
},
"username": {
"type": "string"
}
}
},
"v1.CustomizedProfile": {
"type": "object",
"properties": {
"appearance": {
"description": "Appearance is the server default appearance.",
"type": "string"
},
"description": {
"description": "Description is the server description.",
"type": "string"
},
"externalUrl": {
"description": "ExternalURL is the external url of server. e.g. https://usermemos.com",
"type": "string"
},
"locale": {
"description": "Locale is the server default locale.",
"type": "string"
},
"logoUrl": {
"description": "LogoURL is the url of logo image.",
"type": "string"
},
"name": {
"description": "Name is the server name, default is ` + "`" + `memos` + "`" + `",
"type": "string"
}
}
},
"v1.DeleteTagRequest": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
}
},
"v1.FieldMapping": {
"type": "object",
"properties": {
"displayName": {
"type": "string"
},
"email": {
"type": "string"
},
"identifier": {
"type": "string"
}
}
},
"v1.IdentityProvider": {
"type": "object",
"properties": {
"config": {
"$ref": "#/definitions/v1.IdentityProviderConfig"
},
"id": {
"type": "integer"
},
"identifierFilter": {
"type": "string"
},
"name": {
"type": "string"
},
"type": {
"$ref": "#/definitions/v1.IdentityProviderType"
}
}
},
"v1.IdentityProviderConfig": {
"type": "object",
"properties": {
"oauth2Config": {
"$ref": "#/definitions/v1.IdentityProviderOAuth2Config"
}
}
},
"v1.IdentityProviderOAuth2Config": {
"type": "object",
"properties": {
"authUrl": {
"type": "string"
},
"clientId": {
"type": "string"
},
"clientSecret": {
"type": "string"
},
"fieldMapping": {
"$ref": "#/definitions/v1.FieldMapping"
},
"scopes": {
"type": "array",
"items": {
"type": "string"
}
},
"tokenUrl": {
"type": "string"
},
"userInfoUrl": {
"type": "string"
}
}
},
"v1.IdentityProviderType": {
"type": "string",
"enum": [
"OAUTH2"
],
"x-enum-varnames": [
"IdentityProviderOAuth2Type"
]
},
"v1.MemoRelationType": {
"type": "string",
"enum": [
"REFERENCE",
"ADDITIONAL"
],
"x-enum-varnames": [
"MemoRelationReference",
"MemoRelationAdditional"
]
},
"v1.PatchMemoRequest": {
"type": "object",
"properties": {
"content": {
"description": "Domain specific fields",
"type": "string"
},
"createdTs": {
"description": "Standard fields",
"type": "integer"
},
"relationList": {
"type": "array",
"items": {
"$ref": "#/definitions/v1.UpsertMemoRelationRequest"
}
},
"resourceIdList": {
"description": "Related fields",
"type": "array",
"items": {
"type": "integer"
}
},
"rowStatus": {
"$ref": "#/definitions/v1.RowStatus"
},
"updatedTs": {
"type": "integer"
},
"visibility": {
"$ref": "#/definitions/v1.Visibility"
}
}
},
"v1.Resource": {
"type": "object",
"properties": {
"createdTs": {
"type": "integer"
},
"creatorId": {
"description": "Standard fields",
"type": "integer"
},
"externalLink": {
"type": "string"
},
"filename": {
"description": "Domain specific fields",
"type": "string"
},
"id": {
"type": "integer"
},
"linkedMemoAmount": {
"description": "Related fields",
"type": "integer"
},
"size": {
"type": "integer"
},
"type": {
"type": "string"
},
"updatedTs": {
"type": "integer"
}
}
},
"v1.Role": {
"type": "string",
"enum": [
"HOST",
"ADMIN",
"USER"
],
"x-enum-varnames": [
"RoleHost",
"RoleAdmin",
"RoleUser"
]
},
"v1.RowStatus": {
"type": "string",
"enum": [
"NORMAL",
"ARCHIVED"
],
"x-enum-varnames": [
"Normal",
"Archived"
]
},
"v1.SSOSignIn": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"identityProviderId": {
"type": "integer"
},
"redirectUri": {
"type": "string"
}
}
},
"v1.SignIn": {
"type": "object",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"v1.SignUp": {
"type": "object",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"v1.StorageConfig": {
"type": "object",
"properties": {
"s3Config": {
"$ref": "#/definitions/v1.StorageS3Config"
}
}
},
"v1.StorageS3Config": {
"type": "object",
"properties": {
"accessKey": {
"type": "string"
},
"bucket": {
"type": "string"
},
"endPoint": {
"type": "string"
},
"path": {
"type": "string"
},
"region": {
"type": "string"
},
"secretKey": {
"type": "string"
},
"urlPrefix": {
"type": "string"
},
"urlSuffix": {
"type": "string"
}
}
},
"v1.StorageType": {
"type": "string",
"enum": [
"S3"
],
"x-enum-varnames": [
"StorageS3"
]
},
"v1.SystemSetting": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"name": {
"$ref": "#/definitions/v1.SystemSettingName"
},
"value": {
"description": "Value is a JSON string with basic value.",
"type": "string"
}
}
},
"v1.SystemSettingName": {
"type": "string",
"enum": [
"server-id",
"secret-session",
"allow-signup",
"disable-password-login",
"disable-public-memos",
"max-upload-size-mib",
"additional-style",
"additional-script",
"customized-profile",
"storage-service-id",
"local-storage-path",
"telegram-bot-token",
"memo-display-with-updated-ts",
"auto-backup-interval"
],
"x-enum-varnames": [
"SystemSettingServerIDName",
"SystemSettingSecretSessionName",
"SystemSettingAllowSignUpName",
"SystemSettingDisablePasswordLoginName",
"SystemSettingDisablePublicMemosName",
"SystemSettingMaxUploadSizeMiBName",
"SystemSettingAdditionalStyleName",
"SystemSettingAdditionalScriptName",
"SystemSettingCustomizedProfileName",
"SystemSettingStorageServiceIDName",
"SystemSettingLocalStoragePathName",
"SystemSettingTelegramBotTokenName",
"SystemSettingMemoDisplayWithUpdatedTsName",
"SystemSettingAutoBackupIntervalName"
]
},
"v1.SystemStatus": {
"type": "object",
"properties": {
"additionalScript": {
"description": "Additional script.",
"type": "string"
},
"additionalStyle": {
"description": "Additional style.",
"type": "string"
},
"allowSignUp": {
"description": "System settings\nAllow sign up.",
"type": "boolean"
},
"autoBackupInterval": {
"description": "Auto Backup Interval.",
"type": "integer"
},
"customizedProfile": {
"description": "Customized server profile, including server name and external url.",
"allOf": [
{
"$ref": "#/definitions/v1.CustomizedProfile"
}
]
},
"dbSize": {
"type": "integer"
},
"disablePasswordLogin": {
"description": "Disable password login.",
"type": "boolean"
},
"disablePublicMemos": {
"description": "Disable public memos.",
"type": "boolean"
},
"host": {
"$ref": "#/definitions/v1.User"
},
"localStoragePath": {
"description": "Local storage path.",
"type": "string"
},
"maxUploadSizeMiB": {
"description": "Max upload size.",
"type": "integer"
},
"memoDisplayWithUpdatedTs": {
"description": "Memo display with updated timestamp.",
"type": "boolean"
},
"profile": {
"$ref": "#/definitions/profile.Profile"
},
"storageServiceId": {
"description": "Storage service ID.",
"type": "integer"
}
}
},
"v1.UpdateIdentityProviderRequest": {
"type": "object",
"properties": {
"config": {
"$ref": "#/definitions/v1.IdentityProviderConfig"
},
"identifierFilter": {
"type": "string"
},
"name": {
"type": "string"
},
"type": {
"$ref": "#/definitions/v1.IdentityProviderType"
}
}
},
"v1.UpdateResourceRequest": {
"type": "object",
"properties": {
"filename": {
"type": "string"
}
}
},
"v1.UpdateStorageRequest": {
"type": "object",
"properties": {
"config": {
"$ref": "#/definitions/v1.StorageConfig"
},
"name": {
"type": "string"
},
"type": {
"$ref": "#/definitions/v1.StorageType"
}
}
},
"v1.UpdateUserRequest": {
"type": "object",
"properties": {
"avatarUrl": {
"type": "string"
},
"email": {
"type": "string"
},
"nickname": {
"type": "string"
},
"password": {
"type": "string"
},
"resetOpenId": {
"type": "boolean"
},
"rowStatus": {
"$ref": "#/definitions/v1.RowStatus"
},
"username": {
"type": "string"
}
}
},
"v1.UpsertMemoOrganizerRequest": {
"type": "object",
"properties": {
"pinned": {
"type": "boolean"
}
}
},
"v1.UpsertMemoRelationRequest": {
"type": "object",
"properties": {
"relatedMemoId": {
"type": "integer"
},
"type": {
"$ref": "#/definitions/v1.MemoRelationType"
}
}
},
"v1.UpsertMemoResourceRequest": {
"type": "object",
"properties": {
"resourceId": {
"type": "integer"
},
"updatedTs": {
"type": "integer"
}
}
},
"v1.UpsertSystemSettingRequest": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"name": {
"$ref": "#/definitions/v1.SystemSettingName"
},
"value": {
"type": "string"
}
}
},
"v1.UpsertTagRequest": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
}
},
"v1.UpsertUserSettingRequest": {
"type": "object",
"properties": {
"key": {
"$ref": "#/definitions/v1.UserSettingKey"
},
"value": {
"type": "string"
}
}
},
"v1.User": {
"type": "object",
"properties": {
"avatarUrl": {
"type": "string"
},
"createdTs": {
"type": "integer"
},
"email": {
"type": "string"
},
"id": {
"type": "integer"
},
"nickname": {
"type": "string"
},
"openId": {
"type": "string"
},
"role": {
"$ref": "#/definitions/v1.Role"
},
"rowStatus": {
"description": "Standard fields",
"allOf": [
{
"$ref": "#/definitions/v1.RowStatus"
}
]
},
"updatedTs": {
"type": "integer"
},
"userSettingList": {
"type": "array",
"items": {
"$ref": "#/definitions/v1.UserSetting"
}
},
"username": {
"description": "Domain specific fields",
"type": "string"
}
}
},
"v1.UserSetting": {
"type": "object",
"properties": {
"key": {
"$ref": "#/definitions/v1.UserSettingKey"
},
"userId": {
"type": "integer"
},
"value": {
"type": "string"
}
}
},
"v1.UserSettingKey": {
"type": "string",
"enum": [
"locale",
"appearance",
"memo-visibility",
"telegram-user-id"
],
"x-enum-varnames": [
"UserSettingLocaleKey",
"UserSettingAppearanceKey",
"UserSettingMemoVisibilityKey",
"UserSettingTelegramUserIDKey"
]
},
"v1.Visibility": {
"type": "string",
"enum": [
"PUBLIC",
"PROTECTED",
"PRIVATE"
],
"x-enum-varnames": [
"Public",
"Protected",
"Private"
]
}
},
"securityDefinitions": {
"ApiKeyAuth": {
"description": "Insert your Open ID API Key here.",
"type": "apiKey",
"name": "openId",
"in": "query"
}
},
"externalDocs": {
"description": "Find out more about Memos",
"url": "https://usememos.com/"
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Host: "",
BasePath: "/",
Schemes: []string{},
Title: "memos API",
Description: "A privacy-first, lightweight note-taking service.",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}