Contributors endpoint¶
Fetch all contributors¶
- contributors(project_id[, params=None])¶
- Parameters:
project_id (str) – ID of the project to fetch contributors for.
params (dict) – (optional) pagination options
- Returns:
Collection of contributors
Example:
client.contributors('123.abc', {"limit": 3, "page": 2})
Fetch a single contributor¶
- contributor(project_id, contributor_id)¶
- Parameters:
project_id (str) – ID of the project
contributor_id (int or str) – ID of the contributor to fetch
- Returns:
Contributor model
Example:
contributor = client.contributor('123.abc', 2345)
contributor.email == "test@example.com"
contributor.fullname == "John Doe"
Fetch current contributor¶
This endpoint returns contributor in the given project based on the user whose token is used to send the request. In other words, it returns information about self in scope of a project.
- current_contributor(project_id)¶
- Parameters:
project_id (str) – ID of the project
- Returns:
Contributor model
Example:
contributor = client.current_contributor('123.abc')
contributor.fullname == "John Doe"
Create one or multiple contributors¶
- create_contributors(project_id, params)¶
- Parameters:
project_id (str) – ID of the project
params (list or dict) – Contributors parameters
- Returns:
Contributors collection
Creating multiple contributors example:
client.create_contributors('123.abc', [
{
"email": "demo@python.org",
"fullname": "Python demo 1",
"languages": [{
"lang_iso": "en",
"is_writable": False
}]
},
{
"email": "demo2@python.org",
"fullname": "Python demo 2",
"languages": [{
"lang_iso": "en",
"is_writable": True
}]
}
])
Creating one contributor:
client.create_contributors(PROJECT_ID, {
"email": "demo3@python.org",
"fullname": "Python demo 3",
"languages": [{
"lang_iso": "ru_RU",
"is_writable": True
}]
})
Update contributor¶
- update_contributor(project_id, contributor_id, params)¶
- Parameters:
project_id (str) – ID of the project
contributor_id (int or str) – ID of the contributor to update
params (dict) – Update parameters
- Returns:
Contributor model
Example:
client.update_contributor('123.abc', 23456, {
"is_reviewer": True,
"languages": [
{
"lang_iso": "ru_RU",
"is_writable": True
},
{
"lang_iso": "en",
"is_writable": False
}
]
})
Delete contributor¶
- delete_contributor(project_id, contributor_id)¶
- Parameters:
project_id (str) – ID of the project
contributor_id (int or str) – ID of the contributor to delete
- Returns:
Dictionary with project ID and “contributor_deleted” set to True
- Rtype dict:
Example:
client.delete_contributor('123.abc', 34567)