public async Task <WorkItem> PatchAsync(PatchWorkItem patchWorkItem) { var patchDocuments = CreatePatchDocuments(patchWorkItem.Relations, patchWorkItem.Fields); var nativeWorkItem = await _restProxy.PatchWorkItemAsync(patchWorkItem.Id, patchDocuments); return(Adapt(nativeWorkItem)); }
public bool PatchWorkItem(string wid, PatchWorkItem patchWorkItem) { var wiPatchRequest = new RestRequest("exSILentiaProducts/_apis/wit/workitems/{wid}?api-version=1.0", Method.PATCH); wiPatchRequest.AddUrlSegment("wid", wid); wiPatchRequest.AddHeader("Content-Type", "application/json-patch+json"); wiPatchRequest.AddParameter("undefined", CreatePatchBody(patchWorkItem), ParameterType.RequestBody); TFSWorkItem wiItem = Execute <TFSWorkItem>(wiPatchRequest); return(true); }
public void ReadyForTestToReadyForTest() { // Get Trello cards that are in ready to test List <TrelloCard> rdyTestCards = _trelloApi.GetListCards(TrelloListNames.READYFORTEST); //For each card, set the TFS status to 'ready to test' foreach (TrelloCard card in rdyTestCards) { //Get card id String tfsID = GetCardTFSId(card); TFSWorkItem wi = _tfsApi.GetWorkItem(tfsID); //Check the status in tfs. The status should be "committed", if not, set it if possible, if (wi.fields.State != "Ready for Test") { _tfsApi.PatchWorkItem(wi.id, PatchWorkItem.CreateReadyForTestWorkItemPatch()); } } }
public void DevCompleteToCommitted() { // Get Trello cards that are in dev complete List <TrelloCard> devCompleteCards = _trelloApi.GetListCards(TrelloListNames.DEVELOPMENTCOMPLETE); //For each card, set the TFS status to 'committed' foreach (TrelloCard card in devCompleteCards) { //Get card id String tfsID = GetCardTFSId(card); TFSWorkItem wi = _tfsApi.GetWorkItem(tfsID); //Check the status in tfs. The status should be "committed", if not, set it if possible, if (wi.fields.State != "Committed") { //Can't go directly from Test -> Committed, have to set the status to new first if (wi.fields.State == "Ready for Test") { _tfsApi.PatchWorkItem(wi.id, PatchWorkItem.CreateNewWorkItemPatch()); } _tfsApi.PatchWorkItem(wi.id, PatchWorkItem.CreateCommittedWorkItemPatch()); } } }
private string CreatePatchBody(PatchWorkItem patchWorkItem) { String patchBody = $" [{{\r\n\t\"op\":\"{patchWorkItem.op}\",\r\n\t\"path\":\"{patchWorkItem.path}\",\r\n\t\"value\":\"{patchWorkItem.value}\"\r\n\t}}]"; return(patchBody); }