From 2264eb9ce912ac9b1e1916d12ca7ed4787741b17 Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Wed, 14 Feb 2024 10:26:10 +0100 Subject: [PATCH] Add obs_api.Project.to_api() --- osc/obs_api/project.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osc/obs_api/project.py b/osc/obs_api/project.py index 9c6cf501..0fc33e5e 100644 --- a/osc/obs_api/project.py +++ b/osc/obs_api/project.py @@ -8,6 +8,7 @@ from .project_link import ProjectLink from .project_maintenance_maintains import ProjectMaintenanceMaintains from .repository import Repository from .simple_flag import SimpleFlag +from .status import Status class Project(XmlModel): @@ -112,3 +113,10 @@ class Project(XmlModel): url_query = {} response = cls.xml_request("GET", apiurl, url_path, url_query) return cls.from_file(response) + + def to_api(self, apiurl, *, project=None): + project = project or self.name + url_path = ["source", project, "_meta"] + url_query = {} + response = self.xml_request("PUT", apiurl, url_path, url_query, data=self.to_string()) + return Status.from_file(response)