diff --git a/apps/strider/package.json b/apps/strider/package.json index 88153a778..26bfce1f2 100644 --- a/apps/strider/package.json +++ b/apps/strider/package.json @@ -135,8 +135,8 @@ "@types/shelljs": "^0.8.6", "@typescript-eslint/eslint-plugin": "^2.31.0", "@typescript-eslint/parser": "^2.31.0", - "apidoc": "^0.17.1", - "apidoc-markdown": "github:zambonilli/node-apidoc-markdown", + "apidoc": "^0.27.1", + "apidoc-markdown": "^5.2.3", "chai": "^4.2.0", "chai-as-promised": "^7.1.1", "eslint": "^6.8.0", diff --git a/apps/website/docs/api.md b/apps/website/docs/api.md index 770be9b4a..aef7e848a 100644 --- a/apps/website/docs/api.md +++ b/apps/website/docs/api.md @@ -3,594 +3,564 @@ Strider API -- [Account](#account) - - [Change Email](#change-email) - - [Change Password](#change-password) - - [Delete Provider Account](#delete-provider-account) - - [Update Provider Account](#update-provider-account) - -- [Admin](#admin) - - [Get All Users](#get-all-users) - - [Revoke Invite](#revoke-invite) - - [Send Invite](#send-invite) - -- [Branch](#branch) - - [Add Branch](#add-branch) - - [Delete Branch](#delete-branch) - - [Reorder Branches](#reorder-branches) - -- [Collaborators](#collaborators) - - [Add Collaborator](#add-collaborator) - - [Delete Collaborator](#delete-collaborator) - - [Get Collaborators](#get-collaborators) - -- [Job](#job) - - [Get Latest Jobs](#get-latest-jobs) - - [Start Job](#start-job) - -- [Provider](#provider) - - [Get Project Provider](#get-project-provider) - - [Update Project Provider](#update-project-provider) - -- [Repo](#repo) - - [Clear Cache](#clear-cache) - - [Create Repo](#create-repo) - - [Delete Repo](#delete-repo) - -- [Session](#session) - - [Create New Session](#create-new-session) - - [Get Session](#get-session) - - - -# Account - -## Change Email +# Table of contents + +- [Account](#Account) + - [Change Email](#Change-Email) + - [Change jobs quantity on page](#Change-jobs-quantity-on-page) + - [Change Password](#Change-Password) + - [Delete Provider Account](#Delete-Provider-Account) + - [Update Provider Account](#Update-Provider-Account) +- [Admin](#Admin) + - [Get All Users](#Get-All-Users) + - [Revoke Invite](#Revoke-Invite) + - [Send Invite](#Send-Invite) +- [Branch](#Branch) + - [Add Branch](#Add-Branch) + - [Delete Branch](#Delete-Branch) + - [Reorder Branches](#Reorder-Branches) +- [Collaborators](#Collaborators) + - [Add Collaborator](#Add-Collaborator) + - [Delete Collaborator](#Delete-Collaborator) + - [Get Collaborators](#Get-Collaborators) +- [Job](#Job) + - [Get Latest Jobs](#Get-Latest-Jobs) + - [Start Job](#Start-Job) +- [Provider](#Provider) + - [Get Project Provider](#Get-Project-Provider) + - [Update Project Provider](#Update-Project-Provider) +- [Repo](#Repo) + - [Clear Cache](#Clear-Cache) + - [Create Repo](#Create-Repo) + - [Delete Repo](#Delete-Repo) +- [Session](#Session) + - [Create New Session](#Create-New-Session) + - [Get Session](#Get-Session) + +___ + + +# Account + +## Change Email [Back to top](#top)
Changes the email address for the active user (the API user).
- POST /account/email +``` +POST /account/email +``` + +### Parameters - `Request Body Parameters` +| Name | Type | Description | +|----------|------------|---------------------------------------| +| email | `String` |The new email address. This must be a VALID email address.
| +## Change jobs quantity on page +[Back to top](#top) -### Request Body Parameters Parameters +Changes the jobs quantity on page for the active user (the API user).
-| Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -| email | String |The new email address. This must be a VALID email address.
| +``` +POST /account/jobsQuantityOnPage +``` +### Parameters - `Request Body Parameters` +| Name | Type | Description | +|----------|------------|---------------------------------------| +| quantity | `Number` |The new value.
| -## Change Password +## Change Password [Back to top](#top)Changes the password for the active user (the API user).
- POST /account/password - - +``` +POST /account/password +``` -### Request Body Parameters Parameters +### Parameters - `Request Body Parameters` | Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -| password | String |The new password, which must be at least 6 characters long.
_Size range: 6.._The new password, which must be at least 6 characters long.
_Size range: 6.._Deletes a provider account for the active user (the API user).
- DELETE /account/:provider/:id - - +``` +DELETE /account/:provider/:id +``` -### Parameter Parameters +### Parameters - `Parameter` | Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -| provider | String |Type of provider, e.g. github
| -| id | Number |Unique provider identification
| - - +|----------|------------|---------------------------------------| +| provider | `String` |Type of provider, e.g. github
| +| id | `Number` |Unique provider identification
| -## Update Provider Account +## Update Provider Account [Back to top](#top)Updates a provider account for the active user (the API user).
- PUT /account/:provider/:id - - +``` +PUT /account/:provider/:id +``` -### Parameter Parameters +### Parameters - `Parameter` | Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -| provider | String |Type of provider, e.g. github
| -| id | Number |Unique provider identification
| - +|----------|------------|---------------------------------------| +| provider | `String` |Type of provider, e.g. github
| +| id | `Number` |Unique provider identification
| +# Admin -# Admin - -## Get All Users +## Get All Users [Back to top](#top)Retrieves a list of all Strider users.
- GET /admin/users +``` +GET /admin/users +``` ### Examples - CURL Example: -``` +```curl curl -X GET http://localhost/admin/users ``` - - -## Revoke Invite +## Revoke Invite [Back to top](#top)Revokes a previously sent Strider invitation.
- POST /admin/invite/revoke - - +``` +POST /admin/invite/revoke +``` -### Request Body Parameters Parameters +### Parameters - `Request Body Parameters` | Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -| invite_code | String |The invite code/token of the invite being revoked.
| -### Examples +|----------|------------|---------------------------------------| +| invite_code | `String` |The invite code/token of the invite being revoked.
| +### Examples CURL Example: -``` +```curl curl -X POST -d invite_code=xoxox http://localhost/invite/revoke ``` - - -## Send Invite +## Send Invite [Back to top](#top)Create & email a new Strider invite.
- POST /admin/invite/new - - +``` +POST /admin/invite/new +``` -### Request Body Parameters Parameters +### Parameters - `Request Body Parameters` | Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -| invite_code | String |The invite code/token to use in the invitation
| -| email | String |The email address of the new user being invited
| -### Examples +|----------|------------|---------------------------------------| +| invite_code | `String` |The invite code/token to use in the invitation
| +| email | `String` |The email address of the new user being invited
| +### Examples CURL Example: -``` +```curl curl -X POST -d invite_code=xoxox -d email=new_guy@strider-cd.com http://localhost/invite/new ``` +# Branch - -# Branch - -## Add Branch +## Add Branch [Back to top](#top)Add a new branch for a project.
- POST /:org/:repo/branches - - +``` +POST /:org/:repo/branches +``` -### Request Body Parameters Parameters +### Parameters - `Request Body Parameters` | Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -| name | String |The name of the new branch
| -| cloneName | String |The name of the cloned branch
| +|----------|------------|---------------------------------------| +| name | `String` |The name of the new branch
| +| cloneName | `String` |The name of the cloned branch
| -### Request URL Parameters Parameters +### Parameters - `Request URL Parameters` | Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -| org | String |The organization name for the project. This is usually a GitHub user or organization name (e.g. "strider" in "strider-cd/strider") but may vary from one project provider to another. (as another example, in GitLab this refers to the repository's "group").
| -| repo | String |The project's repository name.
| -### Examples +|----------|------------|---------------------------------------| +| org | `String` |The organization name for the project. This is usually a GitHub user or organization name (e.g. "strider" in "strider-cd/strider") but may vary from one project provider to another. (as another example, in GitLab this refers to the repository's "group").
| +| repo | `String` |The project's repository name.
| +### Examples CURL Example: -``` +```curl curl -X POST -d name=newbranch http://localhost/api/strider-cd/strider/branches ``` - - -## Delete Branch +## Delete Branch [Back to top](#top)Deletes a branch from a project
- DELETE /:org/:repo/branches - - +``` +DELETE /:org/:repo/branches +``` -### Request Body Parameters Parameters +### Parameters - `Request Body Parameters` | Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -| name | String |The name of the branch to delete
| +|----------|------------|---------------------------------------| +| name | `String` |The name of the branch to delete
| -### Request URL Parameters Parameters +### Parameters - `Request URL Parameters` | Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -| org | String |The organization name for the project. This is usually a GitHub user or organization name (e.g. "strider" in "strider-cd/strider") but may vary from one project provider to another. (as another example, in GitLab this refers to the repository's "group").
| -| repo | String |The project's repository name.
| -### Examples +|----------|------------|---------------------------------------| +| org | `String` |The organization name for the project. This is usually a GitHub user or organization name (e.g. "strider" in "strider-cd/strider") but may vary from one project provider to another. (as another example, in GitLab this refers to the repository's "group").
| +| repo | `String` |The project's repository name.
| +### Examples CURL Example: -``` +```curl curl -X DELETE -d name=mybranch http://localhost/api/strider-cd/strider/branches ``` - - -## Reorder Branches +## Reorder Branches [Back to top](#top)Updates the branch order for a project.
- PUT /:org/:repo/branches - - +``` +PUT /:org/:repo/branches +``` -### Request Body Parameters Parameters +### Parameters - `Request Body Parameters` | Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -| branches | String |The new branch order, comma delimited
| +|----------|------------|---------------------------------------| +| branches | `String` |The new branch order, comma delimited
| -### Request URL Parameters Parameters +### Parameters - `Request URL Parameters` | Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -| org | String |The organization name for the project. This is usually a GitHub user or organization name (e.g. "strider" in "strider-cd/strider") but may vary from one project provider to another. (as another example, in GitLab this refers to the repository's "group").
| -| repo | String |The project's repository name.
| -### Examples +|----------|------------|---------------------------------------| +| org | `String` |The organization name for the project. This is usually a GitHub user or organization name (e.g. "strider" in "strider-cd/strider") but may vary from one project provider to another. (as another example, in GitLab this refers to the repository's "group").
| +| repo | `String` |The project's repository name.
| +### Examples CURL Example: -``` +```curl curl -X PUT -d branches=master,testing http://localhost/api/strider-cd/strider/branches ``` +# Collaborators - -# Collaborators - -## Add Collaborator +## Add Collaborator [Back to top](#top)Add a new collaborator to a repository/project.
- POST /:org/:repo/collaborators - - +``` +POST /:org/:repo/collaborators +``` -### Request Body Parameters Parameters +### Parameters - `Request Body Parameters` | Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -| email | String |Email address to add. If the user is not registered with Strider, we will send them an invite. If they are already registered, they will receive a notification of access.
| -| access | Number |Access level to grant to the new collaborator. This can be 0
, for read only access, or 2
for admin access.
Email address to add. If the user is not registered with Strider, we will send them an invite. If they are already registered, they will receive a notification of access.
| +| access | `Number` |Access level to grant to the new collaborator. This can be 0
, for read only access, or 2
for admin access.
The organization name for the project. This is usually a GitHub user or organization name (e.g. "strider" in "strider-cd/strider") but may vary from one project provider to another. (as another example, in GitLab this refers to the repository's "group").
| -| repo | String |The project's repository name.
| -### Examples +|----------|------------|---------------------------------------| +| org | `String` |The organization name for the project. This is usually a GitHub user or organization name (e.g. "strider" in "strider-cd/strider") but may vary from one project provider to another. (as another example, in GitLab this refers to the repository's "group").
| +| repo | `String` |The project's repository name.
| +### Examples CURL Example: -``` +```curl curl -X GET -d '{"email":"new_guy@strider-cd.com", "access":2}' http://localhost/api/strider-cd/strider/collaborators ``` - - -## Delete Collaborator +## Delete Collaborator [Back to top](#top)Remove a collaborator from a repository/project.
- DELETE /:org/:repo/collaborators - - +``` +DELETE /:org/:repo/collaborators +``` -### Request Body Parameters Parameters +### Parameters - `Request Body Parameters` | Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -| email | String |Email address to remove from the repo/project.
| +|----------|------------|---------------------------------------| +| email | `String` |Email address to remove from the repo/project.
| -### Request URL Parameters Parameters +### Parameters - `Request URL Parameters` | Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -| org | String |The organization name for the project. This is usually a GitHub user or organization name (e.g. "strider" in "strider-cd/strider") but may vary from one project provider to another. (as another example, in GitLab this refers to the repository's "group").
| -| repo | String |The project's repository name.
| -### Examples +|----------|------------|---------------------------------------| +| org | `String` |The organization name for the project. This is usually a GitHub user or organization name (e.g. "strider" in "strider-cd/strider") but may vary from one project provider to another. (as another example, in GitLab this refers to the repository's "group").
| +| repo | `String` |The project's repository name.
| +### Examples CURL Example: -``` +```curl curl -X DELETE -d '{"email":"old_guy@strider-cd.com"}' http://localhost/api/strider-cd/strider/collaborators ``` - - -## Get Collaborators +## Get Collaborators [Back to top](#top)Gets a list of collaborators for a project
- GET /:org/:repo/collaborators - - +``` +GET /:org/:repo/collaborators +``` -### Request URL Parameters Parameters +### Parameters - `Request URL Parameters` | Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -| org | String |The organization name for the project. This is usually a GitHub user or organization name (e.g. "strider" in "strider-cd/strider") but may vary from one project provider to another. (as another example, in GitLab this refers to the repository's "group").
| -| repo | String |The project's repository name.
| -### Examples +|----------|------------|---------------------------------------| +| org | `String` |The organization name for the project. This is usually a GitHub user or organization name (e.g. "strider" in "strider-cd/strider") but may vary from one project provider to another. (as another example, in GitLab this refers to the repository's "group").
| +| repo | `String` |The project's repository name.
| +### Examples CURL Example: -``` +```curl curl -X GET http://localhost/api/strider-cd/strider/collaborators ``` +# Job - -# Job - -## Get Latest Jobs +## Get Latest Jobs [Back to top](#top)Return JSON object containing the most recent build status for each configured repo This function is used to build the main dashboard status page. The result is separated into {public: [], yours: []}
.
Note: the private ones are just ones that the current user is a collaborator on and are not necessarily private
- GET /api/jobs +``` +GET /api/jobs +``` ### Examples - CURL Example: -``` +```curl curl -X GET http://localhost/api/jobs ``` - - -## Start Job +## Start Job [Back to top](#top)Executes a strider test and, optionally, deployment.
- POST /:org/:repo/start - - +``` +POST /:org/:repo/start +``` -### Request Body Parameters Parameters +### Parameters - `Request Body Parameters` | Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -| type | String |Denotes the type of job to run. This can be "TEST_ONLY", which indicates that only the test stages of the job should be executed or "TEST_AND_DEPLOY", which indicates that all stages should be executed.
_Default value: TEST_ONLY_Indicates which branch configuration should be executed.
_Default value: master_An optional message to include as the title of the execution.
_Default value: Manually Retesting/Redeploying_Denotes the type of job to run. This can be "TEST_ONLY", which indicates that only the test stages of the job should be executed or "TEST_AND_DEPLOY", which indicates that all stages should be executed.
_Default value: TEST_ONLY_Indicates which branch configuration should be executed.
_Default value: master_An optional message to include as the title of the execution.
_Default value: Manually Retesting/Redeploying_The organization name for the project. This is usually a GitHub user or organization name (e.g. "strider" in "strider-cd/strider") but may vary from one project provider to another. (as another example, in GitLab this refers to the repository's "group").
| -| repo | String |The project's repository name.
| -### Examples +|----------|------------|---------------------------------------| +| org | `String` |The organization name for the project. This is usually a GitHub user or organization name (e.g. "strider" in "strider-cd/strider") but may vary from one project provider to another. (as another example, in GitLab this refers to the repository's "group").
| +| repo | `String` |The project's repository name.
| +### Examples CURL Example: -``` +```curl curl -X POST http://localhost/api/strider-cd/strider/start ``` +# Provider - -# Provider - -## Get Project Provider +## Get Project Provider [Back to top](#top)Get the provider config for the specified project
- GET /:org/:repo/provider - - +``` +GET /:org/:repo/provider +``` -### Request URL Parameters Parameters +### Parameters - `Request URL Parameters` | Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -| org | String |The organization name for the project. This is usually a GitHub user or organization name (e.g. "strider" in "strider-cd/strider") but may vary from one project provider to another. (as another example, in GitLab this refers to the repository's "group").
| -| repo | String |The project's repository name.
| -### Examples +|----------|------------|---------------------------------------| +| org | `String` |The organization name for the project. This is usually a GitHub user or organization name (e.g. "strider" in "strider-cd/strider") but may vary from one project provider to another. (as another example, in GitLab this refers to the repository's "group").
| +| repo | `String` |The project's repository name.
| +### Examples CURL Example: -``` +```curl curl -X GET http://localhost:3000/strider-cd/strider/provider ``` - - -## Update Project Provider +## Update Project Provider [Back to top](#top)Update a project's provider
- POST /:org/:repo/provider - - +``` +POST /:org/:repo/provider +``` -### Request URL Parameters Parameters +### Parameters - `Request URL Parameters` | Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -| org | String |The organization name for the project. This is usually a GitHub user or organization name (e.g. "strider" in "strider-cd/strider") but may vary from one project provider to another. (as another example, in GitLab this refers to the repository's "group").
| -| repo | String |The project's repository name.
| -### Examples +|----------|------------|---------------------------------------| +| org | `String` |The organization name for the project. This is usually a GitHub user or organization name (e.g. "strider" in "strider-cd/strider") but may vary from one project provider to another. (as another example, in GitLab this refers to the repository's "group").
| +| repo | `String` |The project's repository name.
| +### Examples CURL Example: -``` +```curl curl -X POST http://localhost:3000/strider-cd/strider/provider ``` +# Repo - -# Repo - -## Clear Cache +## Clear Cache [Back to top](#top)Clears/invalidates the cache for a project.
- DELETE /:org/:repo/cache - - +``` +DELETE /:org/:repo/cache +``` -### Request URL Parameters Parameters +### Parameters - `Request URL Parameters` | Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -| org | String |The organization name for the project. This is usually a GitHub user or organization name (e.g. "strider" in "strider-cd/strider") but may vary from one project provider to another. (as another example, in GitLab this refers to the repository's "group").
| -| repo | String |The project's repository name.
| -### Examples +|----------|------------|---------------------------------------| +| org | `String` |The organization name for the project. This is usually a GitHub user or organization name (e.g. "strider" in "strider-cd/strider") but may vary from one project provider to another. (as another example, in GitLab this refers to the repository's "group").
| +| repo | `String` |The project's repository name.
| +### Examples CURL Example: -``` +```curl curl -X DELETE http://localhost/api/strider-cd/strider/cache ``` - - -## Create Repo +## Create Repo [Back to top](#top)Create a new project for a repo.
- PUT /:org - - +``` +PUT /:org +``` -### Request Body Parameters Parameters +### Parameters - `Request Body Parameters` | Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -| name | String |The name of the new branch
| -| display_name | String |Human-readable project name
| -| display_url | String |The URL for the repo (e.g. Github homepage)
| -| public | Boolean |Whether this project is public or not.
_Default value: false_Whether the strider.json should be fetched in advance.
_Default value: true_The ID of provider account
| -| repo_id | String |The ID of the repo
| -| provider | Object |A json object with 'id' and 'config' properties.
| - - - -## Delete Repo +|----------|------------|---------------------------------------| +| name | `String` |The name of the new branch
| +| display_name | `String` |Human-readable project name
| +| display_url | `String` |The URL for the repo (e.g. Github homepage)
| +| public | `Boolean` |Whether this project is public or not.
_Default value: false_Whether the strider.json should be fetched in advance.
_Default value: true_The ID of provider account
| +| repo_id | `String` |The ID of the repo
| +| provider | `Object` |A json object with 'id' and 'config' properties.
| + +## Delete Repo [Back to top](#top)Deletes a repository/project. Also archives all jobs (marks as archived in DB which makes them hidden).
- DELETE /:org/:repo - - +``` +DELETE /:org/:repo +``` -### Request URL Parameters Parameters +### Parameters - `Request URL Parameters` | Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -| org | String |The organization name for the project. This is usually a GitHub user or organization name (e.g. "strider" in "strider-cd/strider") but may vary from one project provider to another. (as another example, in GitLab this refers to the repository's "group").
| -| repo | String |The project's repository name.
| -### Examples +|----------|------------|---------------------------------------| +| org | `String` |The organization name for the project. This is usually a GitHub user or organization name (e.g. "strider" in "strider-cd/strider") but may vary from one project provider to another. (as another example, in GitLab this refers to the repository's "group").
| +| repo | `String` |The project's repository name.
| +### Examples CURL Example: -``` +```curl curl -X DELETE http://localhost/api/strider-cd/strider ``` +# Session - -# Session - -## Create New Session +## Create New Session [Back to top](#top)Creates a new user session after validating an email address and password pair.
- POST /api/session - - +``` +POST /api/session +``` -### Request Body Parameters Parameters +### Parameters - `Request Body Parameters` | Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -| email | String |The email address to login as (which is used as the username).
| -| password | String |The user's password.
| -### Examples +|----------|------------|---------------------------------------| +| email | `String` |The email address to login as (which is used as the username).
| +| password | `String` |The user's password.
| +### Examples CURL Example: -``` +```curl curl -X POST -d email=me@me.com -d password=mypass http://localhost/api/session ``` - - -## Get Session +## Get Session [Back to top](#top)Gets the current session information
- GET /api/session +``` +GET /api/session +``` ### Examples - CURL Example: -``` +```curl curl -X GET http://localhost/api/session ``` - - -