Repository User
Repository User is the link object between Repositories and Users. With them, you define who belongs to what repository, and what they can do in the repository.
- Attributes
-
- GET /projects/:project_id/repositories/:repository_id/repository_users
- GET /projects/:project_id/repositories/:repository_id/repository_users/:user_id
- POST /projects/:project_id/repositories/:repository_id/repository_users
- PUT /projects/:project_id/repositories/:repository_id/repository_users/:user_id
- DELETE /projects/:project_id/repositories/:repository_id/repository_users/:user_id
Attributes
repository
The ID of the repository that the membership is meant for. When requesting, can be expanded to the full repository object by including the query parameter expand=repository.
- Type: string
- Required: true
user
The ID of the user that the membership is meant for. When requesting, can be expanded to the full user object by including the query parameter expand=user.
- Type: string
- Required: true
role
The role that the user has directly in the repository. Must be one of admin, master, developer, or guest.
- Type: string
- Required: true
highest_role
The highest role that the user has in the repository. This field is automatically updated.
- Type: string
Operations
GET /projects/:project_id/repositories/:repository_id/repository_users
Lists all repository users for a repository, with optional limit and offset parameters, as a metadata-results object.
GET /projects/:project_id/repositories/:repository_id/repository_users/:user_id
Returns a specific repository user.
Example request
curl -X GET \
-H "Accept: application/vnd.hth.v1" \
-H "Authorization: company_key='$COMPANY_KEY',account_key='$ACCOUNT_KEY'" \
https://helixteamhub.cloud/api/projects/luotsi/repositories/acme/repository_users/johndoe
Example response
{
"api_status": 200,
"api_timestamp": "2018-10-25T09:29:37Z",
"repository": {
"id": "acme"
},
"user": {
"id": "johndoe"
},
"role": "developer",
"highest_role": "admin"
}
POST /projects/:project_id/repositories/:repository_id/repository_users
Adds a repository user for a repository. The user must have a project role either directly or through a group before a repository role can be defined.
Example request
curl -X POST \
-H "Accept: application/vnd.hth.v1" \
-H "Authorization: company_key='$COMPANY_KEY',account_key='$ACCOUNT_KEY'" \
-H "Content-Type: application/json" \
-d '{ "repository_user": { "id": "johndoe", "role": "guest" } }' \
https://helixteamhub.cloud/api/projects/luotsi/repositories/acme/repository_users
Example response
{
"api_status": 201,
"api_timestamp": "2018-10-25T09:29:37Z",
"repository": {
"id": "acme"
},
"user": {
"id": "johndoe"
},
"role": "guest",
"highest_role": "guest"
}
PUT /projects/:project_id/repositories/:repository_id/repository_users/:user_id
Updates the role for a repository user. Returns the updated repository user.
Example request
curl -X PUT \
-H "Accept: application/vnd.hth.v1" \
-H "Authorization: company_key='$COMPANY_KEY',account_key='$ACCOUNT_KEY'" \
-H "Content-Type: application/json" \
-d '{ "repository_user": { "role": "admin" } }' \
https://helixteamhub.cloud/api/projects/luotsi/repositories/acme/repository_users/johndoe
Example response
{
"api_status": 200,
"api_timestamp": "2018-11-28T10:12:20Z",
"repository": {
"id": "acme"
},
"user": {
"id": "johndoe"
},
"role": "admin",
"highest_role": "admin"
}
DELETE /projects/:project_id/repositories/:repository_id/repository_users/:user_id
Removes a user from a repository. Returns the removed repository user.
Example request
curl -X DELETE \
-H "Accept: application/vnd.hth.v1" \
-H "Authorization: company_key='$COMPANY_KEY',account_key='$ACCOUNT_KEY'" \
https://helixteamhub.cloud/api/projects/luotsi/repositories/acme/repository_users/johndoe
Example response
{
"api_status": 200,
"api_timestamp": "2018-11-28T10:12:28Z",
"repository": {
"id": "acme"
},
"user": {
"id": "johndoe"
},
"role": "admin",
"highest_role": "admin"
}