private static void CreateLinkOnStory() { var client = new VersionOneRestClient(V1_REST_API_URL, USERNAME, PASSWORD); var response = client.Create("Link", new { Asset = "Story:90295", URL = "http://www.versionone.com", Name = "This is the link to VersionOne", OnMenu = false }); WriteLine(response.OidToken); }
private static void Create(VersionOneRestClient client) { WriteIntro("Create:"); var scope = "Scope:86271"; dynamic asset = client.Create("Story", new { Name = "Testing the client.Create method at " + DateTime.Now.ToLongTimeString(), Description = "Just playing around...", Scope = scope, Owners = Relation("Member:20") }); var oidToken = asset.OidToken; asset = client.Create("Issue", new { Name = "My Issue", Scope = scope, PrimaryWorkitems = Relation(oidToken) }); var tok1 = asset.OidToken; WriteLine(tok1); asset = client.Create("Issue", new { Name = "My Issue 2", Scope = scope, PrimaryWorkitems = Relation(oidToken) }); var tok2 = asset.OidToken; WriteLine(tok2); asset = client.Query("Story") .Select("Name", "Issues", "Description") .Where("ID", oidToken) .RetrieveFirst(); WriteLine(asset); var storyTasks = asset._links["Issues"]; WriteLine(storyTasks); //results[0].RemoveRelatedAssets("Issues", "Issue:1", "Issue:2"); //results[0].RemoveRelatedAssets("Issues", new string[] { tok1.ToString(), tok2.ToString() }); //results[0].RemoveRelatedAssets("Issues", new [] { tok1, tok2 }); asset.RemoveRelatedAssets("Issues", tok1, tok2); storyTasks = asset._links["Issues"]; WriteLine(storyTasks); asset.AddRelatedAssets("Issues", tok1); storyTasks = asset._links["Issues"]; WriteLine(storyTasks); asset.Name = "Newbie name"; //results[0].NewProp = "New Prop"; asset.Description = "Just playing around..."; var changes = asset.GetChangesDto(); var payload = RestApiPayloadBuilder.Build(changes); asset = client.Update(oidToken, new { Owners = Remove("Member:20") }); }