]>
git.ipfire.org Git - people/stevee/pakfire.git/blob - python/pakfire/client.py
c1f7ba65c12c136070a585fab992be088e11ea39
2 ###############################################################################
4 # Pakfire - The IPFire package management system #
5 # Copyright (C) 2013 Pakfire development team #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
24 from pakfire
.constants
import *
25 from pakfire
.i18n
import _
28 log
= logging
.getLogger("pakfire.client")
30 class PakfireClient(object):
31 def __init__(self
, config
):
34 # Create connection to the hub.
35 self
.transport
= transport
.PakfireHubTransport(self
.config
)
37 def build_create(self
, *args
, **kwargs
):
38 return self
.transport
.build_create(*args
, **kwargs
)
40 def build_get(self
, *args
, **kwargs
):
41 return self
.transport
.build_get(*args
, **kwargs
)
43 def job_get(self
, *args
, **kwargs
):
44 return self
.transport
.job_get(*args
, **kwargs
)
46 def package_get(self
, *args
, **kwargs
):
47 return self
.transport
.package_get(*args
, **kwargs
)
51 class PakfireUserClient(PakfireClient
):
56 Check if the user was successfully authenticated.
58 return self
.conn
.check_auth()
60 def get_user_profile(self
):
62 Get information about the user profile.
64 return self
.conn
.get_user_profile()
66 def get_builds(self
, type=None, limit
=10, offset
=0):
67 return self
.conn
.get_builds(type=type, limit
=limit
, offset
=offset
)
69 def get_build(self
, build_id
):
70 return self
.conn
.get_build(build_id
)
72 def get_builder(self
, builder_id
):
73 return self
.conn
.get_builder(builder_id
)
75 def get_job(self
, job_id
):
76 return self
.conn
.get_job(job_id
)
78 def get_latest_jobs(self
):
79 return self
.conn
.get_latest_jobs()
81 def get_active_jobs(self
):
82 return self
.conn
.get_active_jobs()