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