Skip to content

Instantly share code, notes, and snippets.

@guitarrapc
Created February 13, 2016 00:31
Show Gist options
  • Save guitarrapc/7d705846341a17cc1b38 to your computer and use it in GitHub Desktop.
Save guitarrapc/7d705846341a17cc1b38 to your computer and use it in GitHub Desktop.
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 Project Api
// Get Project
var projectApi = new UnityCloudBuildApi.IO.Swagger.Api.ProjectsApi(config);
var proejct = await projectApi.GetBillingPlansAsync(orgId, projectId);
proejct.Dump();
// List Project
var listProject = await projectApi.ListProjectsForOrgAsync(orgId);
listProject.Dump();
// Add Project
var options = new UnityCloudBuildApi.IO.Swagger.Model.Options
{
Name = "Test",
Settings = new UnityCloudBuildApi.IO.Swagger.Model.OrgsorgidprojectsSettings
{
Scm = new UnityCloudBuildApi.IO.Swagger.Model.OrgsorgidprojectsSettingsScm
{
Url = "https://github.com/username/repositoryname.git",
Type = "git",
User = "github user name",
Pass = "github api token",
},
},
};
var addProject = await projectApi.AddProjectAsync(orgId, options);
addProject.Dump();
#endregion
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment