python/aiovieter/targets.py

25 lines
801 B
Python

class VieterTargets:
def __init__(self, vieter):
self._vieter = vieter
async def list(self, offset: int = 0, limit: int = 25, repo: str = None) -> dict:
params = {"offset": offset, "limit": limit, "repo": repo}
return await self._vieter._get("/targets", params=params)
async def info(self, repo_id: int) -> dict:
return await self._vieter._get(f"/targets/{repo_id}")
async def create(self, url: str, branch: str, repo: str, schedule: str = None, arch: [str] = None):
params = {
'url': url,
'branch': branch,
'repo': repo,
'schedule': schedule,
}
if arch is not None:
params['arch'] = arch.join(',')
await self._vieter._post('/targets', params=params)