Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
HttpClientJsonExtensions.cs
Go to the documentation of this file.
7
9
10public static class HttpClientJsonExtensions
11{
12 [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
22
23 [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
33
34 [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
44
45 [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
55
57 {
58 if (client == null)
59 {
60 throw new ArgumentNullException("client");
61 }
64 }
65
75
85
95
96 [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
101
102 [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
107
108 [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
113
114 [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
119
120 [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
122 {
124 {
125 response.EnsureSuccessStatusCode();
127 }
128 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "Workaround for https://github.com/mono/linker/issues/1416. The outer method is marked as RequiresUnreferencedCode.")]
129 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2067:UnrecognizedReflectionPattern", Justification = "Workaround for https://github.com/mono/linker/issues/1416. The outer method is marked as RequiresUnreferencedCode.")]
131 {
132 return content.ReadFromJsonAsync(type, options, cancellationToken);
133 }
134 }
135
136 [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
143
144 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "Workaround for https://github.com/mono/linker/issues/1416. The outer method is marked as RequiresUnreferencedCode.")]
145 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2091:UnrecognizedReflectionPattern", Justification = "Workaround for https://github.com/mono/linker/issues/1416. The outer method is marked as RequiresUnreferencedCode.")]
147 {
148 return content.ReadFromJsonAsync<T>(options, cancellationToken);
149 }
150
157
164
165 [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
167 {
168 if (client == null)
169 {
170 throw new ArgumentNullException("client");
171 }
172 JsonContent content = JsonContent.Create(value, null, options);
173 return client.PostAsync(requestUri, content, cancellationToken);
174 }
175
176 [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
178 {
179 if (client == null)
180 {
181 throw new ArgumentNullException("client");
182 }
183 JsonContent content = JsonContent.Create(value, null, options);
184 return client.PostAsync(requestUri, content, cancellationToken);
185 }
186
187 [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
192
193 [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
198
200 {
201 if (client == null)
202 {
203 throw new ArgumentNullException("client");
204 }
206 return client.PostAsync(requestUri, content, cancellationToken);
207 }
208
218
219 [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
221 {
222 if (client == null)
223 {
224 throw new ArgumentNullException("client");
225 }
226 JsonContent content = JsonContent.Create(value, null, options);
227 return client.PutAsync(requestUri, content, cancellationToken);
228 }
229
230 [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
232 {
233 if (client == null)
234 {
235 throw new ArgumentNullException("client");
236 }
237 JsonContent content = JsonContent.Create(value, null, options);
238 return client.PutAsync(requestUri, content, cancellationToken);
239 }
240
241 [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
246
247 [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
252
254 {
255 if (client == null)
256 {
257 throw new ArgumentNullException("client");
258 }
260 return client.PutAsync(requestUri, content, cancellationToken);
261 }
262
272}
static Task< object?> GetFromJsonAsync(this HttpClient client, Uri? requestUri, Type type, JsonSerializerContext context, CancellationToken cancellationToken=default(CancellationToken))
static Task< T > ReadFromJsonAsyncHelper< T >(HttpContent content, JsonSerializerOptions options, CancellationToken cancellationToken)
static Task< TValue?> GetFromJsonAsync< TValue >(this HttpClient client, string? requestUri, JsonSerializerOptions? options, CancellationToken cancellationToken=default(CancellationToken))
static async Task< T > GetFromJsonAsyncCore< T >(Task< HttpResponseMessage > taskResponse, JsonSerializerOptions options, CancellationToken cancellationToken)
static Task< HttpResponseMessage > PutAsJsonAsync< TValue >(this HttpClient client, string? requestUri, TValue value, JsonSerializerOptions? options=null, CancellationToken cancellationToken=default(CancellationToken))
static Task< object?> GetFromJsonAsync(this HttpClient client, string? requestUri, Type type, JsonSerializerOptions? options, CancellationToken cancellationToken=default(CancellationToken))
static async Task< object > GetFromJsonAsyncCore(Task< HttpResponseMessage > taskResponse, Type type, JsonSerializerOptions options, CancellationToken cancellationToken)
static async Task< object > GetFromJsonAsyncCore(Task< HttpResponseMessage > taskResponse, Type type, JsonSerializerContext context, CancellationToken cancellationToken)
static Task< object?> GetFromJsonAsync(this HttpClient client, Uri? requestUri, Type type, CancellationToken cancellationToken=default(CancellationToken))
static Task< object?> GetFromJsonAsync(this HttpClient client, string? requestUri, Type type, CancellationToken cancellationToken=default(CancellationToken))
static Task< object?> GetFromJsonAsync(this HttpClient client, string? requestUri, Type type, JsonSerializerContext context, CancellationToken cancellationToken=default(CancellationToken))
static Task< object?> GetFromJsonAsync(this HttpClient client, Uri? requestUri, Type type, JsonSerializerOptions? options, CancellationToken cancellationToken=default(CancellationToken))
static Task< HttpResponseMessage > PostAsJsonAsync< TValue >(this HttpClient client, string? requestUri, TValue value, JsonSerializerOptions? options=null, CancellationToken cancellationToken=default(CancellationToken))
static JsonContent Create(object? inputValue, Type inputType, MediaTypeHeaderValue? mediaType=null, JsonSerializerOptions? options=null)