private static RestSession createSessionAndLogin(BambooServer server)
        {
            RestSession s = new RestSession(server);

            s.login(server.UserName, server.Password);
            return(s);
        }
        public BambooServer(BambooServer other) : base(other)
        {
            if (other == null)
            {
                return;
            }
            UseFavourites      = other.UseFavourites;
            ShowBranches       = other.ShowBranches;
            ShowMyBranchesOnly = other.ShowMyBranchesOnly;

            if (other.PlanKeys != null)
            {
                PlanKeys = new List <string>(other.PlanKeys);
            }
        }
 public BambooBuild(
     BambooServer server, string key, string projectName, string masterPlanKey,
     BuildResult result, int number, string relativeTime,
     string duration, int successfulTests, int failedTests, string reason, PlanState state,
     ICollection <RelatedIssue> relatedIssues)
 {
     MasterPlanKey   = masterPlanKey;
     ProjectKey      = key.Split(new[] { '-' })[0];
     ProjectName     = projectName;
     Server          = server;
     Key             = key;
     Result          = result;
     Number          = number;
     RelativeTime    = relativeTime;
     Duration        = duration;
     SuccessfulTests = successfulTests;
     FailedTests     = failedTests;
     Reason          = reason;
     State           = state;
     RelatedIssues   = relatedIssues;
 }
        public BambooBuild getBuildByKey(BambooServer server, string buildKey)
        {
            RestSession session = createSessionAndLogin(server);

            return(wrapExceptions(session, () => session.getBuildByKey(buildKey)));
        }
        public void addLabel(BambooServer server, string planKey, int buildNumber, string label)
        {
            RestSession session = createSessionAndLogin(server);

            wrapExceptionsVoid(session, () => session.addLabel(planKey, buildNumber, label));
        }
        public void addComment(BambooServer server, string planKey, int buildNumber, string comment)
        {
            RestSession session = createSessionAndLogin(server);

            wrapExceptionsVoid(session, () => session.addComment(planKey, buildNumber, comment));
        }
        public void runBuild(BambooServer server, string planKey)
        {
            RestSession session = createSessionAndLogin(server);

            wrapExceptionsVoid(session, () => session.runBuild(planKey));
        }
        public ICollection <BambooBuild> getLatestBuildsForPlanKeys(BambooServer server, ICollection <string> keys)
        {
            RestSession session = createSessionAndLogin(server);

            return(wrapExceptions(session, () => session.getLatestBuildsForPlanKeys(keys)));
        }
        public ICollection <BambooBuild> getLatestBuildsForFavouritePlans(BambooServer server)
        {
            RestSession session = createSessionAndLogin(server);

            return(wrapExceptions(session, () => session.getLatestBuildsForFavouritePlans()));
        }
        public ICollection <BambooPlan> getPlanList(BambooServer server)
        {
            RestSession session = createSessionAndLogin(server);

            return(wrapExceptions(session, () => session.getAllPlans()));
        }
        public int getServerBuildNumber(BambooServer server)
        {
            var session = createSessionAndLogin(server);

            return(wrapExceptions <int>(session, () => session.getServerBuildNumber()));
        }
 public void login(BambooServer server)
 {
     new RestSession(server).login(server.UserName, server.Password);
 }
//        public string getBuildLog(BambooBuild build) {
//            RestSession session = createSessionAndLogin(build.Server);
//            return wrapExceptions(session, () => session.getBuildLog(build));
//        }

        public string getBuildLog(BambooServer server, string logUrl)
        {
            RestSession session = createSessionAndLogin(server);

            return(wrapExceptions(session, () => session.getBuildLog(logUrl)));
        }
        public ICollection <BambooBuild> getLastNBuildsForPlan(BambooServer server, string planKey, int howMany)
        {
            RestSession session = createSessionAndLogin(server);

            return(wrapExceptions(session, () => session.getLastNBuildsForPlan(planKey, howMany)));
        }