{ "swagger": "2.0", "info": { "description": "This is a sample server celler server.", "title": "Swagger Example API", "termsOfService": "http://swagger.io/terms/", "contact": { "name": "API Support", "url": "http://www.swagger.io/support", "email": "support@swagger.io" }, "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.html" }, "version": "1.0" }, "host": "localhost:8080", "basePath": "/api/v1", "paths": { "/accounts": { "get": { "description": "get accounts", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "accounts" ], "summary": "List accounts", "parameters": [ { "type": "string", "format": "email", "description": "name search by q", "name": "q", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/model.Account" } } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httputil.HTTPError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/httputil.HTTPError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/httputil.HTTPError" } } } }, "post": { "description": "add by json account", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "accounts" ], "summary": "Add an account", "parameters": [ { "description": "Add account", "name": "account", "in": "body", "required": true, "schema": { "$ref": "#/definitions/model.AddAccount" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/model.Account" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httputil.HTTPError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/httputil.HTTPError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/httputil.HTTPError" } } } } }, "/accounts/{id}": { "get": { "description": "get string by ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "accounts" ], "summary": "Show an account", "parameters": [ { "type": "integer", "description": "Account ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/model.Account" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httputil.HTTPError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/httputil.HTTPError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/httputil.HTTPError" } } } }, "delete": { "description": "Delete by account ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "accounts" ], "summary": "Delete an account", "parameters": [ { "type": "integer", "format": "int64", "description": "Account ID", "name": "id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content", "schema": { "$ref": "#/definitions/model.Account" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httputil.HTTPError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/httputil.HTTPError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/httputil.HTTPError" } } } }, "patch": { "description": "Update by json account", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "accounts" ], "summary": "Update an account", "parameters": [ { "type": "integer", "description": "Account ID", "name": "id", "in": "path", "required": true }, { "description": "Update account", "name": "account", "in": "body", "required": true, "schema": { "$ref": "#/definitions/model.UpdateAccount" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/model.Account" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httputil.HTTPError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/httputil.HTTPError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/httputil.HTTPError" } } } } }, "/accounts/{id}/images": { "post": { "description": "Upload file", "consumes": [ "multipart/form-data" ], "produces": [ "application/json" ], "tags": [ "accounts" ], "summary": "Upload account image", "parameters": [ { "type": "integer", "description": "Account ID", "name": "id", "in": "path", "required": true }, { "type": "file", "description": "account image", "name": "file", "in": "formData", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/controller.Message" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httputil.HTTPError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/httputil.HTTPError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/httputil.HTTPError" } } } } }, "/admin/auth": { "post": { "security": [ { "ApiKeyAuth": [] } ], "description": "get admin info", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "accounts", "admin" ], "summary": "Auth admin", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/model.Admin" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httputil.HTTPError" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httputil.HTTPError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/httputil.HTTPError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/httputil.HTTPError" } } } } }, "/bottles": { "get": { "description": "get bottles", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "bottles" ], "summary": "List bottles", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/model.Bottle" } } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httputil.HTTPError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/httputil.HTTPError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/httputil.HTTPError" } } } } }, "/bottles/{id}": { "get": { "description": "get string by ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "bottles" ], "summary": "Show a bottle", "operationId": "get-string-by-int", "parameters": [ { "type": "integer", "description": "Bottle ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/model.Bottle" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httputil.HTTPError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/httputil.HTTPError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/httputil.HTTPError" } } } } }, "/examples/attribute": { "get": { "description": "attribute", "consumes": [ "application/json" ], "produces": [ "text/plain" ], "tags": [ "example" ], "summary": "attribute example", "parameters": [ { "enum": [ "A", "B", "C" ], "type": "string", "description": "string enums", "name": "enumstring", "in": "query" }, { "enum": [ 1, 2, 3 ], "type": "integer", "description": "int enums", "name": "enumint", "in": "query" }, { "enum": [ 1.1, 1.2, 1.3 ], "type": "number", "description": "int enums", "name": "enumnumber", "in": "query" }, { "maxLength": 10, "minLength": 5, "type": "string", "description": "string valid", "name": "string", "in": "query" }, { "maximum": 10, "minimum": 1, "type": "integer", "description": "int valid", "name": "int", "in": "query" }, { "type": "string", "default": "A", "description": "string default", "name": "default", "in": "query" } ], "responses": { "200": { "description": "answer", "schema": { "type": "string" } }, "400": { "description": "ok", "schema": { "type": "string" } }, "404": { "description": "ok", "schema": { "type": "string" } }, "500": { "description": "ok", "schema": { "type": "string" } } } } }, "/examples/calc": { "get": { "description": "plus", "consumes": [ "application/json" ], "produces": [ "text/plain" ], "tags": [ "example" ], "summary": "calc example", "parameters": [ { "type": "integer", "description": "used for calc", "name": "val1", "in": "query", "required": true }, { "type": "integer", "description": "used for calc", "name": "val2", "in": "query", "required": true } ], "responses": { "200": { "description": "answer", "schema": { "type": "integer" } }, "400": { "description": "ok", "schema": { "type": "string" } }, "404": { "description": "ok", "schema": { "type": "string" } }, "500": { "description": "ok", "schema": { "type": "string" } } } } }, "/examples/groups/{group_id}/accounts/{account_id}": { "get": { "description": "path params", "consumes": [ "application/json" ], "produces": [ "text/plain" ], "tags": [ "example" ], "summary": "path params example", "parameters": [ { "type": "integer", "description": "Group ID", "name": "group_id", "in": "path", "required": true }, { "type": "integer", "description": "Account ID", "name": "account_id", "in": "path", "required": true } ], "responses": { "200": { "description": "answer", "schema": { "type": "string" } }, "400": { "description": "ok", "schema": { "type": "string" } }, "404": { "description": "ok", "schema": { "type": "string" } }, "500": { "description": "ok", "schema": { "type": "string" } } } } }, "/examples/header": { "get": { "description": "custome header", "consumes": [ "application/json" ], "produces": [ "text/plain" ], "tags": [ "example" ], "summary": "custome header example", "parameters": [ { "type": "string", "description": "Authentication header", "name": "Authorization", "in": "header", "required": true } ], "responses": { "200": { "description": "answer", "schema": { "type": "string" } }, "400": { "description": "ok", "schema": { "type": "string" } }, "404": { "description": "ok", "schema": { "type": "string" } }, "500": { "description": "ok", "schema": { "type": "string" } } } } }, "/examples/ping": { "get": { "description": "do ping", "consumes": [ "application/json" ], "produces": [ "text/plain" ], "tags": [ "example" ], "summary": "ping example", "responses": { "200": { "description": "pong", "schema": { "type": "string" } }, "400": { "description": "ok", "schema": { "type": "string" } }, "404": { "description": "ok", "schema": { "type": "string" } }, "500": { "description": "ok", "schema": { "type": "string" } } } } }, "/examples/post": { "post": { "description": "post request example", "consumes": [ "application/json" ], "produces": [ "text/plain" ], "summary": "post request example", "parameters": [ { "description": "Account Info", "name": "message", "in": "body", "required": true, "schema": { "$ref": "#/definitions/model.Account" } } ], "responses": { "200": { "description": "success", "schema": { "type": "string" } }, "500": { "description": "fail", "schema": { "type": "string" } } } } }, "/examples/securities": { "get": { "security": [ { "ApiKeyAuth": [] }, { "OAuth2Implicit": [ "admin", "write" ] } ], "description": "custome header", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "example" ], "summary": "custome header example", "parameters": [ { "type": "string", "description": "Authentication header", "name": "Authorization", "in": "header", "required": true } ], "responses": { "200": { "description": "answer", "schema": { "type": "string" } }, "400": { "description": "ok", "schema": { "type": "string" } }, "404": { "description": "ok", "schema": { "type": "string" } }, "500": { "description": "ok", "schema": { "type": "string" } } } } } }, "definitions": { "controller.Message": { "type": "object", "properties": { "message": { "type": "string", "example": "message" } } }, "httputil.HTTPError": { "type": "object", "properties": { "code": { "type": "integer", "example": 400 }, "message": { "type": "string", "example": "status bad request" } } }, "model.Account": { "type": "object", "properties": { "id": { "type": "integer", "format": "int64", "example": 1 }, "name": { "type": "string", "example": "account name" }, "uuid": { "type": "string", "format": "uuid", "example": "550e8400-e29b-41d4-a716-446655440000" } } }, "model.AddAccount": { "type": "object", "properties": { "name": { "type": "string", "example": "account name" } } }, "model.Admin": { "type": "object", "properties": { "id": { "type": "integer", "example": 1 }, "name": { "type": "string", "example": "admin name" } } }, "model.Bottle": { "type": "object", "properties": { "account": { "$ref": "#/definitions/model.Account" }, "id": { "type": "integer", "example": 1 }, "name": { "type": "string", "example": "bottle_name" } } }, "model.UpdateAccount": { "type": "object", "properties": { "name": { "type": "string", "example": "account name" } } } }, "securityDefinitions": { "ApiKeyAuth": { "description": "Description for what is this security definition being used", "type": "apiKey", "name": "Authorization", "in": "header" }, "BasicAuth": { "type": "basic" }, "OAuth2AccessCode": { "type": "oauth2", "flow": "accessCode", "authorizationUrl": "https://example.com/oauth/authorize", "tokenUrl": "https://example.com/oauth/token", "scopes": { "admin": "\t\t\t\t\t\t\tGrants read and write access to administrative information" } }, "OAuth2Application": { "type": "oauth2", "flow": "application", "tokenUrl": "https://example.com/oauth/token", "scopes": { "admin": "\t\t\t\t\t\t\tGrants read and write access to administrative information", "write": "\t\t\t\t\t\t\tGrants write access" } }, "OAuth2Implicit": { "type": "oauth2", "flow": "implicit", "authorizationUrl": "https://example.com/oauth/authorize", "scopes": { "admin": "\t\t\t\t\t\t\tGrants read and write access to administrative information", "write": "\t\t\t\t\t\t\tGrants write access" } }, "OAuth2Password": { "type": "oauth2", "flow": "password", "tokenUrl": "https://example.com/oauth/token", "scopes": { "admin": "\t\t\t\t\t\t\tGrants read and write access to administrative information", "read": "\t\t\t\t\t\t\t\tGrants read access", "write": "\t\t\t\t\t\t\tGrants write access" } } } }