@azure-typespec/http-client-csharp-mgmt 1.0.0-alpha.20250409.3 → 1.0.0-alpha.20250429.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +138 -0
- package/dist/emitter/emitter.d.ts +2 -2
- package/dist/emitter/emitter.d.ts.map +1 -1
- package/dist/emitter/emitter.js +13 -6
- package/dist/emitter/emitter.js.map +1 -1
- package/dist/emitter/index.d.ts +2 -1
- package/dist/emitter/index.d.ts.map +1 -1
- package/dist/emitter/index.js +2 -1
- package/dist/emitter/index.js.map +1 -1
- package/dist/emitter/lib/lib.d.ts +4 -0
- package/dist/emitter/lib/lib.d.ts.map +1 -0
- package/dist/emitter/lib/lib.js +13 -0
- package/dist/emitter/lib/lib.js.map +1 -0
- package/dist/emitter/sdk-context-options.d.ts.map +1 -1
- package/dist/emitter/sdk-context-options.js +3 -1
- package/dist/emitter/sdk-context-options.js.map +1 -1
- package/dist/generator/Azure.Generator.Mgmt.deps.json +48 -46
- package/dist/generator/Azure.Generator.Mgmt.dll +0 -0
- package/dist/generator/Azure.Generator.Mgmt.pdb +0 -0
- package/dist/generator/Azure.Generator.dll +0 -0
- package/dist/generator/Microsoft.TypeSpec.Generator.ClientModel.dll +0 -0
- package/dist/generator/Microsoft.TypeSpec.Generator.Input.dll +0 -0
- package/dist/generator/Microsoft.TypeSpec.Generator.dll +0 -0
- package/dist/generator/Shared/Core/RawRequestUriBuilder.cs +9 -1
- package/dist/generator/Shared/Core/RequestHeaderExtensions.cs +132 -0
- package/dist/generator/Shared/Core/TypeFormatters.cs +159 -0
- package/dist/generator/net8.0/Azure.Generator.Mgmt.deps.json +48 -46
- package/dist/generator/net8.0/Azure.Generator.Mgmt.dll +0 -0
- package/dist/generator/net8.0/Azure.Generator.Mgmt.pdb +0 -0
- package/dist/generator/net8.0/Azure.Generator.dll +0 -0
- package/dist/generator/net8.0/Microsoft.TypeSpec.Generator.ClientModel.dll +0 -0
- package/dist/generator/net8.0/Microsoft.TypeSpec.Generator.Input.dll +0 -0
- package/dist/generator/net8.0/Microsoft.TypeSpec.Generator.dll +0 -0
- package/dist/generator/net8.0/Shared/Core/RawRequestUriBuilder.cs +9 -1
- package/dist/generator/net8.0/Shared/Core/RequestHeaderExtensions.cs +132 -0
- package/dist/generator/net8.0/Shared/Core/TypeFormatters.cs +159 -0
- package/package.json +40 -21
- package/dist/generator/Azure.Generator.pdb +0 -0
- package/dist/generator/Azure.Generator.xml +0 -168
- package/dist/generator/net8.0/Azure.Generator.pdb +0 -0
- package/dist/generator/net8.0/Azure.Generator.xml +0 -168
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#nullable enable
|
|
5
|
+
|
|
6
|
+
using System;
|
|
7
|
+
using System.Collections.Generic;
|
|
8
|
+
using System.Globalization;
|
|
9
|
+
using System.Linq;
|
|
10
|
+
using System.Xml;
|
|
11
|
+
|
|
12
|
+
namespace Azure.Core
|
|
13
|
+
{
|
|
14
|
+
internal static class RequestHeaderExtensions
|
|
15
|
+
{
|
|
16
|
+
public static void Add(this RequestHeaders headers, string name, bool value)
|
|
17
|
+
{
|
|
18
|
+
headers.Add(name, TypeFormatters.ToString(value));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public static void Add(this RequestHeaders headers, string name, float value)
|
|
22
|
+
{
|
|
23
|
+
headers.Add(name, value.ToString(TypeFormatters.DefaultNumberFormat, CultureInfo.InvariantCulture));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public static void Add(this RequestHeaders headers, string name, double value)
|
|
27
|
+
{
|
|
28
|
+
headers.Add(name, value.ToString(TypeFormatters.DefaultNumberFormat, CultureInfo.InvariantCulture));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public static void Add(this RequestHeaders headers, string name, int value)
|
|
32
|
+
{
|
|
33
|
+
headers.Add(name, value.ToString(TypeFormatters.DefaultNumberFormat, CultureInfo.InvariantCulture));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public static void Add(this RequestHeaders headers, string name, long value)
|
|
37
|
+
{
|
|
38
|
+
headers.Add(name, value.ToString(TypeFormatters.DefaultNumberFormat, CultureInfo.InvariantCulture));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public static void Add(this RequestHeaders headers, string name, DateTimeOffset value, string format)
|
|
42
|
+
{
|
|
43
|
+
headers.Add(name, TypeFormatters.ToString(value, format));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public static void Add(this RequestHeaders headers, string name, TimeSpan value, string format)
|
|
47
|
+
{
|
|
48
|
+
headers.Add(name, TypeFormatters.ToString(value, format));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public static void Add(this RequestHeaders headers, string name, Guid value)
|
|
52
|
+
{
|
|
53
|
+
headers.Add(name, value.ToString());
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public static void Add(this RequestHeaders headers, string name, byte[] value, string format)
|
|
57
|
+
{
|
|
58
|
+
headers.Add(name, TypeFormatters.ToString(value, format));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public static void Add(this RequestHeaders headers, string name, BinaryData value, string format)
|
|
62
|
+
{
|
|
63
|
+
headers.Add(name, TypeFormatters.ToString(value.ToArray(), format));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
public static void Add(this RequestHeaders headers, string prefix, IDictionary<string, string> headersToAdd)
|
|
67
|
+
{
|
|
68
|
+
foreach (var header in headersToAdd)
|
|
69
|
+
{
|
|
70
|
+
headers.Add(prefix + header.Key, header.Value);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public static void Add(this RequestHeaders headers, string name, ETag value)
|
|
75
|
+
{
|
|
76
|
+
headers.Add(name, value.ToString("H"));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public static void Add(this RequestHeaders headers, MatchConditions conditions)
|
|
80
|
+
{
|
|
81
|
+
if (conditions.IfMatch != null)
|
|
82
|
+
{
|
|
83
|
+
headers.Add("If-Match", conditions.IfMatch.Value);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (conditions.IfNoneMatch != null)
|
|
87
|
+
{
|
|
88
|
+
headers.Add("If-None-Match", conditions.IfNoneMatch.Value);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
public static void Add(this RequestHeaders headers, RequestConditions conditions, string format)
|
|
93
|
+
{
|
|
94
|
+
if (conditions.IfMatch != null)
|
|
95
|
+
{
|
|
96
|
+
headers.Add("If-Match", conditions.IfMatch.Value);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (conditions.IfNoneMatch != null)
|
|
100
|
+
{
|
|
101
|
+
headers.Add("If-None-Match", conditions.IfNoneMatch.Value);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (conditions.IfModifiedSince != null)
|
|
105
|
+
{
|
|
106
|
+
headers.Add("If-Modified-Since", conditions.IfModifiedSince.Value, format);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (conditions.IfUnmodifiedSince != null)
|
|
110
|
+
{
|
|
111
|
+
headers.Add("If-Unmodified-Since", conditions.IfUnmodifiedSince.Value, format);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
public static void AddDelimited<T>(this RequestHeaders headers, string name, IEnumerable<T> value, string delimiter)
|
|
116
|
+
{
|
|
117
|
+
headers.Add(name, string.Join(delimiter, value));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
public static void AddDelimited<T>(this RequestHeaders headers, string name, IEnumerable<T> value, string delimiter, string format)
|
|
121
|
+
{
|
|
122
|
+
var stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format));
|
|
123
|
+
headers.Add(name, string.Join(delimiter, stringValues));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
public static void SetDelimited<T>(this RequestHeaders headers, string name, IEnumerable<T> value, string delimiter, string format)
|
|
127
|
+
{
|
|
128
|
+
IEnumerable<string> stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format));
|
|
129
|
+
headers.SetValue(name, string.Join(delimiter, stringValues));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#nullable enable
|
|
5
|
+
|
|
6
|
+
using System;
|
|
7
|
+
using System.Collections.Generic;
|
|
8
|
+
using System.Globalization;
|
|
9
|
+
using System.Xml;
|
|
10
|
+
|
|
11
|
+
namespace Azure.Core
|
|
12
|
+
{
|
|
13
|
+
internal class TypeFormatters
|
|
14
|
+
{
|
|
15
|
+
private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ";
|
|
16
|
+
public static string DefaultNumberFormat { get; } = "G";
|
|
17
|
+
|
|
18
|
+
public static string ToString(bool value) => value ? "true" : "false";
|
|
19
|
+
|
|
20
|
+
public static string ToString(DateTime value, string format) => value.Kind switch
|
|
21
|
+
{
|
|
22
|
+
DateTimeKind.Utc => ToString((DateTimeOffset)value, format),
|
|
23
|
+
_ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.")
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
public static string ToString(DateTimeOffset value, string format) => format switch
|
|
27
|
+
{
|
|
28
|
+
"D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture),
|
|
29
|
+
"U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture),
|
|
30
|
+
"O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture),
|
|
31
|
+
"o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture),
|
|
32
|
+
"R" => value.ToString("r", CultureInfo.InvariantCulture),
|
|
33
|
+
_ => value.ToString(format, CultureInfo.InvariantCulture)
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
public static string ToString(TimeSpan value, string format) => format switch
|
|
37
|
+
{
|
|
38
|
+
"P" => XmlConvert.ToString(value),
|
|
39
|
+
_ => value.ToString(format, CultureInfo.InvariantCulture)
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
public static string ToString(byte[] value, string format) => format switch
|
|
43
|
+
{
|
|
44
|
+
"U" => ToBase64UrlString(value),
|
|
45
|
+
"D" => Convert.ToBase64String(value),
|
|
46
|
+
_ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format))
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
public static string ToBase64UrlString(byte[] value)
|
|
50
|
+
{
|
|
51
|
+
var numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3;
|
|
52
|
+
var size = checked(numWholeOrPartialInputBlocks * 4);
|
|
53
|
+
var output = new char[size];
|
|
54
|
+
|
|
55
|
+
var numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0);
|
|
56
|
+
|
|
57
|
+
// Fix up '+' -> '-' and '/' -> '_'. Drop padding characters.
|
|
58
|
+
int i = 0;
|
|
59
|
+
for (; i < numBase64Chars; i++)
|
|
60
|
+
{
|
|
61
|
+
var ch = output[i];
|
|
62
|
+
if (ch == '+')
|
|
63
|
+
{
|
|
64
|
+
output[i] = '-';
|
|
65
|
+
}
|
|
66
|
+
else if (ch == '/')
|
|
67
|
+
{
|
|
68
|
+
output[i] = '_';
|
|
69
|
+
}
|
|
70
|
+
else if (ch == '=')
|
|
71
|
+
{
|
|
72
|
+
// We've reached a padding character; truncate the remainder.
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return new string(output, 0, i);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
public static byte[] FromBase64UrlString(string value)
|
|
81
|
+
{
|
|
82
|
+
var paddingCharsToAdd = GetNumBase64PaddingCharsToAddForDecode(value.Length);
|
|
83
|
+
|
|
84
|
+
var output = new char[value.Length + paddingCharsToAdd];
|
|
85
|
+
|
|
86
|
+
int i;
|
|
87
|
+
for (i = 0; i < value.Length; i++)
|
|
88
|
+
{
|
|
89
|
+
var ch = value[i];
|
|
90
|
+
if (ch == '-')
|
|
91
|
+
{
|
|
92
|
+
output[i] = '+';
|
|
93
|
+
}
|
|
94
|
+
else if (ch == '_')
|
|
95
|
+
{
|
|
96
|
+
output[i] = '/';
|
|
97
|
+
}
|
|
98
|
+
else
|
|
99
|
+
{
|
|
100
|
+
output[i] = ch;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
for (; i < output.Length; i++)
|
|
105
|
+
{
|
|
106
|
+
output[i] = '=';
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return Convert.FromBase64CharArray(output, 0, output.Length);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
private static int GetNumBase64PaddingCharsToAddForDecode(int inputLength)
|
|
113
|
+
{
|
|
114
|
+
switch (inputLength % 4)
|
|
115
|
+
{
|
|
116
|
+
case 0:
|
|
117
|
+
return 0;
|
|
118
|
+
case 2:
|
|
119
|
+
return 2;
|
|
120
|
+
case 3:
|
|
121
|
+
return 1;
|
|
122
|
+
default:
|
|
123
|
+
throw new InvalidOperationException("Malformed input");
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
public static DateTimeOffset ParseDateTimeOffset(string value, string format)
|
|
128
|
+
{
|
|
129
|
+
return format switch
|
|
130
|
+
{
|
|
131
|
+
"U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)),
|
|
132
|
+
_ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal)
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
public static TimeSpan ParseTimeSpan(string value, string format) => format switch
|
|
137
|
+
{
|
|
138
|
+
"P" => XmlConvert.ToTimeSpan(value),
|
|
139
|
+
_ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture)
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
public static string ConvertToString(object? value, string? format = null)
|
|
143
|
+
=> value switch
|
|
144
|
+
{
|
|
145
|
+
null => "null",
|
|
146
|
+
string s => s,
|
|
147
|
+
bool b => ToString(b),
|
|
148
|
+
int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture),
|
|
149
|
+
byte[] b when format != null => ToString(b, format),
|
|
150
|
+
IEnumerable<string> s => string.Join(",", s),
|
|
151
|
+
DateTimeOffset dateTime when format != null => ToString(dateTime, format),
|
|
152
|
+
TimeSpan timeSpan when format != null => ToString(timeSpan, format),
|
|
153
|
+
TimeSpan timeSpan => XmlConvert.ToString(timeSpan),
|
|
154
|
+
Guid guid => guid.ToString(),
|
|
155
|
+
BinaryData binaryData => TypeFormatters.ConvertToString(binaryData.ToArray(), format),
|
|
156
|
+
_ => value.ToString()!
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
}
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
"compilationOptions": {},
|
|
7
7
|
"targets": {
|
|
8
8
|
".NETCoreApp,Version=v8.0": {
|
|
9
|
-
"Azure.Generator.Mgmt/1.0.0-alpha.
|
|
9
|
+
"Azure.Generator.Mgmt/1.0.0-alpha.20250429.1": {
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"Azure.Core": "1.44.1",
|
|
12
|
-
"Azure.Generator": "1.0.0-alpha.
|
|
12
|
+
"Azure.Generator": "1.0.0-alpha.20250423.3",
|
|
13
13
|
"Azure.ResourceManager": "1.13.0",
|
|
14
|
-
"Microsoft.Azure.AutoRest.CSharp": "3.0.0-beta.
|
|
14
|
+
"Microsoft.Azure.AutoRest.CSharp": "3.0.0-beta.20250426.1",
|
|
15
15
|
"Microsoft.SourceLink.GitHub": "8.0.0",
|
|
16
|
-
"Microsoft.TypeSpec.Generator.ClientModel": "1.0.0-alpha.
|
|
16
|
+
"Microsoft.TypeSpec.Generator.ClientModel": "1.0.0-alpha.20250424.2",
|
|
17
17
|
"SauceControl.InheritDoc": "1.2.0",
|
|
18
18
|
"StyleCop.Analyzers": "1.2.0-beta.333"
|
|
19
19
|
},
|
|
@@ -39,6 +39,19 @@
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
|
+
"Azure.Generator/1.0.0-alpha.20250423.3": {
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"Azure.Core": "1.44.1",
|
|
45
|
+
"Azure.ResourceManager": "1.13.0",
|
|
46
|
+
"Microsoft.TypeSpec.Generator.ClientModel": "1.0.0-alpha.20250424.2"
|
|
47
|
+
},
|
|
48
|
+
"runtime": {
|
|
49
|
+
"lib/net8.0/Azure.Generator.dll": {
|
|
50
|
+
"assemblyVersion": "1.0.0.0",
|
|
51
|
+
"fileVersion": "1.0.0.0"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
42
55
|
"Azure.ResourceManager/1.13.0": {
|
|
43
56
|
"dependencies": {
|
|
44
57
|
"Azure.Core": "1.44.1",
|
|
@@ -68,7 +81,7 @@
|
|
|
68
81
|
}
|
|
69
82
|
}
|
|
70
83
|
},
|
|
71
|
-
"Microsoft.Azure.AutoRest.CSharp/3.0.0-beta.
|
|
84
|
+
"Microsoft.Azure.AutoRest.CSharp/3.0.0-beta.20250426.1": {},
|
|
72
85
|
"Microsoft.Bcl.AsyncInterfaces/7.0.0": {
|
|
73
86
|
"runtime": {
|
|
74
87
|
"lib/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.dll": {
|
|
@@ -347,12 +360,12 @@
|
|
|
347
360
|
"Microsoft.SourceLink.Common": "8.0.0"
|
|
348
361
|
}
|
|
349
362
|
},
|
|
350
|
-
"Microsoft.TypeSpec.Generator/1.0.0-alpha.
|
|
363
|
+
"Microsoft.TypeSpec.Generator/1.0.0-alpha.20250424.2": {
|
|
351
364
|
"dependencies": {
|
|
352
365
|
"CommandLineParser": "2.9.1",
|
|
353
366
|
"Microsoft.Build": "17.9.5",
|
|
354
367
|
"Microsoft.CodeAnalysis.CSharp.Workspaces": "4.8.0",
|
|
355
|
-
"Microsoft.TypeSpec.Generator.Input": "1.0.0-alpha.
|
|
368
|
+
"Microsoft.TypeSpec.Generator.Input": "1.0.0-alpha.20250424.2",
|
|
356
369
|
"NuGet.Configuration": "6.9.1",
|
|
357
370
|
"System.ComponentModel.Composition": "8.0.0",
|
|
358
371
|
"System.Memory.Data": "8.0.1"
|
|
@@ -364,9 +377,9 @@
|
|
|
364
377
|
}
|
|
365
378
|
}
|
|
366
379
|
},
|
|
367
|
-
"Microsoft.TypeSpec.Generator.ClientModel/1.0.0-alpha.
|
|
380
|
+
"Microsoft.TypeSpec.Generator.ClientModel/1.0.0-alpha.20250424.2": {
|
|
368
381
|
"dependencies": {
|
|
369
|
-
"Microsoft.TypeSpec.Generator": "1.0.0-alpha.
|
|
382
|
+
"Microsoft.TypeSpec.Generator": "1.0.0-alpha.20250424.2",
|
|
370
383
|
"System.ClientModel": "1.3.0"
|
|
371
384
|
},
|
|
372
385
|
"runtime": {
|
|
@@ -376,7 +389,7 @@
|
|
|
376
389
|
}
|
|
377
390
|
}
|
|
378
391
|
},
|
|
379
|
-
"Microsoft.TypeSpec.Generator.Input/1.0.0-alpha.
|
|
392
|
+
"Microsoft.TypeSpec.Generator.Input/1.0.0-alpha.20250424.2": {
|
|
380
393
|
"dependencies": {
|
|
381
394
|
"Microsoft.CodeAnalysis.CSharp.Workspaces": "4.8.0",
|
|
382
395
|
"System.Memory.Data": "8.0.1"
|
|
@@ -603,24 +616,11 @@
|
|
|
603
616
|
},
|
|
604
617
|
"System.Threading.Channels/7.0.0": {},
|
|
605
618
|
"System.Threading.Tasks.Dataflow/8.0.0": {},
|
|
606
|
-
"System.Threading.Tasks.Extensions/4.5.4": {}
|
|
607
|
-
"Azure.Generator/1.0.0-alpha.20250409.1": {
|
|
608
|
-
"dependencies": {
|
|
609
|
-
"Azure.Core": "1.44.1",
|
|
610
|
-
"Azure.ResourceManager": "1.13.0",
|
|
611
|
-
"Microsoft.TypeSpec.Generator.ClientModel": "1.0.0-alpha.20250320.1"
|
|
612
|
-
},
|
|
613
|
-
"runtime": {
|
|
614
|
-
"Azure.Generator.dll": {
|
|
615
|
-
"assemblyVersion": "1.0.0.0",
|
|
616
|
-
"fileVersion": "1.0.0.0"
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
}
|
|
619
|
+
"System.Threading.Tasks.Extensions/4.5.4": {}
|
|
620
620
|
}
|
|
621
621
|
},
|
|
622
622
|
"libraries": {
|
|
623
|
-
"Azure.Generator.Mgmt/1.0.0-alpha.
|
|
623
|
+
"Azure.Generator.Mgmt/1.0.0-alpha.20250429.1": {
|
|
624
624
|
"type": "project",
|
|
625
625
|
"serviceable": false,
|
|
626
626
|
"sha512": ""
|
|
@@ -632,6 +632,13 @@
|
|
|
632
632
|
"path": "azure.core/1.44.1",
|
|
633
633
|
"hashPath": "azure.core.1.44.1.nupkg.sha512"
|
|
634
634
|
},
|
|
635
|
+
"Azure.Generator/1.0.0-alpha.20250423.3": {
|
|
636
|
+
"type": "package",
|
|
637
|
+
"serviceable": true,
|
|
638
|
+
"sha512": "sha512-uf0E0IhrQLCxoZ496Pnm3rTsLYnk8Nfb70FhzfwDfXO22HJ52JGc+nSqzmoIGr3bVitxfCDtwidvhNlWy475Gg==",
|
|
639
|
+
"path": "azure.generator/1.0.0-alpha.20250423.3",
|
|
640
|
+
"hashPath": "azure.generator.1.0.0-alpha.20250423.3.nupkg.sha512"
|
|
641
|
+
},
|
|
635
642
|
"Azure.ResourceManager/1.13.0": {
|
|
636
643
|
"type": "package",
|
|
637
644
|
"serviceable": true,
|
|
@@ -653,12 +660,12 @@
|
|
|
653
660
|
"path": "humanizer.core/2.14.1",
|
|
654
661
|
"hashPath": "humanizer.core.2.14.1.nupkg.sha512"
|
|
655
662
|
},
|
|
656
|
-
"Microsoft.Azure.AutoRest.CSharp/3.0.0-beta.
|
|
663
|
+
"Microsoft.Azure.AutoRest.CSharp/3.0.0-beta.20250426.1": {
|
|
657
664
|
"type": "package",
|
|
658
665
|
"serviceable": true,
|
|
659
|
-
"sha512": "sha512-
|
|
660
|
-
"path": "microsoft.azure.autorest.csharp/3.0.0-beta.
|
|
661
|
-
"hashPath": "microsoft.azure.autorest.csharp.3.0.0-beta.
|
|
666
|
+
"sha512": "sha512-7kj8EXYRGgnUlN8RM4G39i3tEPKtUokbnRgsTzZe3dp6H52mhyx8a6XuykWiJ2t2fMXCBdfmK5TNIAkg1Utd7g==",
|
|
667
|
+
"path": "microsoft.azure.autorest.csharp/3.0.0-beta.20250426.1",
|
|
668
|
+
"hashPath": "microsoft.azure.autorest.csharp.3.0.0-beta.20250426.1.nupkg.sha512"
|
|
662
669
|
},
|
|
663
670
|
"Microsoft.Bcl.AsyncInterfaces/7.0.0": {
|
|
664
671
|
"type": "package",
|
|
@@ -751,26 +758,26 @@
|
|
|
751
758
|
"path": "microsoft.sourcelink.github/8.0.0",
|
|
752
759
|
"hashPath": "microsoft.sourcelink.github.8.0.0.nupkg.sha512"
|
|
753
760
|
},
|
|
754
|
-
"Microsoft.TypeSpec.Generator/1.0.0-alpha.
|
|
761
|
+
"Microsoft.TypeSpec.Generator/1.0.0-alpha.20250424.2": {
|
|
755
762
|
"type": "package",
|
|
756
763
|
"serviceable": true,
|
|
757
|
-
"sha512": "sha512-
|
|
758
|
-
"path": "microsoft.typespec.generator/1.0.0-alpha.
|
|
759
|
-
"hashPath": "microsoft.typespec.generator.1.0.0-alpha.
|
|
764
|
+
"sha512": "sha512-KgFQmDJQ8j6juezvzjAF1UCcKB/FWI4xy4sp9iWEpDqNNqO+BGc8i1nUca7QHxvgIAtI3TrN0ifQgZsGA2boYA==",
|
|
765
|
+
"path": "microsoft.typespec.generator/1.0.0-alpha.20250424.2",
|
|
766
|
+
"hashPath": "microsoft.typespec.generator.1.0.0-alpha.20250424.2.nupkg.sha512"
|
|
760
767
|
},
|
|
761
|
-
"Microsoft.TypeSpec.Generator.ClientModel/1.0.0-alpha.
|
|
768
|
+
"Microsoft.TypeSpec.Generator.ClientModel/1.0.0-alpha.20250424.2": {
|
|
762
769
|
"type": "package",
|
|
763
770
|
"serviceable": true,
|
|
764
|
-
"sha512": "sha512-
|
|
765
|
-
"path": "microsoft.typespec.generator.clientmodel/1.0.0-alpha.
|
|
766
|
-
"hashPath": "microsoft.typespec.generator.clientmodel.1.0.0-alpha.
|
|
771
|
+
"sha512": "sha512-OTmTezjWnC1pSPFEV0Kd4aIdIoxjZUJVHOoCBDoJ+pPXRFhY+7G6+iQANDt/c5iRsud2pVyJFYN4l+U083AwUA==",
|
|
772
|
+
"path": "microsoft.typespec.generator.clientmodel/1.0.0-alpha.20250424.2",
|
|
773
|
+
"hashPath": "microsoft.typespec.generator.clientmodel.1.0.0-alpha.20250424.2.nupkg.sha512"
|
|
767
774
|
},
|
|
768
|
-
"Microsoft.TypeSpec.Generator.Input/1.0.0-alpha.
|
|
775
|
+
"Microsoft.TypeSpec.Generator.Input/1.0.0-alpha.20250424.2": {
|
|
769
776
|
"type": "package",
|
|
770
777
|
"serviceable": true,
|
|
771
|
-
"sha512": "sha512-
|
|
772
|
-
"path": "microsoft.typespec.generator.input/1.0.0-alpha.
|
|
773
|
-
"hashPath": "microsoft.typespec.generator.input.1.0.0-alpha.
|
|
778
|
+
"sha512": "sha512-uXPVTgQqO66Nw3cWJIrSWH6UGXxsiq4HyED+V8KCXRBHh1qSy7KIbzgDHgmDQRKgrlFXsP4QHjG2F1ML9Yqd2g==",
|
|
779
|
+
"path": "microsoft.typespec.generator.input/1.0.0-alpha.20250424.2",
|
|
780
|
+
"hashPath": "microsoft.typespec.generator.input.1.0.0-alpha.20250424.2.nupkg.sha512"
|
|
774
781
|
},
|
|
775
782
|
"NuGet.Common/6.9.1": {
|
|
776
783
|
"type": "package",
|
|
@@ -988,11 +995,6 @@
|
|
|
988
995
|
"sha512": "sha512-zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==",
|
|
989
996
|
"path": "system.threading.tasks.extensions/4.5.4",
|
|
990
997
|
"hashPath": "system.threading.tasks.extensions.4.5.4.nupkg.sha512"
|
|
991
|
-
},
|
|
992
|
-
"Azure.Generator/1.0.0-alpha.20250409.1": {
|
|
993
|
-
"type": "project",
|
|
994
|
-
"serviceable": false,
|
|
995
|
-
"sha512": ""
|
|
996
998
|
}
|
|
997
999
|
}
|
|
998
1000
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
#nullable enable
|
|
5
5
|
|
|
6
6
|
using System;
|
|
7
|
+
using System.Collections.Generic;
|
|
7
8
|
using System.Globalization;
|
|
8
|
-
using System.
|
|
9
|
+
using System.Linq;
|
|
9
10
|
|
|
10
11
|
namespace Azure.Core
|
|
11
12
|
{
|
|
@@ -188,5 +189,12 @@ namespace Azure.Core
|
|
|
188
189
|
|
|
189
190
|
AppendRaw(nextLink, escape);
|
|
190
191
|
}
|
|
192
|
+
|
|
193
|
+
public void AppendQueryDelimited<T>(string name, IEnumerable<T> value, string delimiter, string? format = null, bool escape = true)
|
|
194
|
+
{
|
|
195
|
+
delimiter ??= ",";
|
|
196
|
+
IEnumerable<string> stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format));
|
|
197
|
+
AppendQuery(name, string.Join(delimiter, stringValues), escape);
|
|
198
|
+
}
|
|
191
199
|
}
|
|
192
200
|
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#nullable enable
|
|
5
|
+
|
|
6
|
+
using System;
|
|
7
|
+
using System.Collections.Generic;
|
|
8
|
+
using System.Globalization;
|
|
9
|
+
using System.Linq;
|
|
10
|
+
using System.Xml;
|
|
11
|
+
|
|
12
|
+
namespace Azure.Core
|
|
13
|
+
{
|
|
14
|
+
internal static class RequestHeaderExtensions
|
|
15
|
+
{
|
|
16
|
+
public static void Add(this RequestHeaders headers, string name, bool value)
|
|
17
|
+
{
|
|
18
|
+
headers.Add(name, TypeFormatters.ToString(value));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public static void Add(this RequestHeaders headers, string name, float value)
|
|
22
|
+
{
|
|
23
|
+
headers.Add(name, value.ToString(TypeFormatters.DefaultNumberFormat, CultureInfo.InvariantCulture));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public static void Add(this RequestHeaders headers, string name, double value)
|
|
27
|
+
{
|
|
28
|
+
headers.Add(name, value.ToString(TypeFormatters.DefaultNumberFormat, CultureInfo.InvariantCulture));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public static void Add(this RequestHeaders headers, string name, int value)
|
|
32
|
+
{
|
|
33
|
+
headers.Add(name, value.ToString(TypeFormatters.DefaultNumberFormat, CultureInfo.InvariantCulture));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public static void Add(this RequestHeaders headers, string name, long value)
|
|
37
|
+
{
|
|
38
|
+
headers.Add(name, value.ToString(TypeFormatters.DefaultNumberFormat, CultureInfo.InvariantCulture));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public static void Add(this RequestHeaders headers, string name, DateTimeOffset value, string format)
|
|
42
|
+
{
|
|
43
|
+
headers.Add(name, TypeFormatters.ToString(value, format));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public static void Add(this RequestHeaders headers, string name, TimeSpan value, string format)
|
|
47
|
+
{
|
|
48
|
+
headers.Add(name, TypeFormatters.ToString(value, format));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public static void Add(this RequestHeaders headers, string name, Guid value)
|
|
52
|
+
{
|
|
53
|
+
headers.Add(name, value.ToString());
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public static void Add(this RequestHeaders headers, string name, byte[] value, string format)
|
|
57
|
+
{
|
|
58
|
+
headers.Add(name, TypeFormatters.ToString(value, format));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public static void Add(this RequestHeaders headers, string name, BinaryData value, string format)
|
|
62
|
+
{
|
|
63
|
+
headers.Add(name, TypeFormatters.ToString(value.ToArray(), format));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
public static void Add(this RequestHeaders headers, string prefix, IDictionary<string, string> headersToAdd)
|
|
67
|
+
{
|
|
68
|
+
foreach (var header in headersToAdd)
|
|
69
|
+
{
|
|
70
|
+
headers.Add(prefix + header.Key, header.Value);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public static void Add(this RequestHeaders headers, string name, ETag value)
|
|
75
|
+
{
|
|
76
|
+
headers.Add(name, value.ToString("H"));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public static void Add(this RequestHeaders headers, MatchConditions conditions)
|
|
80
|
+
{
|
|
81
|
+
if (conditions.IfMatch != null)
|
|
82
|
+
{
|
|
83
|
+
headers.Add("If-Match", conditions.IfMatch.Value);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (conditions.IfNoneMatch != null)
|
|
87
|
+
{
|
|
88
|
+
headers.Add("If-None-Match", conditions.IfNoneMatch.Value);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
public static void Add(this RequestHeaders headers, RequestConditions conditions, string format)
|
|
93
|
+
{
|
|
94
|
+
if (conditions.IfMatch != null)
|
|
95
|
+
{
|
|
96
|
+
headers.Add("If-Match", conditions.IfMatch.Value);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (conditions.IfNoneMatch != null)
|
|
100
|
+
{
|
|
101
|
+
headers.Add("If-None-Match", conditions.IfNoneMatch.Value);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (conditions.IfModifiedSince != null)
|
|
105
|
+
{
|
|
106
|
+
headers.Add("If-Modified-Since", conditions.IfModifiedSince.Value, format);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (conditions.IfUnmodifiedSince != null)
|
|
110
|
+
{
|
|
111
|
+
headers.Add("If-Unmodified-Since", conditions.IfUnmodifiedSince.Value, format);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
public static void AddDelimited<T>(this RequestHeaders headers, string name, IEnumerable<T> value, string delimiter)
|
|
116
|
+
{
|
|
117
|
+
headers.Add(name, string.Join(delimiter, value));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
public static void AddDelimited<T>(this RequestHeaders headers, string name, IEnumerable<T> value, string delimiter, string format)
|
|
121
|
+
{
|
|
122
|
+
var stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format));
|
|
123
|
+
headers.Add(name, string.Join(delimiter, stringValues));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
public static void SetDelimited<T>(this RequestHeaders headers, string name, IEnumerable<T> value, string delimiter, string format)
|
|
127
|
+
{
|
|
128
|
+
IEnumerable<string> stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format));
|
|
129
|
+
headers.SetValue(name, string.Join(delimiter, stringValues));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|