Skip to content

Commit

Permalink
Bump MetaBrainz.Common to version 4.0.0
Browse files Browse the repository at this point in the history
This also drops all non-`async` versions of `async` methods (i.e.
`JsonUtils.Deserialize<T>()` and `JsonUtils.GetJsonContent<T>()`).

Note that the version of `JsonUtils.Deserialize<T>()` taking a `string`
remains; it has no `async` version.
  • Loading branch information
Zastai committed Jan 4, 2025
1 parent 03ca4f7 commit 7421b3d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 38 deletions.
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<!-- Package Versions -->
<ItemGroup>
<PackageVersion Include="JetBrains.Annotations" Version="2024.3.0" />
<PackageVersion Include="MetaBrainz.Common" Version="3.0.0" />
<PackageVersion Include="MetaBrainz.Common" Version="4.0.0" />
</ItemGroup>

</Project>
36 changes: 0 additions & 36 deletions MetaBrainz.Common.Json/JsonUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,6 @@ public static class JsonUtils {

#region General Utilities

/// <summary>Deserializes JSON to an object of the specified type, using default options.</summary>
/// <param name="json">The JSON to deserialize.</param>
/// <typeparam name="T">The type of object to deserialize.</typeparam>
/// <returns>A newly deserialized object of type <typeparamref name="T"/>.</returns>
/// <remarks>The options used match those returned by <see cref="CreateReaderOptions()"/>.</remarks>
public static T? Deserialize<T>(Stream json) => JsonUtils.Deserialize<T>(json, JsonUtils.ReaderOptions);

/// <summary>Deserializes JSON to an object of the specified type.</summary>
/// <param name="json">The JSON to deserialize.</param>
/// <param name="options">The options to use for deserialization.</param>
/// <typeparam name="T">The type of object to deserialize.</typeparam>
/// <returns>A newly deserialized object of type <typeparamref name="T"/>.</returns>
public static T? Deserialize<T>(Stream json, JsonSerializerOptions options) => JsonSerializer.Deserialize<T>(json, options);

/// <summary>Deserializes JSON to an object of the specified type, using default options.</summary>
/// <param name="json">The JSON to deserialize.</param>
/// <typeparam name="T">The type of object to deserialize.</typeparam>
Expand Down Expand Up @@ -71,28 +57,6 @@ public static class JsonUtils {
CancellationToken cancellationToken = default)
=> JsonSerializer.DeserializeAsync<T>(json, options, cancellationToken);

/// <summary>Deserializes an object from the JSON content of an HTTP response.</summary>
/// <param name="response">The response to process.</param>
/// <typeparam name="T">The specific type to deserialize.</typeparam>
/// <returns>The deserialized object.</returns>
/// <exception cref="JsonException">
/// When an object of type <typeparamref name="T"/> could not be deserialized from the contents of <paramref name="response"/>.
/// </exception>
/// <remarks>The options used match those returned by <see cref="CreateReaderOptions()"/>.</remarks>
public static T GetJsonContent<T>(HttpResponseMessage response)
=> AsyncUtils.ResultOf(JsonUtils.GetJsonContentAsync<T>(response));

/// <summary>Deserializes an object from the JSON content of an HTTP response.</summary>
/// <param name="response">The response to process.</param>
/// <param name="options">The JSON serializer options to apply.</param>
/// <typeparam name="T">The specific type to deserialize.</typeparam>
/// <returns>The deserialized object.</returns>
/// <exception cref="JsonException">
/// When an object of type <typeparamref name="T"/> could not be deserialized from the contents of <paramref name="response"/>.
/// </exception>
public static T GetJsonContent<T>(HttpResponseMessage response, JsonSerializerOptions options)
=> AsyncUtils.ResultOf(JsonUtils.GetJsonContentAsync<T>(response, options));

/// <summary>Deserializes an object from the JSON content of an HTTP response.</summary>
/// <param name="response">The response to process.</param>
/// <param name="cancellationToken">The cancellation token to cancel the operation.</param>
Expand Down
2 changes: 1 addition & 1 deletion MetaBrainz.Common.Json/MetaBrainz.Common.Json.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PackageCopyrightYears>2020, 2021, 2022, 2023, 2025</PackageCopyrightYears>
<PackageRepositoryName>MetaBrainz.Common.Json</PackageRepositoryName>
<PackageTags>MetaBrainz JSON</PackageTags>
<Version>6.0.3-pre</Version>
<Version>7.0.0-pre</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down

0 comments on commit 7421b3d

Please sign in to comment.