# -*- coding: utf-8 -*- """ Python OBS 'source' API ~~~~~~~~~~~~~~~~~~~~~~~ This module provides the ObsSourceAPI class used for accessing the `Open Build Service '_ APIs related to `sources `_. :copyright: Copyright (c) 2015-2020 Scott Bahling This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (see the file COPYING); if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA :license: GPL-2.0, see COPYING for details """ from obsapi.httpapi import ObsHttpApi class ObsSourceApi(ObsHttpApi): rootapi = '/source/' def __get(self, *args, **kwargs): return super(ObsSourceApi, self).get(*args, **kwargs) def __put(self, *args, **kwargs): return super(ObsSourceApi, self).put(*args, **kwargs) def __post(self, *args, **kwargs): return super(ObsSourceApi, self).post(*args, **kwargs) def get(self, prj=None, pkg=None, filename=None, binary_get=None, **kwargs): if filename: binary_get = True return self.__get(prj, pkg, filename, binary_get=binary_get, **kwargs) def put(self, prj, pkg=None, filename=None, data=None, **kwargs): return self.__put(prj, pkg, filename, data, **kwargs) def post(self, prj, pkg=None, filename=None, data=None, **kwargs): return self.__post(prj, pkg, filename, data, **kwargs) def get_meta(self, prj, pkg=''): return self.__get(prj, pkg, '_meta') def put_meta(self, prj, pkg=None, meta=None): return self.__put(prj, pkg, '_meta', data=meta) def get_attribute(self, prj, pkg=None, binary=None, attribute=None): return self.__get(prj, pkg, binary, '_attribute', attribute) def get_config(self, prj): return self.__get(prj, '_config') def put_config(self, prj, data): return self.__put(prj, '_config', data=data) def get_pattern(self, prj, patternfile=''): return self.__get(prj, '_pattern', patternfile) def put_pattern(self, prj, patternfile, data): return self.__put(prj, '_pattern', patternfile, data=data) def get_pubkey(self, prj): return self.__get(prj, '_pubkey') def get_history(self, prj, pkg): return self.__get(prj, pkg, '_history')