From 78b810f63c620312f1e00b51a60202e80337bf5c Mon Sep 17 00:00:00 2001 From: ehsan Date: Wed, 7 Oct 2020 12:43:16 +0330 Subject: [PATCH] get view xml #472 --- .../com/offbytwo/jenkins/JenkinsServer.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java b/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java index 01755baa..5eb962dc 100644 --- a/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java +++ b/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java @@ -260,6 +260,29 @@ public View getView(FolderJob folder, String name) throws IOException { } } + /** + * Get the xml description of an existing view + * + * @param viewName name of the view. + * @return the new view object + * @throws IOException in case of an error. + */ + public String getViewXml(String viewName) throws IOException { + return getJobXml(null, viewName); + } + + /** + * Get the xml description of an existing vie. + * + * @param viewName name of the view. + * @param folder {@link FolderJob} + * @return the new job object + * @throws IOException in case of an error. + */ + public String getViewXml(FolderJob folder, String viewName) throws IOException { + return client.get(UrlUtils.toJobBaseUrl(folder, viewName) + "/config.xml"); + } + /** * Get a single Job from the server. *