public void Execute() { var v1 = new AssetClient(instanceUrl, accessToken); dynamic newStory = v1.Create(new { AssetType = "Story", Scope = "Scope:1015", Name = $"Test Story Scope:1015 Update scalar attribute", Description = "I am not going to change this description after it is set" }); dynamic retrievedStory = v1.Query(newStory.Oid).Select("Name", "Description").RetrieveFirst(); retrievedStory.Name = $"{newStory.Name} - Name updated"; v1.Update(retrievedStory); dynamic updatedRetrievedStory = v1.Query(retrievedStory.Oid).Select("Name", "Description").RetrieveFirst(); WriteLine($"{newStory.Oid} original name: {newStory.Name}"); WriteLine($"{retrievedStory.Oid} updated name: {updatedRetrievedStory.Name}"); WriteLine($"{newStory.Oid} original description: {newStory.Description}"); WriteLine($"{updatedRetrievedStory.Oid} non-updated description: {updatedRetrievedStory.Description}"); WriteLine("Now we are going to try updating the original newStory object..."); newStory.Name = "Test Story Scope:1015 updated on original newStory object!"; v1.Update(newStory); dynamic newStoryFetchedAfterUpdate = v1.Query(newStory.Oid).Select("Name").RetrieveFirst(); WriteLine($"{newStoryFetchedAfterUpdate.Oid} updated name is: {newStoryFetchedAfterUpdate.Name}"); }
public void Execute() { var v1 = new AssetClient(instanceUrl, accessToken); var story = v1.Create(new { AssetType = "Story", Scope = "Scope:0", Name = "My Story", Children = new [] { new { AssetType = "Test", Name = "Test" }, new { AssetType = "Task", Name = "Task" } } }); dynamic queriedStory = v1 .Query(story.Oid) .Select("Name", "Scope") .RetrieveFirst(); WriteLine(queriedStory.Oid); WriteLine(queriedStory.Name); WriteLine(queriedStory["Scope"].Oid); WriteLine(queriedStory.Scope.Oid); }
public void Execute() { var v1 = new AssetClient(instanceUrl, accessToken); dynamic newStory = v1.Create(new { AssetType = "Story", Scope = "Scope:1015", Name = $"Test Story Scope:1015 Create new Story with scalar attribute" }); WriteLine("Created: " + newStory.Oid); }
public void Execute() { var v1 = new AssetClient(instanceUrl, accessToken); dynamic story = new VersionOne.SDK.API.Asset.Asset("Story"); story.Scope = "Scope:1015"; story.Name = "Story created from newed up Asset instance"; dynamic createdStory = v1.Create(story); WriteLine("Created: " + createdStory.Oid); }
public void Execute() { var v1 = new AssetClient(instanceUrl, accessToken); var epicDict = new Dictionary <string, object>() { { "AssetType", "Epic" }, { "Scope", "Scope:0" }, { "Name", "My Epic" }, { "Subs", new [] { new Dictionary <string, object>() { { "AssetType", "Story" }, { "Name", "My Epic : My Story 1" }, { "Children", new [] { new Dictionary <string, object>() { { "AssetType", "Test" }, { "Name", "My Story 1: Test" } }, new Dictionary <string, object>() { { "AssetType", "Task" }, { "Name", "My Story 1: Task" } } } } }, new Dictionary <string, object>() { { "AssetType", "Story" }, { "Name", "My Epic : My Story 2" }, { "Children", new [] { new Dictionary <string, object>() { { "AssetType", "Test" }, { "Name", "My Story 2: Test" } }, new Dictionary <string, object>() { { "AssetType", "Task" }, { "Name", "My Story 2: Task" } } } } } } } }; dynamic epic = v1.Create(epicDict); WriteLine("Epic returned from .Create (which does not requery the system, but fills in Oids linearly from server response):"); PrintEpic(epic); epic = v1 .Query(epic.Oid) .Select( "Name", "Scope", From("Subs") .Select( "AssetType", "Name", From("Children") .Select( "AssetType", "Name" ) ) ) .RetrieveFirst(); WriteLine(); WriteLine("Epic returned from .Query, requerying the system with subselect syntax to pull in nested relationships:"); PrintEpic(epic); }
public void Execute() { var v1 = new AssetClient(instanceUrl, accessToken); var epic = Asset("Epic", new { Scope = "Scope:0", Name = "My Epic", Subs = Assets( Asset("Story", new { Name = "My Epic : My Story 1", Children = Assets( Asset("Test", new { Name = "My Story 1: Test" }), Asset("Task", new { Name = "My Story 1: Task" }) ) }), Asset("Story", new { Name = "My Epic : My Story 2", Children = Assets( Asset("Test", new { Name = "My Story 2: Test" }), Asset("Task", new { Name = "My Story 2: Task" }) ) }) ) }); // TODO: probably should be void in this case epic = v1.Create(epic); WriteLine("Epic returned from .Create (which does not requery the system, but fills in Oids linearly from server response):"); PrintEpic(epic); epic = v1 .Query(epic.Oid) .Select( "Name", "Scope", From("Subs") .Select( "AssetType", "Name", From("Children") .Select( "AssetType", "Name" ) ) ) .RetrieveFirst(); WriteLine(); WriteLine("Epic returned from .Query, requerying the system with subselect syntax to pull in nested relationships:"); PrintEpic(epic); }