commit
97f180b650
|
|
@ -7,10 +7,10 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: 1.19.x
|
go-version: 1.21.x
|
||||||
- uses: actions/setup-node@v1
|
- uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: '16'
|
node-version: '20'
|
||||||
- uses: actions/cache@v2
|
- uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ~/go/pkg/mod
|
path: ~/go/pkg/mod
|
||||||
|
|
@ -28,7 +28,7 @@ jobs:
|
||||||
- run: make build-js
|
- run: make build-js
|
||||||
- uses: golangci/golangci-lint-action@v3
|
- uses: golangci/golangci-lint-action@v3
|
||||||
with:
|
with:
|
||||||
version: v1.45
|
version: v1.53
|
||||||
args: --timeout=5m
|
args: --timeout=5m
|
||||||
skip-cache: true
|
skip-cache: true
|
||||||
- run: go mod download
|
- run: go mod download
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,6 @@ run:
|
||||||
linters:
|
linters:
|
||||||
enable:
|
enable:
|
||||||
- asciicheck
|
- asciicheck
|
||||||
- deadcode
|
|
||||||
- depguard
|
|
||||||
- exportloopref
|
- exportloopref
|
||||||
- godot
|
- godot
|
||||||
- gofmt
|
- gofmt
|
||||||
|
|
@ -23,12 +21,10 @@ linters:
|
||||||
- nolintlint
|
- nolintlint
|
||||||
- sqlclosecheck
|
- sqlclosecheck
|
||||||
- staticcheck
|
- staticcheck
|
||||||
- structcheck
|
|
||||||
- stylecheck
|
- stylecheck
|
||||||
- typecheck
|
- typecheck
|
||||||
- unconvert
|
- unconvert
|
||||||
- unused
|
- unused
|
||||||
- varcheck
|
|
||||||
- whitespace
|
- whitespace
|
||||||
disable:
|
disable:
|
||||||
- goerr113
|
- goerr113
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
1.19.1
|
1.21.1
|
||||||
|
|
|
||||||
12
Makefile
12
Makefile
|
|
@ -7,8 +7,9 @@ DOCKER_BUILD_IMAGE=gotify/build
|
||||||
DOCKER_WORKDIR=/proj
|
DOCKER_WORKDIR=/proj
|
||||||
DOCKER_RUN=docker run --rm -v "$$PWD/.:${DOCKER_WORKDIR}" -v "`go env GOPATH`/pkg/mod/.:/go/pkg/mod:ro" -w ${DOCKER_WORKDIR}
|
DOCKER_RUN=docker run --rm -v "$$PWD/.:${DOCKER_WORKDIR}" -v "`go env GOPATH`/pkg/mod/.:/go/pkg/mod:ro" -w ${DOCKER_WORKDIR}
|
||||||
DOCKER_GO_BUILD=go build -mod=readonly -a -installsuffix cgo -ldflags "$$LD_FLAGS"
|
DOCKER_GO_BUILD=go build -mod=readonly -a -installsuffix cgo -ldflags "$$LD_FLAGS"
|
||||||
|
NODE_OPTIONS=$(shell if node --help | grep -q -- "--openssl-legacy-provider"; then echo --openssl-legacy-provider; fi)
|
||||||
|
|
||||||
test: test-coverage test-race test-js
|
test: test-coverage test-js
|
||||||
check: check-go check-swagger check-js
|
check: check-go check-swagger check-js
|
||||||
check-ci: check-swagger check-js
|
check-ci: check-swagger check-js
|
||||||
|
|
||||||
|
|
@ -16,11 +17,8 @@ require-version:
|
||||||
if [ -n ${VERSION} ] && [[ $$VERSION == "v"* ]]; then echo "The version may not start with v" && exit 1; fi
|
if [ -n ${VERSION} ] && [[ $$VERSION == "v"* ]]; then echo "The version may not start with v" && exit 1; fi
|
||||||
if [ -z ${VERSION} ]; then echo "Need to set VERSION" && exit 1; fi;
|
if [ -z ${VERSION} ]; then echo "Need to set VERSION" && exit 1; fi;
|
||||||
|
|
||||||
test-race:
|
|
||||||
go test -race ./...
|
|
||||||
|
|
||||||
test-coverage:
|
test-coverage:
|
||||||
go test -coverprofile=coverage.txt -covermode=atomic ./...
|
go test --race -coverprofile=coverage.txt -covermode=atomic ./...
|
||||||
|
|
||||||
format:
|
format:
|
||||||
goimports -w $(shell find . -type f -name '*.go' -not -path "./vendor/*")
|
goimports -w $(shell find . -type f -name '*.go' -not -path "./vendor/*")
|
||||||
|
|
@ -38,7 +36,7 @@ check-js:
|
||||||
(cd ui && yarn testformat)
|
(cd ui && yarn testformat)
|
||||||
|
|
||||||
download-tools:
|
download-tools:
|
||||||
go install github.com/go-swagger/go-swagger/cmd/swagger@v0.26.1
|
go install github.com/go-swagger/go-swagger/cmd/swagger@v0.30.5
|
||||||
|
|
||||||
update-swagger:
|
update-swagger:
|
||||||
swagger generate spec --scan-models -o docs/spec.json
|
swagger generate spec --scan-models -o docs/spec.json
|
||||||
|
|
@ -124,7 +122,7 @@ build-docker-riscv64: require-version
|
||||||
build-docker: build-docker-amd64 build-docker-arm-7 build-docker-arm64 build-docker-riscv64
|
build-docker: build-docker-amd64 build-docker-arm-7 build-docker-arm64 build-docker-riscv64
|
||||||
|
|
||||||
build-js:
|
build-js:
|
||||||
(cd ui && yarn build)
|
(cd ui && NODE_OPTIONS="${NODE_OPTIONS}" yarn build)
|
||||||
|
|
||||||
build-linux-amd64:
|
build-linux-amd64:
|
||||||
${DOCKER_RUN} ${DOCKER_BUILD_IMAGE}:$(GO_VERSION)-linux-amd64 ${DOCKER_GO_BUILD} -o ${BUILD_DIR}/gotify-linux-amd64 ${DOCKER_WORKDIR}
|
${DOCKER_RUN} ${DOCKER_BUILD_IMAGE}:$(GO_VERSION)-linux-amd64 ${DOCKER_GO_BUILD} -o ${BUILD_DIR}/gotify-linux-amd64 ${DOCKER_WORKDIR}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ type ApplicationAPI struct {
|
||||||
|
|
||||||
// Application Params Model
|
// Application Params Model
|
||||||
//
|
//
|
||||||
// Params allowed to create or update Applications
|
// Params allowed to create or update Applications.
|
||||||
//
|
//
|
||||||
// swagger:model ApplicationParams
|
// swagger:model ApplicationParams
|
||||||
type ApplicationParams struct {
|
type ApplicationParams struct {
|
||||||
|
|
@ -55,34 +55,34 @@ type ApplicationParams struct {
|
||||||
//
|
//
|
||||||
// Create an application.
|
// Create an application.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// consumes: [application/json]
|
// consumes: [application/json]
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// parameters:
|
// parameters:
|
||||||
// - name: body
|
// - name: body
|
||||||
// in: body
|
// in: body
|
||||||
// description: the application to add
|
// description: the application to add
|
||||||
// required: true
|
// required: true
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/ApplicationParams"
|
// $ref: "#/definitions/ApplicationParams"
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Application"
|
// $ref: "#/definitions/Application"
|
||||||
// 400:
|
// 400:
|
||||||
// description: Bad Request
|
// description: Bad Request
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (a *ApplicationAPI) CreateApplication(ctx *gin.Context) {
|
func (a *ApplicationAPI) CreateApplication(ctx *gin.Context) {
|
||||||
applicationParams := ApplicationParams{}
|
applicationParams := ApplicationParams{}
|
||||||
if err := ctx.Bind(&applicationParams); err == nil {
|
if err := ctx.Bind(&applicationParams); err == nil {
|
||||||
|
|
@ -107,25 +107,25 @@ func (a *ApplicationAPI) CreateApplication(ctx *gin.Context) {
|
||||||
//
|
//
|
||||||
// Return all applications.
|
// Return all applications.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// consumes: [application/json]
|
// consumes: [application/json]
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// schema:
|
// schema:
|
||||||
// type: array
|
// type: array
|
||||||
// items:
|
// items:
|
||||||
// $ref: "#/definitions/Application"
|
// $ref: "#/definitions/Application"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (a *ApplicationAPI) GetApplications(ctx *gin.Context) {
|
func (a *ApplicationAPI) GetApplications(ctx *gin.Context) {
|
||||||
userID := auth.GetUserID(ctx)
|
userID := auth.GetUserID(ctx)
|
||||||
apps, err := a.DB.GetApplicationsByUser(userID)
|
apps, err := a.DB.GetApplicationsByUser(userID)
|
||||||
|
|
@ -143,36 +143,36 @@ func (a *ApplicationAPI) GetApplications(ctx *gin.Context) {
|
||||||
//
|
//
|
||||||
// Delete an application.
|
// Delete an application.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// consumes: [application/json]
|
// consumes: [application/json]
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// parameters:
|
// parameters:
|
||||||
// - name: id
|
// - name: id
|
||||||
// in: path
|
// in: path
|
||||||
// description: the application id
|
// description: the application id
|
||||||
// required: true
|
// required: true
|
||||||
// type: integer
|
// type: integer
|
||||||
// format: int64
|
// format: int64
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// 400:
|
// 400:
|
||||||
// description: Bad Request
|
// description: Bad Request
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 404:
|
// 404:
|
||||||
// description: Not Found
|
// description: Not Found
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (a *ApplicationAPI) DeleteApplication(ctx *gin.Context) {
|
func (a *ApplicationAPI) DeleteApplication(ctx *gin.Context) {
|
||||||
withID(ctx, "id", func(id uint) {
|
withID(ctx, "id", func(id uint) {
|
||||||
app, err := a.DB.GetApplicationByID(id)
|
app, err := a.DB.GetApplicationByID(id)
|
||||||
|
|
@ -201,44 +201,44 @@ func (a *ApplicationAPI) DeleteApplication(ctx *gin.Context) {
|
||||||
//
|
//
|
||||||
// Update an application.
|
// Update an application.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// consumes: [application/json]
|
// consumes: [application/json]
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// parameters:
|
// parameters:
|
||||||
// - name: body
|
// - name: body
|
||||||
// in: body
|
// in: body
|
||||||
// description: the application to update
|
// description: the application to update
|
||||||
// required: true
|
// required: true
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/ApplicationParams"
|
// $ref: "#/definitions/ApplicationParams"
|
||||||
// - name: id
|
// - name: id
|
||||||
// in: path
|
// in: path
|
||||||
// description: the application id
|
// description: the application id
|
||||||
// required: true
|
// required: true
|
||||||
// type: integer
|
// type: integer
|
||||||
// format: int64
|
// format: int64
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Application"
|
// $ref: "#/definitions/Application"
|
||||||
// 400:
|
// 400:
|
||||||
// description: Bad Request
|
// description: Bad Request
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 404:
|
// 404:
|
||||||
// description: Not Found
|
// description: Not Found
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (a *ApplicationAPI) UpdateApplication(ctx *gin.Context) {
|
func (a *ApplicationAPI) UpdateApplication(ctx *gin.Context) {
|
||||||
withID(ctx, "id", func(id uint) {
|
withID(ctx, "id", func(id uint) {
|
||||||
app, err := a.DB.GetApplicationByID(id)
|
app, err := a.DB.GetApplicationByID(id)
|
||||||
|
|
@ -268,48 +268,48 @@ func (a *ApplicationAPI) UpdateApplication(ctx *gin.Context) {
|
||||||
//
|
//
|
||||||
// Upload an image for an application.
|
// Upload an image for an application.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// consumes:
|
// consumes:
|
||||||
// - multipart/form-data
|
// - multipart/form-data
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// parameters:
|
// parameters:
|
||||||
// - name: file
|
// - name: file
|
||||||
// in: formData
|
// in: formData
|
||||||
// description: the application image
|
// description: the application image
|
||||||
// required: true
|
// required: true
|
||||||
// type: file
|
// type: file
|
||||||
// - name: id
|
// - name: id
|
||||||
// in: path
|
// in: path
|
||||||
// description: the application id
|
// description: the application id
|
||||||
// required: true
|
// required: true
|
||||||
// type: integer
|
// type: integer
|
||||||
// format: int64
|
// format: int64
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Application"
|
// $ref: "#/definitions/Application"
|
||||||
// 400:
|
// 400:
|
||||||
// description: Bad Request
|
// description: Bad Request
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 404:
|
// 404:
|
||||||
// description: Not Found
|
// description: Not Found
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 500:
|
// 500:
|
||||||
// description: Server Error
|
// description: Server Error
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (a *ApplicationAPI) UploadApplicationImage(ctx *gin.Context) {
|
func (a *ApplicationAPI) UploadApplicationImage(ctx *gin.Context) {
|
||||||
withID(ctx, "id", func(id uint) {
|
withID(ctx, "id", func(id uint) {
|
||||||
app, err := a.DB.GetApplicationByID(id)
|
app, err := a.DB.GetApplicationByID(id)
|
||||||
|
|
@ -369,40 +369,40 @@ func (a *ApplicationAPI) UploadApplicationImage(ctx *gin.Context) {
|
||||||
//
|
//
|
||||||
// Deletes an image of an application.
|
// Deletes an image of an application.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// consumes: [application/json]
|
// consumes: [application/json]
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// parameters:
|
// parameters:
|
||||||
// - name: id
|
// - name: id
|
||||||
// in: path
|
// in: path
|
||||||
// description: the application id
|
// description: the application id
|
||||||
// required: true
|
// required: true
|
||||||
// type: integer
|
// type: integer
|
||||||
// format: int64
|
// format: int64
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// 400:
|
// 400:
|
||||||
// description: Bad Request
|
// description: Bad Request
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 404:
|
// 404:
|
||||||
// description: Not Found
|
// description: Not Found
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 500:
|
// 500:
|
||||||
// description: Server Error
|
// description: Server Error
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (a *ApplicationAPI) RemoveApplicationImage(ctx *gin.Context) {
|
func (a *ApplicationAPI) RemoveApplicationImage(ctx *gin.Context) {
|
||||||
withID(ctx, "id", func(id uint) {
|
withID(ctx, "id", func(id uint) {
|
||||||
app, err := a.DB.GetApplicationByID(id)
|
app, err := a.DB.GetApplicationByID(id)
|
||||||
|
|
|
||||||
232
api/client.go
232
api/client.go
|
|
@ -27,7 +27,7 @@ type ClientAPI struct {
|
||||||
|
|
||||||
// Client Params Model
|
// Client Params Model
|
||||||
//
|
//
|
||||||
// Params allowed to create or update Clients
|
// Params allowed to create or update Clients.
|
||||||
//
|
//
|
||||||
// swagger:model ClientParams
|
// swagger:model ClientParams
|
||||||
type ClientParams struct {
|
type ClientParams struct {
|
||||||
|
|
@ -43,44 +43,44 @@ type ClientParams struct {
|
||||||
//
|
//
|
||||||
// Update a client.
|
// Update a client.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// consumes: [application/json]
|
// consumes: [application/json]
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// parameters:
|
// parameters:
|
||||||
// - name: body
|
// - name: body
|
||||||
// in: body
|
// in: body
|
||||||
// description: the client to update
|
// description: the client to update
|
||||||
// required: true
|
// required: true
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/ClientParams"
|
// $ref: "#/definitions/ClientParams"
|
||||||
// - name: id
|
// - name: id
|
||||||
// in: path
|
// in: path
|
||||||
// description: the client id
|
// description: the client id
|
||||||
// required: true
|
// required: true
|
||||||
// type: integer
|
// type: integer
|
||||||
// format: int64
|
// format: int64
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Client"
|
// $ref: "#/definitions/Client"
|
||||||
// 400:
|
// 400:
|
||||||
// description: Bad Request
|
// description: Bad Request
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 404:
|
// 404:
|
||||||
// description: Not Found
|
// description: Not Found
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (a *ClientAPI) UpdateClient(ctx *gin.Context) {
|
func (a *ClientAPI) UpdateClient(ctx *gin.Context) {
|
||||||
withID(ctx, "id", func(id uint) {
|
withID(ctx, "id", func(id uint) {
|
||||||
client, err := a.DB.GetClientByID(id)
|
client, err := a.DB.GetClientByID(id)
|
||||||
|
|
@ -108,34 +108,34 @@ func (a *ClientAPI) UpdateClient(ctx *gin.Context) {
|
||||||
//
|
//
|
||||||
// Create a client.
|
// Create a client.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// consumes: [application/json]
|
// consumes: [application/json]
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// parameters:
|
// parameters:
|
||||||
// - name: body
|
// - name: body
|
||||||
// in: body
|
// in: body
|
||||||
// description: the client to add
|
// description: the client to add
|
||||||
// required: true
|
// required: true
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/ClientParams"
|
// $ref: "#/definitions/ClientParams"
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Client"
|
// $ref: "#/definitions/Client"
|
||||||
// 400:
|
// 400:
|
||||||
// description: Bad Request
|
// description: Bad Request
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (a *ClientAPI) CreateClient(ctx *gin.Context) {
|
func (a *ClientAPI) CreateClient(ctx *gin.Context) {
|
||||||
clientParams := ClientParams{}
|
clientParams := ClientParams{}
|
||||||
if err := ctx.Bind(&clientParams); err == nil {
|
if err := ctx.Bind(&clientParams); err == nil {
|
||||||
|
|
@ -157,25 +157,25 @@ func (a *ClientAPI) CreateClient(ctx *gin.Context) {
|
||||||
//
|
//
|
||||||
// Return all clients.
|
// Return all clients.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// consumes: [application/json]
|
// consumes: [application/json]
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// schema:
|
// schema:
|
||||||
// type: array
|
// type: array
|
||||||
// items:
|
// items:
|
||||||
// $ref: "#/definitions/Client"
|
// $ref: "#/definitions/Client"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (a *ClientAPI) GetClients(ctx *gin.Context) {
|
func (a *ClientAPI) GetClients(ctx *gin.Context) {
|
||||||
userID := auth.GetUserID(ctx)
|
userID := auth.GetUserID(ctx)
|
||||||
clients, err := a.DB.GetClientsByUser(userID)
|
clients, err := a.DB.GetClientsByUser(userID)
|
||||||
|
|
@ -190,36 +190,36 @@ func (a *ClientAPI) GetClients(ctx *gin.Context) {
|
||||||
//
|
//
|
||||||
// Delete a client.
|
// Delete a client.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// consumes: [application/json]
|
// consumes: [application/json]
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// parameters:
|
// parameters:
|
||||||
// - name: id
|
// - name: id
|
||||||
// in: path
|
// in: path
|
||||||
// description: the client id
|
// description: the client id
|
||||||
// required: true
|
// required: true
|
||||||
// type: integer
|
// type: integer
|
||||||
// format: int64
|
// format: int64
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// 400:
|
// 400:
|
||||||
// description: Bad Request
|
// description: Bad Request
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 404:
|
// 404:
|
||||||
// description: Not Found
|
// description: Not Found
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (a *ClientAPI) DeleteClient(ctx *gin.Context) {
|
func (a *ClientAPI) DeleteClient(ctx *gin.Context) {
|
||||||
withID(ctx, "id", func(id uint) {
|
withID(ctx, "id", func(id uint) {
|
||||||
client, err := a.DB.GetClientByID(id)
|
client, err := a.DB.GetClientByID(id)
|
||||||
|
|
|
||||||
|
|
@ -20,17 +20,17 @@ type HealthAPI struct {
|
||||||
//
|
//
|
||||||
// Get health information.
|
// Get health information.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Health"
|
// $ref: "#/definitions/Health"
|
||||||
// 500:
|
// 500:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Health"
|
// $ref: "#/definitions/Health"
|
||||||
func (a *HealthAPI) Health(ctx *gin.Context) {
|
func (a *HealthAPI) Health(ctx *gin.Context) {
|
||||||
if err := a.DB.Ping(); err != nil {
|
if err := a.DB.Ping(); err != nil {
|
||||||
ctx.JSON(500, model.Health{
|
ctx.JSON(500, model.Health{
|
||||||
|
|
|
||||||
365
api/message.go
365
api/message.go
|
|
@ -50,42 +50,42 @@ type pagingParams struct {
|
||||||
//
|
//
|
||||||
// Return all messages.
|
// Return all messages.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// parameters:
|
// parameters:
|
||||||
// - name: limit
|
// - name: limit
|
||||||
// in: query
|
// in: query
|
||||||
// description: the maximal amount of messages to return
|
// description: the maximal amount of messages to return
|
||||||
// required: false
|
// required: false
|
||||||
// maximum: 200
|
// maximum: 200
|
||||||
// minimum: 1
|
// minimum: 1
|
||||||
// default: 100
|
// default: 100
|
||||||
// type: integer
|
// type: integer
|
||||||
// - name: since
|
// - name: since
|
||||||
// in: query
|
// in: query
|
||||||
// description: return all messages with an ID less than this value
|
// description: return all messages with an ID less than this value
|
||||||
// minimum: 0
|
// minimum: 0
|
||||||
// required: false
|
// required: false
|
||||||
// type: integer
|
// type: integer
|
||||||
// format: int64
|
// format: int64
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/PagedMessages"
|
// $ref: "#/definitions/PagedMessages"
|
||||||
// 400:
|
// 400:
|
||||||
// description: Bad Request
|
// description: Bad Request
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (a *MessageAPI) GetMessages(ctx *gin.Context) {
|
func (a *MessageAPI) GetMessages(ctx *gin.Context) {
|
||||||
userID := auth.GetUserID(ctx)
|
userID := auth.GetUserID(ctx)
|
||||||
withPaging(ctx, func(params *pagingParams) {
|
withPaging(ctx, func(params *pagingParams) {
|
||||||
|
|
@ -131,52 +131,52 @@ func withPaging(ctx *gin.Context, f func(pagingParams *pagingParams)) {
|
||||||
//
|
//
|
||||||
// Return all messages from a specific application.
|
// Return all messages from a specific application.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// parameters:
|
// parameters:
|
||||||
// - name: id
|
// - name: id
|
||||||
// in: path
|
// in: path
|
||||||
// description: the application id
|
// description: the application id
|
||||||
// required: true
|
// required: true
|
||||||
// type: integer
|
// type: integer
|
||||||
// format: int64
|
// format: int64
|
||||||
// - name: limit
|
// - name: limit
|
||||||
// in: query
|
// in: query
|
||||||
// description: the maximal amount of messages to return
|
// description: the maximal amount of messages to return
|
||||||
// required: false
|
// required: false
|
||||||
// maximum: 200
|
// maximum: 200
|
||||||
// minimum: 1
|
// minimum: 1
|
||||||
// default: 100
|
// default: 100
|
||||||
// type: integer
|
// type: integer
|
||||||
// - name: since
|
// - name: since
|
||||||
// in: query
|
// in: query
|
||||||
// description: return all messages with an ID less than this value
|
// description: return all messages with an ID less than this value
|
||||||
// minimum: 0
|
// minimum: 0
|
||||||
// required: false
|
// required: false
|
||||||
// type: integer
|
// type: integer
|
||||||
// format: int64
|
// format: int64
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/PagedMessages"
|
// $ref: "#/definitions/PagedMessages"
|
||||||
// 400:
|
// 400:
|
||||||
// description: Bad Request
|
// description: Bad Request
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 404:
|
// 404:
|
||||||
// description: Not Found
|
// description: Not Found
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (a *MessageAPI) GetMessagesWithApplication(ctx *gin.Context) {
|
func (a *MessageAPI) GetMessagesWithApplication(ctx *gin.Context) {
|
||||||
withID(ctx, "id", func(id uint) {
|
withID(ctx, "id", func(id uint) {
|
||||||
withPaging(ctx, func(params *pagingParams) {
|
withPaging(ctx, func(params *pagingParams) {
|
||||||
|
|
@ -203,20 +203,20 @@ func (a *MessageAPI) GetMessagesWithApplication(ctx *gin.Context) {
|
||||||
//
|
//
|
||||||
// Delete all messages.
|
// Delete all messages.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (a *MessageAPI) DeleteMessages(ctx *gin.Context) {
|
func (a *MessageAPI) DeleteMessages(ctx *gin.Context) {
|
||||||
userID := auth.GetUserID(ctx)
|
userID := auth.GetUserID(ctx)
|
||||||
successOrAbort(ctx, 500, a.DB.DeleteMessagesByUser(userID))
|
successOrAbort(ctx, 500, a.DB.DeleteMessagesByUser(userID))
|
||||||
|
|
@ -227,35 +227,35 @@ func (a *MessageAPI) DeleteMessages(ctx *gin.Context) {
|
||||||
//
|
//
|
||||||
// Delete all messages from a specific application.
|
// Delete all messages from a specific application.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// parameters:
|
// parameters:
|
||||||
// - name: id
|
// - name: id
|
||||||
// in: path
|
// in: path
|
||||||
// description: the application id
|
// description: the application id
|
||||||
// required: true
|
// required: true
|
||||||
// type: integer
|
// type: integer
|
||||||
// format: int64
|
// format: int64
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// 400:
|
// 400:
|
||||||
// description: Bad Request
|
// description: Bad Request
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 404:
|
// 404:
|
||||||
// description: Not Found
|
// description: Not Found
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (a *MessageAPI) DeleteMessageWithApplication(ctx *gin.Context) {
|
func (a *MessageAPI) DeleteMessageWithApplication(ctx *gin.Context) {
|
||||||
withID(ctx, "id", func(id uint) {
|
withID(ctx, "id", func(id uint) {
|
||||||
application, err := a.DB.GetApplicationByID(id)
|
application, err := a.DB.GetApplicationByID(id)
|
||||||
|
|
@ -275,35 +275,35 @@ func (a *MessageAPI) DeleteMessageWithApplication(ctx *gin.Context) {
|
||||||
//
|
//
|
||||||
// Deletes a message with an id.
|
// Deletes a message with an id.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// parameters:
|
// parameters:
|
||||||
// - name: id
|
// - name: id
|
||||||
// in: path
|
// in: path
|
||||||
// description: the message id
|
// description: the message id
|
||||||
// required: true
|
// required: true
|
||||||
// type: integer
|
// type: integer
|
||||||
// format: int64
|
// format: int64
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// 400:
|
// 400:
|
||||||
// description: Bad Request
|
// description: Bad Request
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 404:
|
// 404:
|
||||||
// description: Not Found
|
// description: Not Found
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (a *MessageAPI) DeleteMessage(ctx *gin.Context) {
|
func (a *MessageAPI) DeleteMessage(ctx *gin.Context) {
|
||||||
withID(ctx, "id", func(id uint) {
|
withID(ctx, "id", func(id uint) {
|
||||||
msg, err := a.DB.GetMessageByID(id)
|
msg, err := a.DB.GetMessageByID(id)
|
||||||
|
|
@ -332,34 +332,35 @@ func (a *MessageAPI) DeleteMessage(ctx *gin.Context) {
|
||||||
// Create a message.
|
// Create a message.
|
||||||
//
|
//
|
||||||
// __NOTE__: This API ONLY accepts an application token as authentication.
|
// __NOTE__: This API ONLY accepts an application token as authentication.
|
||||||
// ---
|
//
|
||||||
// consumes: [application/json]
|
// ---
|
||||||
// produces: [application/json]
|
// consumes: [application/json]
|
||||||
// security: [appTokenAuthorizationHeader: [], appTokenHeader: [], appTokenQuery: []]
|
// produces: [application/json]
|
||||||
// parameters:
|
// security: [appTokenAuthorizationHeader: [], appTokenHeader: [], appTokenQuery: []]
|
||||||
// - name: body
|
// parameters:
|
||||||
// in: body
|
// - name: body
|
||||||
// description: the message to add
|
// in: body
|
||||||
// required: true
|
// description: the message to add
|
||||||
// schema:
|
// required: true
|
||||||
// $ref: "#/definitions/Message"
|
// schema:
|
||||||
// responses:
|
// $ref: "#/definitions/Message"
|
||||||
// 200:
|
// responses:
|
||||||
// description: Ok
|
// 200:
|
||||||
// schema:
|
// description: Ok
|
||||||
// $ref: "#/definitions/Message"
|
// schema:
|
||||||
// 400:
|
// $ref: "#/definitions/Message"
|
||||||
// description: Bad Request
|
// 400:
|
||||||
// schema:
|
// description: Bad Request
|
||||||
// $ref: "#/definitions/Error"
|
// schema:
|
||||||
// 401:
|
// $ref: "#/definitions/Error"
|
||||||
// description: Unauthorized
|
// 401:
|
||||||
// schema:
|
// description: Unauthorized
|
||||||
// $ref: "#/definitions/Error"
|
// schema:
|
||||||
// 403:
|
// $ref: "#/definitions/Error"
|
||||||
// description: Forbidden
|
// 403:
|
||||||
// schema:
|
// description: Forbidden
|
||||||
// $ref: "#/definitions/Error"
|
// schema:
|
||||||
|
// $ref: "#/definitions/Error"
|
||||||
func (a *MessageAPI) CreateMessage(ctx *gin.Context) {
|
func (a *MessageAPI) CreateMessage(ctx *gin.Context) {
|
||||||
message := model.MessageExternal{}
|
message := model.MessageExternal{}
|
||||||
if err := ctx.Bind(&message); err == nil {
|
if err := ctx.Bind(&message); err == nil {
|
||||||
|
|
|
||||||
380
api/plugin.go
380
api/plugin.go
|
|
@ -33,33 +33,33 @@ type PluginAPI struct {
|
||||||
//
|
//
|
||||||
// Return all plugins.
|
// Return all plugins.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// consumes: [application/json]
|
// consumes: [application/json]
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// schema:
|
// schema:
|
||||||
// type: array
|
// type: array
|
||||||
// items:
|
// items:
|
||||||
// $ref: "#/definitions/PluginConf"
|
// $ref: "#/definitions/PluginConf"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 404:
|
// 404:
|
||||||
// description: Not Found
|
// description: Not Found
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 500:
|
// 500:
|
||||||
// description: Internal Server Error
|
// description: Internal Server Error
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (c *PluginAPI) GetPlugins(ctx *gin.Context) {
|
func (c *PluginAPI) GetPlugins(ctx *gin.Context) {
|
||||||
userID := auth.GetUserID(ctx)
|
userID := auth.GetUserID(ctx)
|
||||||
plugins, err := c.DB.GetPluginConfByUser(userID)
|
plugins, err := c.DB.GetPluginConfByUser(userID)
|
||||||
|
|
@ -91,36 +91,36 @@ func (c *PluginAPI) GetPlugins(ctx *gin.Context) {
|
||||||
//
|
//
|
||||||
// Enable a plugin.
|
// Enable a plugin.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// consumes: [application/json]
|
// consumes: [application/json]
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// parameters:
|
// parameters:
|
||||||
// - name: id
|
// - name: id
|
||||||
// in: path
|
// in: path
|
||||||
// description: the plugin id
|
// description: the plugin id
|
||||||
// required: true
|
// required: true
|
||||||
// type: integer
|
// type: integer
|
||||||
// format: int64
|
// format: int64
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 404:
|
// 404:
|
||||||
// description: Not Found
|
// description: Not Found
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 500:
|
// 500:
|
||||||
// description: Internal Server Error
|
// description: Internal Server Error
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (c *PluginAPI) EnablePlugin(ctx *gin.Context) {
|
func (c *PluginAPI) EnablePlugin(ctx *gin.Context) {
|
||||||
withID(ctx, "id", func(id uint) {
|
withID(ctx, "id", func(id uint) {
|
||||||
conf, err := c.DB.GetPluginConfByID(id)
|
conf, err := c.DB.GetPluginConfByID(id)
|
||||||
|
|
@ -149,36 +149,36 @@ func (c *PluginAPI) EnablePlugin(ctx *gin.Context) {
|
||||||
//
|
//
|
||||||
// Disable a plugin.
|
// Disable a plugin.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// consumes: [application/json]
|
// consumes: [application/json]
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// parameters:
|
// parameters:
|
||||||
// - name: id
|
// - name: id
|
||||||
// in: path
|
// in: path
|
||||||
// description: the plugin id
|
// description: the plugin id
|
||||||
// required: true
|
// required: true
|
||||||
// type: integer
|
// type: integer
|
||||||
// format: int64
|
// format: int64
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 404:
|
// 404:
|
||||||
// description: Not Found
|
// description: Not Found
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 500:
|
// 500:
|
||||||
// description: Internal Server Error
|
// description: Internal Server Error
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (c *PluginAPI) DisablePlugin(ctx *gin.Context) {
|
func (c *PluginAPI) DisablePlugin(ctx *gin.Context) {
|
||||||
withID(ctx, "id", func(id uint) {
|
withID(ctx, "id", func(id uint) {
|
||||||
conf, err := c.DB.GetPluginConfByID(id)
|
conf, err := c.DB.GetPluginConfByID(id)
|
||||||
|
|
@ -207,38 +207,38 @@ func (c *PluginAPI) DisablePlugin(ctx *gin.Context) {
|
||||||
//
|
//
|
||||||
// Get display info for a Displayer plugin.
|
// Get display info for a Displayer plugin.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// consumes: [application/json]
|
// consumes: [application/json]
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// parameters:
|
// parameters:
|
||||||
// - name: id
|
// - name: id
|
||||||
// in: path
|
// in: path
|
||||||
// description: the plugin id
|
// description: the plugin id
|
||||||
// required: true
|
// required: true
|
||||||
// type: integer
|
// type: integer
|
||||||
// format: int64
|
// format: int64
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// schema:
|
// schema:
|
||||||
// type: string
|
// type: string
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 404:
|
// 404:
|
||||||
// description: Not Found
|
// description: Not Found
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 500:
|
// 500:
|
||||||
// description: Internal Server Error
|
// description: Internal Server Error
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (c *PluginAPI) GetDisplay(ctx *gin.Context) {
|
func (c *PluginAPI) GetDisplay(ctx *gin.Context) {
|
||||||
withID(ctx, "id", func(id uint) {
|
withID(ctx, "id", func(id uint) {
|
||||||
conf, err := c.DB.GetPluginConfByID(id)
|
conf, err := c.DB.GetPluginConfByID(id)
|
||||||
|
|
@ -263,43 +263,43 @@ func (c *PluginAPI) GetDisplay(ctx *gin.Context) {
|
||||||
//
|
//
|
||||||
// Get YAML configuration for Configurer plugin.
|
// Get YAML configuration for Configurer plugin.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// consumes: [application/json]
|
// consumes: [application/json]
|
||||||
// produces: [application/x-yaml]
|
// produces: [application/x-yaml]
|
||||||
// parameters:
|
// parameters:
|
||||||
// - name: id
|
// - name: id
|
||||||
// in: path
|
// in: path
|
||||||
// description: the plugin id
|
// description: the plugin id
|
||||||
// required: true
|
// required: true
|
||||||
// type: integer
|
// type: integer
|
||||||
// format: int64
|
// format: int64
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// schema:
|
// schema:
|
||||||
// type: object
|
// type: object
|
||||||
// description: plugin configuration
|
// description: plugin configuration
|
||||||
// 400:
|
// 400:
|
||||||
// description: Bad Request
|
// description: Bad Request
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 404:
|
// 404:
|
||||||
// description: Not Found
|
// description: Not Found
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 500:
|
// 500:
|
||||||
// description: Internal Server Error
|
// description: Internal Server Error
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (c *PluginAPI) GetConfig(ctx *gin.Context) {
|
func (c *PluginAPI) GetConfig(ctx *gin.Context) {
|
||||||
withID(ctx, "id", func(id uint) {
|
withID(ctx, "id", func(id uint) {
|
||||||
conf, err := c.DB.GetPluginConfByID(id)
|
conf, err := c.DB.GetPluginConfByID(id)
|
||||||
|
|
@ -330,40 +330,40 @@ func (c *PluginAPI) GetConfig(ctx *gin.Context) {
|
||||||
//
|
//
|
||||||
// Update YAML configuration for Configurer plugin.
|
// Update YAML configuration for Configurer plugin.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// consumes: [application/x-yaml]
|
// consumes: [application/x-yaml]
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// parameters:
|
// parameters:
|
||||||
// - name: id
|
// - name: id
|
||||||
// in: path
|
// in: path
|
||||||
// description: the plugin id
|
// description: the plugin id
|
||||||
// required: true
|
// required: true
|
||||||
// type: integer
|
// type: integer
|
||||||
// format: int64
|
// format: int64
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// 400:
|
// 400:
|
||||||
// description: Bad Request
|
// description: Bad Request
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 404:
|
// 404:
|
||||||
// description: Not Found
|
// description: Not Found
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 500:
|
// 500:
|
||||||
// description: Internal Server Error
|
// description: Internal Server Error
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (c *PluginAPI) UpdateConfig(ctx *gin.Context) {
|
func (c *PluginAPI) UpdateConfig(ctx *gin.Context) {
|
||||||
withID(ctx, "id", func(id uint) {
|
withID(ctx, "id", func(id uint) {
|
||||||
conf, err := c.DB.GetPluginConfByID(id)
|
conf, err := c.DB.GetPluginConfByID(id)
|
||||||
|
|
|
||||||
|
|
@ -115,31 +115,31 @@ func (a *API) register(client *client) {
|
||||||
//
|
//
|
||||||
// Websocket, return newly created messages.
|
// Websocket, return newly created messages.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// schema: ws, wss
|
// schema: ws, wss
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Message"
|
// $ref: "#/definitions/Message"
|
||||||
// 400:
|
// 400:
|
||||||
// description: Bad Request
|
// description: Bad Request
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 500:
|
// 500:
|
||||||
// description: Server Error
|
// description: Server Error
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (a *API) Handle(ctx *gin.Context) {
|
func (a *API) Handle(ctx *gin.Context) {
|
||||||
conn, err := a.upgrader.Upgrade(ctx.Writer, ctx.Request, nil)
|
conn, err := a.upgrader.Upgrade(ctx.Writer, ctx.Request, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
387
api/user.go
387
api/user.go
|
|
@ -69,24 +69,24 @@ type UserAPI struct {
|
||||||
//
|
//
|
||||||
// Return all users.
|
// Return all users.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// schema:
|
// schema:
|
||||||
// type: array
|
// type: array
|
||||||
// items:
|
// items:
|
||||||
// $ref: "#/definitions/User"
|
// $ref: "#/definitions/User"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (a *UserAPI) GetUsers(ctx *gin.Context) {
|
func (a *UserAPI) GetUsers(ctx *gin.Context) {
|
||||||
users, err := a.DB.GetUsers()
|
users, err := a.DB.GetUsers()
|
||||||
if success := successOrAbort(ctx, 500, err); !success {
|
if success := successOrAbort(ctx, 500, err); !success {
|
||||||
|
|
@ -105,22 +105,22 @@ func (a *UserAPI) GetUsers(ctx *gin.Context) {
|
||||||
//
|
//
|
||||||
// Return the current user.
|
// Return the current user.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/User"
|
// $ref: "#/definitions/User"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (a *UserAPI) GetCurrentUser(ctx *gin.Context) {
|
func (a *UserAPI) GetCurrentUser(ctx *gin.Context) {
|
||||||
user, err := a.DB.GetUserByID(auth.GetUserID(ctx))
|
user, err := a.DB.GetUserByID(auth.GetUserID(ctx))
|
||||||
if success := successOrAbort(ctx, 500, err); !success {
|
if success := successOrAbort(ctx, 500, err); !success {
|
||||||
|
|
@ -137,34 +137,34 @@ func (a *UserAPI) GetCurrentUser(ctx *gin.Context) {
|
||||||
// With enabled registration: non admin users can be created without authentication.
|
// With enabled registration: non admin users can be created without authentication.
|
||||||
// With disabled registrations: users can only be created by admin users.
|
// With disabled registrations: users can only be created by admin users.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// consumes: [application/json]
|
// consumes: [application/json]
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// parameters:
|
// parameters:
|
||||||
// - name: body
|
// - name: body
|
||||||
// in: body
|
// in: body
|
||||||
// description: the user to add
|
// description: the user to add
|
||||||
// required: true
|
// required: true
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/CreateUserExternal"
|
// $ref: "#/definitions/CreateUserExternal"
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/User"
|
// $ref: "#/definitions/User"
|
||||||
// 400:
|
// 400:
|
||||||
// description: Bad Request
|
// description: Bad Request
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (a *UserAPI) CreateUser(ctx *gin.Context) {
|
func (a *UserAPI) CreateUser(ctx *gin.Context) {
|
||||||
user := model.CreateUserExternal{}
|
user := model.CreateUserExternal{}
|
||||||
if err := ctx.Bind(&user); err == nil {
|
if err := ctx.Bind(&user); err == nil {
|
||||||
|
|
@ -223,38 +223,38 @@ func (a *UserAPI) CreateUser(ctx *gin.Context) {
|
||||||
//
|
//
|
||||||
// Get a user.
|
// Get a user.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// consumes: [application/json]
|
// consumes: [application/json]
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// parameters:
|
// parameters:
|
||||||
// - name: id
|
// - name: id
|
||||||
// in: path
|
// in: path
|
||||||
// description: the user id
|
// description: the user id
|
||||||
// required: true
|
// required: true
|
||||||
// type: integer
|
// type: integer
|
||||||
// format: int64
|
// format: int64
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/User"
|
// $ref: "#/definitions/User"
|
||||||
// 400:
|
// 400:
|
||||||
// description: Bad Request
|
// description: Bad Request
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 404:
|
// 404:
|
||||||
// description: Not Found
|
// description: Not Found
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (a *UserAPI) GetUserByID(ctx *gin.Context) {
|
func (a *UserAPI) GetUserByID(ctx *gin.Context) {
|
||||||
withID(ctx, "id", func(id uint) {
|
withID(ctx, "id", func(id uint) {
|
||||||
user, err := a.DB.GetUserByID(id)
|
user, err := a.DB.GetUserByID(id)
|
||||||
|
|
@ -274,35 +274,35 @@ func (a *UserAPI) GetUserByID(ctx *gin.Context) {
|
||||||
//
|
//
|
||||||
// Deletes a user.
|
// Deletes a user.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// parameters:
|
// parameters:
|
||||||
// - name: id
|
// - name: id
|
||||||
// in: path
|
// in: path
|
||||||
// description: the user id
|
// description: the user id
|
||||||
// required: true
|
// required: true
|
||||||
// type: integer
|
// type: integer
|
||||||
// format: int64
|
// format: int64
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// 400:
|
// 400:
|
||||||
// description: Bad Request
|
// description: Bad Request
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 404:
|
// 404:
|
||||||
// description: Not Found
|
// description: Not Found
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (a *UserAPI) DeleteUserByID(ctx *gin.Context) {
|
func (a *UserAPI) DeleteUserByID(ctx *gin.Context) {
|
||||||
withID(ctx, "id", func(id uint) {
|
withID(ctx, "id", func(id uint) {
|
||||||
user, err := a.DB.GetUserByID(id)
|
user, err := a.DB.GetUserByID(id)
|
||||||
|
|
@ -334,32 +334,32 @@ func (a *UserAPI) DeleteUserByID(ctx *gin.Context) {
|
||||||
//
|
//
|
||||||
// Update the password of the current user.
|
// Update the password of the current user.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// consumes: [application/json]
|
// consumes: [application/json]
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// parameters:
|
// parameters:
|
||||||
// - name: body
|
// - name: body
|
||||||
// in: body
|
// in: body
|
||||||
// description: the user
|
// description: the user
|
||||||
// required: true
|
// required: true
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/UserPass"
|
// $ref: "#/definitions/UserPass"
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// 400:
|
// 400:
|
||||||
// description: Bad Request
|
// description: Bad Request
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (a *UserAPI) ChangePassword(ctx *gin.Context) {
|
func (a *UserAPI) ChangePassword(ctx *gin.Context) {
|
||||||
pw := model.UserExternalPass{}
|
pw := model.UserExternalPass{}
|
||||||
if err := ctx.Bind(&pw); err == nil {
|
if err := ctx.Bind(&pw); err == nil {
|
||||||
|
|
@ -377,44 +377,44 @@ func (a *UserAPI) ChangePassword(ctx *gin.Context) {
|
||||||
//
|
//
|
||||||
// Update a user.
|
// Update a user.
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// consumes: [application/json]
|
// consumes: [application/json]
|
||||||
// produces: [application/json]
|
// produces: [application/json]
|
||||||
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
// security: [clientTokenAuthorizationHeader: [], clientTokenHeader: [], clientTokenQuery: [], basicAuth: []]
|
||||||
// parameters:
|
// parameters:
|
||||||
// - name: id
|
// - name: id
|
||||||
// in: path
|
// in: path
|
||||||
// description: the user id
|
// description: the user id
|
||||||
// required: true
|
// required: true
|
||||||
// type: integer
|
// type: integer
|
||||||
// format: int64
|
// format: int64
|
||||||
// - name: body
|
// - name: body
|
||||||
// in: body
|
// in: body
|
||||||
// description: the updated user
|
// description: the updated user
|
||||||
// required: true
|
// required: true
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/UpdateUserExternal"
|
// $ref: "#/definitions/UpdateUserExternal"
|
||||||
// responses:
|
// responses:
|
||||||
// 200:
|
// 200:
|
||||||
// description: Ok
|
// description: Ok
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/User"
|
// $ref: "#/definitions/User"
|
||||||
// 400:
|
// 400:
|
||||||
// description: Bad Request
|
// description: Bad Request
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 401:
|
// 401:
|
||||||
// description: Unauthorized
|
// description: Unauthorized
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 403:
|
// 403:
|
||||||
// description: Forbidden
|
// description: Forbidden
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
// 404:
|
// 404:
|
||||||
// description: Not Found
|
// description: Not Found
|
||||||
// schema:
|
// schema:
|
||||||
// $ref: "#/definitions/Error"
|
// $ref: "#/definitions/Error"
|
||||||
func (a *UserAPI) UpdateUserByID(ctx *gin.Context) {
|
func (a *UserAPI) UpdateUserByID(ctx *gin.Context) {
|
||||||
withID(ctx, "id", func(id uint) {
|
withID(ctx, "id", func(id uint) {
|
||||||
var user *model.UpdateUserExternal
|
var user *model.UpdateUserExternal
|
||||||
|
|
@ -452,19 +452,6 @@ func (a *UserAPI) UpdateUserByID(ctx *gin.Context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *UserAPI) toInternalUser(response *model.UserExternal, newPass string, pw []byte) *model.User {
|
|
||||||
user := &model.User{
|
|
||||||
Name: response.Name,
|
|
||||||
Admin: response.Admin,
|
|
||||||
}
|
|
||||||
if newPass != "" {
|
|
||||||
user.Pass = password.CreatePassword(newPass, a.PasswordStrength)
|
|
||||||
} else {
|
|
||||||
user.Pass = pw
|
|
||||||
}
|
|
||||||
return user
|
|
||||||
}
|
|
||||||
|
|
||||||
func toExternalUser(internal *model.User) *model.UserExternal {
|
func toExternalUser(internal *model.User) *model.UserExternal {
|
||||||
return &model.UserExternal{
|
return &model.UserExternal{
|
||||||
Name: internal.Name,
|
Name: internal.Name,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
//go:build !race
|
|
||||||
// +build !race
|
|
||||||
|
|
||||||
package auth
|
package auth
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
//go:build !race
|
|
||||||
// +build !race
|
|
||||||
|
|
||||||
package password
|
package password
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
||||||
|
|
@ -2,61 +2,61 @@
|
||||||
//
|
//
|
||||||
// This is the documentation of the Gotify REST-API.
|
// This is the documentation of the Gotify REST-API.
|
||||||
//
|
//
|
||||||
// # Authentication
|
// # Authentication
|
||||||
// In Gotify there are two token types:
|
// In Gotify there are two token types:
|
||||||
// __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app)
|
// __clientToken__: a client is something that receives message and manages stuff like creating new tokens or delete messages. (f.ex this token should be used for an android app)
|
||||||
// __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script)
|
// __appToken__: an application is something that sends messages (f.ex. this token should be used for a shell script)
|
||||||
//
|
//
|
||||||
// The token can be transmitted in a header named `X-Gotify-Key`, in a query parameter named `token` or
|
// The token can be transmitted in a header named `X-Gotify-Key`, in a query parameter named `token` or
|
||||||
// through a header named `Authorization` with the value prefixed with `Bearer` (Ex. `Bearer randomtoken`).
|
// through a header named `Authorization` with the value prefixed with `Bearer` (Ex. `Bearer randomtoken`).
|
||||||
// There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken.
|
// There is also the possibility to authenticate through basic auth, this should only be used for creating a clientToken.
|
||||||
//
|
//
|
||||||
// \---
|
// \---
|
||||||
//
|
//
|
||||||
// Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
// Found a bug or have some questions? [Create an issue on GitHub](https://github.com/gotify/server/issues)
|
||||||
//
|
//
|
||||||
// Schemes: http, https
|
// Schemes: http, https
|
||||||
// Host: localhost
|
// Host: localhost
|
||||||
// Version: 2.0.2
|
// Version: 2.0.2
|
||||||
// License: MIT https://github.com/gotify/server/blob/master/LICENSE
|
// License: MIT https://github.com/gotify/server/blob/master/LICENSE
|
||||||
//
|
//
|
||||||
// Consumes:
|
// Consumes:
|
||||||
// - application/json
|
// - application/json
|
||||||
//
|
//
|
||||||
// Produces:
|
// Produces:
|
||||||
// - application/json
|
// - application/json
|
||||||
//
|
//
|
||||||
// SecurityDefinitions:
|
// SecurityDefinitions:
|
||||||
// appTokenQuery:
|
// appTokenQuery:
|
||||||
// type: apiKey
|
// type: apiKey
|
||||||
// name: token
|
// name: token
|
||||||
// in: query
|
// in: query
|
||||||
// clientTokenQuery:
|
// clientTokenQuery:
|
||||||
// type: apiKey
|
// type: apiKey
|
||||||
// name: token
|
// name: token
|
||||||
// in: query
|
// in: query
|
||||||
// appTokenHeader:
|
// appTokenHeader:
|
||||||
// type: apiKey
|
// type: apiKey
|
||||||
// name: X-Gotify-Key
|
// name: X-Gotify-Key
|
||||||
// in: header
|
// in: header
|
||||||
// clientTokenHeader:
|
// clientTokenHeader:
|
||||||
// type: apiKey
|
// type: apiKey
|
||||||
// name: X-Gotify-Key
|
// name: X-Gotify-Key
|
||||||
// in: header
|
// in: header
|
||||||
// appTokenAuthorizationHeader:
|
// appTokenAuthorizationHeader:
|
||||||
// type: apiKey
|
// type: apiKey
|
||||||
// name: Authorization
|
// name: Authorization
|
||||||
// in: header
|
// in: header
|
||||||
// description: >-
|
// description: >-
|
||||||
// Enter an application token with the `Bearer` prefix, e.g. `Bearer Axxxxxxxxxx`.
|
// Enter an application token with the `Bearer` prefix, e.g. `Bearer Axxxxxxxxxx`.
|
||||||
// clientTokenAuthorizationHeader:
|
// clientTokenAuthorizationHeader:
|
||||||
// type: apiKey
|
// type: apiKey
|
||||||
// name: Authorization
|
// name: Authorization
|
||||||
// in: header
|
// in: header
|
||||||
// description: >-
|
// description: >-
|
||||||
// Enter a client token with the `Bearer` prefix, e.g. `Bearer Cxxxxxxxxxx`.
|
// Enter a client token with the `Bearer` prefix, e.g. `Bearer Cxxxxxxxxxx`.
|
||||||
// basicAuth:
|
// basicAuth:
|
||||||
// type: basic
|
// type: basic
|
||||||
//
|
//
|
||||||
// swagger:meta
|
// swagger:meta
|
||||||
package docs
|
package docs
|
||||||
|
|
|
||||||
|
|
@ -2123,7 +2123,7 @@
|
||||||
"x-go-package": "github.com/gotify/server/v2/model"
|
"x-go-package": "github.com/gotify/server/v2/model"
|
||||||
},
|
},
|
||||||
"ApplicationParams": {
|
"ApplicationParams": {
|
||||||
"description": "Params allowed to create or update Applications",
|
"description": "Params allowed to create or update Applications.",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"title": "Application Params Model",
|
"title": "Application Params Model",
|
||||||
"required": [
|
"required": [
|
||||||
|
|
@ -2195,7 +2195,7 @@
|
||||||
"x-go-package": "github.com/gotify/server/v2/model"
|
"x-go-package": "github.com/gotify/server/v2/model"
|
||||||
},
|
},
|
||||||
"ClientParams": {
|
"ClientParams": {
|
||||||
"description": "Params allowed to create or update Clients",
|
"description": "Params allowed to create or update Clients.",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"title": "Client Params Model",
|
"title": "Client Params Model",
|
||||||
"required": [
|
"required": [
|
||||||
|
|
@ -2328,9 +2328,7 @@
|
||||||
"extras": {
|
"extras": {
|
||||||
"description": "The extra data sent along the message.\n\nThe extra fields are stored in a key-value scheme. Only accepted in CreateMessage requests with application/json content-type.\n\nThe keys should be in the following format: \u0026lt;top-namespace\u0026gt;::[\u0026lt;sub-namespace\u0026gt;::]\u0026lt;action\u0026gt;\n\nThese namespaces are reserved and might be used in the official clients: gotify android ios web server client. Do not use them for other purposes.",
|
"description": "The extra data sent along the message.\n\nThe extra fields are stored in a key-value scheme. Only accepted in CreateMessage requests with application/json content-type.\n\nThe keys should be in the following format: \u0026lt;top-namespace\u0026gt;::[\u0026lt;sub-namespace\u0026gt;::]\u0026lt;action\u0026gt;\n\nThese namespaces are reserved and might be used in the official clients: gotify android ios web server client. Do not use them for other purposes.",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": {
|
"additionalProperties": {},
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"x-go-name": "Extras",
|
"x-go-name": "Extras",
|
||||||
"example": {
|
"example": {
|
||||||
"home::appliances::lighting::on": {
|
"home::appliances::lighting::on": {
|
||||||
|
|
@ -2373,7 +2371,7 @@
|
||||||
"x-go-package": "github.com/gotify/server/v2/model"
|
"x-go-package": "github.com/gotify/server/v2/model"
|
||||||
},
|
},
|
||||||
"PagedMessages": {
|
"PagedMessages": {
|
||||||
"description": "Wrapper for the paging and the messages",
|
"description": "Wrapper for the paging and the messages.",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"title": "PagedMessages Model",
|
"title": "PagedMessages Model",
|
||||||
"required": [
|
"required": [
|
||||||
|
|
|
||||||
8
go.mod
8
go.mod
|
|
@ -5,7 +5,7 @@ require (
|
||||||
github.com/gin-contrib/cors v1.4.0
|
github.com/gin-contrib/cors v1.4.0
|
||||||
github.com/gin-contrib/gzip v0.0.6
|
github.com/gin-contrib/gzip v0.0.6
|
||||||
github.com/gin-gonic/gin v1.9.1
|
github.com/gin-gonic/gin v1.9.1
|
||||||
github.com/go-playground/validator/v10 v10.14.1
|
github.com/go-playground/validator/v10 v10.15.4
|
||||||
github.com/gorilla/websocket v1.5.0
|
github.com/gorilla/websocket v1.5.0
|
||||||
github.com/gotify/configor v1.0.2
|
github.com/gotify/configor v1.0.2
|
||||||
github.com/gotify/location v0.0.0-20170722210143-03bc4ad20437
|
github.com/gotify/location v0.0.0-20170722210143-03bc4ad20437
|
||||||
|
|
@ -14,7 +14,7 @@ require (
|
||||||
github.com/jinzhu/gorm v1.9.16
|
github.com/jinzhu/gorm v1.9.16
|
||||||
github.com/robfig/cron v1.2.0
|
github.com/robfig/cron v1.2.0
|
||||||
github.com/stretchr/testify v1.8.4
|
github.com/stretchr/testify v1.8.4
|
||||||
golang.org/x/crypto v0.11.0
|
golang.org/x/crypto v0.13.0
|
||||||
gopkg.in/yaml.v2 v2.4.0
|
gopkg.in/yaml.v2 v2.4.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -46,8 +46,8 @@ require (
|
||||||
github.com/ugorji/go/codec v1.2.11 // indirect
|
github.com/ugorji/go/codec v1.2.11 // indirect
|
||||||
golang.org/x/arch v0.3.0 // indirect
|
golang.org/x/arch v0.3.0 // indirect
|
||||||
golang.org/x/net v0.10.0 // indirect
|
golang.org/x/net v0.10.0 // indirect
|
||||||
golang.org/x/sys v0.10.0 // indirect
|
golang.org/x/sys v0.12.0 // indirect
|
||||||
golang.org/x/text v0.11.0 // indirect
|
golang.org/x/text v0.13.0 // indirect
|
||||||
google.golang.org/protobuf v1.30.0 // indirect
|
google.golang.org/protobuf v1.30.0 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
|
|
|
||||||
16
go.sum
16
go.sum
|
|
@ -41,8 +41,8 @@ github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl
|
||||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||||
github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos=
|
github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos=
|
||||||
github.com/go-playground/validator/v10 v10.14.1 h1:9c50NUPC30zyuKprjL3vNZ0m5oG+jU0zvx4AqHGnv4k=
|
github.com/go-playground/validator/v10 v10.15.4 h1:zMXza4EpOdooxPel5xDqXEdXG5r+WggpvnAKMsalBjs=
|
||||||
github.com/go-playground/validator/v10 v10.14.1/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
|
github.com/go-playground/validator/v10 v10.15.4/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
|
||||||
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
|
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
|
||||||
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||||
github.com/go-yaml/yaml v2.1.0+incompatible h1:RYi2hDdss1u4YE7GwixGzWwVo47T8UQwnTLB6vQiq+o=
|
github.com/go-yaml/yaml v2.1.0+incompatible h1:RYi2hDdss1u4YE7GwixGzWwVo47T8UQwnTLB6vQiq+o=
|
||||||
|
|
@ -147,8 +147,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
|
||||||
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=
|
golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck=
|
||||||
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
|
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
|
||||||
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20190110200230-915654e7eabc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20190110200230-915654e7eabc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
|
@ -168,14 +168,14 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||||
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
|
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
|
||||||
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
|
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
|
||||||
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ type Paging struct {
|
||||||
|
|
||||||
// PagedMessages Model
|
// PagedMessages Model
|
||||||
//
|
//
|
||||||
// Wrapper for the paging and the messages
|
// Wrapper for the paging and the messages.
|
||||||
//
|
//
|
||||||
// swagger:model PagedMessages
|
// swagger:model PagedMessages
|
||||||
type PagedMessages struct {
|
type PagedMessages struct {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
//go:build (linux || darwin) && !race
|
//go:build linux || darwin
|
||||||
// +build linux darwin
|
// +build linux darwin
|
||||||
// +build !race
|
|
||||||
|
|
||||||
package plugin
|
package plugin
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue