Documentation (2024.2 Enterprise)

# Repository Bot

Repository Bot is the link object between Repositories and Bots. With them, you define which bots belong to what repository, and what they can do in the repository.

- Attributes

- Operations

  - GET /projects/:project_id/repositories/:repository_id/repository-bots
  - GET /projects/:project_id/repositories/:repository_id/repository-bots/:repository_bot_id
  - POST /projects/:project_id/repositories/:repository_id/repository-bots
  - PUT/PATCH /projects/:project_id/repositories/:repository_id/repository-bots/:repository_bot_id
  - DELETE /projects/:project_id/repositories/:repository_id/repository-bots/:repository_bot_id

## Attributes

### role

The role the bots have directly in the repository. Must be one of master, developer, or guest.

- Type: string
- Required: true

## Operations

### GET /projects/:project_id/repositories/:repository_id/repository-bots

List all repository bots for a repository.

#### Example request

    curl -X GET \
      -H "Accept: application/vnd.api+json" \
      -H "Content-Type: application/vnd.api+json" \
      -H "Authorization: Token $ACCOUNT_KEY" \
      https://helixteamhub.cloud/api/v2/projects/luotsi/repositories/acme/repository-bots

#### Example response

    {
      "data": [
        {
          "id": "f90da853-c5f2-4e55-9fa5-773e83b78784_85b7af71-3eb5-4526-8aa9  -f9219391c506",
          "type": "repository-bots",
          "attributes": {
            "role": "guest"
          },
          "relationships": {
            "repository": {
              "data": {
                "id": "f90da853-c5f2-4e55-9fa5-773e83b78784",
                "type": "repositories"
              }
            },
            "bot": {
              "data": {
                "id": "85b7af71-3eb5-4526-8aa9-f9219391c506",
                "type": "bots"
              }
            }
          }
        },
        {
          "id": "f90da853-c5f2-4e55-9fa5-773e83b78784_4fe239d7-6913-4ed3-b2a4-c92cfa8f68af",
          "type": "repository-bots",
          "attributes": {
            "role": "master"
          },
          "relationships": {
            "repository": {
              "data": {
                "id": "f90da853-c5f2-4e55-9fa5-773e83b78784",
                "type": "repositories"
              }
            },
            "bot": {
              "data": {
                "id": "4fe239d7-6913-4ed3-b2a4-c92cfa8f68af",
                "type": "bots"
              }
            }
          }
        }
      ],
      "links": {
        "self": "https://helixteamhub.cloud/api/v2/projects/luotsi/repositories/acme/repository-bots?page%5Bnumber%5D=1&page%5Bsize%5D=25",
        "first": "https://helixteamhub.cloud/api/v2/projects/luotsi/repositories/acme/repository-bots?page%5Bnumber%5D=1&page%5Bsize%5D=25",
        "prev": null,
        "next": null,
        "last": "https://helixteamhub.cloud/api/v2/projects/luotsi/repositories/acme/repository-bots?page%5Bnumber%5D=1&page%5Bsize%5D=25"
      },
      "meta": {
        "total": 2
      }
    }

### GET /projects/:project_id/repositories/:repository_id/repository-bots/:repository_bot_id

Return a specific repository bot. The repository_bot_id can be constructed by joining the repository_id and bot_id (or short-name attributes) using an underscore (_).

#### Example request

    curl -X GET \
      -H "Accept: application/vnd.api+json" \
      -H "Content-Type: application/vnd.api+json" \
      -H "Authorization: Token $ACCOUNT_KEY" \
      https://helixteamhub.cloud/api/v2/projects/luotsi/repositories/acme/repository-bots/acme_my-bot

#### Example response

    {
      "data": {
        "id": "f90da853-c5f2-4e55-9fa5-773e83b78784_85b7af71-3eb5-4526-8aa9-f9219391c506",
        "type": "repository-bots",
        "attributes": {
        "role": "master"
      },
        "relationships": {
          "repository": {
            "data": {
              "id": "f90da853-c5f2-4e55-9fa5-773e83b78784",
              "type": "repositories"
            }
          },
          "bot": {
            "data": {
              "id": "85b7af71-3eb5-4526-8aa9-f9219391c506",
              "type": "bots"
            }
          }
        }
      }
    }

### POST /projects/:project_id/repositories/:repository_id/repository-bots

Add a repository bot for a repository. The bot must have a project role before a repository role can be defined.

#### Example request

    curl -X POST \
      -H "Accept: application/vnd.api+json" \
      -H "Content-Type: application/vnd.api+json" \
      -H "Authorization: Token $ACCOUNT_KEY" \
      -d '{ "data": { "attributes": { "role": "developer" }, "relationships": { "bot": { "data": { "type": "bots", "id": "4fe239d7-6913-4ed3-b2a4-c92cfa8f68af" } } }, "type": "repository-bots" } }' \
      https://helixteamhub.cloud/api/v2/projects/luotsi/repositories/acme/repository-bots

#### Example response

    {
      "data": {
        "attributes": {
          "role": "developer"
        },
        "id": "f90da853-c5f2-4e55-9fa5-773e83b78784_85b7af71-3eb5-4526-8aa9-f9219391c506",
        "relationships": {
          "bot": {
            "data": {
              "id": "85b7af71-3eb5-4526-8aa9-f9219391c506",
              "type": "bots"
            }
          },
          "repository": {
            "data": {
              "id": "f90da853-c5f2-4e55-9fa5-773e83b78784",
              "type": "repositories"
            }
          }
        },
        "type": "repository-bots"
      }
    }

### PUT/PATCH /projects/:project_id/repositories/:repository_id/repository-bots/:repository_bot_id

Update role for a repository bot. Returns the updated repository bot.

#### Example request

    curl -X PATCH \
      -H "Accept: application/vnd.api+json" \
      -H "Content-Type: application/vnd.api+json" \
      -H "Authorization: Token $ACCOUNT_KEY" \
      -d '{ "data": { "attributes": { "role": "master" } } }' \
      https://helixteamhub.cloud/api/v2/projects/luotsi/repositories/acme/repository-bots/acme_my-bot

#### Example response

    {
      "data": {
        "attributes": {
          "role": "master"
        },
        "id": "f90da853-c5f2-4e55-9fa5-773e83b78784_85b7af71-3eb5-4526-8aa9-f9219391c506",
        "relationships": {
          "bot": {
            "data": {
              "id": "85b7af71-3eb5-4526-8aa9-f9219391c506",
              "type": "bots"
            }
          },
          "repository": {
            "data": {
              "id": "f90da853-c5f2-4e55-9fa5-773e83b78784",
              "type": "repositories"
            }
          }
        },
        "type": "repository-bots"
      }
    }

### DELETE /projects/:project_id/repositories/:repository_id/repository-bots/:repository_bot_id

Remove the bot from the repository. Returns 204 status code and a blank response.

#### Example request

    curl -X DELETE \
      -H "Accept: application/vnd.api+json" \
      -H "Authorization: Token $ACCOUNT_KEY" \
      https://helixteamhub.cloud/api/v2/projects/luotsi/repositories/acme/repository-bots/acme-my_bot

Your search for returned results

Your search for returned results