Repository navigation
Expand file tree
/
Copy pathListData.cs
More file actions
62 lines (52 loc) · 1.92 KB
/
Copy pathListData.cs
File metadata and controls
62 lines (52 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System.Text.Json;
namespace SupportAgent;
public static class ListData
{
private static readonly string DataRoot = Path.Combine(
Directory.GetCurrentDirectory(),
"data");
public static void Run()
{
Console.WriteLine("=== CapStream synthetic data ===\n");
ListDocs();
Console.WriteLine();
ListResolved();
Console.WriteLine();
ListInbox();
}
private static void ListDocs()
{
var docsDir = Path.Combine(DataRoot, "docs");
var files = Directory.GetFiles(docsDir, "*.md").OrderBy(f => f);
Console.WriteLine($"Docs ({files.Count()}) — simulated Confluence pages");
foreach (var file in files)
{
Console.WriteLine($" {Path.GetFileName(file)}");
}
}
private static void ListResolved()
{
var resolvedDir = Path.Combine(DataRoot, "resolved");
var files = Directory.GetFiles(resolvedDir, "*.json").OrderBy(f => f);
Console.WriteLine($"Resolved ({files.Count()}) — past closed tickets");
foreach (var file in files)
{
using var doc = JsonDocument.Parse(File.ReadAllText(file));
var id = doc.RootElement.GetProperty("id").GetString();
var question = doc.RootElement.GetProperty("question").GetString();
Console.WriteLine($" {id} {question}");
}
}
private static void ListInbox()
{
var inboxPath = Path.Combine(DataRoot, "inbox", "tickets.json");
using var doc = JsonDocument.Parse(File.ReadAllText(inboxPath));
Console.WriteLine($"Inbox ({doc.RootElement.GetArrayLength()}) — backlog queue");
foreach (var ticket in doc.RootElement.EnumerateArray())
{
var id = ticket.GetProperty("id").GetString();
var subject = ticket.GetProperty("subject").GetString();
Console.WriteLine($" {id} {subject}");
}
}
}