]> git.ipfire.org Git - people/stevee/pakfire.git/blob - python/pakfire/client.py
c1f7ba65c12c136070a585fab992be088e11ea39
[people/stevee/pakfire.git] / python / pakfire / client.py
1 #!/usr/bin/python
2 ###############################################################################
3 # #
4 # Pakfire - The IPFire package management system #
5 # Copyright (C) 2013 Pakfire development team #
6 # #
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. #
11 # #
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. #
16 # #
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/>. #
19 # #
20 ###############################################################################
21
22 import transport
23
24 from pakfire.constants import *
25 from pakfire.i18n import _
26
27 import logging
28 log = logging.getLogger("pakfire.client")
29
30 class PakfireClient(object):
31 def __init__(self, config):
32 self.config = config
33
34 # Create connection to the hub.
35 self.transport = transport.PakfireHubTransport(self.config)
36
37 def build_create(self, *args, **kwargs):
38 return self.transport.build_create(*args, **kwargs)
39
40 def build_get(self, *args, **kwargs):
41 return self.transport.build_get(*args, **kwargs)
42
43 def job_get(self, *args, **kwargs):
44 return self.transport.job_get(*args, **kwargs)
45
46 def package_get(self, *args, **kwargs):
47 return self.transport.package_get(*args, **kwargs)
48
49 # XXX OLD CODE
50
51 class PakfireUserClient(PakfireClient):
52 type = "user"
53
54 def check_auth(self):
55 """
56 Check if the user was successfully authenticated.
57 """
58 return self.conn.check_auth()
59
60 def get_user_profile(self):
61 """
62 Get information about the user profile.
63 """
64 return self.conn.get_user_profile()
65
66 def get_builds(self, type=None, limit=10, offset=0):
67 return self.conn.get_builds(type=type, limit=limit, offset=offset)
68
69 def get_build(self, build_id):
70 return self.conn.get_build(build_id)
71
72 def get_builder(self, builder_id):
73 return self.conn.get_builder(builder_id)
74
75 def get_job(self, job_id):
76 return self.conn.get_job(job_id)
77
78 def get_latest_jobs(self):
79 return self.conn.get_latest_jobs()
80
81 def get_active_jobs(self):
82 return self.conn.get_active_jobs()
83