1
0
mirror of https://github.com/raseels-repos/golang-saas-starter-kit.git synced 2025-06-15 00:15:15 +02:00

completed API from signup to auth token with swagger UI.

This commit is contained in:
Lee Brown
2019-06-25 06:25:55 -08:00
parent 2fbda74a73
commit 8328cf525b
15 changed files with 443 additions and 26 deletions

View File

@ -1,6 +1,6 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
// 2019-06-25 02:19:21.144417 -0800 AKDT m=+51.040366621
// 2019-06-25 06:15:54.005963 -0800 AKDT m=+73.603716546
package docs
@ -33,6 +33,11 @@ var doc = `{
"paths": {
"/accounts/{id}": {
"get": {
"security": [
{
"OAuth2Password": []
}
],
"description": "get string by ID",
"consumes": [
"application/json"
@ -44,10 +49,9 @@ var doc = `{
"account"
],
"summary": "Read returns the specified account from the system.",
"operationId": "get-string-by-int",
"parameters": [
{
"type": "integer",
"type": "string",
"description": "Account ID",
"name": "id",
"in": "path",
@ -92,6 +96,62 @@ var doc = `{
}
}
},
"/oauth/token": {
"post": {
"security": [
{
"BasicAuth": []
}
],
"description": "Token generates an oauth2 accessToken using Basic Auth with a user's email and password.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Token handles a request to authenticate a user.",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"$ref": "#/definitions/user.Token"
},
"headers": {
"Token": {
"type": "string",
"description": "qwerty"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"$ref": "#/definitions/web.Error"
}
},
"403": {
"description": "Forbidden",
"schema": {
"type": "object",
"$ref": "#/definitions/web.Error"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "object",
"$ref": "#/definitions/web.Error"
}
}
}
}
},
"/signup": {
"post": {
"description": "Signup creates a new account and user in the system.",
@ -150,6 +210,11 @@ var doc = `{
},
"/users/{id}": {
"get": {
"security": [
{
"OAuth2Password": []
}
],
"description": "get string by ID",
"consumes": [
"application/json"
@ -161,14 +226,20 @@ var doc = `{
"user"
],
"summary": "Read returns the specified user from the system.",
"operationId": "get-string-by-int",
"parameters": [
{
"type": "integer",
"type": "string",
"description": "User ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Authentication header",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
@ -360,6 +431,20 @@ var doc = `{
}
}
},
"user.Token": {
"type": "object",
"properties": {
"access_token": {
"type": "string"
},
"expiry": {
"type": "string"
},
"token_type": {
"type": "string"
}
}
},
"user.User": {
"type": "object",
"required": [
@ -412,10 +497,18 @@ var doc = `{
}
},
"securityDefinitions": {
"BasicAuth": {
"type": "basic"
},
"OAuth2Password": {
"type": "oauth2",
"flow": "password",
"tokenUrl": "/v1/oauth/token"
"tokenUrl": "/v1/oauth/token",
"scopes": {
"admin": " Grants read and write access to administrative information",
"read": " Grants read access",
"write": " Grants write access"
}
}
}
}`

View File

@ -20,6 +20,11 @@
"paths": {
"/accounts/{id}": {
"get": {
"security": [
{
"OAuth2Password": []
}
],
"description": "get string by ID",
"consumes": [
"application/json"
@ -31,10 +36,9 @@
"account"
],
"summary": "Read returns the specified account from the system.",
"operationId": "get-string-by-int",
"parameters": [
{
"type": "integer",
"type": "string",
"description": "Account ID",
"name": "id",
"in": "path",
@ -79,6 +83,62 @@
}
}
},
"/oauth/token": {
"post": {
"security": [
{
"BasicAuth": []
}
],
"description": "Token generates an oauth2 accessToken using Basic Auth with a user's email and password.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Token handles a request to authenticate a user.",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"$ref": "#/definitions/user.Token"
},
"headers": {
"Token": {
"type": "string",
"description": "qwerty"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"$ref": "#/definitions/web.Error"
}
},
"403": {
"description": "Forbidden",
"schema": {
"type": "object",
"$ref": "#/definitions/web.Error"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "object",
"$ref": "#/definitions/web.Error"
}
}
}
}
},
"/signup": {
"post": {
"description": "Signup creates a new account and user in the system.",
@ -137,6 +197,11 @@
},
"/users/{id}": {
"get": {
"security": [
{
"OAuth2Password": []
}
],
"description": "get string by ID",
"consumes": [
"application/json"
@ -148,14 +213,20 @@
"user"
],
"summary": "Read returns the specified user from the system.",
"operationId": "get-string-by-int",
"parameters": [
{
"type": "integer",
"type": "string",
"description": "User ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Authentication header",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
@ -347,6 +418,20 @@
}
}
},
"user.Token": {
"type": "object",
"properties": {
"access_token": {
"type": "string"
},
"expiry": {
"type": "string"
},
"token_type": {
"type": "string"
}
}
},
"user.User": {
"type": "object",
"required": [
@ -399,10 +484,18 @@
}
},
"securityDefinitions": {
"BasicAuth": {
"type": "basic"
},
"OAuth2Password": {
"type": "oauth2",
"flow": "password",
"tokenUrl": "/v1/oauth/token"
"tokenUrl": "/v1/oauth/token",
"scopes": {
"admin": " Grants read and write access to administrative information",
"read": " Grants read access",
"write": " Grants write access"
}
}
}
}

View File

@ -108,6 +108,15 @@ definitions:
$ref: '#/definitions/user.User'
type: object
type: object
user.Token:
properties:
access_token:
type: string
expiry:
type: string
token_type:
type: string
type: object
user.User:
properties:
archived_at:
@ -161,13 +170,12 @@ paths:
consumes:
- application/json
description: get string by ID
operationId: get-string-by-int
parameters:
- description: Account ID
in: path
name: id
required: true
type: integer
type: string
produces:
- application/json
responses:
@ -195,9 +203,49 @@ paths:
schema:
$ref: '#/definitions/web.Error'
type: object
security:
- OAuth2Password: []
summary: Read returns the specified account from the system.
tags:
- account
/oauth/token:
post:
consumes:
- application/json
description: Token generates an oauth2 accessToken using Basic Auth with a user's
email and password.
produces:
- application/json
responses:
"200":
description: OK
headers:
Token:
description: qwerty
type: string
schema:
$ref: '#/definitions/user.Token'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/web.Error'
type: object
"403":
description: Forbidden
schema:
$ref: '#/definitions/web.Error'
type: object
"404":
description: Not Found
schema:
$ref: '#/definitions/web.Error'
type: object
security:
- BasicAuth: []
summary: Token handles a request to authenticate a user.
tags:
- user
/signup:
post:
consumes:
@ -241,13 +289,17 @@ paths:
consumes:
- application/json
description: get string by ID
operationId: get-string-by-int
parameters:
- description: User ID
in: path
name: id
required: true
type: integer
type: string
- description: Authentication header
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
@ -275,12 +327,20 @@ paths:
schema:
$ref: '#/definitions/web.Error'
type: object
security:
- OAuth2Password: []
summary: Read returns the specified user from the system.
tags:
- user
securityDefinitions:
BasicAuth:
type: basic
OAuth2Password:
flow: password
scopes:
admin: ' Grants read and write access to administrative information'
read: ' Grants read access'
write: ' Grants write access'
tokenUrl: /v1/oauth/token
type: oauth2
swagger: "2.0"