Repository navigation
Expand file tree
/
Copy pathQueryRequest.cs
More file actions
66 lines (55 loc) · 1.7 KB
/
Copy pathQueryRequest.cs
File metadata and controls
66 lines (55 loc) · 1.7 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
63
64
65
66
using System.Collections.Generic;
namespace EntityGraphQL;
/// <summary>
/// A GraphQL request. The query, and any variables
/// </summary>
public class QueryRequest
{
// Name of the operation you want to run in the Query document (if it contains many)
public string? OperationName { get; set; }
/// <summary>
/// GraphQL query document
/// </summary>
/// <value></value>
public string? Query { get; set; }
/// <summary>
/// Variables values for the query.
/// It is a Dictionary<string, object?> type. Make sure that object is a resolved .NET type and
/// not a JsonElement/JObject (e.g. turn objects into more dictionaries)
/// </summary>
public QueryVariables? Variables { get; set; }
public Dictionary<string, Dictionary<string, object>> Extensions { get; set; } = [];
}
public class QueryExtensions : Dictionary<string, Dictionary<string, object>>
{
public QueryExtensions() { }
public QueryExtensions(IDictionary<string, Dictionary<string, object>> dictionary)
: base(dictionary) { }
}
public class PersistedQueryExtension : Dictionary<string, object>
{
public PersistedQueryExtension()
{
Version = 1;
}
public string Sha256Hash
{
get => (string)this[nameof(Sha256Hash)];
set => this[nameof(Sha256Hash)] = value;
}
public int Version
{
get => (int)this[nameof(Version)];
set => this[nameof(Version)] = value;
}
}
/// <summary>
/// Holds the variables passed along with a GraphQL query
/// </summary>
public class QueryVariables : Dictionary<string, object?>
{
public object? GetValueFor(string varKey)
{
return ContainsKey(varKey) ? this[varKey] : null;
}
}