@@ -6,71 +6,71 @@ namespace Styra.Opa;
6
6
7
7
public class OpaBatchInputs : Dictionary < string , Dictionary < string , object > >
8
8
{
9
- public override string ToString ( )
10
- {
11
- return JsonConvert . SerializeObject ( this ) ;
12
- }
9
+ public override string ToString ( )
10
+ {
11
+ return JsonConvert . SerializeObject ( this ) ;
12
+ }
13
13
}
14
14
15
15
public class OpaBatchResults : Dictionary < string , OpaResult >
16
16
{
17
- public override string ToString ( )
18
- {
19
- return JsonConvert . SerializeObject ( this ) ;
20
- }
17
+ public override string ToString ( )
18
+ {
19
+ return JsonConvert . SerializeObject ( this ) ;
20
+ }
21
21
}
22
22
23
23
public class OpaBatchErrors : Dictionary < string , OpaError >
24
24
{
25
- public override string ToString ( )
26
- {
27
- return JsonConvert . SerializeObject ( this ) ;
28
- }
25
+ public override string ToString ( )
26
+ {
27
+ return JsonConvert . SerializeObject ( this ) ;
28
+ }
29
29
}
30
30
31
31
// Used for converting inputs for the Batch Query API, and converting result types
32
32
// into useful higher-level types.
33
33
public static class DictionaryExtensions
34
34
{
35
- public static Dictionary < string , Input > ToOpaBatchInputRaw ( this Dictionary < string , Dictionary < string , object > > inputs )
36
- {
37
- var opaBatchInputs = new Dictionary < string , Input > ( ) ;
38
- foreach ( var kvp in inputs )
35
+ public static Dictionary < string , Input > ToOpaBatchInputRaw ( this Dictionary < string , Dictionary < string , object > > inputs )
39
36
{
40
- opaBatchInputs [ kvp . Key ] = Input . CreateMapOfAny ( kvp . Value ) ;
37
+ var opaBatchInputs = new Dictionary < string , Input > ( ) ;
38
+ foreach ( var kvp in inputs )
39
+ {
40
+ opaBatchInputs [ kvp . Key ] = Input . CreateMapOfAny ( kvp . Value ) ;
41
+ }
42
+ return opaBatchInputs ;
41
43
}
42
- return opaBatchInputs ;
43
- }
44
44
45
- // The OpenApi.Models.Errors variant of the ServerError type.
46
- public static OpaBatchErrors ToOpaBatchErrors ( this Dictionary < string , Styra . Opa . OpenApi . Models . Errors . ServerError > errors )
47
- {
48
- var opaBatchErrors = new OpaBatchErrors ( ) ;
49
- foreach ( var kvp in errors )
45
+ // The OpenApi.Models.Errors variant of the ServerError type.
46
+ public static OpaBatchErrors ToOpaBatchErrors ( this Dictionary < string , Styra . Opa . OpenApi . Models . Errors . ServerError > errors )
50
47
{
51
- opaBatchErrors [ kvp . Key ] = new OpaError ( kvp . Value ) ;
48
+ var opaBatchErrors = new OpaBatchErrors ( ) ;
49
+ foreach ( var kvp in errors )
50
+ {
51
+ opaBatchErrors [ kvp . Key ] = new OpaError ( kvp . Value ) ;
52
+ }
53
+ return opaBatchErrors ;
52
54
}
53
- return opaBatchErrors ;
54
- }
55
55
56
- // The OpenApi.Models.Components variant of the ServerError type.
57
- public static OpaBatchErrors ToOpaBatchErrors ( this Dictionary < string , Styra . Opa . OpenApi . Models . Components . ServerErrorWithStatusCode > errors )
58
- {
59
- var opaBatchErrors = new OpaBatchErrors ( ) ;
60
- foreach ( var kvp in errors )
56
+ // The OpenApi.Models.Components variant of the ServerError type.
57
+ public static OpaBatchErrors ToOpaBatchErrors ( this Dictionary < string , Styra . Opa . OpenApi . Models . Components . ServerErrorWithStatusCode > errors )
61
58
{
62
- opaBatchErrors [ kvp . Key ] = new OpaError ( kvp . Value ) ;
59
+ var opaBatchErrors = new OpaBatchErrors ( ) ;
60
+ foreach ( var kvp in errors )
61
+ {
62
+ opaBatchErrors [ kvp . Key ] = new OpaError ( kvp . Value ) ;
63
+ }
64
+ return opaBatchErrors ;
63
65
}
64
- return opaBatchErrors ;
65
- }
66
66
67
- public static OpaBatchResults ToOpaBatchResults ( this Dictionary < string , SuccessfulPolicyResponse > responses )
68
- {
69
- var opaBatchResults = new OpaBatchResults ( ) ;
70
- foreach ( var kvp in responses )
67
+ public static OpaBatchResults ToOpaBatchResults ( this Dictionary < string , SuccessfulPolicyResponse > responses )
71
68
{
72
- opaBatchResults [ kvp . Key ] = ( OpaResult ) kvp . Value ;
69
+ var opaBatchResults = new OpaBatchResults ( ) ;
70
+ foreach ( var kvp in responses )
71
+ {
72
+ opaBatchResults [ kvp . Key ] = ( OpaResult ) kvp . Value ;
73
+ }
74
+ return opaBatchResults ;
73
75
}
74
- return opaBatchResults ;
75
- }
76
76
}
0 commit comments