[message pusher] - add swagger

This commit is contained in:
zeaslity
2024-04-23 15:25:53 +08:00
parent 16541183ef
commit 9d09c793ad
11 changed files with 605 additions and 22 deletions

185
message_pusher/docs/docs.go Normal file
View File

@@ -0,0 +1,185 @@
// Package docs Code generated by swaggo/swag. DO NOT EDIT
package docs
import "github.com/swaggo/swag"
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "API Support",
"url": "http://www.swagger.io/support",
"email": "support@swagger.io"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/cmii/update": {
"post": {
"description": "response to cmii update notification",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"CmiiUpdate"
],
"summary": "ping example",
"parameters": [
{
"description": "请求体",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/cmii.MessageBody"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/pusher.Message"
}
}
}
}
}
},
"definitions": {
"cmii.MessageBody": {
"type": "object",
"properties": {
"appName": {
"type": "string"
},
"deployStatus": {
"type": "boolean"
},
"fromTag": {
"type": "string"
},
"namespace": {
"type": "string"
},
"replicas": {
"type": "string"
},
"toTag": {
"type": "string"
}
}
},
"pusher.Attachment": {
"type": "object",
"properties": {
"expires": {
"type": "integer"
},
"name": {
"type": "string"
},
"size": {
"type": "integer"
},
"type": {
"type": "string"
},
"url": {
"type": "string"
}
}
},
"pusher.Message": {
"type": "object",
"properties": {
"attachment": {
"$ref": "#/definitions/pusher.Attachment"
},
"click": {
"type": "string"
},
"event": {
"type": "string"
},
"icon": {
"type": "string"
},
"id": {
"type": "string"
},
"message": {
"type": "string"
},
"priority": {
"type": "integer"
},
"raw": {
"type": "string"
},
"subscriptionID": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"time": {
"type": "integer"
},
"title": {
"type": "string"
},
"topic": {
"type": "string"
},
"topicURL": {
"description": "Additional fields",
"type": "string"
}
}
}
},
"securityDefinitions": {
"BasicAuth": {
"type": "basic"
}
},
"externalDocs": {
"description": "OpenAPI",
"url": "https://swagger.io/resources/open-api/"
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Host: "localhost:8080",
BasePath: "",
Schemes: []string{},
Title: "Swagger Example API",
Description: "This is a sample server celler server.",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}

View File

@@ -0,0 +1,160 @@
{
"swagger": "2.0",
"info": {
"description": "This is a sample server celler server.",
"title": "Swagger Example API",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "API Support",
"url": "http://www.swagger.io/support",
"email": "support@swagger.io"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "1.0"
},
"host": "localhost:8080",
"paths": {
"/cmii/update": {
"post": {
"description": "response to cmii update notification",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"CmiiUpdate"
],
"summary": "ping example",
"parameters": [
{
"description": "请求体",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/cmii.MessageBody"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/pusher.Message"
}
}
}
}
}
},
"definitions": {
"cmii.MessageBody": {
"type": "object",
"properties": {
"appName": {
"type": "string"
},
"deployStatus": {
"type": "boolean"
},
"fromTag": {
"type": "string"
},
"namespace": {
"type": "string"
},
"replicas": {
"type": "string"
},
"toTag": {
"type": "string"
}
}
},
"pusher.Attachment": {
"type": "object",
"properties": {
"expires": {
"type": "integer"
},
"name": {
"type": "string"
},
"size": {
"type": "integer"
},
"type": {
"type": "string"
},
"url": {
"type": "string"
}
}
},
"pusher.Message": {
"type": "object",
"properties": {
"attachment": {
"$ref": "#/definitions/pusher.Attachment"
},
"click": {
"type": "string"
},
"event": {
"type": "string"
},
"icon": {
"type": "string"
},
"id": {
"type": "string"
},
"message": {
"type": "string"
},
"priority": {
"type": "integer"
},
"raw": {
"type": "string"
},
"subscriptionID": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"time": {
"type": "integer"
},
"title": {
"type": "string"
},
"topic": {
"type": "string"
},
"topicURL": {
"description": "Additional fields",
"type": "string"
}
}
}
},
"securityDefinitions": {
"BasicAuth": {
"type": "basic"
}
},
"externalDocs": {
"description": "OpenAPI",
"url": "https://swagger.io/resources/open-api/"
}
}

View File

@@ -0,0 +1,106 @@
definitions:
cmii.MessageBody:
properties:
appName:
type: string
deployStatus:
type: boolean
fromTag:
type: string
namespace:
type: string
replicas:
type: string
toTag:
type: string
type: object
pusher.Attachment:
properties:
expires:
type: integer
name:
type: string
size:
type: integer
type:
type: string
url:
type: string
type: object
pusher.Message:
properties:
attachment:
$ref: '#/definitions/pusher.Attachment'
click:
type: string
event:
type: string
icon:
type: string
id:
type: string
message:
type: string
priority:
type: integer
raw:
type: string
subscriptionID:
type: string
tags:
items:
type: string
type: array
time:
type: integer
title:
type: string
topic:
type: string
topicURL:
description: Additional fields
type: string
type: object
externalDocs:
description: OpenAPI
url: https://swagger.io/resources/open-api/
host: localhost:8080
info:
contact:
email: support@swagger.io
name: API Support
url: http://www.swagger.io/support
description: This is a sample server celler server.
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
termsOfService: http://swagger.io/terms/
title: Swagger Example API
version: "1.0"
paths:
/cmii/update:
post:
consumes:
- application/json
description: response to cmii update notification
parameters:
- description: 请求体
in: body
name: body
required: true
schema:
$ref: '#/definitions/cmii.MessageBody'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/pusher.Message'
summary: ping example
tags:
- CmiiUpdate
securityDefinitions:
BasicAuth:
type: basic
swagger: "2.0"