github.com/covergates/covergates@v0.2.2-0.20201009050117-42ef8a19fb95/routers/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 "termsOfService": "http://swagger.io/terms/", 22 "contact": {}, 23 "license": { 24 "name": "Apache 2.0", 25 "url": "http://www.apache.org/licenses/LICENSE-2.0.html" 26 }, 27 "version": "{{.Version}}" 28 }, 29 "host": "{{.Host}}", 30 "basePath": "{{.BasePath}}", 31 "paths": { 32 "/reports/{id}": { 33 "get": { 34 "tags": [ 35 "Report" 36 ], 37 "summary": "get reports for the report id", 38 "parameters": [ 39 { 40 "type": "string", 41 "description": "report id", 42 "name": "id", 43 "in": "path", 44 "required": true 45 }, 46 { 47 "type": "boolean", 48 "description": "get only the latest report", 49 "name": "latest", 50 "in": "query" 51 }, 52 { 53 "type": "string", 54 "description": "get report for git ref", 55 "name": "ref", 56 "in": "query" 57 } 58 ], 59 "responses": { 60 "200": { 61 "description": "coverage report", 62 "schema": { 63 "$ref": "#/definitions/core.Report" 64 } 65 } 66 } 67 }, 68 "post": { 69 "tags": [ 70 "Report" 71 ], 72 "summary": "Upload coverage report", 73 "parameters": [ 74 { 75 "type": "string", 76 "description": "report id", 77 "name": "id", 78 "in": "path", 79 "required": true 80 }, 81 { 82 "type": "file", 83 "description": "report", 84 "name": "file", 85 "in": "formData", 86 "required": true 87 }, 88 { 89 "type": "string", 90 "description": "Git commit SHA", 91 "name": "commit", 92 "in": "formData", 93 "required": true 94 }, 95 { 96 "type": "string", 97 "description": "report type", 98 "name": "type", 99 "in": "formData", 100 "required": true 101 }, 102 { 103 "type": "string", 104 "description": "ref", 105 "name": "ref", 106 "in": "formData" 107 }, 108 { 109 "type": "string", 110 "description": "files list of the repository", 111 "name": "files", 112 "in": "formData" 113 } 114 ], 115 "responses": { 116 "200": { 117 "description": "ok", 118 "schema": { 119 "type": "string" 120 } 121 }, 122 "400": { 123 "description": "error message", 124 "schema": { 125 "type": "string" 126 } 127 } 128 } 129 } 130 }, 131 "/reports/{id}/badge": { 132 "get": { 133 "tags": [ 134 "Report" 135 ], 136 "summary": "get badge for the report id", 137 "parameters": [ 138 { 139 "type": "string", 140 "description": "report id", 141 "name": "id", 142 "in": "path", 143 "required": true 144 }, 145 { 146 "type": "boolean", 147 "description": "get latest report in main branch", 148 "name": "latest", 149 "in": "query" 150 } 151 ], 152 "responses": { 153 "200": { 154 "description": "badge svg", 155 "schema": { 156 "type": "string" 157 } 158 } 159 } 160 } 161 }, 162 "/reports/{id}/card": { 163 "get": { 164 "produces": [ 165 "image/svg+xml" 166 ], 167 "tags": [ 168 "Report" 169 ], 170 "summary": "Get status card of the repository", 171 "parameters": [ 172 { 173 "type": "string", 174 "description": "report id", 175 "name": "id", 176 "in": "path", 177 "required": true 178 } 179 ], 180 "responses": { 181 "200": { 182 "description": "treemap svg", 183 "schema": { 184 "type": "string" 185 } 186 } 187 } 188 } 189 }, 190 "/reports/{id}/comment/{number}": { 191 "post": { 192 "tags": [ 193 "Report" 194 ], 195 "summary": "Leave a report summary comment on pull request", 196 "parameters": [ 197 { 198 "type": "string", 199 "description": "report id", 200 "name": "id", 201 "in": "path", 202 "required": true 203 }, 204 { 205 "type": "string", 206 "description": "pull request number", 207 "name": "number", 208 "in": "path", 209 "required": true 210 } 211 ], 212 "responses": { 213 "200": { 214 "description": "ok", 215 "schema": { 216 "type": "string" 217 } 218 } 219 } 220 } 221 }, 222 "/reports/{id}/repo": { 223 "get": { 224 "tags": [ 225 "Report" 226 ], 227 "summary": "get repository of the report id", 228 "parameters": [ 229 { 230 "type": "string", 231 "description": "report id", 232 "name": "id", 233 "in": "path", 234 "required": true 235 } 236 ], 237 "responses": { 238 "200": { 239 "description": "repository", 240 "schema": { 241 "$ref": "#/definitions/core.Repo" 242 } 243 }, 244 "400": { 245 "description": "error message", 246 "schema": { 247 "type": "string" 248 } 249 } 250 } 251 } 252 }, 253 "/reports/{id}/treemap/{ref}": { 254 "get": { 255 "produces": [ 256 "image/svg+xml" 257 ], 258 "tags": [ 259 "Report" 260 ], 261 "summary": "Get coverage difference treemap with main branch", 262 "parameters": [ 263 { 264 "type": "string", 265 "description": "report id", 266 "name": "id", 267 "in": "path", 268 "required": true 269 }, 270 { 271 "type": "string", 272 "description": "source branch", 273 "name": "source", 274 "in": "path", 275 "required": true 276 } 277 ], 278 "responses": { 279 "200": { 280 "description": "treemap svg", 281 "schema": { 282 "type": "string" 283 } 284 } 285 } 286 } 287 }, 288 "/repos": { 289 "get": { 290 "tags": [ 291 "Repository" 292 ], 293 "summary": "List repositories for all available SCM providers", 294 "responses": { 295 "200": { 296 "description": "repositories", 297 "schema": { 298 "type": "array", 299 "items": { 300 "$ref": "#/definitions/core.Repo" 301 } 302 } 303 } 304 } 305 }, 306 "post": { 307 "tags": [ 308 "Repository" 309 ], 310 "summary": "Create new repository for code coverage", 311 "parameters": [ 312 { 313 "description": "repository to create", 314 "name": "repo", 315 "in": "body", 316 "required": true, 317 "schema": { 318 "$ref": "#/definitions/core.Repo" 319 } 320 } 321 ], 322 "responses": { 323 "200": { 324 "description": "Created repository", 325 "schema": { 326 "$ref": "#/definitions/core.Repo" 327 } 328 } 329 } 330 } 331 }, 332 "/repos/{scm}": { 333 "get": { 334 "tags": [ 335 "Repository" 336 ], 337 "summary": "List repositories", 338 "parameters": [ 339 { 340 "type": "string", 341 "description": "SCM source (github, gitea)", 342 "name": "scm", 343 "in": "path", 344 "required": true 345 } 346 ], 347 "responses": { 348 "200": { 349 "description": "repositories", 350 "schema": { 351 "type": "array", 352 "items": { 353 "$ref": "#/definitions/core.Repo" 354 } 355 } 356 } 357 } 358 } 359 }, 360 "/repos/{scm}/{namespace}/{name}": { 361 "get": { 362 "tags": [ 363 "Repository" 364 ], 365 "summary": "get repository", 366 "parameters": [ 367 { 368 "type": "string", 369 "description": "SCM", 370 "name": "scm", 371 "in": "path", 372 "required": true 373 }, 374 { 375 "type": "string", 376 "description": "Namespace", 377 "name": "namespace", 378 "in": "path", 379 "required": true 380 }, 381 { 382 "type": "string", 383 "description": "name", 384 "name": "name", 385 "in": "path", 386 "required": true 387 } 388 ], 389 "responses": { 390 "200": { 391 "description": "OK", 392 "schema": { 393 "$ref": "#/definitions/core.Repo" 394 } 395 } 396 } 397 }, 398 "patch": { 399 "tags": [ 400 "Repository" 401 ], 402 "summary": "sync repository information with SCM", 403 "parameters": [ 404 { 405 "type": "string", 406 "description": "SCM", 407 "name": "scm", 408 "in": "path", 409 "required": true 410 }, 411 { 412 "type": "string", 413 "description": "Namespace", 414 "name": "namespace", 415 "in": "path", 416 "required": true 417 }, 418 { 419 "type": "string", 420 "description": "name", 421 "name": "name", 422 "in": "path", 423 "required": true 424 } 425 ], 426 "responses": { 427 "200": { 428 "description": "OK", 429 "schema": { 430 "$ref": "#/definitions/core.Repo" 431 } 432 } 433 } 434 } 435 }, 436 "/repos/{scm}/{namespace}/{name}/branches": { 437 "get": { 438 "tags": [ 439 "Repository" 440 ], 441 "summary": "list repository branches", 442 "parameters": [ 443 { 444 "type": "string", 445 "description": "SCM", 446 "name": "scm", 447 "in": "path", 448 "required": true 449 }, 450 { 451 "type": "string", 452 "description": "Namespace", 453 "name": "namespace", 454 "in": "path", 455 "required": true 456 }, 457 { 458 "type": "string", 459 "description": "name", 460 "name": "name", 461 "in": "path", 462 "required": true 463 } 464 ], 465 "responses": { 466 "200": { 467 "description": "OK", 468 "schema": { 469 "type": "array", 470 "items": { 471 "type": "string" 472 } 473 } 474 } 475 } 476 } 477 }, 478 "/repos/{scm}/{namespace}/{name}/commits": { 479 "get": { 480 "tags": [ 481 "Repository" 482 ], 483 "summary": "list recent commits", 484 "parameters": [ 485 { 486 "type": "string", 487 "description": "SCM", 488 "name": "scm", 489 "in": "path", 490 "required": true 491 }, 492 { 493 "type": "string", 494 "description": "Namespace", 495 "name": "namespace", 496 "in": "path", 497 "required": true 498 }, 499 { 500 "type": "string", 501 "description": "name", 502 "name": "name", 503 "in": "path", 504 "required": true 505 }, 506 { 507 "type": "string", 508 "description": "branch to list commits from", 509 "name": "ref", 510 "in": "query" 511 } 512 ], 513 "responses": { 514 "200": { 515 "description": "OK", 516 "schema": { 517 "type": "array", 518 "items": { 519 "$ref": "#/definitions/core.Commit" 520 } 521 } 522 } 523 } 524 } 525 }, 526 "/repos/{scm}/{namespace}/{name}/content/{path}": { 527 "get": { 528 "tags": [ 529 "Repository" 530 ], 531 "summary": "Get a file content", 532 "parameters": [ 533 { 534 "type": "string", 535 "description": "SCM", 536 "name": "scm", 537 "in": "path", 538 "required": true 539 }, 540 { 541 "type": "string", 542 "description": "Namespace", 543 "name": "namespace", 544 "in": "path", 545 "required": true 546 }, 547 { 548 "type": "string", 549 "description": "name", 550 "name": "name", 551 "in": "path", 552 "required": true 553 }, 554 { 555 "type": "string", 556 "description": "file path", 557 "name": "path", 558 "in": "path", 559 "required": true 560 }, 561 { 562 "type": "string", 563 "description": "specify git ref, default main branch", 564 "name": "ref", 565 "in": "query" 566 } 567 ], 568 "responses": { 569 "200": { 570 "description": "file content", 571 "schema": { 572 "type": "string" 573 } 574 } 575 } 576 } 577 }, 578 "/repos/{scm}/{namespace}/{name}/files": { 579 "get": { 580 "tags": [ 581 "Repository" 582 ], 583 "summary": "List all files in repository", 584 "parameters": [ 585 { 586 "type": "string", 587 "description": "SCM", 588 "name": "scm", 589 "in": "path", 590 "required": true 591 }, 592 { 593 "type": "string", 594 "description": "Namespace", 595 "name": "namespace", 596 "in": "path", 597 "required": true 598 }, 599 { 600 "type": "string", 601 "description": "name", 602 "name": "name", 603 "in": "path", 604 "required": true 605 }, 606 { 607 "type": "string", 608 "description": "specify git ref, default main branch", 609 "name": "ref", 610 "in": "query" 611 } 612 ], 613 "responses": { 614 "200": { 615 "description": "files", 616 "schema": { 617 "type": "array", 618 "items": { 619 "type": "string" 620 } 621 } 622 } 623 } 624 } 625 }, 626 "/repos/{scm}/{namespace}/{name}/hook": { 627 "post": { 628 "tags": [ 629 "Repository" 630 ], 631 "summary": "handle webhook event", 632 "parameters": [ 633 { 634 "type": "string", 635 "description": "SCM", 636 "name": "scm", 637 "in": "path", 638 "required": true 639 }, 640 { 641 "type": "string", 642 "description": "Namespace", 643 "name": "namespace", 644 "in": "path", 645 "required": true 646 }, 647 { 648 "type": "string", 649 "description": "name", 650 "name": "name", 651 "in": "path", 652 "required": true 653 } 654 ], 655 "responses": { 656 "200": { 657 "description": "OK", 658 "schema": { 659 "type": "string" 660 } 661 } 662 } 663 } 664 }, 665 "/repos/{scm}/{namespace}/{name}/hook/create": { 666 "post": { 667 "tags": [ 668 "Repository" 669 ], 670 "summary": "create repository webhook", 671 "parameters": [ 672 { 673 "type": "string", 674 "description": "SCM", 675 "name": "scm", 676 "in": "path", 677 "required": true 678 }, 679 { 680 "type": "string", 681 "description": "Namespace", 682 "name": "namespace", 683 "in": "path", 684 "required": true 685 }, 686 { 687 "type": "string", 688 "description": "name", 689 "name": "name", 690 "in": "path", 691 "required": true 692 } 693 ], 694 "responses": { 695 "200": { 696 "description": "OK", 697 "schema": { 698 "type": "string" 699 } 700 } 701 } 702 } 703 }, 704 "/repos/{scm}/{namespace}/{name}/report": { 705 "patch": { 706 "tags": [ 707 "Repository" 708 ], 709 "summary": "renew repository report id", 710 "parameters": [ 711 { 712 "type": "string", 713 "description": "SCM", 714 "name": "scm", 715 "in": "path", 716 "required": true 717 }, 718 { 719 "type": "string", 720 "description": "Namespace", 721 "name": "namespace", 722 "in": "path", 723 "required": true 724 }, 725 { 726 "type": "string", 727 "description": "name", 728 "name": "name", 729 "in": "path", 730 "required": true 731 } 732 ], 733 "responses": { 734 "200": { 735 "description": "updated repository", 736 "schema": { 737 "$ref": "#/definitions/core.Repo" 738 } 739 } 740 } 741 } 742 }, 743 "/repos/{scm}/{namespace}/{name}/setting": { 744 "get": { 745 "tags": [ 746 "Repository" 747 ], 748 "summary": "get repository setting", 749 "parameters": [ 750 { 751 "type": "string", 752 "description": "SCM", 753 "name": "scm", 754 "in": "path", 755 "required": true 756 }, 757 { 758 "type": "string", 759 "description": "Namespace", 760 "name": "namespace", 761 "in": "path", 762 "required": true 763 }, 764 { 765 "type": "string", 766 "description": "name", 767 "name": "name", 768 "in": "path", 769 "required": true 770 } 771 ], 772 "responses": { 773 "200": { 774 "description": "OK", 775 "schema": { 776 "$ref": "#/definitions/core.RepoSetting" 777 } 778 } 779 } 780 }, 781 "post": { 782 "tags": [ 783 "Repository" 784 ], 785 "summary": "update repository setting", 786 "parameters": [ 787 { 788 "type": "string", 789 "description": "SCM", 790 "name": "scm", 791 "in": "path", 792 "required": true 793 }, 794 { 795 "type": "string", 796 "description": "Namespace", 797 "name": "namespace", 798 "in": "path", 799 "required": true 800 }, 801 { 802 "type": "string", 803 "description": "name", 804 "name": "name", 805 "in": "path", 806 "required": true 807 }, 808 { 809 "description": "repository setting", 810 "name": "setting", 811 "in": "body", 812 "required": true, 813 "schema": { 814 "$ref": "#/definitions/core.RepoSetting" 815 } 816 } 817 ], 818 "responses": { 819 "200": { 820 "description": "OK", 821 "schema": { 822 "$ref": "#/definitions/core.RepoSetting" 823 } 824 } 825 } 826 } 827 }, 828 "/user": { 829 "get": { 830 "tags": [ 831 "User" 832 ], 833 "summary": "Get login user", 834 "responses": { 835 "200": { 836 "description": "user", 837 "schema": { 838 "$ref": "#/definitions/user.User" 839 } 840 }, 841 "404": { 842 "description": "error", 843 "schema": { 844 "type": "string" 845 } 846 } 847 } 848 } 849 }, 850 "/user/owner/{scm}/{namespace}/{name}": { 851 "get": { 852 "tags": [ 853 "User" 854 ], 855 "summary": "Get repository's owner", 856 "parameters": [ 857 { 858 "type": "string", 859 "description": "SCM", 860 "name": "scm", 861 "in": "path", 862 "required": true 863 }, 864 { 865 "type": "string", 866 "description": "Namespace", 867 "name": "namespace", 868 "in": "path", 869 "required": true 870 }, 871 { 872 "type": "string", 873 "description": "name", 874 "name": "name", 875 "in": "path", 876 "required": true 877 } 878 ], 879 "responses": { 880 "200": { 881 "description": "owner", 882 "schema": { 883 "$ref": "#/definitions/user.User" 884 } 885 } 886 } 887 } 888 }, 889 "/user/repos": { 890 "get": { 891 "tags": [ 892 "User" 893 ], 894 "summary": "List user synchronized repositories", 895 "responses": { 896 "200": { 897 "description": "list of repositories", 898 "schema": { 899 "type": "array", 900 "items": { 901 "$ref": "#/definitions/core.Repo" 902 } 903 } 904 } 905 } 906 }, 907 "patch": { 908 "tags": [ 909 "User" 910 ], 911 "summary": "Synchronize user's repository from remote SCM", 912 "responses": { 913 "200": { 914 "description": "ok", 915 "schema": { 916 "type": "string" 917 } 918 } 919 } 920 } 921 }, 922 "/user/scm": { 923 "get": { 924 "tags": [ 925 "User" 926 ], 927 "summary": "Get user's SCM binding state", 928 "responses": { 929 "200": { 930 "description": "providers", 931 "schema": { 932 "$ref": "#/definitions/user.Providers" 933 } 934 }, 935 "404": { 936 "description": "providers", 937 "schema": { 938 "$ref": "#/definitions/user.Providers" 939 } 940 } 941 } 942 } 943 }, 944 "/user/tokens": { 945 "get": { 946 "tags": [ 947 "User" 948 ], 949 "summary": "list OAuth tokens", 950 "responses": { 951 "200": { 952 "description": "list of tokens", 953 "schema": { 954 "type": "array", 955 "items": { 956 "$ref": "#/definitions/user.Token" 957 } 958 } 959 } 960 } 961 }, 962 "post": { 963 "tags": [ 964 "User" 965 ], 966 "summary": "create OAuth token", 967 "parameters": [ 968 { 969 "type": "string", 970 "description": "token name", 971 "name": "name", 972 "in": "formData" 973 } 974 ], 975 "responses": { 976 "200": { 977 "description": "OK", 978 "schema": { 979 "type": "string" 980 } 981 } 982 } 983 } 984 }, 985 "/user/tokens/{id}": { 986 "delete": { 987 "tags": [ 988 "User" 989 ], 990 "summary": "delete token with id", 991 "parameters": [ 992 { 993 "type": "integer", 994 "description": "token id", 995 "name": "id", 996 "in": "path", 997 "required": true 998 } 999 ], 1000 "responses": { 1001 "200": { 1002 "description": "deleted token", 1003 "schema": { 1004 "$ref": "#/definitions/user.Token" 1005 } 1006 } 1007 } 1008 } 1009 } 1010 }, 1011 "definitions": { 1012 "core.Commit": { 1013 "type": "object", 1014 "properties": { 1015 "committer": { 1016 "type": "string" 1017 }, 1018 "committerAvatar": { 1019 "type": "string" 1020 }, 1021 "message": { 1022 "type": "string" 1023 }, 1024 "sha": { 1025 "type": "string" 1026 } 1027 } 1028 }, 1029 "core.Repo": { 1030 "type": "object", 1031 "properties": { 1032 "branch": { 1033 "type": "string" 1034 }, 1035 "id": { 1036 "type": "integer" 1037 }, 1038 "name": { 1039 "type": "string" 1040 }, 1041 "nameSpace": { 1042 "type": "string" 1043 }, 1044 "private": { 1045 "type": "boolean" 1046 }, 1047 "reportID": { 1048 "type": "string" 1049 }, 1050 "scm": { 1051 "type": "SCMProvider" 1052 }, 1053 "url": { 1054 "type": "string" 1055 } 1056 } 1057 }, 1058 "core.RepoSetting": { 1059 "type": "object", 1060 "properties": { 1061 "filters": { 1062 "type": "FileNameFilters" 1063 }, 1064 "mergePR": { 1065 "type": "boolean" 1066 }, 1067 "protected": { 1068 "type": "boolean" 1069 }, 1070 "updateAction": { 1071 "type": "ReportUpdateAction" 1072 } 1073 } 1074 }, 1075 "core.Report": { 1076 "type": "object", 1077 "properties": { 1078 "commit": { 1079 "type": "string" 1080 }, 1081 "coverages": { 1082 "type": "array", 1083 "items": { 1084 "type": "CoverageReport" 1085 } 1086 }, 1087 "createdAt": { 1088 "type": "string" 1089 }, 1090 "files": { 1091 "type": "array", 1092 "items": { 1093 "type": "string" 1094 } 1095 }, 1096 "reference": { 1097 "type": "string" 1098 }, 1099 "reportID": { 1100 "type": "string" 1101 } 1102 } 1103 }, 1104 "user.Providers": { 1105 "type": "object", 1106 "additionalProperties": { 1107 "type": "boolean" 1108 } 1109 }, 1110 "user.Token": { 1111 "type": "object", 1112 "properties": { 1113 "createdAt": { 1114 "type": "string" 1115 }, 1116 "id": { 1117 "type": "integer" 1118 }, 1119 "name": { 1120 "type": "string" 1121 } 1122 } 1123 }, 1124 "user.User": { 1125 "type": "object", 1126 "properties": { 1127 "avatar": { 1128 "type": "string" 1129 }, 1130 "email": { 1131 "type": "string" 1132 }, 1133 "login": { 1134 "type": "string" 1135 } 1136 } 1137 } 1138 } 1139 }` 1140 1141 type swaggerInfo struct { 1142 Version string 1143 Host string 1144 BasePath string 1145 Schemes []string 1146 Title string 1147 Description string 1148 } 1149 1150 // SwaggerInfo holds exported Swagger Info so clients can modify it 1151 var SwaggerInfo = swaggerInfo{ 1152 Version: "1.0", 1153 Host: "localhost:8080", 1154 BasePath: "/api/v1", 1155 Schemes: []string{}, 1156 Title: "CodeCover API", 1157 Description: "REST API for CodeCover", 1158 } 1159 1160 type s struct{} 1161 1162 func (s *s) ReadDoc() string { 1163 sInfo := SwaggerInfo 1164 sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1) 1165 1166 t, err := template.New("swagger_info").Funcs(template.FuncMap{ 1167 "marshal": func(v interface{}) string { 1168 a, _ := json.Marshal(v) 1169 return string(a) 1170 }, 1171 }).Parse(doc) 1172 if err != nil { 1173 return doc 1174 } 1175 1176 var tpl bytes.Buffer 1177 if err := t.Execute(&tpl, sInfo); err != nil { 1178 return doc 1179 } 1180 1181 return tpl.String() 1182 } 1183 1184 func init() { 1185 swag.Register(swag.Name, &s{}) 1186 }