public virtual async Task <AppVeyorServiceResponse <Build> > StartBuild(string accountName, string projectSlug, string branchName) { var response = new AppVeyorServiceResponse <Build>(); try { Condition.Requires(accountName, "accountName").IsNotNullOrEmpty(); Condition.Requires(projectSlug, "projectSlug").IsNotNullOrEmpty(); Condition.Requires(branchName, "branchName").IsNotNullOrEmpty(); var request = new RestRequest("builds", Method.POST); request.AddJsonBody(new { accountName, projectSlug, branch = branchName }); var build = await ExecuteAsync <Build>(request); response.Result = build; } catch (Exception exception) { response.Exception = exception; response.HasError = true; } return(response); }
public async Task <AppVeyorServiceResponse <List <Project> > > GetProjectsAsync() { var request = new RestRequest("projects", Method.GET); var response = new AppVeyorServiceResponse <List <Project> >(); try { var projects = await ExecuteAsync <List <Project> >(request); response.Result = projects; } catch (Exception exception) { response.Exception = exception; response.HasError = true; } return(response); }
public async Task <AppVeyorServiceResponse <HttpStatusCode> > CancelBuild(string accountName, string projectSlug, string buildVersion) { var response = new AppVeyorServiceResponse <HttpStatusCode>(); try { Condition.Requires(accountName, "accountName").IsNotNullOrEmpty(); Condition.Requires(projectSlug, "projectSlug").IsNotNullOrEmpty(); Condition.Requires(buildVersion, "buildVersion").IsNotNullOrEmpty(); var request = new RestRequest("builds/{accountName}/{projectSlug}/{buildVersion}", Method.DELETE); request.AddUrlSegment("accountName", accountName); request.AddUrlSegment("projectSlug", projectSlug); request.AddUrlSegment("buildVersion", buildVersion); var stopResult = await ExecuteAsync <HttpStatusCode>(request); response.Result = stopResult; } catch (Exception exception) { response.Exception = exception; response.HasError = true; } return(response); }