git-rest-api/swagger-spec.json

721 строка
16 KiB
JSON

{
"swagger": "2.0",
"info": {
"description": "Rest api to run operation on git repositories",
"version": "1.0",
"title": "GIT Rest API"
},
"basePath": "/",
"tags": [],
"schemes": [
"http",
"https"
],
"paths": {
"/health/alive": {
"get": {
"summary": "Check alive",
"operationId": "health_checkAlive",
"responses": {
"200": {
"description": ""
}
},
"produces": [
"application/json"
],
"consumes": [
"application/json"
]
}
},
"/repos/{remote}/branches": {
"get": {
"summary": "List branches",
"operationId": "Branches_List",
"parameters": [
{
"type": "string",
"name": "remote",
"required": true,
"in": "path"
},
{
"name": "x-authorization",
"required": false,
"in": "header",
"type": "string"
},
{
"name": "x-github-token",
"required": false,
"in": "header",
"type": "string"
}
],
"responses": {
"200": {
"description": "",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/GitBranch"
}
}
},
"400": {
"description": "When the x-authorization header is malformed"
},
"404": {
"description": ""
}
},
"produces": [
"application/json"
],
"consumes": [
"application/json"
]
}
},
"/repos/{remote}/commits": {
"get": {
"summary": "List commits",
"operationId": "commits_list",
"parameters": [
{
"type": "string",
"name": "remote",
"required": true,
"in": "path"
},
{
"name": "page",
"required": false,
"in": "query",
"type": "string"
},
{
"name": "ref",
"required": false,
"in": "query",
"description": "Reference to list the commits from. Can be a branch or a commit. Default to master",
"type": "string"
},
{
"name": "x-authorization",
"required": false,
"in": "header",
"type": "string"
},
{
"name": "x-github-token",
"required": false,
"in": "header",
"type": "string"
}
],
"responses": {
"200": {
"headers": {
"Link": {
"type": "string",
"description": "Links to navigate pagination in the format defined by [RFC 5988](https://tools.ietf.org/html/rfc5988#section-5). It will include next, last, first and prev links if applicable"
},
"x-total-count": {
"type": "integer",
"description": "Total count of items that can be retrieved"
}
},
"description": "",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/GitCommit"
}
}
},
"400": {
"description": "When the x-authorization header is malformed"
},
"404": {
"description": ""
}
},
"produces": [
"application/json"
],
"consumes": [
"application/json"
]
}
},
"/repos/{remote}/commits/{commitSha}": {
"get": {
"summary": "Get a commit",
"operationId": "commits_get",
"parameters": [
{
"type": "string",
"name": "remote",
"required": true,
"in": "path"
},
{
"type": "string",
"name": "commitSha",
"required": true,
"in": "path"
},
{
"name": "x-authorization",
"required": false,
"in": "header",
"type": "string"
},
{
"name": "x-github-token",
"required": false,
"in": "header",
"type": "string"
}
],
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/GitCommit"
}
},
"400": {
"description": "When the x-authorization header is malformed"
},
"404": {
"description": ""
}
},
"produces": [
"application/json"
],
"consumes": [
"application/json"
]
}
},
"/repos/{remote}/compare/{base}...{head}": {
"get": {
"summary": "Compare two commits",
"operationId": "commits_compare",
"parameters": [
{
"type": "string",
"name": "remote",
"required": true,
"in": "path"
},
{
"type": "string",
"name": "base",
"required": true,
"in": "path"
},
{
"type": "string",
"name": "head",
"required": true,
"in": "path"
},
{
"name": "x-authorization",
"required": false,
"in": "header",
"type": "string"
},
{
"name": "x-github-token",
"required": false,
"in": "header",
"type": "string"
}
],
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/GitDiff"
}
},
"400": {
"description": "When the x-authorization header is malformed"
},
"404": {
"description": ""
}
},
"produces": [
"application/json"
],
"consumes": [
"application/json"
]
}
},
"/repos/{remote}/contents/{path}": {
"get": {
"summary": "Get content",
"operationId": "contents_get",
"parameters": [
{
"type": "string",
"name": "remote",
"required": true,
"in": "path"
},
{
"name": "path",
"required": true,
"in": "path",
"type": "string"
},
{
"name": "recursive",
"required": false,
"in": "query",
"type": "string"
},
{
"name": "ref",
"required": false,
"in": "query",
"type": "string"
},
{
"name": "x-authorization",
"required": false,
"in": "header",
"type": "string"
},
{
"name": "x-github-token",
"required": false,
"in": "header",
"type": "string"
}
],
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/GitContents"
}
},
"400": {
"description": "When the x-authorization header is malformed"
},
"404": {
"description": ""
}
},
"produces": [
"application/json"
],
"consumes": [
"application/json"
]
}
},
"/repos/{remote}/tree/{path}": {
"get": {
"summary": "Get tree",
"operationId": "tree_get",
"parameters": [
{
"type": "string",
"name": "remote",
"required": true,
"in": "path"
},
{
"name": "path",
"required": true,
"in": "path",
"type": "string"
},
{
"name": "ref",
"required": false,
"in": "query",
"type": "string"
},
{
"name": "x-authorization",
"required": false,
"in": "header",
"type": "string"
},
{
"name": "x-github-token",
"required": false,
"in": "header",
"type": "string"
}
],
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/GitTree"
}
},
"400": {
"description": "When the x-authorization header is malformed"
},
"404": {
"description": ""
}
},
"produces": [
"application/json"
],
"consumes": [
"application/json"
]
}
}
},
"definitions": {
"GitCommitRef": {
"type": "object",
"properties": {
"sha": {
"type": "string"
}
},
"required": [
"sha"
]
},
"GitBranch": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"commit": {
"$ref": "#/definitions/GitCommitRef"
}
},
"required": [
"name",
"commit"
]
},
"GitSignature": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"email": {
"type": "string"
},
"date": {
"type": "string",
"format": "date-time"
}
},
"required": [
"name",
"email",
"date"
]
},
"GitCommit": {
"type": "object",
"properties": {
"sha": {
"type": "string"
},
"message": {
"type": "string"
},
"author": {
"$ref": "#/definitions/GitSignature"
},
"committer": {
"$ref": "#/definitions/GitSignature"
},
"parents": {
"type": "array",
"items": {
"$ref": "#/definitions/GitCommitRef"
}
}
},
"required": [
"sha",
"message",
"author",
"committer",
"parents"
]
},
"GitFileDiff": {
"type": "object",
"properties": {
"filename": {
"type": "string"
},
"sha": {
"type": "string"
},
"status": {
"type": "string",
"enum": [
"unmodified",
"modified",
"added",
"deleted",
"renamed"
],
"x-ms-enum": {
"name": "PatchStatus"
}
},
"additions": {
"type": "number"
},
"deletions": {
"type": "number"
},
"changes": {
"type": "number"
},
"previousFilename": {
"type": "string"
}
},
"required": [
"filename",
"sha",
"status",
"additions",
"deletions",
"changes"
]
},
"GitDiff": {
"type": "object",
"properties": {
"headCommit": {
"$ref": "#/definitions/GitCommit"
},
"baseCommit": {
"$ref": "#/definitions/GitCommit"
},
"mergeBaseCommit": {
"$ref": "#/definitions/GitCommit"
},
"totalCommits": {
"type": "number"
},
"commits": {
"type": "array",
"items": {
"$ref": "#/definitions/GitCommit"
}
},
"files": {
"type": "array",
"items": {
"$ref": "#/definitions/GitFileDiff"
}
}
},
"required": [
"headCommit",
"baseCommit",
"mergeBaseCommit",
"totalCommits",
"commits",
"files"
]
},
"GitDirObjectContent": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"size": {
"type": "number"
},
"name": {
"type": "string"
},
"path": {
"type": "string"
},
"sha": {
"type": "string"
}
},
"required": [
"type",
"size",
"name",
"path",
"sha"
]
},
"GitFileObjectWithoutContent": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"size": {
"type": "number"
},
"name": {
"type": "string"
},
"path": {
"type": "string"
},
"sha": {
"type": "string"
},
"encoding": {
"type": "string"
}
},
"required": [
"type",
"size",
"name",
"path",
"sha",
"encoding"
]
},
"GitSubmoduleObjectContent": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"size": {
"type": "number"
},
"name": {
"type": "string"
},
"path": {
"type": "string"
},
"sha": {
"type": "string"
}
},
"required": [
"type",
"size",
"name",
"path",
"sha"
]
},
"GitContents": {
"type": "object",
"properties": {
"dirs": {
"type": "array",
"items": {
"$ref": "#/definitions/GitDirObjectContent"
}
},
"files": {
"type": "array",
"items": {
"$ref": "#/definitions/GitFileObjectWithoutContent"
}
},
"submodules": {
"type": "array",
"items": {
"$ref": "#/definitions/GitSubmoduleObjectContent"
}
}
},
"required": [
"dirs",
"files",
"submodules"
]
},
"GitFileObjectWithContent": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"size": {
"type": "number"
},
"name": {
"type": "string"
},
"path": {
"type": "string"
},
"sha": {
"type": "string"
},
"encoding": {
"type": "string"
},
"content": {
"type": "string"
}
},
"required": [
"type",
"size",
"name",
"path",
"sha",
"encoding",
"content"
]
},
"GitTree": {
"type": "object",
"properties": {
"dirs": {
"type": "array",
"items": {
"$ref": "#/definitions/GitDirObjectContent"
}
},
"files": {
"type": "array",
"items": {
"$ref": "#/definitions/GitFileObjectWithContent"
}
},
"submodules": {
"type": "array",
"items": {
"$ref": "#/definitions/GitSubmoduleObjectContent"
}
}
},
"required": [
"dirs",
"files",
"submodules"
]
}
}
}