examples

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package examples @info.title: Swagger Petstore - OpenAPI 3.0 @info.description: |-

This is a sample Pet Store Server based on the OpenAPI 3.0 specification.  You can find out more about
Swagger at [https://swagger.io](https://swagger.io). In the third iteration of the pet store, we've switched to the design first approach!
You can now help us improve the API whether it's by making changes to the definition itself or to the code.
That way, with time, we can improve the API in general, and expose some of the new features in OAS3.
@abc=125
_If you're looking for the Swagger 2.0/OAS 2.0 version of Petstore, then click [here](https://editor.swagger.io/?url=https://petstore.swagger.io/v2/swagger.yaml). Alternatively, you can load via the `Edit > Load Petstore OAS 2.0` menu option!_

Some useful links:
- [The Pet Store repository](https://github.com/swagger-api/swagger-petstore)
- [The source API definition for the Pet Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)

@info.termsOfService: http://swagger.io/terms/ @info.contact.email: 807495056@qq.com @info.license.name: Apache 2.0 @info.license.url: http://www.apache.org/licenses/LICENSE-2.0.html @info.version: 1.0.0

@externalDocs.description:Find out more about Swagger @externalDocs.url: http://swagger.io

@servers: url=/v1;description=版本v1 @servers: url=/v2;description=版本v2

@tags: name=admin;description=后台管理

验证设置 @components.securitySchemes: field=token;type=apiKey;name=token;in=header

@components.securitySchemes: |-

field=projectID;type=oauth2;
flows={
	   "implicit": {
	     "authorizationUrl": "https://example.com/api/oauth/dialog",
	     "scopes": {
	       "write:pets": "modify pets in your account",
	       "read:pets": "read your pets"
	     }
	   }
	 }

@global.res: status=500; in=application/json; content=服务器链接失败; desc=系统内部错误

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetList

func GetList()

GetList openapi @summary: 获取用户列表 @description: 用户列表接口需要授权 @tags: admin @param: in=query; name=name; type=string; desc=用户名称 @param: in=query; name=sex; type=string; desc=用户性别 @res: status=200; in=application/json; content=[]examples.ExampleRes; desc=返回信息 @res: status=404; in=application/json; content=github.com/getkin/kin-openapi/openapi3.T; desc=错误信息 @security: token;projectID=write:pets,read:pets @router: method=get;path=/user/list

func Info

func Info()

Info openapi @summary: 用户信息 @description: 根据用户id查找用户信息 @tags: admin @param: in=path; name=id; type=integer(int64); required; desc=主键; minimum=1;maximum=10;default=8 @res: status=200; in=application/json; content=examples.ExampleRes; desc=返回信息 @res: status=404; in=application/json; content=examples.ExampleRes; desc=错误信息 @security: token;projectID=write:pets,read:pets @router: method=get;path=/admin/{id}

func Login

func Login()

Login openapi @summary: 登录后台 @description: 登录后返回token信息 @tags: admin @body: in=application/json; content=examples.ExampleBody; desc=用户信息 @res: status=200; in=application/json; content=examples.ExampleRes; desc=返回信息 @res: status=404; in=application/json; content=examples.ExampleRes; desc=错误信息 @security: token;projectID=write:pets,read:pets @router: method=post;path=/admin/login

func Logout

func Logout()

Logout openapi @summary: 退出登录 @description: 清除后端的登录缓存 @tags: admin @res: status=200; in=application/json; content=examples.ExampleRes; desc=返回信息 @res: status=404; in=application/json; content=examples.ExampleRes; desc=错误信息 @security: token;projectID=write:pets,read:pets @router: method=delete;path=/admin/logout

Types

type ExampleBody

type ExampleBody struct {
	UserName string `json:"user_name"` // 用户名称
	Password string `json:"password"`  // 密码
}

type ExampleRes

type ExampleRes struct {
	ID   int    `json:"id"`   // 主键
	Name string `json:"name"` // 名称
}

ExampleRes 是测试结果返回

type ServerError

type ServerError struct {
	Code int    `json:"code" default:"500"`   // 错误码
	Msg  string `json:"msg" default:"系统内部错误"` // 错误信息
}

ServerError 是服务器错误信息

type Test

type Test struct {
	Map map[string]ExampleRes `json:"map"` // 对象
}

Test 测试结构体注释

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL