From 6cea80a9acdcf5f91970515fb3ca3e38a5913fc0 Mon Sep 17 00:00:00 2001 From: noah Date: Sat, 25 Jun 2022 15:21:41 +0900 Subject: [PATCH] Reorganize OpenAPI --- openapi/v1.yaml | 2034 ----------------- openapi/v1/openapi.yaml | 85 + openapi/v1/paths/license/index.yaml | 13 + openapi/v1/paths/repos/branch.yaml | 38 + openapi/v1/paths/repos/branches.yaml | 44 + openapi/v1/paths/repos/commit.yaml | 38 + openapi/v1/paths/repos/commit_statuses.yaml | 45 + openapi/v1/paths/repos/commits.yaml | 52 + openapi/v1/paths/repos/config.yaml | 34 + openapi/v1/paths/repos/deployment.yaml | 82 + .../v1/paths/repos/deployment_changes.yaml | 53 + .../repos/deployment_remote_statuses.yaml | 52 + openapi/v1/paths/repos/deployment_review.yaml | 94 + .../v1/paths/repos/deployment_reviews.yaml | 94 + .../v1/paths/repos/deployment_rollback.yaml | 43 + .../v1/paths/repos/deployment_statuses.yaml | 40 + openapi/v1/paths/repos/deployments.yaml | 109 + openapi/v1/paths/repos/index.yaml | 54 + openapi/v1/paths/repos/lock.yaml | 84 + openapi/v1/paths/repos/locks.yaml | 77 + openapi/v1/paths/repos/perms.yaml | 45 + openapi/v1/paths/repos/repo.yaml | 68 + openapi/v1/paths/repos/tag.yaml | 38 + openapi/v1/paths/repos/tags.yaml | 44 + openapi/v1/paths/search/deployments.yaml | 67 + openapi/v1/paths/search/reviews.yaml | 21 + openapi/v1/paths/stream/events.yaml | 31 + openapi/v1/paths/sync/index.yaml | 13 + openapi/v1/paths/users/index.yaml | 35 + openapi/v1/paths/users/me.yaml | 17 + openapi/v1/paths/users/ratelimit.yaml | 17 + openapi/v1/paths/users/user.yaml | 61 + openapi/v1/responses.yaml | 57 + openapi/v1/schemas/Branch.yaml | 9 + openapi/v1/schemas/ChatUser.yaml | 12 + openapi/v1/schemas/Commit.yaml | 24 + openapi/v1/schemas/Config.yaml | 82 + openapi/v1/schemas/Deployment.yaml | 59 + openapi/v1/schemas/DeploymentStatus.yaml | 32 + openapi/v1/schemas/Error.yaml | 8 + openapi/v1/schemas/License.yaml | 13 + openapi/v1/schemas/Lock.yaml | 21 + openapi/v1/schemas/Perm.yaml | 24 + openapi/v1/schemas/RateLimit.yaml | 12 + .../v1/schemas/RemoteDeploymentStatus.yaml | 13 + openapi/v1/schemas/Repository.yaml | 41 + openapi/v1/schemas/Review.yaml | 29 + openapi/v1/schemas/Status.yaml | 22 + openapi/v1/schemas/Tag.yaml | 9 + openapi/v1/schemas/User.yaml | 27 + 50 files changed, 2082 insertions(+), 2034 deletions(-) delete mode 100644 openapi/v1.yaml create mode 100644 openapi/v1/openapi.yaml create mode 100644 openapi/v1/paths/license/index.yaml create mode 100644 openapi/v1/paths/repos/branch.yaml create mode 100644 openapi/v1/paths/repos/branches.yaml create mode 100644 openapi/v1/paths/repos/commit.yaml create mode 100644 openapi/v1/paths/repos/commit_statuses.yaml create mode 100644 openapi/v1/paths/repos/commits.yaml create mode 100644 openapi/v1/paths/repos/config.yaml create mode 100644 openapi/v1/paths/repos/deployment.yaml create mode 100644 openapi/v1/paths/repos/deployment_changes.yaml create mode 100644 openapi/v1/paths/repos/deployment_remote_statuses.yaml create mode 100644 openapi/v1/paths/repos/deployment_review.yaml create mode 100644 openapi/v1/paths/repos/deployment_reviews.yaml create mode 100644 openapi/v1/paths/repos/deployment_rollback.yaml create mode 100644 openapi/v1/paths/repos/deployment_statuses.yaml create mode 100644 openapi/v1/paths/repos/deployments.yaml create mode 100644 openapi/v1/paths/repos/index.yaml create mode 100644 openapi/v1/paths/repos/lock.yaml create mode 100644 openapi/v1/paths/repos/locks.yaml create mode 100644 openapi/v1/paths/repos/perms.yaml create mode 100644 openapi/v1/paths/repos/repo.yaml create mode 100644 openapi/v1/paths/repos/tag.yaml create mode 100644 openapi/v1/paths/repos/tags.yaml create mode 100644 openapi/v1/paths/search/deployments.yaml create mode 100644 openapi/v1/paths/search/reviews.yaml create mode 100644 openapi/v1/paths/stream/events.yaml create mode 100644 openapi/v1/paths/sync/index.yaml create mode 100644 openapi/v1/paths/users/index.yaml create mode 100644 openapi/v1/paths/users/me.yaml create mode 100644 openapi/v1/paths/users/ratelimit.yaml create mode 100644 openapi/v1/paths/users/user.yaml create mode 100644 openapi/v1/responses.yaml create mode 100644 openapi/v1/schemas/Branch.yaml create mode 100644 openapi/v1/schemas/ChatUser.yaml create mode 100644 openapi/v1/schemas/Commit.yaml create mode 100644 openapi/v1/schemas/Config.yaml create mode 100644 openapi/v1/schemas/Deployment.yaml create mode 100644 openapi/v1/schemas/DeploymentStatus.yaml create mode 100644 openapi/v1/schemas/Error.yaml create mode 100644 openapi/v1/schemas/License.yaml create mode 100644 openapi/v1/schemas/Lock.yaml create mode 100644 openapi/v1/schemas/Perm.yaml create mode 100644 openapi/v1/schemas/RateLimit.yaml create mode 100644 openapi/v1/schemas/RemoteDeploymentStatus.yaml create mode 100644 openapi/v1/schemas/Repository.yaml create mode 100644 openapi/v1/schemas/Review.yaml create mode 100644 openapi/v1/schemas/Status.yaml create mode 100644 openapi/v1/schemas/Tag.yaml create mode 100644 openapi/v1/schemas/User.yaml diff --git a/openapi/v1.yaml b/openapi/v1.yaml deleted file mode 100644 index b4913065..00000000 --- a/openapi/v1.yaml +++ /dev/null @@ -1,2034 +0,0 @@ -openapi: '3.0.2' -info: - title: gitploy. - version: '1.0' -servers: - - url: http://localhost/api/v1 - - url: https://gitploy.jp.ngrok.io/api/v1 -paths: - /license: - get: - tags: - - License - summary: Return license - responses: - '200': - description: Licnese - content: - application/json: - schema: - $ref: '#/components/schemas/License' - '500': - $ref: '#/components/responses/500InternalError' - /repos: - get: - tags: - - Repo - summary: List repositories the user can access. - parameters: - - in: query - name: sort - schema: - type: boolean - default: false - - in: query - name: q - schema: - type: string - default: "" - - in: query - name: namespace - schema: - type: string - default: "" - - in: query - name: name - schema: - type: string - default: "" - - in: query - name: page - schema: - type: integer - default: 1 - description: The page number - - in: query - name: per_page - schema: - type: integer - default: 30 - description: The number per page - responses: - '200': - description: Repositories - content: - application/json: - schema: - $ref: '#/components/schemas/Repositories' - '400': - $ref: '#/components/responses/400BadRequest' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '500': - $ref: '#/components/responses/500InternalError' - /repos/{namespace}/{name}: - get: - tags: - - Repo - summary: Get the repository. - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - responses: - '200': - description: Repository - content: - application/json: - schema: - $ref: '#/components/schemas/Repository' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '500': - $ref: '#/components/responses/500InternalError' - patch: - tags: - - Repo - summary: Update the repository. - description: Basically patch the respository field. And it creates a new webhook when it activates. - requestBody: - content: - application/json: - schema: - type: object - properties: - config_path: - type: string - default: deploy.yml - active: - type: boolean - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - responses: - '200': - description: Ok - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '500': - $ref: '#/components/responses/500InternalError' - /repos/{namespace}/{name}/commits: - get: - tags: - - Repo - summary: List commits of repository. - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - - in: query - name: branch - schema: - type: string - default: - description: > - The branch to start listing commits from. - Default - the repository’s default branch. - - in: query - name: page - schema: - type: integer - default: 1 - description: The page number - - in: query - name: per_page - schema: - type: integer - default: 30 - description: The page number - responses: - '200': - description: Commits - content: - application/json: - schema: - $ref: '#/components/schemas/Commits' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '500': - $ref: '#/components/responses/500InternalError' - /repos/{namespace}/{name}/commits/{sha}: - get: - tags: - - Repo - summary: Get the commit of repository. - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - - in: path - name: sha - required: true - schema: - type: string - description: The commit sha - responses: - '200': - description: Commit - content: - application/json: - schema: - $ref: '#/components/schemas/Commit' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '404': - $ref: '#/components/responses/404NotFound' - '500': - $ref: '#/components/responses/500InternalError' - /repos/{namespace}/{name}/commits/{sha}/statuses: - get: - tags: - - Repo - summary: List statuses of the commit. - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - - in: path - name: sha - required: true - schema: - type: string - description: The commit sha - responses: - '200': - description: Statuses for ref - content: - application/json: - schema: - type: object - properties: - state: - type: string - statuses: - $ref: '#/components/schemas/Statuses' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '404': - $ref: '#/components/responses/404NotFound' - '500': - $ref: '#/components/responses/500InternalError' - /repos/{namespace}/{name}/branches: - get: - tags: - - Repo - summary: List branches of the repository. - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - - in: query - name: page - schema: - type: integer - default: 1 - description: The page number - - in: query - name: per_page - schema: - type: integer - default: 30 - description: The item count per page - responses: - '200': - description: Branches - content: - application/json: - schema: - $ref: '#/components/schemas/Branches' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '500': - $ref: '#/components/responses/500InternalError' - /repos/{namespace}/{name}/branches/{branch}: - get: - tags: - - Repo - summary: Get the branch of repository. - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - - in: path - name: branch - required: true - schema: - type: string - description: The branch name - responses: - '200': - description: Branch - content: - application/json: - schema: - $ref: '#/components/schemas/Branch' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '404': - $ref: '#/components/responses/404NotFound' - '500': - $ref: '#/components/responses/500InternalError' - /repos/{namespace}/{name}/tags: - get: - tags: - - Repo - summary: List tags of the repository. - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - - in: query - name: page - schema: - type: integer - default: 1 - description: The page number - - in: query - name: per_page - schema: - type: integer - default: 30 - description: The item count per page - responses: - '200': - description: Tags - content: - application/json: - schema: - $ref: '#/components/schemas/Tags' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '500': - $ref: '#/components/responses/500InternalError' - /repos/{namespace}/{name}/tags/{tag}: - get: - tags: - - Repo - summary: Get the tag of the repository. - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - - in: path - name: tag - required: true - schema: - type: string - description: The tag name - responses: - '200': - description: Tag - content: - application/json: - schema: - $ref: '#/components/schemas/Tag' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '404': - $ref: '#/components/responses/404NotFound' - '500': - $ref: '#/components/responses/500InternalError' - /repos/{namespace}/{name}/deployments: - get: - tags: - - Repo - summary: List deployments of repository. - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - - in: query - name: env - description: Name for the target deployment environment. - schema: - type: string - description: The target environment - - in: query - name: status - description: The status of deployment. - schema: - type: string - description: The deployment status - - in: query - name: page - schema: - type: integer - default: 1 - description: The page number - - in: query - name: per_page - schema: - type: integer - default: 30 - description: The item count per page - responses: - '200': - description: Deployment list - content: - application/json: - schema: - $ref: '#/components/schemas/Deployments' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '500': - $ref: '#/components/responses/500InternalError' - post: - tags: - - Repo - summary: Create a new deployment. - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - requestBody: - content: - application/json: - schema: - type: object - properties: - type: - type: string - default: commit - ref: - type: string - env: - type: string - dynamic_payload: - type: object - required: - - type - - ref - - env - responses: - '201': - description: Created - '400': - $ref: '#/components/responses/400BadRequest' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '409': - $ref: '#/components/responses/409Conflict' - description: The deployment number is conflicted. - '422': - $ref: '#/components/responses/422UnprocessableEntity' - description: The deployment payload or the configuration is invalid. - '500': - $ref: '#/components/responses/500InternalError' - /repos/{namespace}/{name}/deployments/{number}: - get: - tags: - - Repo - summary: Get the deployments by the number. - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - - in: path - name: number - required: true - schema: - type: integer - description: The deployment number. - responses: - '200': - description: Deployment - content: - application/json: - schema: - $ref: '#/components/schemas/Deployment' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '404': - $ref: '#/components/responses/404NotFound' - '422': - $ref: '#/components/responses/422UnprocessableEntity' - description: The deployment payload or the configuration is invalid. - '500': - $ref: '#/components/responses/500InternalError' - put: - tags: - - Repo - summary: Create a remote deployment when the status of the deployment is 'waiting'. - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - - in: path - name: number - required: true - schema: - type: integer - description: The deployment number. - responses: - '200': - description: Deployment - content: - application/json: - schema: - $ref: '#/components/schemas/Deployment' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '404': - $ref: '#/components/responses/404NotFound' - '422': - $ref: '#/components/responses/422UnprocessableEntity' - description: The configuration is invalid or it is not approved. - '500': - $ref: '#/components/responses/500InternalError' - /repos/{namespace}/{name}/deployments/{number}/changes: - get: - tags: - - Repo - summary: List commits from the environment state. - description: > - List commits from the environment state, internally, - it compares with the previous succeed deployment. - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - - in: path - name: number - required: true - schema: - type: integer - description: The deployment number. - - in: query - name: page - schema: - type: integer - default: 1 - - in: query - name: per_page - schema: - type: integer - default: 30 - responses: - '200': - description: Commits - content: - application/json: - schema: - $ref: '#/components/schemas/Commits' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '404': - $ref: '#/components/responses/404NotFound' - '500': - $ref: '#/components/responses/500InternalError' - /repos/{namespace}/{name}/deployments/{number}/rollback: - post: - tags: - - Repo - summary: Rollback by the deployment. - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - - in: path - name: number - required: true - schema: - type: integer - description: The deployment number. - responses: - '201': - description: Rollbacked Deployment - content: - application/json: - schema: - $ref: '#/components/schemas/Deployment' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '404': - $ref: '#/components/responses/404NotFound' - '409': - $ref: '#/components/responses/409Conflict' - '422': - description: The deployment number or the configuration is invalid. - $ref: '#/components/responses/422UnprocessableEntity' - '500': - $ref: '#/components/responses/500InternalError' - /repos/{namespace}/{name}/deployments/{number}/reviews: - get: - tags: - - Repo - summary: List reviews of the deployment. - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - - in: path - name: number - required: true - schema: - type: integer - description: The deployment number. - responses: - '200': - description: List of reviews. - content: - application/json: - schema: - $ref: '#/components/schemas/Reviews' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '500': - $ref: '#/components/responses/500InternalError' - /repos/{namespace}/{name}/deployments/{number}/review: - get: - tags: - - Repo - summary: Get the review of the user. - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - - in: path - name: number - required: true - schema: - type: integer - description: The deployment number. - responses: - '200': - description: Return the review. - content: - application/json: - schema: - $ref: '#/components/schemas/Review' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '404': - $ref: '#/components/responses/404NotFound' - '500': - $ref: '#/components/responses/500InternalError' - patch: - tags: - - Repo - summary: Update the review of the user if it exist. - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - - in: path - name: number - required: true - schema: - type: integer - description: The deployment number. - requestBody: - content: - application/json: - schema: - type: object - properties: - status: - type: string - enum: - - approved - - rejected - comment: - type: string - description: Leave the comment with the review. - required: - - status - responses: - '200': - description: Return the review. - content: - application/json: - schema: - $ref: '#/components/schemas/Review' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '404': - $ref: '#/components/responses/404NotFound' - '422': - $ref: '#/components/responses/422UnprocessableEntity' - '500': - $ref: '#/components/responses/500InternalError' - /repos/{namespace}/{name}/deployments/{number}/statuses: - get: - tags: - - Repo - summary: List deployment statuses. - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - - in: path - name: number - required: true - schema: - type: integer - description: The deployment number. - responses: - '200': - description: Return the deployment statuses. - content: - application/json: - schema: - $ref: '#/components/schemas/DeploymentStatuses' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '422': - $ref: '#/components/responses/422UnprocessableEntity' - '500': - $ref: '#/components/responses/500InternalError' - /repos/{namespace}/{name}/deployments/{number}/remote-statuses: - post: - tags: - - Repo - summary: Create a new remote deployment status. - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - - in: path - name: number - required: true - schema: - type: integer - description: The deployment number. - requestBody: - content: - application/json: - schema: - type: object - properties: - status: - type: string - description: - type: string - log_url: - type: string - required: - - status - responses: - '200': - description: Return the deployment status. - content: - application/json: - schema: - $ref: '#/components/schemas/RemoteDeploymentStatus' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '422': - $ref: '#/components/responses/422UnprocessableEntity' - '500': - $ref: '#/components/responses/500InternalError' - /repos/{namespace}/{name}/locks: - get: - tags: - - Repo - summary: List locked environments. - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - responses: - '200': - description: Locks - content: - application/json: - schema: - $ref: '#/components/schemas/Locks' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '500': - $ref: '#/components/responses/500InternalError' - post: - tags: - - Repo - summary: Lock the environment. - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - requestBody: - content: - application/json: - schema: - type: object - properties: - env: - type: string - description: The name of env in deploy.yml - expired_at: - type: string - required: - - env - responses: - '201': - description: Lock - content: - application/json: - schema: - $ref: '#/components/schemas/Lock' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '422': - $ref: '#/components/responses/422UnprocessableEntity' - '500': - $ref: '#/components/responses/500InternalError' - /repos/{namespace}/{name}/locks/{lockId}: - patch: - tags: - - Repo - summary: Patch the lock. - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - - in: path - name: lockId - required: true - schema: - type: integer - description: The lock ID. - requestBody: - content: - application/json: - schema: - type: object - properties: - expired_at: - type: string - responses: - '200': - description: Ok - content: - application/json: - schema: - type: object - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '404': - $ref: '#/components/responses/404NotFound' - '500': - $ref: '#/components/responses/500InternalError' - delete: - tags: - - Repo - summary: Unlock the environment. - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - - in: path - name: lockId - required: true - schema: - type: integer - description: The lock ID. - responses: - '200': - description: Ok - content: - application/json: - schema: - type: object - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '404': - $ref: '#/components/responses/404NotFound' - '500': - $ref: '#/components/responses/500InternalError' - /repos/{namespace}/{name}/perms: - get: - tags: - - Repo - summary: Get permissions for the repository - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - - in: query - name: q - schema: - type: string - description: Search perms by login. - - in: query - name: page - schema: - type: number - - in: query - name: per_page - schema: - type: number - responses: - '200': - description: Perms - content: - application/json: - schema: - $ref: '#/components/schemas/Perms' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '500': - $ref: '#/components/responses/500InternalError' - /repos/{namespace}/{name}/config: - get: - tags: - - Repo - summary: Get the config file - parameters: - - in: path - name: namespace - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - responses: - '200': - description: Config - content: - application/json: - schema: - $ref: '#/components/schemas/Config' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '404': - $ref: '#/components/responses/404NotFound' - '422': - $ref: '#/components/responses/422UnprocessableEntity' - '500': - $ref: '#/components/responses/500InternalError' - /users: - get: - tags: - - User - summary: Get user list. - parameters: - - in: query - name: q - schema: - type: string - description: Search users by login. - - in: query - name: page - schema: - type: number - default: 1 - - in: query - name: per_page - schema: - type: number - default: 30 - responses: - '200': - description: User - content: - application/json: - schema: - $ref: '#/components/schemas/User' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '500': - $ref: '#/components/responses/500InternalError' - /users/{id}: - patch: - tags: - - User - summary: Update the user. - parameters: - - in: path - name: id - required: true - schema: - type: string - description: User id. - requestBody: - content: - application/json: - schema: - type: object - properties: - admin: - type: boolean - default: false - responses: - '200': - description: User - content: - application/json: - schema: - $ref: '#/components/schemas/User' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '500': - $ref: '#/components/responses/500InternalError' - delete: - tags: - - User - summary: Delete the user. - parameters: - - in: path - name: id - required: true - schema: - type: string - description: User id. - responses: - '200': - description: User - content: - application/json: - schema: - $ref: '#/components/schemas/User' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '403': - $ref: '#/components/responses/403Forbidden' - '500': - $ref: '#/components/responses/500InternalError' - /user: - get: - tags: - - User - summary: Get my information. - responses: - '200': - description: User - content: - application/json: - schema: - $ref: '#/components/schemas/User' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '500': - $ref: '#/components/responses/500InternalError' - /user/rate-limit: - get: - tags: - - User - summary: Get rate-limit of SCM. - responses: - '200': - description: Rate Limit - content: - application/json: - schema: - $ref: '#/components/schemas/RateLimit' - '401': - $ref: '#/components/responses/401Unauthorized' - '403': - $ref: '#/components/responses/403Forbidden' - '500': - $ref: '#/components/responses/500InternalError' - /search/deployments: - get: - tags: - - Search - summary: Search deployments. - parameters: - - in: query - name: statuses - required: false - schema: - type: string - description: > - Status list comma separated. - - in: query - name: owned - required: false - schema: - type: boolean - description: Own deployments. - - in: query - name: production_only - required: false - schema: - type: boolean - description: Return the deployments for the production environment. - - in: query - name: from - required: false - schema: - type: string - format: date-time - description: Begin of created_at. - - in: query - name: to - required: false - schema: - type: string - format: date-time - description: End of created_at. - - in: query - name: page - schema: - type: integer - default: 1 - description: The page number - - in: query - name: per_page - schema: - type: integer - default: 30 - description: The number per page - responses: - '200': - description: Returns deployments which matches to conditions. - content: - application/json: - schema: - $ref: '#/components/schemas/Deployments' - '400': - $ref: '#/components/responses/400BadRequest' - '402': - $ref: '#/components/responses/402PaymentRequired' - '401': - $ref: '#/components/responses/401Unauthorized' - '500': - $ref: '#/components/responses/500InternalError' - /search/reviews: - get: - tags: - - Search - summary: Search assigned reviews. - responses: - '200': - description: Returns deployments which matches to conditions. - content: - application/json: - schema: - $ref: '#/components/schemas/Deployments' - '400': - $ref: '#/components/responses/400BadRequest' - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '500': - $ref: '#/components/responses/500InternalError' - /stream/events: - get: - tags: - - Event - summary: Subscribes streaming event - responses: - '200': - description: Returns events for deployments and reviews - content: - text/event-stream: - schema: - type: array - format: chunked - items: - type: object - format: text - required: - - id - - event - - data - properties: - id: - type: integer - event: - type: string - enum: - - deployment_status - - review - data: - oneOf: - - $ref: '#/components/schemas/DeploymentStatus' - - $ref: '#/components/schemas/Review' - /sync: - post: - tags: - - Sync - summary: Synchronize with SCM. - responses: - '200': - description: OK - '401': - $ref: '#/components/responses/401Unauthorized' - '402': - $ref: '#/components/responses/402PaymentRequired' - '500': - $ref: '#/components/responses/500InternalError' -security: - - BearerAuth: [] - - OAuth2: - - read - -components: - schemas: - Users: - type: array - items: - $ref: '#/components/schemas/User' - User: - type: object - properties: - id: - type: number - login: - type: string - avatar: - type: string - admin: - type: boolean - created_at: - type: string - updated_at: - type: string - edges: - type: object - properties: - chat_user: - $ref: '#/components/schemas/ChatUser' - required: - - id - - login - - admin - - avatar - - created_at - - updated_at - - edges - ChatUser: - type: object - properties: - id: - type: string - created_at: - type: string - updated_at: - type: string - required: - - id - - created_at - - updated_at - Repositories: - type: array - items: - $ref: '#/components/schemas/Repository' - Repository: - type: object - properties: - id: - type: number - namespace: - type: string - description: Repository owner - name: - type: string - description: - type: string - config_path: - type: string - active: - type: boolean - webhook_id: - type: integer - synced_at: - type: string - created_at: - type: string - updated_at: - type: string - latest_deployed_at: - type: string - edges: - type: object - properties: - deployments: - $ref: '#/components/schemas/Deployments' - required: - - id - - namespace - - name - - description - - config_path - - active - - created_at - - updated_at - Perms: - type: array - items: - $ref: '#/components/schemas/Perm' - Perm: - type: object - properties: - id: - type: number - repo_perm: - type: string - synced_at: - type: string - created_at: - type: string - updated_at: - type: string - edges: - type: object - properties: - user: - $ref: '#/components/schemas/User' - repo: - $ref: '#/components/schemas/Repository' - required: - - id - - repo_perm - - created_at - - updated_at - Commits: - type: array - items: - $ref: '#/components/schemas/Commit' - Commit: - type: object - properties: - sha: - type: string - message: - type: string - is_pull_request: - type: boolean - html_url: - type: string - author: - type: object - properties: - login: - type: string - avatar_url: - type: string - date: - type: string - required: - - sha - - message - - is_pull_request - - html_url - Statuses: - type: array - items: - $ref: '#/components/schemas/Status' - Status: - type: object - properties: - context: - type: string - avatar_url: - type: string - target_url: - type: string - state: - type: string - description: The state is one of failure, pending, and success. - enum: - - pending - - failure - - success - - cancelled - - skipped - required: - - context - - avatar_url - - target_url - - state - Branches: - type: array - items: - $ref: '#/components/schemas/Branch' - Branch: - type: object - properties: - name: - type: string - commit_sha: - type: string - required: - - name - - commit_sha - Tags: - type: array - items: - $ref: '#/components/schemas/Tag' - Tag: - type: object - properties: - name: - type: string - commit_sha: - type: string - required: - - name - - commit_sha - Deployments: - type: array - items: - $ref: '#/components/schemas/Deployment' - Deployment: - type: object - properties: - id: - type: integer - type: - type: string - enum: - - commit - - branch - - tag - ref: - type: string - env: - type: string - status: - type: string - enum: - - waiting - - created - - queued - - running - - success - - failure - - canceled - uid: - type: integer - sha: - type: string - html_url: - type: string - production_environment: - type: boolean - is_rollback: - type: boolean - created_at: - type: string - updated_at: - type: string - edges: - type: object - properties: - user: - $ref: '#/components/schemas/User' - repo: - $ref: '#/components/schemas/Repository' - deployment_statuses: - type: array - items: - $ref: '#/components/schemas/DeploymentStatus' - required: - - id - - type - - ref - - env - - status - - production_environment - - is_rollback - - created_at - - updated_at - DeploymentStatuses: - type: array - items: - $ref: '#/components/schemas/DeploymentStatus' - DeploymentStatus: - type: object - properties: - id: - type: number - status: - type: string - description: - type: string - log_url: - type: string - created_at: - type: string - updated_at: - type: string - deployment_id: - type: number - repo_id: - type: number - edges: - type: object - properties: - deployment: - $ref: '#/components/schemas/DeploymentStatus' - repo: - $ref: '#/components/schemas/Repository' - required: - - id - - status - - created_at - - updated_at - - deployment_id - - repo_id - RemoteDeploymentStatus: - type: object - properties: - id: - type: number - status: - type: string - description: - type: string - log_url: - type: string - required: - - id - - status - Locks: - type: array - items: - $ref: '#/components/schemas/Lock' - Lock: - type: object - properties: - id: - type: number - env: - type: string - expired_at: - type: string - created_at: - type: string - edges: - type: object - properties: - repo: - $ref: '#/components/schemas/Repository' - user: - $ref: '#/components/schemas/User' - required: - - id - - env - - created_at - Config: - type: object - properties: - envs: - type: array - items: - $ref: '#/components/schemas/Env' - Env: - type: object - properties: - name: - type: string - task: - type: string - description: - type: string - auto_merge: - type: boolean - required_contexts: - type: array - items: - type: string - payload: - type: string - dynamic_payload: - $ref: '#/components/schemas/DynamicPayload' - production_environment: - type: boolean - review: - type: object - properties: - enabled: - type: boolean - reviewers: - type: array - items: - type: string - required: - - enabled - - reviewers - required: - - name - - task - - description - - auto_merge - - payload - - production_environment - DynamicPayload: - type: object - properties: - enabled: - type: boolean - inputs: - # Dictionaries - type: object - additionalProperties: - type: object - properties: - type: - type: string - enum: - - select - - number - - string - - boolean - required: - type: boolean - default: - anyOf: - - type: number - - type: string - - type: boolean - description: - type: string - options: - type: array - items: - type: string - required: - - type - Reviews: - type: array - items: - $ref: '#/components/schemas/Review' - Review: - type: object - properties: - id: - type: integer - status: - type: string - enum: - - pending - - rejected - - approved - comment: - type: string - created_at: - type: string - updated_at: - type: string - edges: - type: object - properties: - user: - $ref: '#/components/schemas/User' - deployment: - $ref: '#/components/schemas/Deployment' - required: - - id - - status - - comment - - created_at - - updated_at - RateLimit: - type: object - properties: - limit: - type: number - remaining: - type: number - reset: - type: string - required: - - limit - - remaining - - reset - License: - type: object - properties: - kind: - type: string - member_count: - type: number - member_limit: - type: number - expired_at: - type: string - required: - - kind - - member_count - Error: - type: object - properties: - code: - type: string - message: - type: string - required: - - message - - securitySchemes: - BearerAuth: - type: http - scheme: bearer - description: Hash key of user - OAuth2: - type: oauth2 - flows: - authorizationCode: - authorizationUrl: https://github.com/oauth/authorize - tokenUrl: https://github.com/oauth/token - scopes: - read: Grants read access - write: Grants write access - admin: Grants access to admin operations - - responses: - 400BadRequest: - description: | - The request could not be understood by the server due to malformed syntax. - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - - 401Unauthorized: - description: Unauthorized access - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - - 402PaymentRequired: - description: License is expired - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - - 403Forbidden: - description: Permisson denied - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - - 404NotFound: - description: The resource is not found - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - - 409Conflict: - description: The conflict occurs - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - - 422UnprocessableEntity: - description: | - the syntax of the request entity is correct but was unable to process the contained instructions. - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - - 500InternalError: - description: Server internal error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' diff --git a/openapi/v1/openapi.yaml b/openapi/v1/openapi.yaml new file mode 100644 index 00000000..3f83f0e7 --- /dev/null +++ b/openapi/v1/openapi.yaml @@ -0,0 +1,85 @@ +openapi: '3.0.2' +info: + title: gitploy. + version: '1.0' +servers: + - url: http://localhost/api/v1 + - url: https://gitploy.jp.ngrok.io/api/v1 +paths: + /license: + $ref: './paths/license/index.yaml' + /repos: + $ref: './paths/repos/index.yaml' + /repos/{namespace}/{name}: + $ref: './paths/repos/repo.yaml' + /repos/{namespace}/{name}/commits: + $ref: './paths/repos/commits.yaml' + /repos/{namespace}/{name}/commits/{sha}: + $ref: './paths/repos/commit.yaml' + /repos/{namespace}/{name}/commits/{sha}/statuses: + $ref: './paths/repos/commit_statuses.yaml' + /repos/{namespace}/{name}/branches: + $ref: './paths/repos/branches.yaml' + /repos/{namespace}/{name}/branches/{branch}: + $ref: './paths/repos/branch.yaml' + /repos/{namespace}/{name}/tags: + $ref: './paths/repos/tags.yaml' + /repos/{namespace}/{name}/tags/{tag}: + $ref: './paths/repos/tag.yaml' + /repos/{namespace}/{name}/deployments: + $ref: './paths/repos/deployments.yaml' + /repos/{namespace}/{name}/deployment: + $ref: './paths/repos/deployment.yaml' + /repos/{namespace}/{name}/deployments/{number}/changes: + $ref: './paths/repos/deployment_changes.yaml' + /repos/{namespace}/{name}/deployments/{number}/rollback: + $ref: './paths/repos/deployment_rollback.yaml' + /repos/{namespace}/{name}/deployments/{number}/reviews: + $ref: './paths/repos/deployment_reviews.yaml' + /repos/{namespace}/{name}/deployments/{number}/review: + $ref: './paths/repos/deployment_review.yaml' + /repos/{namespace}/{name}/deployments/{number}/statuses: + $ref: './paths/repos/deployment_statuses.yaml' + /repos/{namespace}/{name}/deployments/{number}/remote-statuses: + $ref: './paths/repos/deployment_statuses.yaml' + /repos/{namespace}/{name}/locks: + $ref: './paths/repos/locks.yaml' + /repos/{namespace}/{name}/locks/{lockId}: + $ref: './paths/repos/lock.yaml' + /repos/{namespace}/{name}/perms: + $ref: './paths/repos/perms.yaml' + /repos/{namespace}/{name}/config: + $ref: './paths/repos/config.yaml' + /users: + $ref: './paths/users/index.yaml' + /users/{id}: + $ref: './paths/users/user.yaml' + /user: + $ref: './paths/users/me.yaml' + /user/rate-limit: + $ref: './paths/users/ratelimit.yaml' + /search/deployments: + $ref: './paths/search/deployments.yaml' + /search/reviews: + $ref: './paths/search/deployments.yaml' + /stream/events: + $ref: './paths/stream/events.yaml' + /sync: + $ref: './paths/sync/index.yaml' + +components: + securitySchemes: + BearerAuth: + type: http + scheme: bearer + description: Hash key of user + OAuth2: + type: oauth2 + flows: + authorizationCode: + authorizationUrl: https://github.com/oauth/authorize + tokenUrl: https://github.com/oauth/token + scopes: + read: Grants read access + write: Grants write access + admin: Grants access to admin operations \ No newline at end of file diff --git a/openapi/v1/paths/license/index.yaml b/openapi/v1/paths/license/index.yaml new file mode 100644 index 00000000..2f6166d2 --- /dev/null +++ b/openapi/v1/paths/license/index.yaml @@ -0,0 +1,13 @@ +get: + tags: + - License + summary: Return license + responses: + '200': + description: Licnese + content: + application/json: + schema: + $ref: '../../schemas/License.yaml' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/repos/branch.yaml b/openapi/v1/paths/repos/branch.yaml new file mode 100644 index 00000000..5fe4fbce --- /dev/null +++ b/openapi/v1/paths/repos/branch.yaml @@ -0,0 +1,38 @@ +get: + tags: + - Repo + summary: Get the branch of repository. + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + - in: path + name: branch + required: true + schema: + type: string + description: The branch name + responses: + '200': + description: Branch + content: + application/json: + schema: + $ref: '../../schemas/Branch.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '404': + $ref: '../../responses.yaml#/404NotFound' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/repos/branches.yaml b/openapi/v1/paths/repos/branches.yaml new file mode 100644 index 00000000..f4029a18 --- /dev/null +++ b/openapi/v1/paths/repos/branches.yaml @@ -0,0 +1,44 @@ +get: + tags: + - Repo + summary: List branches of the repository. + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + - in: query + name: page + schema: + type: integer + default: 1 + description: The page number + - in: query + name: per_page + schema: + type: integer + default: 30 + description: The item count per page + responses: + '200': + description: Branches + content: + application/json: + schema: + type: array + items: + $ref: '../../schemas/Branch.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/repos/commit.yaml b/openapi/v1/paths/repos/commit.yaml new file mode 100644 index 00000000..534b63da --- /dev/null +++ b/openapi/v1/paths/repos/commit.yaml @@ -0,0 +1,38 @@ +get: + tags: + - Repo + summary: Get the commit of repository. + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + - in: path + name: sha + required: true + schema: + type: string + description: The commit sha + responses: + '200': + description: Commit + content: + application/json: + schema: + $ref: '../../schemas/Commit.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '404': + $ref: '../../responses.yaml#/404NotFound' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/repos/commit_statuses.yaml b/openapi/v1/paths/repos/commit_statuses.yaml new file mode 100644 index 00000000..aa19825c --- /dev/null +++ b/openapi/v1/paths/repos/commit_statuses.yaml @@ -0,0 +1,45 @@ +get: + tags: + - Repo + summary: List statuses of the commit. + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + - in: path + name: sha + required: true + schema: + type: string + description: The commit sha + responses: + '200': + description: Statuses for ref + content: + application/json: + schema: + type: object + properties: + state: + type: string + statuses: + type: array + items: + $ref: '../../schemas/Status.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '404': + $ref: '../../responses.yaml#/404NotFound' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/repos/commits.yaml b/openapi/v1/paths/repos/commits.yaml new file mode 100644 index 00000000..7c3336a9 --- /dev/null +++ b/openapi/v1/paths/repos/commits.yaml @@ -0,0 +1,52 @@ +get: + tags: + - Repo + summary: List commits of repository. + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + - in: query + name: branch + schema: + type: string + default: + description: > + The branch to start listing commits from. + Default - the repository’s default branch. + - in: query + name: page + schema: + type: integer + default: 1 + description: The page number + - in: query + name: per_page + schema: + type: integer + default: 30 + description: The page number + responses: + '200': + description: Commits + content: + application/json: + schema: + type: array + items: + $ref: '../../schemas/Commit.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/repos/config.yaml b/openapi/v1/paths/repos/config.yaml new file mode 100644 index 00000000..1c757d10 --- /dev/null +++ b/openapi/v1/paths/repos/config.yaml @@ -0,0 +1,34 @@ +get: + tags: + - Repo + summary: Get the config file + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + responses: + '200': + description: Config + content: + application/json: + schema: + $ref: '../../schemas/Config.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '404': + $ref: '../../responses.yaml#/404NotFound' + '422': + $ref: '../../responses.yaml#/422UnprocessableEntity' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/repos/deployment.yaml b/openapi/v1/paths/repos/deployment.yaml new file mode 100644 index 00000000..9f93bb29 --- /dev/null +++ b/openapi/v1/paths/repos/deployment.yaml @@ -0,0 +1,82 @@ +get: + tags: + - Repo + summary: Get the deployments by the number. + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + - in: path + name: number + required: true + schema: + type: integer + description: The deployment number. + responses: + '200': + description: Deployment + content: + application/json: + schema: + $ref: '../../schemas/Deployment.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '404': + $ref: '../../responses.yaml#/404NotFound' + '422': + $ref: '../../responses.yaml#/422UnprocessableEntity' + description: The deployment payload or the configuration is invalid. + '500': + $ref: '../../responses.yaml#/500InternalError' +put: + tags: + - Repo + summary: Create a remote deployment when the status of the deployment is 'waiting'. + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + - in: path + name: number + required: true + schema: + type: integer + description: The deployment number. + responses: + '200': + description: Deployment + content: + application/json: + schema: + $ref: '../../schemas/Deployment.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '404': + $ref: '../../responses.yaml#/404NotFound' + '422': + $ref: '../../responses.yaml#/422UnprocessableEntity' + description: The configuration is invalid or it is not approved. + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/repos/deployment_changes.yaml b/openapi/v1/paths/repos/deployment_changes.yaml new file mode 100644 index 00000000..31965a0d --- /dev/null +++ b/openapi/v1/paths/repos/deployment_changes.yaml @@ -0,0 +1,53 @@ +get: + tags: + - Repo + summary: List commits from the environment state. + description: > + List commits from the environment state, internally, + it compares with the previous succeed deployment. + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + - in: path + name: number + required: true + schema: + type: integer + description: The deployment number. + - in: query + name: page + schema: + type: integer + default: 1 + - in: query + name: per_page + schema: + type: integer + default: 30 + responses: + '200': + description: Commits + content: + application/json: + schema: + type: array + items: + $ref: '../../schemas/Commit.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '404': + $ref: '../../responses.yaml#/404NotFound' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/repos/deployment_remote_statuses.yaml b/openapi/v1/paths/repos/deployment_remote_statuses.yaml new file mode 100644 index 00000000..e94ea390 --- /dev/null +++ b/openapi/v1/paths/repos/deployment_remote_statuses.yaml @@ -0,0 +1,52 @@ +post: + tags: + - Repo + summary: Create a new remote deployment status. + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + - in: path + name: number + required: true + schema: + type: integer + description: The deployment number. + requestBody: + content: + application/json: + schema: + type: object + properties: + status: + type: string + description: + type: string + log_url: + type: string + required: + - status + responses: + '200': + description: Return the deployment status. + content: + application/json: + schema: + $ref: '../../schemas/RemoteDeploymentStatus.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '422': + $ref: '../../responses.yaml#/422UnprocessableEntity' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/repos/deployment_review.yaml b/openapi/v1/paths/repos/deployment_review.yaml new file mode 100644 index 00000000..07baed20 --- /dev/null +++ b/openapi/v1/paths/repos/deployment_review.yaml @@ -0,0 +1,94 @@ +get: + tags: + - Repo + summary: Get the review of the user. + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + - in: path + name: number + required: true + schema: + type: integer + description: The deployment number. + responses: + '200': + description: Return the review. + content: + application/json: + schema: + $ref: '../../schemas/Review.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '404': + $ref: '../../responses.yaml#/404NotFound' + '500': + $ref: '../../responses.yaml#/500InternalError' +patch: + tags: + - Repo + summary: Update the review of the user if it exist. + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + - in: path + name: number + required: true + schema: + type: integer + description: The deployment number. + requestBody: + content: + application/json: + schema: + type: object + properties: + status: + type: string + enum: + - approved + - rejected + comment: + type: string + description: Leave the comment with the review. + required: + - status + responses: + '200': + description: Return the review. + content: + application/json: + schema: + $ref: '../../schemas/Review.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '404': + $ref: '../../responses.yaml#/404NotFound' + '422': + $ref: '../../responses.yaml#/422UnprocessableEntity' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/repos/deployment_reviews.yaml b/openapi/v1/paths/repos/deployment_reviews.yaml new file mode 100644 index 00000000..07baed20 --- /dev/null +++ b/openapi/v1/paths/repos/deployment_reviews.yaml @@ -0,0 +1,94 @@ +get: + tags: + - Repo + summary: Get the review of the user. + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + - in: path + name: number + required: true + schema: + type: integer + description: The deployment number. + responses: + '200': + description: Return the review. + content: + application/json: + schema: + $ref: '../../schemas/Review.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '404': + $ref: '../../responses.yaml#/404NotFound' + '500': + $ref: '../../responses.yaml#/500InternalError' +patch: + tags: + - Repo + summary: Update the review of the user if it exist. + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + - in: path + name: number + required: true + schema: + type: integer + description: The deployment number. + requestBody: + content: + application/json: + schema: + type: object + properties: + status: + type: string + enum: + - approved + - rejected + comment: + type: string + description: Leave the comment with the review. + required: + - status + responses: + '200': + description: Return the review. + content: + application/json: + schema: + $ref: '../../schemas/Review.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '404': + $ref: '../../responses.yaml#/404NotFound' + '422': + $ref: '../../responses.yaml#/422UnprocessableEntity' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/repos/deployment_rollback.yaml b/openapi/v1/paths/repos/deployment_rollback.yaml new file mode 100644 index 00000000..94335205 --- /dev/null +++ b/openapi/v1/paths/repos/deployment_rollback.yaml @@ -0,0 +1,43 @@ +post: + tags: + - Repo + summary: Rollback by the deployment. + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + - in: path + name: number + required: true + schema: + type: integer + description: The deployment number. + responses: + '201': + description: Rollbacked Deployment + content: + application/json: + schema: + $ref: '../../schemas/Deployment.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '404': + $ref: '../../responses.yaml#/404NotFound' + '409': + $ref: '../../responses.yaml#/409Conflict' + '422': + description: The deployment number or the configuration is invalid. + $ref: '../../responses.yaml#/422UnprocessableEntity' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/repos/deployment_statuses.yaml b/openapi/v1/paths/repos/deployment_statuses.yaml new file mode 100644 index 00000000..a2bcb67b --- /dev/null +++ b/openapi/v1/paths/repos/deployment_statuses.yaml @@ -0,0 +1,40 @@ +get: + tags: + - Repo + summary: List deployment statuses. + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + - in: path + name: number + required: true + schema: + type: integer + description: The deployment number. + responses: + '200': + description: Return the deployment statuses. + content: + application/json: + schema: + type: array + items: + $ref: '../../schemas/DeploymentStatus.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '422': + $ref: '../../responses.yaml#/422UnprocessableEntity' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/repos/deployments.yaml b/openapi/v1/paths/repos/deployments.yaml new file mode 100644 index 00000000..a9c7176e --- /dev/null +++ b/openapi/v1/paths/repos/deployments.yaml @@ -0,0 +1,109 @@ +get: + tags: + - Repo + summary: List deployments of repository. + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + - in: query + name: env + description: Name for the target deployment environment. + schema: + type: string + description: The target environment + - in: query + name: status + description: The status of deployment. + schema: + type: string + description: The deployment status + - in: query + name: page + schema: + type: integer + default: 1 + description: The page number + - in: query + name: per_page + schema: + type: integer + default: 30 + description: The item count per page + responses: + '200': + description: Deployment list + content: + application/json: + schema: + type: array + items: + $ref: '../../schemas/Deployment.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '500': + $ref: '../../responses.yaml#/500InternalError' +post: + tags: + - Repo + summary: Create a new deployment. + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + type: + type: string + default: commit + ref: + type: string + env: + type: string + dynamic_payload: + type: object + required: + - type + - ref + - env + responses: + '201': + description: Created + '400': + $ref: '../../responses.yaml#/400BadRequest' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '409': + $ref: '../../responses.yaml#/409Conflict' + description: The deployment number is conflicted. + '422': + $ref: '../../responses.yaml#/422UnprocessableEntity' + description: The deployment payload or the configuration is invalid. + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/repos/index.yaml b/openapi/v1/paths/repos/index.yaml new file mode 100644 index 00000000..141b4d0e --- /dev/null +++ b/openapi/v1/paths/repos/index.yaml @@ -0,0 +1,54 @@ +get: + tags: + - Repo + summary: List repositories the user can access. + parameters: + - in: query + name: sort + schema: + type: boolean + default: false + - in: query + name: q + schema: + type: string + default: "" + - in: query + name: namespace + schema: + type: string + default: "" + - in: query + name: name + schema: + type: string + default: "" + - in: query + name: page + schema: + type: integer + default: 1 + description: The page number + - in: query + name: per_page + schema: + type: integer + default: 30 + description: The number per page + responses: + '200': + description: Repositories + content: + application/json: + schema: + type: array + items: + $ref: '../../schemas/Repository.yaml' + '400': + $ref: '../../responses.yaml#/400BadRequest' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/repos/lock.yaml b/openapi/v1/paths/repos/lock.yaml new file mode 100644 index 00000000..5d45d8ce --- /dev/null +++ b/openapi/v1/paths/repos/lock.yaml @@ -0,0 +1,84 @@ +patch: + tags: + - Repo + summary: Patch the lock. + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + - in: path + name: lockId + required: true + schema: + type: integer + description: The lock ID. + requestBody: + content: + application/json: + schema: + type: object + properties: + expired_at: + type: string + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '404': + $ref: '../../responses.yaml#/404NotFound' + '500': + $ref: '../../responses.yaml#/500InternalError' +delete: + tags: + - Repo + summary: Unlock the environment. + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + - in: path + name: lockId + required: true + schema: + type: integer + description: The lock ID. + responses: + '200': + description: Ok + content: + application/json: + schema: + type: object + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '404': + $ref: '../../responses.yaml#/404NotFound' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/repos/locks.yaml b/openapi/v1/paths/repos/locks.yaml new file mode 100644 index 00000000..b4b15d7f --- /dev/null +++ b/openapi/v1/paths/repos/locks.yaml @@ -0,0 +1,77 @@ +get: + tags: + - Repo + summary: List locked environments. + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + responses: + '200': + description: Locks + content: + application/json: + schema: + type: array + items: + $ref: '../../schemas/Lock.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '500': + $ref: '../../responses.yaml#/500InternalError' +post: + tags: + - Repo + summary: Lock the environment. + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + env: + type: string + description: The name of env in deploy.yml + expired_at: + type: string + required: + - env + responses: + '201': + description: Lock + content: + application/json: + schema: + $ref: '../../schemas/Lock.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '422': + $ref: '../../responses.yaml#/422UnprocessableEntity' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/repos/perms.yaml b/openapi/v1/paths/repos/perms.yaml new file mode 100644 index 00000000..7ae6d71a --- /dev/null +++ b/openapi/v1/paths/repos/perms.yaml @@ -0,0 +1,45 @@ +get: + tags: + - Repo + summary: Get permissions for the repository + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + - in: query + name: q + schema: + type: string + description: Search perms by login. + - in: query + name: page + schema: + type: number + - in: query + name: per_page + schema: + type: number + responses: + '200': + description: Perms + content: + application/json: + schema: + type: array + items: + $ref: '../../schemas/Perm.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/repos/repo.yaml b/openapi/v1/paths/repos/repo.yaml new file mode 100644 index 00000000..640146e2 --- /dev/null +++ b/openapi/v1/paths/repos/repo.yaml @@ -0,0 +1,68 @@ +get: + tags: + - Repo + summary: Get the repository. + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + responses: + '200': + description: Repository + content: + application/json: + schema: + $ref: '../../schemas/Repository.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '500': + $ref: '../../responses.yaml#/500InternalError' +patch: + tags: + - Repo + summary: Update the repository. + description: Basically patch the respository field. And it creates a new webhook when it activates. + requestBody: + content: + application/json: + schema: + type: object + properties: + config_path: + type: string + default: deploy.yml + active: + type: boolean + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + responses: + '200': + description: Ok + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/repos/tag.yaml b/openapi/v1/paths/repos/tag.yaml new file mode 100644 index 00000000..a162d08b --- /dev/null +++ b/openapi/v1/paths/repos/tag.yaml @@ -0,0 +1,38 @@ +get: + tags: + - Repo + summary: Get the tag of the repository. + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + - in: path + name: tag + required: true + schema: + type: string + description: The tag name + responses: + '200': + description: Tag + content: + application/json: + schema: + $ref: '../../schemas/Tag.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '404': + $ref: '../../responses.yaml#/404NotFound' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/repos/tags.yaml b/openapi/v1/paths/repos/tags.yaml new file mode 100644 index 00000000..2058f7f1 --- /dev/null +++ b/openapi/v1/paths/repos/tags.yaml @@ -0,0 +1,44 @@ +get: + tags: + - Repo + summary: List tags of the repository. + parameters: + - in: path + name: namespace + required: true + schema: + type: string + - in: path + name: name + required: true + schema: + type: string + - in: query + name: page + schema: + type: integer + default: 1 + description: The page number + - in: query + name: per_page + schema: + type: integer + default: 30 + description: The item count per page + responses: + '200': + description: Tags + content: + application/json: + schema: + type: array + items: + $ref: '../../schemas/Tag.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/search/deployments.yaml b/openapi/v1/paths/search/deployments.yaml new file mode 100644 index 00000000..bca8432a --- /dev/null +++ b/openapi/v1/paths/search/deployments.yaml @@ -0,0 +1,67 @@ +get: + tags: + - Search + summary: Search deployments. + parameters: + - in: query + name: statuses + required: false + schema: + type: string + description: > + Status list comma separated. + - in: query + name: owned + required: false + schema: + type: boolean + description: Own deployments. + - in: query + name: production_only + required: false + schema: + type: boolean + description: Return the deployments for the production environment. + - in: query + name: from + required: false + schema: + type: string + format: date-time + description: Begin of created_at. + - in: query + name: to + required: false + schema: + type: string + format: date-time + description: End of created_at. + - in: query + name: page + schema: + type: integer + default: 1 + description: The page number + - in: query + name: per_page + schema: + type: integer + default: 30 + description: The number per page + responses: + '200': + description: Returns deployments which matches to conditions. + content: + application/json: + schema: + type: array + items: + $ref: '../../schemas/Deployment.yaml' + '400': + $ref: '../../responses.yaml#/400BadRequest' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/search/reviews.yaml b/openapi/v1/paths/search/reviews.yaml new file mode 100644 index 00000000..9e16a070 --- /dev/null +++ b/openapi/v1/paths/search/reviews.yaml @@ -0,0 +1,21 @@ +get: + tags: + - Search + summary: Search assigned reviews. + responses: + '200': + description: Returns deployments which matches to conditions. + content: + application/json: + schema: + type: array + items: + $ref: '../../schemas/Review.yaml' + '400': + $ref: '../../responses.yaml#/400BadRequest' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/stream/events.yaml b/openapi/v1/paths/stream/events.yaml new file mode 100644 index 00000000..340f81db --- /dev/null +++ b/openapi/v1/paths/stream/events.yaml @@ -0,0 +1,31 @@ +get: + tags: + - Event + summary: Subscribes streaming event + responses: + '200': + description: Returns events for deployments and reviews + content: + text/event-stream: + schema: + type: array + format: chunked + items: + type: object + format: text + required: + - id + - event + - data + properties: + id: + type: integer + event: + type: string + enum: + - deployment_status + - review + data: + oneOf: + - $ref: '../../schemas/DeploymentStatus.yaml' + - $ref: '../../schemas/Review.yaml' \ No newline at end of file diff --git a/openapi/v1/paths/sync/index.yaml b/openapi/v1/paths/sync/index.yaml new file mode 100644 index 00000000..d4316691 --- /dev/null +++ b/openapi/v1/paths/sync/index.yaml @@ -0,0 +1,13 @@ +post: + tags: + - Sync + summary: Synchronize with SCM. + responses: + '200': + description: OK + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/users/index.yaml b/openapi/v1/paths/users/index.yaml new file mode 100644 index 00000000..cc4b1466 --- /dev/null +++ b/openapi/v1/paths/users/index.yaml @@ -0,0 +1,35 @@ +get: + tags: + - User + summary: Get user list. + parameters: + - in: query + name: q + schema: + type: string + description: Search users by login. + - in: query + name: page + schema: + type: number + default: 1 + - in: query + name: per_page + schema: + type: number + default: 30 + responses: + '200': + description: User + content: + application/json: + schema: + $ref: '../../schemas/User.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/users/me.yaml b/openapi/v1/paths/users/me.yaml new file mode 100644 index 00000000..2ebd87f3 --- /dev/null +++ b/openapi/v1/paths/users/me.yaml @@ -0,0 +1,17 @@ +get: + tags: + - User + summary: Get my information. + responses: + '200': + description: User + content: + application/json: + schema: + $ref: '../../schemas/User.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/users/ratelimit.yaml b/openapi/v1/paths/users/ratelimit.yaml new file mode 100644 index 00000000..0e812b2a --- /dev/null +++ b/openapi/v1/paths/users/ratelimit.yaml @@ -0,0 +1,17 @@ +get: + tags: + - User + summary: Get rate-limit of SCM. + responses: + '200': + description: Rate Limit + content: + application/json: + schema: + $ref: '../../schemas/RateLimit.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/paths/users/user.yaml b/openapi/v1/paths/users/user.yaml new file mode 100644 index 00000000..773286ab --- /dev/null +++ b/openapi/v1/paths/users/user.yaml @@ -0,0 +1,61 @@ +patch: + tags: + - User + summary: Update the user. + parameters: + - in: path + name: id + required: true + schema: + type: string + description: User id. + requestBody: + content: + application/json: + schema: + type: object + properties: + admin: + type: boolean + default: false + responses: + '200': + description: User + content: + application/json: + schema: + $ref: '../../schemas/User.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '500': + $ref: '../../responses.yaml#/500InternalError' +delete: + tags: + - User + summary: Delete the user. + parameters: + - in: path + name: id + required: true + schema: + type: string + description: User id. + responses: + '200': + description: User + content: + application/json: + schema: + $ref: '../../schemas/User.yaml' + '401': + $ref: '../../responses.yaml#/401Unauthorized' + '402': + $ref: '../../responses.yaml#/402PaymentRequired' + '403': + $ref: '../../responses.yaml#/403Forbidden' + '500': + $ref: '../../responses.yaml#/500InternalError' \ No newline at end of file diff --git a/openapi/v1/responses.yaml b/openapi/v1/responses.yaml new file mode 100644 index 00000000..09d8dc11 --- /dev/null +++ b/openapi/v1/responses.yaml @@ -0,0 +1,57 @@ +400BadRequest: + description: | + The request could not be understood by the server due to malformed syntax. + content: + application/json: + schema: + $ref: './schemas/Error.yaml' + +401Unauthorized: + description: Unauthorized access + content: + application/json: + schema: + $ref: './schemas/Error.yaml' + +402PaymentRequired: + description: License is expired + content: + application/json: + schema: + $ref: './schemas/Error.yaml' + +403Forbidden: + description: Permisson denied + content: + application/json: + schema: + $ref: './schemas/Error.yaml' + +404NotFound: + description: The resource is not found + content: + application/json: + schema: + $ref: './schemas/Error.yaml' + +409Conflict: + description: The conflict occurs + content: + application/json: + schema: + $ref: './schemas/Error.yaml' + +422UnprocessableEntity: + description: | + the syntax of the request entity is correct but was unable to process the contained instructions. + content: + application/json: + schema: + $ref: './schemas/Error.yaml' + +500InternalError: + description: Server internal error + content: + application/json: + schema: + $ref: './schemas/Error.yaml' diff --git a/openapi/v1/schemas/Branch.yaml b/openapi/v1/schemas/Branch.yaml new file mode 100644 index 00000000..94610f35 --- /dev/null +++ b/openapi/v1/schemas/Branch.yaml @@ -0,0 +1,9 @@ +type: object +properties: + name: + type: string + commit_sha: + type: string +required: + - name + - commit_sha \ No newline at end of file diff --git a/openapi/v1/schemas/ChatUser.yaml b/openapi/v1/schemas/ChatUser.yaml new file mode 100644 index 00000000..6af27ca3 --- /dev/null +++ b/openapi/v1/schemas/ChatUser.yaml @@ -0,0 +1,12 @@ +type: object +properties: + id: + type: string + created_at: + type: string + updated_at: + type: string +required: + - id + - created_at + - updated_at \ No newline at end of file diff --git a/openapi/v1/schemas/Commit.yaml b/openapi/v1/schemas/Commit.yaml new file mode 100644 index 00000000..37fd0435 --- /dev/null +++ b/openapi/v1/schemas/Commit.yaml @@ -0,0 +1,24 @@ +type: object +properties: + sha: + type: string + message: + type: string + is_pull_request: + type: boolean + html_url: + type: string + author: + type: object + properties: + login: + type: string + avatar_url: + type: string + date: + type: string +required: + - sha + - message + - is_pull_request + - html_url \ No newline at end of file diff --git a/openapi/v1/schemas/Config.yaml b/openapi/v1/schemas/Config.yaml new file mode 100644 index 00000000..a0c89ff3 --- /dev/null +++ b/openapi/v1/schemas/Config.yaml @@ -0,0 +1,82 @@ +Config: + type: object + properties: + envs: + type: array + items: + $ref: '#/Env' + +Env: + type: object + properties: + name: + type: string + task: + type: string + description: + type: string + auto_merge: + type: boolean + required_contexts: + type: array + items: + type: string + payload: + type: string + dynamic_payload: + $ref: '#/DynamicPayload' + production_environment: + type: boolean + review: + type: object + properties: + enabled: + type: boolean + reviewers: + type: array + items: + type: string + required: + - enabled + - reviewers + required: + - name + - task + - description + - auto_merge + - payload + - production_environment + +DynamicPayload: + type: object + properties: + enabled: + type: boolean + inputs: + # Dictionaries + type: object + additionalProperties: + type: object + properties: + type: + type: string + enum: + - select + - number + - string + - boolean + required: + type: boolean + default: + anyOf: + - type: number + - type: string + - type: boolean + description: + type: string + options: + type: array + items: + type: string + required: + - type \ No newline at end of file diff --git a/openapi/v1/schemas/Deployment.yaml b/openapi/v1/schemas/Deployment.yaml new file mode 100644 index 00000000..f64a7052 --- /dev/null +++ b/openapi/v1/schemas/Deployment.yaml @@ -0,0 +1,59 @@ +type: object +properties: + id: + type: integer + type: + type: string + enum: + - commit + - branch + - tag + ref: + type: string + env: + type: string + status: + type: string + enum: + - waiting + - created + - queued + - running + - success + - failure + - canceled + uid: + type: integer + sha: + type: string + html_url: + type: string + production_environment: + type: boolean + is_rollback: + type: boolean + created_at: + type: string + updated_at: + type: string + edges: + type: object + properties: + user: + $ref: 'User.yaml' + repo: + $ref: 'Repository.yaml' + deployment_statuses: + type: array + items: + $ref: 'DeploymentStatus.yaml' +required: + - id + - type + - ref + - env + - status + - production_environment + - is_rollback + - created_at + - updated_at \ No newline at end of file diff --git a/openapi/v1/schemas/DeploymentStatus.yaml b/openapi/v1/schemas/DeploymentStatus.yaml new file mode 100644 index 00000000..309d3aeb --- /dev/null +++ b/openapi/v1/schemas/DeploymentStatus.yaml @@ -0,0 +1,32 @@ +type: object +properties: + id: + type: number + status: + type: string + description: + type: string + log_url: + type: string + created_at: + type: string + updated_at: + type: string + deployment_id: + type: number + repo_id: + type: number + edges: + type: object + properties: + deployment: + $ref: 'DeploymentStatus.yaml' + repo: + $ref: 'Repository.yaml' +required: + - id + - status + - created_at + - updated_at + - deployment_id + - repo_id \ No newline at end of file diff --git a/openapi/v1/schemas/Error.yaml b/openapi/v1/schemas/Error.yaml new file mode 100644 index 00000000..9ea148d7 --- /dev/null +++ b/openapi/v1/schemas/Error.yaml @@ -0,0 +1,8 @@ +type: object +properties: + code: + type: string + message: + type: string +required: + - message \ No newline at end of file diff --git a/openapi/v1/schemas/License.yaml b/openapi/v1/schemas/License.yaml new file mode 100644 index 00000000..8d0ce771 --- /dev/null +++ b/openapi/v1/schemas/License.yaml @@ -0,0 +1,13 @@ +type: object +properties: + kind: + type: string + member_count: + type: number + member_limit: + type: number + expired_at: + type: string +required: + - kind + - member_count \ No newline at end of file diff --git a/openapi/v1/schemas/Lock.yaml b/openapi/v1/schemas/Lock.yaml new file mode 100644 index 00000000..3e3a814c --- /dev/null +++ b/openapi/v1/schemas/Lock.yaml @@ -0,0 +1,21 @@ +type: object +properties: + id: + type: number + env: + type: string + expired_at: + type: string + created_at: + type: string + edges: + type: object + properties: + repo: + $ref: 'Repository.yaml' + user: + $ref: 'User.yaml' +required: + - id + - env + - created_at \ No newline at end of file diff --git a/openapi/v1/schemas/Perm.yaml b/openapi/v1/schemas/Perm.yaml new file mode 100644 index 00000000..8f514776 --- /dev/null +++ b/openapi/v1/schemas/Perm.yaml @@ -0,0 +1,24 @@ +type: object +properties: + id: + type: number + repo_perm: + type: string + synced_at: + type: string + created_at: + type: string + updated_at: + type: string + edges: + type: object + properties: + user: + $ref: './User.yaml' + repo: + $ref: './Repository.yaml' +required: + - id + - repo_perm + - created_at + - updated_at \ No newline at end of file diff --git a/openapi/v1/schemas/RateLimit.yaml b/openapi/v1/schemas/RateLimit.yaml new file mode 100644 index 00000000..8a861635 --- /dev/null +++ b/openapi/v1/schemas/RateLimit.yaml @@ -0,0 +1,12 @@ +type: object +properties: + limit: + type: number + remaining: + type: number + reset: + type: string +required: + - limit + - remaining + - reset \ No newline at end of file diff --git a/openapi/v1/schemas/RemoteDeploymentStatus.yaml b/openapi/v1/schemas/RemoteDeploymentStatus.yaml new file mode 100644 index 00000000..85a605cf --- /dev/null +++ b/openapi/v1/schemas/RemoteDeploymentStatus.yaml @@ -0,0 +1,13 @@ +type: object +properties: + id: + type: number + status: + type: string + description: + type: string + log_url: + type: string +required: + - id + - status \ No newline at end of file diff --git a/openapi/v1/schemas/Repository.yaml b/openapi/v1/schemas/Repository.yaml new file mode 100644 index 00000000..dea32ed8 --- /dev/null +++ b/openapi/v1/schemas/Repository.yaml @@ -0,0 +1,41 @@ +type: object +properties: + id: + type: number + namespace: + type: string + description: Repository owner + name: + type: string + description: + type: string + config_path: + type: string + active: + type: boolean + webhook_id: + type: integer + synced_at: + type: string + created_at: + type: string + updated_at: + type: string + latest_deployed_at: + type: string + edges: + type: object + properties: + deployments: + type: array + items: + $ref: 'Deployment.yaml' +required: + - id + - namespace + - name + - description + - config_path + - active + - created_at + - updated_at \ No newline at end of file diff --git a/openapi/v1/schemas/Review.yaml b/openapi/v1/schemas/Review.yaml new file mode 100644 index 00000000..8e313391 --- /dev/null +++ b/openapi/v1/schemas/Review.yaml @@ -0,0 +1,29 @@ +type: object +properties: + id: + type: integer + status: + type: string + enum: + - pending + - rejected + - approved + comment: + type: string + created_at: + type: string + updated_at: + type: string + edges: + type: object + properties: + user: + $ref: 'User.yaml' + deployment: + $ref: 'Deployment.yaml' +required: + - id + - status + - comment + - created_at + - updated_at \ No newline at end of file diff --git a/openapi/v1/schemas/Status.yaml b/openapi/v1/schemas/Status.yaml new file mode 100644 index 00000000..b34e0e53 --- /dev/null +++ b/openapi/v1/schemas/Status.yaml @@ -0,0 +1,22 @@ +type: object +properties: + context: + type: string + avatar_url: + type: string + target_url: + type: string + state: + type: string + description: The state is one of failure, pending, and success. + enum: + - pending + - failure + - success + - cancelled + - skipped +required: + - context + - avatar_url + - target_url + - state \ No newline at end of file diff --git a/openapi/v1/schemas/Tag.yaml b/openapi/v1/schemas/Tag.yaml new file mode 100644 index 00000000..94610f35 --- /dev/null +++ b/openapi/v1/schemas/Tag.yaml @@ -0,0 +1,9 @@ +type: object +properties: + name: + type: string + commit_sha: + type: string +required: + - name + - commit_sha \ No newline at end of file diff --git a/openapi/v1/schemas/User.yaml b/openapi/v1/schemas/User.yaml new file mode 100644 index 00000000..132769b1 --- /dev/null +++ b/openapi/v1/schemas/User.yaml @@ -0,0 +1,27 @@ +type: object +properties: + id: + type: number + login: + type: string + avatar: + type: string + admin: + type: boolean + created_at: + type: string + updated_at: + type: string + edges: + type: object + properties: + chat_user: + $ref: './ChatUser.yaml' +required: + - id + - login + - admin + - avatar + - created_at + - updated_at + - edges \ No newline at end of file