Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
async Task Main()
{
var apiKey = "Input your Api Key";
var orgId = "Input Target OrgId";
var projectId = "Input ProjectId";
var client = new UnityCloudBuildApi.IO.Swagger.Client.ApiClient("https://build-api.cloud.unity3d.com/api/v1");
var config = new UnityCloudBuildApi.IO.Swagger.Client.Configuration(client, accessToken: apiKey);
#region BuildTarget Api
// Add Build Target
var buildTargetApi = new UnityCloudBuildApi.IO.Swagger.Api.BuildtargetsApi(config);
var option2 = new UnityCloudBuildApi.IO.Swagger.Model.Options2
{
Platform = "android",
Name = "Test",
Enabled = false,
Settings = new UnityCloudBuildApi.IO.Swagger.Model.OrgsorgidprojectsprojectidbuildtargetsSettings
{
Platform = new UnityCloudBuildApi.IO.Swagger.Model.OrgsorgidprojectsprojectidbuildtargetsSettingsPlatform {BundleId = "com.hoge.fuga"},
AutoBuild = true,
Scm = new UnityCloudBuildApi.IO.Swagger.Model.OrgsorgidprojectsprojectidbuildtargetsSettingsScm
{
Branch = "master",
Type = "git"
},
UnityVersion = "latest",
},
};
var newBuildTarget = await buildTargetApi.AddBuildTargetAsync(orgId, projectId, option2);
newBuildTarget.Dump();
// Get BuildTargets for list BuildTargetId
var buildTargets = await buildTargetApi.GetBuildTargetsAsync(orgId, projectId);
// Get BuildTarget Info
var buildTarget = await buildTargetApi.GetBuildTargetAsync(orgId, projectId, buildTargets.FirstOrDefault().Buildtargetid);
#endregion
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment