static async Task TestBuildOperationApi(Configuration config, string orgId, string projectId, List <InlineResponse2003> buildTargets) { // Get Build Detail var buildApi = new UnityCloudBuildApi.IO.Swagger.Api.BuildsApi(config); var build = await buildApi.GetBuildsAsync(orgId, projectId, buildTargets.FirstOrDefault().Buildtargetid); var piyo = build.Select(x => x.ToJson()); // Start Build var option = new Options4 { Clean = false, Delay = 0, }; var startBuild = await buildApi.StartBuildsAsync(orgId, projectId, buildTargets.FirstOrDefault().Buildtargetid, option); var poyo = startBuild.Select(x => x.ToJson()); // Cancel All queued Build foreach (var item in build.Where(x => x.BuildStatus == "queued")) { var cancelBuilds = await buildApi.CancelAllBuildsAsync(orgId, projectId, item.Buildtargetid); var koko = cancelBuilds.Select(x => x.ToString()); } // Cancel Specific Builds var cancelBuild = await buildApi.CancelBuildAsync(orgId, projectId, buildTargets.FirstOrDefault().Buildtargetid, startBuild.FirstOrDefault().Build.ToString()); #endregion }
public static async Task <string[]> StartBuild(StartaBuildParam param) { Debug.WriteLine("StartBuild with: " + param); var buildTargetsApi = new UnityCloudBuildApi.IO.Swagger.Api.BuildtargetsApi(config); Debug.WriteLine("StartBuild 1"); // Get BuildTargets for list BuildTargetId var buildTargets = await buildTargetsApi.GetBuildTargetsAsync(OrgId, ProjectId, "settings"); Debug.WriteLine("StartBuild 2"); var targets = from x in buildTargets where x.Platform == param.Platform where x.Settings != null && x.Settings.Advanced != null && x.Settings.Advanced.Unity != null let symbolsStr = x.Settings.Advanced.Unity.ScriptingDefineSymbols let symbolList = symbolsStr.Split(';') let release = symbolList.Contains("RELEASE") let realStore = symbolList.Contains("REAL_STORE") where release == param.ReleaseBuild where realStore == param.RealStore let relVer0 = symbolList.Contains("RELEASEVER_0") let relVer1 = symbolList.Contains("RELEASEVER_1") let relVer2 = symbolList.Contains("RELEASEVER_2") let relVer3 = symbolList.Contains("RELEASEVER_3") where (param.ReleaseVer == 3 && (relVer0 && relVer1 && relVer2 && relVer3)) || (param.ReleaseVer == 2 && (relVer0 && relVer1 && relVer2) && (!relVer3)) || (param.ReleaseVer == 1 && (relVer0 && relVer1) && (!relVer2 && !relVer3)) || (param.ReleaseVer == 0 && (relVer0) && (!relVer1 && !relVer2 && !relVer3)) select x; Debug.WriteLine("StartBuild 3: " + targets.Count()); var buildApi = new UnityCloudBuildApi.IO.Swagger.Api.BuildsApi(config); foreach (var target in targets) { var opt4 = new Options4 { Clean = param.CleanBuild, Delay = 0, }; Debug.WriteLine("Build: " + target.Buildtargetid); await buildApi.StartBuildsAsync(OrgId, ProjectId, target.Buildtargetid, opt4); } Debug.WriteLine("StartBuild 4: "); return(targets.Select(x => x.Name).ToArray()); }
/// <summary> /// Create new build Start the build process for this build target (or all targets,\nif '_all' is specified as the buildtargetid), if there is not one\ncurrently in process.\n\nIf a build is currently in process that information will be related\nin the 'error' field. /// </summary> /// <param name="orgid">Organization identifier</param> /// <param name="projectid">Project identifier</param> /// <param name="buildtargetid">unique id auto-generated from the build target name</param> /// <param name="options">Options for starting the builds</param> /// <returns>Task of List<OrgsorgidprojectsprojectidbuildtargetsBuilds></returns> public async System.Threading.Tasks.Task<List<OrgsorgidprojectsprojectidbuildtargetsBuilds>> StartBuildsAsync (string orgid, string projectid, string buildtargetid, Options4 options = null) { ApiResponse<List<OrgsorgidprojectsprojectidbuildtargetsBuilds>> response = await StartBuildsAsyncWithHttpInfo(orgid, projectid, buildtargetid, options); return response.Data; }
/// <summary> /// Create new build Start the build process for this build target (or all targets,\nif '_all' is specified as the buildtargetid), if there is not one\ncurrently in process.\n\nIf a build is currently in process that information will be related\nin the 'error' field. /// </summary> /// <param name="orgid">Organization identifier</param> /// <param name="projectid">Project identifier</param> /// <param name="buildtargetid">unique id auto-generated from the build target name</param> /// <param name="options">Options for starting the builds</param> /// <returns>Task of ApiResponse (List<OrgsorgidprojectsprojectidbuildtargetsBuilds>)</returns> public async System.Threading.Tasks.Task<ApiResponse<List<OrgsorgidprojectsprojectidbuildtargetsBuilds>>> StartBuildsAsyncWithHttpInfo (string orgid, string projectid, string buildtargetid, Options4 options = null) { // verify the required parameter 'orgid' is set if (orgid == null) throw new ApiException(400, "Missing required parameter 'orgid' when calling StartBuilds"); // verify the required parameter 'projectid' is set if (projectid == null) throw new ApiException(400, "Missing required parameter 'projectid' when calling StartBuilds"); // verify the required parameter 'buildtargetid' is set if (buildtargetid == null) throw new ApiException(400, "Missing required parameter 'buildtargetid' when calling StartBuilds"); var path_ = "/orgs/{orgid}/projects/{projectid}/buildtargets/{buildtargetid}/builds"; var pathParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>(Configuration.DefaultHeader); var formParams = new Dictionary<String, String>(); var fileParams = new Dictionary<String, FileParameter>(); Object postBody = null; // to determine the Content-Type header String[] httpContentTypes = new String[] { "application/json" }; String httpContentType = Configuration.ApiClient.SelectHeaderContentType(httpContentTypes); // to determine the Accept header String[] httpHeaderAccepts = new String[] { "application/json", "text/plain", "text/html" }; String httpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(httpHeaderAccepts); if (httpHeaderAccept != null) headerParams.Add("Accept", httpHeaderAccept); // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json pathParams.Add("format", "json"); if (orgid != null) pathParams.Add("orgid", Configuration.ApiClient.ParameterToString(orgid)); // path parameter if (projectid != null) pathParams.Add("projectid", Configuration.ApiClient.ParameterToString(projectid)); // path parameter if (buildtargetid != null) pathParams.Add("buildtargetid", Configuration.ApiClient.ParameterToString(buildtargetid)); // path parameter postBody = Configuration.ApiClient.Serialize(options); // http body (model) parameter // authentication (apikey) required // http basic authentication required if (!String.IsNullOrEmpty(Configuration.Username) || !String.IsNullOrEmpty(Configuration.Password)) { headerParams["Authorization"] = "Basic " + Base64Encode(Configuration.Username + ":" + Configuration.Password); } // authentication (permissions) required // oauth required if (!String.IsNullOrEmpty(Configuration.AccessToken)) { headerParams["Authorization"] = "Bearer " + Configuration.AccessToken; } // make the HTTP request IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, httpContentType); int statusCode = (int) response.StatusCode; if (statusCode >= 400) throw new ApiException (statusCode, "Error calling StartBuilds: " + response.Content, response.Content); else if (statusCode == 0) throw new ApiException (statusCode, "Error calling StartBuilds: " + response.ErrorMessage, response.ErrorMessage); return new ApiResponse<List<OrgsorgidprojectsprojectidbuildtargetsBuilds>>(statusCode, response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (List<OrgsorgidprojectsprojectidbuildtargetsBuilds>) Configuration.ApiClient.Deserialize(response, typeof(List<OrgsorgidprojectsprojectidbuildtargetsBuilds>))); }
/// <summary> /// Create new build Start the build process for this build target (or all targets,\nif '_all' is specified as the buildtargetid), if there is not one\ncurrently in process.\n\nIf a build is currently in process that information will be related\nin the 'error' field. /// </summary> /// <param name="orgid">Organization identifier</param> /// <param name="projectid">Project identifier</param> /// <param name="buildtargetid">unique id auto-generated from the build target name</param> /// <param name="options">Options for starting the builds</param> /// <returns>List<OrgsorgidprojectsprojectidbuildtargetsBuilds></returns> public List<OrgsorgidprojectsprojectidbuildtargetsBuilds> StartBuilds (string orgid, string projectid, string buildtargetid, Options4 options = null) { ApiResponse<List<OrgsorgidprojectsprojectidbuildtargetsBuilds>> response = StartBuildsWithHttpInfo(orgid, projectid, buildtargetid, options); return response.Data; }