2023-01-24

This commit is contained in:
2023-01-24 08:45:13 -07:00
commit 660b89c129
146 changed files with 16122 additions and 0 deletions

View File

@ -0,0 +1,147 @@
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
using Adaptation.Shared;
using Adaptation.Shared.Duplicator;
using Adaptation.Shared.Methods;
using Microsoft.TeamFoundation.WorkItemTracking.WebApi;
using Microsoft.VisualStudio.Services.Common;
using Microsoft.VisualStudio.Services.WebApi;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
namespace Adaptation.FileHandlers.json;
public class FileRead : Shared.FileRead, IFileRead
{
private long? _TickOffset;
private readonly string _API;
private readonly string _Query;
private readonly string _Project;
private readonly string _BasePage;
private readonly HttpClient _HttpClient;
private readonly WorkItemTrackingHttpClient _WorkItemTrackingHttpClient;
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted)
{
_MinFileLength = 10;
_NullData = string.Empty;
_Logistics = new(this);
if (_FileParameter is null)
throw new Exception(cellInstanceConnectionName);
if (_ModelObjectParameterDefinitions is null)
throw new Exception(cellInstanceConnectionName);
if (_IsDuplicator)
throw new Exception(cellInstanceConnectionName);
string cellInstanceNamed = string.Concat("CellInstance.", cellInstanceName);
MediaTypeWithQualityHeaderValue mediaTypeWithQualityHeaderValue = new("application/json");
_API = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, $"{cellInstanceNamed}.HttpClient.API");
_Query = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, $"{cellInstanceNamed}.HttpClient.Query");
string pat = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, $"{cellInstanceNamed}.HttpClient.PAT");
_Project = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, $"{cellInstanceNamed}.HttpClient.Project");
string basePage = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, $"{cellInstanceNamed}.HttpClient.BasePage");
string baseAddress = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, $"{cellInstanceNamed}.HttpClient.BaseAddress");
byte[] bytes = Encoding.ASCII.GetBytes($":{pat}");
string base64 = Convert.ToBase64String(bytes);
_HttpClient = new() { BaseAddress = new(baseAddress) };
_HttpClient.DefaultRequestHeaders.Authorization = new("Basic", base64);
_HttpClient.DefaultRequestHeaders.Accept.Add(mediaTypeWithQualityHeaderValue);
VssBasicCredential credential = new("", pat);
VssConnection connection = new(new(string.Concat(baseAddress, basePage)), credential);
_WorkItemTrackingHttpClient = connection.GetClient<WorkItemTrackingHttpClient>();
_BasePage = basePage;
}
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) => Move(extractResults);
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
string IFileRead.GetEventDescription()
{
string result = _Description.GetEventDescription();
return result;
}
List<string> IFileRead.GetHeaderNames()
{
List<string> results = _Description.GetHeaderNames();
return results;
}
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
{
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
return results;
}
JsonProperty[] IFileRead.GetDefault()
{
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
return results;
}
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
{
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
return results;
}
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
{
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
return results;
}
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
if (string.IsNullOrEmpty(eventName))
throw new Exception();
_ReportFullPath = reportFullPath;
DateTime dateTime = DateTime.Now;
results = GetExtractResult(reportFullPath, dateTime);
if (results.Item3 is null)
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
if (results.Item3.Length > 0 && _IsEAFHosted)
WritePDSF(this, results.Item3);
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
return results;
}
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract()
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
List<string> headerNames = _Description.GetHeaderNames();
Dictionary<string, string> keyValuePairs = _Description.GetDisplayNamesJsonElement(this);
results = ReExtract(this, headerNames, keyValuePairs);
return results;
}
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
_TickOffset ??= new FileInfo(reportFullPath).LastWriteTime.Ticks - dateTime.Ticks;
_Logistics = new Logistics(this, _TickOffset.Value, reportFullPath, useSplitForMID: true);
SetFileParameterLotIDToLogisticsMID();
if (_Logistics.FileInfo.Length < _MinFileLength)
results.Item4.Add(_Logistics.FileInfo);
else
{
IProcessData iProcessData = new ProcessData(this, _Logistics, results.Item4, _HttpClient, _BasePage, _API, _Query, _WorkItemTrackingHttpClient, _Project);
if (iProcessData is not ProcessData _)
throw new Exception(string.Concat("A) No Data - ", dateTime.Ticks));
if (!iProcessData.Details.Any())
throw new Exception(string.Concat("B) No Data - ", dateTime.Ticks));
results = iProcessData.GetResults(this, _Logistics, results.Item4);
}
return results;
}
}

View File

@ -0,0 +1,120 @@
using Adaptation.FileHandlers.ConvertExcelToJson;
using Adaptation.FileHandlers.json.WorkItems;
using Adaptation.Shared;
using Adaptation.Shared.Duplicator;
using Adaptation.Shared.Methods;
using Microsoft.TeamFoundation.WorkItemTracking.WebApi;
using Microsoft.VisualStudio.Services.WebApi.Patch;
using Microsoft.VisualStudio.Services.WebApi.Patch.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;
namespace Adaptation.FileHandlers.json;
public class ProcessData : IProcessData
{
private readonly List<object> _Details;
List<object> Shared.Properties.IProcessData.Details => _Details;
public ProcessData(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection, HttpClient httpClient, string basePage, string api, string query, WorkItemTrackingHttpClient workItemTrackingHttpClient, string project)
{
fileInfoCollection.Clear();
_Details = new List<object>();
Parse(fileRead, logistics, fileInfoCollection, httpClient, basePage, api, query, workItemTrackingHttpClient, project);
}
string IProcessData.GetCurrentReactor(IFileRead fileRead, Logistics logistics, Dictionary<string, string> reactors)
=> throw new Exception(string.Concat("See ", nameof(Parse)));
Tuple<string, Test[], JsonElement[], List<FileInfo>> IProcessData.GetResults(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection)
=> new(logistics.Logistics1[0], Array.Empty<Test>(), Array.Empty<JsonElement>(), fileInfoCollection);
internal static List<Description> GetDescriptions(JsonElement[] jsonElements) => throw new NotImplementedException();
#nullable enable
private static Root GetRoot(HttpClient httpClient, string basePage, string api, int id)
{
Root result;
Task<HttpResponseMessage> httpResponseMessageTask = httpClient.GetAsync(string.Concat(basePage, api, "/workItems/", id));
httpResponseMessageTask.Wait();
if (!httpResponseMessageTask.Result.IsSuccessStatusCode)
throw new Exception(httpResponseMessageTask.Result.StatusCode.ToString());
Task<Stream> streamTask = httpResponseMessageTask.Result.Content.ReadAsStreamAsync();
streamTask.Wait();
if (!streamTask.Result.CanRead)
{
JsonElement? jsonElement = JsonSerializer.Deserialize<JsonElement>(streamTask.Result);
if (jsonElement is null)
throw new NullReferenceException(nameof(jsonElement));
}
Root? root = JsonSerializer.Deserialize<Root>(streamTask.Result, new JsonSerializerOptions() { PropertyNameCaseInsensitive = true });
streamTask.Result.Dispose();
if (root is null || root.Fields is null)
throw new NullReferenceException(nameof(root));
result = root;
return result;
}
private static void AddPatch(JsonPatchDocument document, string path, object value) => document.Add(new JsonPatchOperation { From = null, Operation = Operation.Add, Path = path, Value = value });
private void Parse(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection, HttpClient httpClient, string basePage, string api, string query, WorkItemTrackingHttpClient workItemTrackingHttpClient, string project)
{
if (fileRead is null)
throw new NullReferenceException();
if (logistics is null)
throw new NullReferenceException();
if (fileInfoCollection is null)
throw new NullReferenceException();
Root raw;
ViewModels.WorkItem view;
string json = File.ReadAllText(logistics.ReportFullPath);
FIBacklogMesa[]? fIBacklogMesaCollection = JsonSerializer.Deserialize<FIBacklogMesa[]>(json, new JsonSerializerOptions() { PropertyNameCaseInsensitive = true });
if (fIBacklogMesaCollection is null || !fIBacklogMesaCollection.Any())
throw new NullReferenceException();
Task<HttpResponseMessage> httpResponseMessageTask = httpClient.GetAsync(string.Concat(basePage, api, query));
httpResponseMessageTask.Wait();
if (!httpResponseMessageTask.Result.IsSuccessStatusCode)
throw new Exception(httpResponseMessageTask.Result.StatusCode.ToString());
Task<Stream> streamTask = httpResponseMessageTask.Result.Content.ReadAsStreamAsync();
streamTask.Wait();
if (!streamTask.Result.CanRead)
{
JsonElement? jsonElement = JsonSerializer.Deserialize<JsonElement>(streamTask.Result);
if (jsonElement is null)
throw new NullReferenceException(nameof(jsonElement));
}
WIQL.Root? root = JsonSerializer.Deserialize<WIQL.Root>(streamTask.Result, new JsonSerializerOptions() { PropertyNameCaseInsensitive = true });
streamTask.Result.Dispose();
if (root is null || root.WorkItems is null)
throw new NullReferenceException(nameof(root));
foreach (WIQL.WorkItem workItem in root.WorkItems)
{
raw = GetRoot(httpClient, basePage, api, workItem.Id);
view = new(raw);
_Details.Add(view);
if (workItem.Id == 308759)
break;
}
JsonPatchDocument document = new();
AddPatch(document, "/fields/System.Title", "Title");
AddPatch(document, "/fields/System.Description", "Description");
AddPatch(document, "/fields/System.AssignedTo", "Mike.Phares@infineon.com");
AddPatch(document, "/fields/System.AreaPath", string.Concat(project, @"\OI"));
AddPatch(document, "/fields/System.IterationPath", string.Concat(project, @"\CMP"));
Task<Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models.WorkItem> workItemTask;
workItemTask = workItemTrackingHttpClient.CreateWorkItemAsync(document, project, "Bug");
workItemTask.Wait();
if (workItemTask.Result is null)
{ }
// workItemTask = workItemTrackingHttpClient.UpdateWorkItemAsync(document, project, "Bug");
}
}

View File

@ -0,0 +1,79 @@
using Adaptation.FileHandlers.json.WorkItems;
using System;
namespace Adaptation.FileHandlers.json.ViewModels;
public class WorkItem
{
public string AreaPath { get; set; } // { init; get; }
public string AssignedToDisplayName { get; set; } // { init; get; }
public int CommentCount { get; set; } // { init; get; }
public string CreatedDate { get; set; } // { init; get; }
public string ClosedDate { get; set; } // { init; get; }
public string Description { get; set; } // { init; get; }
public string Discussion { get; set; } // { init; get; }
public string Effort { get; set; } // { init; get; }
public string HypertextReference { get; set; } // { init; get; }
public int Id { get; set; } // { init; get; }
public string IterationPath { get; set; } // { init; get; }
public string Req { get; set; } // { init; get; }
public string ResolvedDate { get; set; } // { init; get; }
public string Priority { get; set; } // { init; get; }
public string State { get; set; } // { init; get; }
public string Tags { get; set; } // { init; get; }
public string TargetDate { get; set; } // { init; get; }
public string Title { get; set; } // { init; get; }
public string WorkItemType { get; set; } // { init; get; }
public WorkItem(Root raw)
{
string req;
string[] words;
if (string.IsNullOrEmpty(raw.Fields.SystemHistory))
words = Array.Empty<string>();
else
words = raw.Fields.SystemHistory.Split(' ');
if (words.Length < 3 || words[0] != "Req" || words[1] != ":")
req = raw.Id.ToString();
else
req = words[2].Split('<')[0];
string systemAreaPath = raw.Fields.SystemAreaPath.Replace(@"Mesa_FI\", string.Empty);
string iterationPath = raw.Fields.SystemIterationPath.Replace(@"Mesa_FI\", string.Empty);
string hypertextReference = string.IsNullOrEmpty(raw.Links?.Html?.Href) ? string.Empty : raw.Links.Html.Href;
string systemAssignedToDisplayName = raw.Fields.SystemAssignedTo is null ? string.Empty : raw.Fields.SystemAssignedTo.DisplayName;
string effort = raw.Fields.MicrosoftVSTSSchedulingEffort < 0.1 ? "" : Math.Floor(raw.Fields.MicrosoftVSTSSchedulingEffort).ToString("0");
string createdDate = raw.Fields.SystemCreatedDate == DateTime.MinValue ? string.Empty : raw.Fields.SystemCreatedDate.ToString("dd-MMM-yy");
string closedDate = raw.Fields.MicrosoftVSTSCommonClosedDate == DateTime.MinValue ? string.Empty : raw.Fields.MicrosoftVSTSCommonClosedDate.ToString("dd-MMM-yy");
string resolvedDate = raw.Fields.MicrosoftVSTSCommonResolvedDate == DateTime.MinValue ? string.Empty : raw.Fields.MicrosoftVSTSCommonResolvedDate.ToString("dd-MMM-yy");
string targetDate = raw.Fields.MicrosoftVSTSSchedulingTargetDate == DateTime.MinValue ? string.Empty : raw.Fields.MicrosoftVSTSSchedulingTargetDate.ToString("dd-MMM-yy");
string priority = raw.Fields.SystemWorkItemType == "Bug" ? "BugFix" : raw.Fields.MicrosoftVSTSCommonPriority switch
{
1 => "High",
2 => "Med",
3 => "Low",
4 => "TBD",
_ => throw new NotImplementedException(),
};
AreaPath = systemAreaPath;
AssignedToDisplayName = systemAssignedToDisplayName;
CommentCount = raw.Fields.SystemCommentCount;
CreatedDate = createdDate;
ClosedDate = closedDate;
Description = raw.Fields.SystemDescription;
Discussion = raw.Fields.SystemHistory;
Effort = effort;
HypertextReference = hypertextReference;
Id = raw.Id;
IterationPath = iterationPath;
Priority = priority;
Req = req;
ResolvedDate = resolvedDate;
State = raw.Fields.SystemState;
Tags = raw.Fields.SystemTags;
TargetDate = targetDate;
Title = raw.Fields.SystemTitle;
WorkItemType = raw.Fields.SystemWorkItemType;
}
}

View File

@ -0,0 +1,22 @@
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.json.WIQL;
public class Column
{
[JsonConstructor]
public Column(
string referenceName,
string name,
string url
)
{
ReferenceName = referenceName;
Name = name;
Url = url;
}
public string ReferenceName { get; set; } // { init; get; }
public string Name { get; set; } // { init; get; }
public string Url { get; set; } // { init; get; }
}

View File

@ -0,0 +1,22 @@
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.json.WIQL;
public class Field
{
[JsonConstructor]
public Field(
string referenceName,
string name,
string url
)
{
ReferenceName = referenceName;
Name = name;
Url = url;
}
public string ReferenceName { get; set; } // { init; get; }
public string Name { get; set; } // { init; get; }
public string Url { get; set; } // { init; get; }
}

View File

@ -0,0 +1,32 @@
using System;
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.json.WIQL;
public class Root
{
[JsonConstructor]
public Root(
string queryType,
string queryResultType,
DateTime asOf,
Column[] columns,
SortColumn[] sortColumns,
WorkItem[] workItems
)
{
QueryType = queryType;
QueryResultType = queryResultType;
AsOf = asOf;
Columns = columns;
SortColumns = sortColumns;
WorkItems = workItems;
}
public string QueryType { get; set; } // { init; get; }
public string QueryResultType { get; set; } // { init; get; }
public DateTime AsOf { get; set; } // { init; get; }
public Column[] Columns { get; set; } // { init; get; }
public SortColumn[] SortColumns { get; set; } // { init; get; }
public WorkItem[] WorkItems { get; set; } // { init; get; }
}

View File

@ -0,0 +1,19 @@
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.json.WIQL;
public class SortColumn
{
[JsonConstructor]
public SortColumn(
Field field,
bool descending
)
{
Field = field;
Descending = descending;
}
public Field Field { get; set; } // { init; get; }
public bool Descending { get; set; } // { init; get; }
}

View File

@ -0,0 +1,19 @@
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.json.WIQL;
public class WorkItem
{
[JsonConstructor]
public WorkItem(
int id,
string url
)
{
Id = id;
Url = url;
}
public int Id { get; set; } // { init; get; }
public string Url { get; set; } // { init; get; }
}

View File

@ -0,0 +1,13 @@
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.json.WorkItems;
public class Avatar
{
[JsonConstructor]
public Avatar(
string href
) => Href = href;
public string Href { get; set; } // { init; get; }
}

View File

@ -0,0 +1,175 @@
using System;
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.json.WorkItems;
public class Fields
{
[JsonConstructor]
public Fields(string systemAreaPath,
string systemTeamProject,
string systemIterationPath,
string systemWorkItemType,
string systemState,
string systemReason,
User systemAssignedTo,
DateTime systemCreatedDate,
User systemCreatedBy,
DateTime systemChangedDate,
User systemChangedBy,
int systemCommentCount,
string systemTitle,
string systemBoardColumn,
bool systemBoardColumnDone,
DateTime microsoftVSTSCommonStateChangeDate,
DateTime microsoftVSTSCommonActivatedDate,
User microsoftVSTSCommonActivatedBy,
DateTime microsoftVSTSCommonResolvedDate,
User microsoftVSTSCommonResolvedBy,
DateTime microsoftVSTSCommonClosedDate,
User microsoftVSTSCommonClosedBy,
int microsoftVSTSCommonPriority,
double microsoftVSTSSchedulingEffort,
DateTime microsoftVSTSSchedulingTargetDate,
double microsoftVSTSCommonStackRank,
string microsoftVSTSCommonValueArea,
string wEF81590F0A22C04FEF834957660F5F0C58KanbanColumn,
bool wEF81590F0A22C04FEF834957660F5F0C58KanbanColumnDone,
string systemDescription,
string systemHistory,
string systemTags,
string href)
{
SystemAreaPath = systemAreaPath;
SystemTeamProject = systemTeamProject;
SystemIterationPath = systemIterationPath;
SystemWorkItemType = systemWorkItemType;
SystemState = systemState;
SystemReason = systemReason;
SystemAssignedTo = systemAssignedTo;
SystemCreatedDate = systemCreatedDate;
SystemCreatedBy = systemCreatedBy;
SystemChangedDate = systemChangedDate;
SystemChangedBy = systemChangedBy;
SystemCommentCount = systemCommentCount;
SystemTitle = systemTitle;
SystemBoardColumn = systemBoardColumn;
SystemBoardColumnDone = systemBoardColumnDone;
MicrosoftVSTSCommonStateChangeDate = microsoftVSTSCommonStateChangeDate;
MicrosoftVSTSCommonActivatedDate = microsoftVSTSCommonActivatedDate;
MicrosoftVSTSCommonActivatedBy = microsoftVSTSCommonActivatedBy;
MicrosoftVSTSCommonResolvedDate = microsoftVSTSCommonResolvedDate;
MicrosoftVSTSCommonResolvedBy = microsoftVSTSCommonResolvedBy;
MicrosoftVSTSCommonClosedDate = microsoftVSTSCommonClosedDate;
MicrosoftVSTSCommonClosedBy = microsoftVSTSCommonClosedBy;
MicrosoftVSTSCommonPriority = microsoftVSTSCommonPriority;
MicrosoftVSTSSchedulingEffort = microsoftVSTSSchedulingEffort;
MicrosoftVSTSSchedulingTargetDate = microsoftVSTSSchedulingTargetDate;
MicrosoftVSTSCommonStackRank = microsoftVSTSCommonStackRank;
MicrosoftVSTSCommonValueArea = microsoftVSTSCommonValueArea;
WEF81590F0A22C04FEF834957660F5F0C58KanbanColumn = wEF81590F0A22C04FEF834957660F5F0C58KanbanColumn;
WEF81590F0A22C04FEF834957660F5F0C58KanbanColumnDone = wEF81590F0A22C04FEF834957660F5F0C58KanbanColumnDone;
SystemDescription = systemDescription;
SystemHistory = systemHistory;
SystemTags = systemTags;
Href = href;
}
[JsonPropertyName("System.AreaPath")]
public string SystemAreaPath { get; set; } // { init; get; }
[JsonPropertyName("System.TeamProject")]
public string SystemTeamProject { get; set; } // { init; get; }
[JsonPropertyName("System.IterationPath")]
public string SystemIterationPath { get; set; } // { init; get; }
[JsonPropertyName("System.WorkItemType")]
public string SystemWorkItemType { get; set; } // { init; get; }
[JsonPropertyName("System.State")]
public string SystemState { get; set; } // { init; get; }
[JsonPropertyName("System.Reason")]
public string SystemReason { get; set; } // { init; get; }
[JsonPropertyName("System.AssignedTo")]
public User SystemAssignedTo { get; set; } // { init; get; }
[JsonPropertyName("System.CreatedDate")]
public DateTime SystemCreatedDate { get; set; } // { init; get; }
[JsonPropertyName("System.CreatedBy")]
public User SystemCreatedBy { get; set; } // { init; get; }
[JsonPropertyName("System.ChangedDate")]
public DateTime SystemChangedDate { get; set; } // { init; get; }
[JsonPropertyName("System.ChangedBy")]
public User SystemChangedBy { get; set; } // { init; get; }
[JsonPropertyName("System.CommentCount")]
public int SystemCommentCount { get; set; } // { init; get; }
[JsonPropertyName("System.Title")]
public string SystemTitle { get; set; } // { init; get; }
[JsonPropertyName("System.BoardColumn")]
public string SystemBoardColumn { get; set; } // { init; get; }
[JsonPropertyName("System.BoardColumnDone")]
public bool SystemBoardColumnDone { get; set; } // { init; get; }
[JsonPropertyName("Microsoft.VSTS.Common.StateChangeDate")]
public DateTime MicrosoftVSTSCommonStateChangeDate { get; set; } // { init; get; }
[JsonPropertyName("Microsoft.VSTS.Common.ActivatedDate")]
public DateTime MicrosoftVSTSCommonActivatedDate { get; set; } // { init; get; }
[JsonPropertyName("Microsoft.VSTS.Common.ActivatedBy")]
public User MicrosoftVSTSCommonActivatedBy { get; set; } // { init; get; }
[JsonPropertyName("Microsoft.VSTS.Common.ResolvedDate")]
public DateTime MicrosoftVSTSCommonResolvedDate { get; set; } // { init; get; }
[JsonPropertyName("Microsoft.VSTS.Common.ResolvedBy")]
public User MicrosoftVSTSCommonResolvedBy { get; set; } // { init; get; }
[JsonPropertyName("Microsoft.VSTS.Common.ClosedDate")]
public DateTime MicrosoftVSTSCommonClosedDate { get; }
[JsonPropertyName("Microsoft.VSTS.Common.ClosedBy")]
public User MicrosoftVSTSCommonClosedBy { get; }
[JsonPropertyName("Microsoft.VSTS.Common.Priority")]
public int MicrosoftVSTSCommonPriority { get; set; } // { init; get; }
[JsonPropertyName("Microsoft.VSTS.Scheduling.Effort")]
public double MicrosoftVSTSSchedulingEffort { get; set; } // { init; get; }
[JsonPropertyName("Microsoft.VSTS.Scheduling.TargetDate")]
public DateTime MicrosoftVSTSSchedulingTargetDate { get; set; } // { init; get; }
[JsonPropertyName("Microsoft.VSTS.Common.StackRank")]
public double MicrosoftVSTSCommonStackRank { get; set; } // { init; get; }
[JsonPropertyName("Microsoft.VSTS.Common.ValueArea")]
public string MicrosoftVSTSCommonValueArea { get; set; } // { init; get; }
[JsonPropertyName("WEF_81590F0A22C04FEF834957660F5F0C58_Kanban.Column")]
public string WEF81590F0A22C04FEF834957660F5F0C58KanbanColumn { get; set; } // { init; get; }
[JsonPropertyName("WEF_81590F0A22C04FEF834957660F5F0C58_Kanban.Column.Done")]
public bool WEF81590F0A22C04FEF834957660F5F0C58KanbanColumnDone { get; set; } // { init; get; }
[JsonPropertyName("System.Description")]
public string SystemDescription { get; set; } // { init; get; }
[JsonPropertyName("System.History")]
public string SystemHistory { get; set; } // { init; get; }
[JsonPropertyName("System.Tags")]
public string SystemTags { get; set; } // { init; get; }
public string Href { get; set; } // { init; get; }
}

View File

@ -0,0 +1,13 @@
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.json.WorkItems;
public class Html
{
[JsonConstructor]
public Html(
string href
) => Href = href;
public string Href { get; set; } // { init; get; }
}

View File

@ -0,0 +1,37 @@
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.json.WorkItems;
public class Links
{
[JsonConstructor]
public Links(
Avatar avatar,
Self self,
WorkItemUpdates workItemUpdates,
WorkItemRevisions workItemRevisions,
WorkItemComments workItemComments,
Html html,
WorkItemType workItemType,
Fields fields
)
{
Avatar = avatar;
Self = self;
WorkItemUpdates = workItemUpdates;
WorkItemRevisions = workItemRevisions;
WorkItemComments = workItemComments;
Html = html;
WorkItemType = workItemType;
Fields = fields;
}
public Avatar Avatar { get; set; } // { init; get; }
public Self Self { get; set; } // { init; get; }
public WorkItemUpdates WorkItemUpdates { get; set; } // { init; get; }
public WorkItemRevisions WorkItemRevisions { get; set; } // { init; get; }
public WorkItemComments WorkItemComments { get; set; } // { init; get; }
public Html Html { get; set; } // { init; get; }
public WorkItemType WorkItemType { get; set; } // { init; get; }
public Fields Fields { get; set; } // { init; get; }
}

View File

@ -0,0 +1,30 @@
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.json.WorkItems;
public class Root
{
[JsonConstructor]
public Root(
int id,
int rev,
Fields fields,
Links links,
string url
)
{
Id = id;
Rev = rev;
Fields = fields;
Links = links;
Url = url;
}
public int Id { get; set; } // { init; get; }
public int Rev { get; set; } // { init; get; }
public Fields Fields { get; set; } // { init; get; }
[JsonPropertyName("_links")]
public Links Links { get; set; } // { init; get; }
public string Url { get; set; } // { init; get; }
}

View File

@ -0,0 +1,13 @@
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.json.WorkItems;
public class Self
{
[JsonConstructor]
public Self(
string href
) => Href = href;
public string Href { get; set; } // { init; get; }
}

View File

@ -0,0 +1,34 @@
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.json.WorkItems;
public class User
{
[JsonConstructor]
public User(
string displayName,
string url,
Links links,
string id,
string uniqueName,
string imageUrl,
string descriptor
)
{
DisplayName = displayName;
Url = url;
Links = links;
Id = id;
UniqueName = uniqueName;
ImageUrl = imageUrl;
Descriptor = descriptor;
}
public string DisplayName { get; set; } // { init; get; }
public string Url { get; set; } // { init; get; }
public Links Links { get; set; } // { init; get; }
public string Id { get; set; } // { init; get; }
public string UniqueName { get; set; } // { init; get; }
public string ImageUrl { get; set; } // { init; get; }
public string Descriptor { get; set; } // { init; get; }
}

View File

@ -0,0 +1,13 @@
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.json.WorkItems;
public class WorkItemComments
{
[JsonConstructor]
public WorkItemComments(
string href
) => Href = href;
public string Href { get; set; } // { init; get; }
}

View File

@ -0,0 +1,13 @@
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.json.WorkItems;
public class WorkItemRevisions
{
[JsonConstructor]
public WorkItemRevisions(
string href
) => Href = href;
public string Href { get; set; } // { init; get; }
}

View File

@ -0,0 +1,13 @@
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.json.WorkItems;
public class WorkItemType
{
[JsonConstructor]
public WorkItemType(
string href
) => Href = href;
public string Href { get; set; } // { init; get; }
}

View File

@ -0,0 +1,13 @@
using System.Text.Json.Serialization;
namespace Adaptation.FileHandlers.json.WorkItems;
public class WorkItemUpdates
{
[JsonConstructor]
public WorkItemUpdates(
string href
) => Href = href;
public string Href { get; set; } // { init; get; }
}