gitee.com/woood2/luca@v1.0.4/cmd/backend/docs/docs.go (about) 1 // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT 2 // This file was generated by swaggo/swag 3 4 package docs 5 6 import ( 7 "bytes" 8 "encoding/json" 9 "strings" 10 11 "github.com/alecthomas/template" 12 "github.com/swaggo/swag" 13 ) 14 15 var doc = `{ 16 "schemes": {{ marshal .Schemes }}, 17 "swagger": "2.0", 18 "info": { 19 "description": "{{.Description}}", 20 "title": "{{.Title}}", 21 "contact": {}, 22 "license": {}, 23 "version": "{{.Version}}" 24 }, 25 "host": "{{.Host}}", 26 "basePath": "{{.BasePath}}", 27 "paths": { 28 "/apps": { 29 "get": { 30 "security": [ 31 { 32 "ApiKeyAuth": [] 33 } 34 ], 35 "description": "批量获取应用列表,支持模糊查询", 36 "consumes": [ 37 "application/json" 38 ], 39 "produces": [ 40 "application/json" 41 ], 42 "tags": [ 43 "应用" 44 ], 45 "summary": "应用列表", 46 "operationId": "list-app", 47 "parameters": [ 48 { 49 "type": "string", 50 "description": "应用标识", 51 "name": "appkey", 52 "in": "query" 53 }, 54 { 55 "type": "string", 56 "description": "应用名称", 57 "name": "name", 58 "in": "query" 59 } 60 ], 61 "responses": { 62 "200": { 63 "description": "OK", 64 "schema": { 65 "allOf": [ 66 { 67 "$ref": "#/definitions/errcode.Resp" 68 }, 69 { 70 "type": "object", 71 "properties": { 72 "data": { 73 "type": "array", 74 "items": { 75 "$ref": "#/definitions/controller.App" 76 } 77 } 78 } 79 } 80 ] 81 } 82 }, 83 "400": { 84 "description": "Bad Request", 85 "schema": { 86 "type": "string" 87 } 88 }, 89 "401": { 90 "description": "Unauthorized", 91 "schema": { 92 "type": "string" 93 } 94 }, 95 "403": { 96 "description": "Forbidden", 97 "schema": { 98 "type": "string" 99 } 100 }, 101 "500": { 102 "description": "Internal Server Error", 103 "schema": { 104 "$ref": "#/definitions/errcode.Resp" 105 } 106 } 107 } 108 }, 109 "post": { 110 "security": [ 111 { 112 "ApiKeyAuth": [] 113 } 114 ], 115 "description": "创建一个新的应用", 116 "consumes": [ 117 "application/json" 118 ], 119 "produces": [ 120 "application/json" 121 ], 122 "tags": [ 123 "应用" 124 ], 125 "summary": "应用创建", 126 "operationId": "create-app", 127 "parameters": [ 128 { 129 "description": "应用参数", 130 "name": "CreateAppParam", 131 "in": "body", 132 "required": true, 133 "schema": { 134 "$ref": "#/definitions/controller.CreateAppParam" 135 } 136 } 137 ], 138 "responses": { 139 "200": { 140 "description": "OK", 141 "schema": { 142 "allOf": [ 143 { 144 "$ref": "#/definitions/errcode.Resp" 145 }, 146 { 147 "type": "object", 148 "properties": { 149 "data": { 150 "$ref": "#/definitions/controller.App" 151 } 152 } 153 } 154 ] 155 } 156 }, 157 "400": { 158 "description": "Bad Request", 159 "schema": { 160 "type": "string" 161 } 162 }, 163 "401": { 164 "description": "Unauthorized", 165 "schema": { 166 "type": "string" 167 } 168 }, 169 "403": { 170 "description": "Forbidden", 171 "schema": { 172 "type": "string" 173 } 174 }, 175 "500": { 176 "description": "Internal Server Error", 177 "schema": { 178 "$ref": "#/definitions/errcode.Resp" 179 } 180 } 181 } 182 } 183 }, 184 "/apps/{appkey}": { 185 "get": { 186 "security": [ 187 { 188 "ApiKeyAuth": [] 189 } 190 ], 191 "description": "查询单个应用详情", 192 "consumes": [ 193 "application/json" 194 ], 195 "produces": [ 196 "application/json" 197 ], 198 "tags": [ 199 "应用" 200 ], 201 "summary": "应用查询", 202 "operationId": "get-app", 203 "parameters": [ 204 { 205 "type": "string", 206 "description": "应用标识", 207 "name": "appkey", 208 "in": "path", 209 "required": true 210 } 211 ], 212 "responses": { 213 "200": { 214 "description": "OK", 215 "schema": { 216 "allOf": [ 217 { 218 "$ref": "#/definitions/errcode.Resp" 219 }, 220 { 221 "type": "object", 222 "properties": { 223 "data": { 224 "$ref": "#/definitions/controller.App" 225 } 226 } 227 } 228 ] 229 } 230 }, 231 "401": { 232 "description": "Unauthorized", 233 "schema": { 234 "type": "string" 235 } 236 }, 237 "403": { 238 "description": "Forbidden", 239 "schema": { 240 "type": "string" 241 } 242 }, 243 "500": { 244 "description": "Internal Server Error", 245 "schema": { 246 "$ref": "#/definitions/errcode.Resp" 247 } 248 } 249 } 250 }, 251 "put": { 252 "security": [ 253 { 254 "ApiKeyAuth": [] 255 } 256 ], 257 "description": "修改应用的属性", 258 "consumes": [ 259 "application/json" 260 ], 261 "produces": [ 262 "application/json" 263 ], 264 "tags": [ 265 "应用" 266 ], 267 "summary": "应用修改", 268 "operationId": "edit-app", 269 "parameters": [ 270 { 271 "type": "string", 272 "description": "应用标识", 273 "name": "appkey", 274 "in": "path", 275 "required": true 276 }, 277 { 278 "description": "应用参数", 279 "name": "EditAppParam", 280 "in": "body", 281 "required": true, 282 "schema": { 283 "$ref": "#/definitions/controller.EditAppParam" 284 } 285 } 286 ], 287 "responses": { 288 "200": { 289 "description": "OK", 290 "schema": { 291 "allOf": [ 292 { 293 "$ref": "#/definitions/errcode.Resp" 294 }, 295 { 296 "type": "object", 297 "properties": { 298 "data": { 299 "type": "boolean" 300 } 301 } 302 } 303 ] 304 } 305 }, 306 "400": { 307 "description": "Bad Request", 308 "schema": { 309 "type": "string" 310 } 311 }, 312 "401": { 313 "description": "Unauthorized", 314 "schema": { 315 "type": "string" 316 } 317 }, 318 "403": { 319 "description": "Forbidden", 320 "schema": { 321 "type": "string" 322 } 323 }, 324 "500": { 325 "description": "Internal Server Error", 326 "schema": { 327 "$ref": "#/definitions/errcode.Resp" 328 } 329 } 330 } 331 }, 332 "delete": { 333 "security": [ 334 { 335 "ApiKeyAuth": [] 336 } 337 ], 338 "description": "删除一个应用", 339 "consumes": [ 340 "application/json" 341 ], 342 "produces": [ 343 "application/json" 344 ], 345 "tags": [ 346 "应用" 347 ], 348 "summary": "应用删除", 349 "operationId": "delete-app", 350 "parameters": [ 351 { 352 "type": "string", 353 "description": "应用标识", 354 "name": "appkey", 355 "in": "path", 356 "required": true 357 } 358 ], 359 "responses": { 360 "200": { 361 "description": "OK", 362 "schema": { 363 "allOf": [ 364 { 365 "$ref": "#/definitions/errcode.Resp" 366 }, 367 { 368 "type": "object", 369 "properties": { 370 "data": { 371 "type": "boolean" 372 } 373 } 374 } 375 ] 376 } 377 }, 378 "401": { 379 "description": "Unauthorized", 380 "schema": { 381 "type": "string" 382 } 383 }, 384 "403": { 385 "description": "Forbidden", 386 "schema": { 387 "type": "string" 388 } 389 }, 390 "500": { 391 "description": "Internal Server Error", 392 "schema": { 393 "$ref": "#/definitions/errcode.Resp" 394 } 395 } 396 } 397 } 398 }, 399 "/apps/{appkey}/disabled": { 400 "put": { 401 "security": [ 402 { 403 "ApiKeyAuth": [] 404 } 405 ], 406 "description": "转变一个应用的状态", 407 "consumes": [ 408 "application/json" 409 ], 410 "produces": [ 411 "application/json" 412 ], 413 "tags": [ 414 "应用" 415 ], 416 "summary": "应用启用/禁用", 417 "operationId": "change-app-disabled", 418 "parameters": [ 419 { 420 "type": "string", 421 "description": "应用标识", 422 "name": "appkey", 423 "in": "path", 424 "required": true 425 }, 426 { 427 "description": "参数", 428 "name": "ChangeAppDisabledParam", 429 "in": "body", 430 "required": true, 431 "schema": { 432 "$ref": "#/definitions/controller.ChangeAppDisabledParam" 433 } 434 } 435 ], 436 "responses": { 437 "200": { 438 "description": "OK", 439 "schema": { 440 "allOf": [ 441 { 442 "$ref": "#/definitions/errcode.Resp" 443 }, 444 { 445 "type": "object", 446 "properties": { 447 "data": { 448 "type": "boolean" 449 } 450 } 451 } 452 ] 453 } 454 }, 455 "400": { 456 "description": "Bad Request", 457 "schema": { 458 "type": "string" 459 } 460 }, 461 "401": { 462 "description": "Unauthorized", 463 "schema": { 464 "type": "string" 465 } 466 }, 467 "403": { 468 "description": "Forbidden", 469 "schema": { 470 "type": "string" 471 } 472 }, 473 "500": { 474 "description": "Internal Server Error", 475 "schema": { 476 "$ref": "#/definitions/errcode.Resp" 477 } 478 } 479 } 480 } 481 } 482 }, 483 "definitions": { 484 "controller.App": { 485 "type": "object", 486 "properties": { 487 "appkey": { 488 "type": "string", 489 "example": "weibo" 490 }, 491 "contacts": { 492 "type": "string", 493 "example": "@来去之间" 494 }, 495 "createtime": { 496 "type": "string", 497 "example": "2006-01-02 15:04:05" 498 }, 499 "disabled": { 500 "type": "integer", 501 "example": 0 502 }, 503 "id": { 504 "type": "integer", 505 "example": 24 506 }, 507 "logo": { 508 "type": "string", 509 "example": "https://img.t.sinajs.cn/t6/style/images/apple/wbfont.svg" 510 }, 511 "name": { 512 "type": "string", 513 "example": "新浪微博" 514 }, 515 "remark": { 516 "type": "string", 517 "example": "备注" 518 }, 519 "secret": { 520 "type": "string", 521 "example": "wow24^_^" 522 }, 523 "updatetime": { 524 "type": "string", 525 "example": "2006-01-02 15:04:05" 526 }, 527 "url": { 528 "type": "string", 529 "example": "https://weibo.com" 530 } 531 } 532 }, 533 "controller.ChangeAppDisabledParam": { 534 "type": "object", 535 "properties": { 536 "disabled": { 537 "type": "boolean", 538 "example": true 539 } 540 } 541 }, 542 "controller.CreateAppParam": { 543 "type": "object", 544 "required": [ 545 "appkey", 546 "name", 547 "secret" 548 ], 549 "properties": { 550 "appkey": { 551 "type": "string", 552 "example": "weibo" 553 }, 554 "contacts": { 555 "type": "string", 556 "example": "@来去之间" 557 }, 558 "logo": { 559 "type": "string", 560 "example": "https://img.t.sinajs.cn/t6/style/images/apple/wbfont.svg" 561 }, 562 "name": { 563 "type": "string", 564 "example": "新浪微博" 565 }, 566 "remark": { 567 "type": "string", 568 "example": "备注" 569 }, 570 "secret": { 571 "type": "string", 572 "example": "wow24^_^" 573 }, 574 "url": { 575 "type": "string", 576 "example": "https://weibo.com" 577 } 578 } 579 }, 580 "controller.EditAppParam": { 581 "type": "object", 582 "required": [ 583 "name", 584 "secret" 585 ], 586 "properties": { 587 "contacts": { 588 "type": "string", 589 "example": "@来去之间" 590 }, 591 "logo": { 592 "type": "string", 593 "example": "https://img.t.sinajs.cn/t6/style/images/apple/wbfont.svg" 594 }, 595 "name": { 596 "type": "string", 597 "example": "新浪微博" 598 }, 599 "remark": { 600 "type": "string", 601 "example": "备注" 602 }, 603 "secret": { 604 "type": "string", 605 "example": "wow24^_^" 606 }, 607 "url": { 608 "type": "string", 609 "example": "https://weibo.com" 610 } 611 } 612 }, 613 "errcode.Resp": { 614 "type": "object", 615 "properties": { 616 "data": { 617 "type": "object" 618 }, 619 "errCode": { 620 "type": "string" 621 }, 622 "errMsg": { 623 "type": "string" 624 }, 625 "stack": { 626 "type": "string" 627 }, 628 "traceID": { 629 "type": "string" 630 } 631 } 632 } 633 }, 634 "securityDefinitions": { 635 "ApiKeyAuth": { 636 "type": "apiKey", 637 "name": "token", 638 "in": "header" 639 } 640 } 641 }` 642 643 type swaggerInfo struct { 644 Version string 645 Host string 646 BasePath string 647 Schemes []string 648 Title string 649 Description string 650 } 651 652 // SwaggerInfo holds exported Swagger Info so clients can modify it 653 var SwaggerInfo = swaggerInfo{ 654 Version: "1.0", 655 Host: "", 656 BasePath: "/", 657 Schemes: []string{}, 658 Title: "Luca APIs", 659 Description: "基于Gin封装的demo项目", 660 } 661 662 type s struct{} 663 664 func (s *s) ReadDoc() string { 665 sInfo := SwaggerInfo 666 sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1) 667 668 t, err := template.New("swagger_info").Funcs(template.FuncMap{ 669 "marshal": func(v interface{}) string { 670 a, _ := json.Marshal(v) 671 return string(a) 672 }, 673 }).Parse(doc) 674 if err != nil { 675 return doc 676 } 677 678 var tpl bytes.Buffer 679 if err := t.Execute(&tpl, sInfo); err != nil { 680 return doc 681 } 682 683 return tpl.String() 684 } 685 686 func init() { 687 swag.Register(swag.Name, &s{}) 688 }