diff --git a/Directory.Packages.props b/Directory.Packages.props
index 1868a11..827553b 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -4,8 +4,8 @@
-
-
+
+
diff --git a/MetaBrainz.MusicBrainz/Interfaces/IPagedQueryResults.cs b/MetaBrainz.MusicBrainz/Interfaces/IPagedQueryResults.cs
index 1e91f41..724205a 100644
--- a/MetaBrainz.MusicBrainz/Interfaces/IPagedQueryResults.cs
+++ b/MetaBrainz.MusicBrainz/Interfaces/IPagedQueryResults.cs
@@ -1,10 +1,11 @@
using System.Collections.Generic;
-using System.Net;
+using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using JetBrains.Annotations;
+using MetaBrainz.Common;
using MetaBrainz.Common.Json;
namespace MetaBrainz.MusicBrainz.Interfaces;
@@ -46,8 +47,8 @@ public interface IPagedQueryResults : IJsonBasedObject
/// of results, based on and .
///
/// This result set (with updated values).
- /// When the web service reports an error.
- /// When something goes wrong with the web request.
+ /// When the web service reports an error.
+ /// When something goes wrong with the request.
TResults Next();
///
@@ -56,8 +57,8 @@ public interface IPagedQueryResults : IJsonBasedObject
///
/// The cancellation token to cancel the operation.
/// This result set (with updated values).
- /// When the web service reports an error.
- /// When something goes wrong with the web request.
+ /// When the web service reports an error.
+ /// When something goes wrong with the request.
Task NextAsync(CancellationToken cancellationToken = default);
///
@@ -77,8 +78,8 @@ public interface IPagedQueryResults : IJsonBasedObject
/// of results, based on and .
///
/// This result set (with updated values).
- /// When the web service reports an error.
- /// When something goes wrong with the web request.
+ /// When the web service reports an error.
+ /// When something goes wrong with the request.
TResults Previous();
///
@@ -87,8 +88,8 @@ public interface IPagedQueryResults : IJsonBasedObject
///
/// The cancellation token to cancel the operation.
/// This result set (with updated values).
- /// When the web service reports an error.
- /// When something goes wrong with the web request.
+ /// When the web service reports an error.
+ /// When something goes wrong with the request.
Task PreviousAsync(CancellationToken cancellationToken = default);
/// The current results.
diff --git a/MetaBrainz.MusicBrainz/Json/Converters.cs b/MetaBrainz.MusicBrainz/Json/Converters.cs
index b6c9e63..e04fb82 100644
--- a/MetaBrainz.MusicBrainz/Json/Converters.cs
+++ b/MetaBrainz.MusicBrainz/Json/Converters.cs
@@ -35,7 +35,8 @@ internal static class Converters {
yield return SearchResultsReader.Instance;
yield return TagReader.Instance;
// Other objects we deserialize
- yield return MessageOrErrorReader.Instance;
+ yield return ErrorResultReader.Instance;
+ yield return MessageResultReader.Instance;
}
}
diff --git a/MetaBrainz.MusicBrainz/Json/HelperMethods.cs b/MetaBrainz.MusicBrainz/Json/HelperMethods.cs
index b5d1902..f767e0b 100644
--- a/MetaBrainz.MusicBrainz/Json/HelperMethods.cs
+++ b/MetaBrainz.MusicBrainz/Json/HelperMethods.cs
@@ -15,25 +15,23 @@ internal static class HelperMethods {
return TimeSpan.FromMilliseconds(ms.Value);
}
- public static EntityType ParseEntityType(string? text) {
- return text switch {
- "area" => EntityType.Area,
- "artist" => EntityType.Artist,
- "collection" => EntityType.Collection,
- "event" => EntityType.Event,
- "genre" => EntityType.Genre,
- "instrument" => EntityType.Instrument,
- "label" => EntityType.Label,
- "place" => EntityType.Place,
- "recording" => EntityType.Recording,
- "release" => EntityType.Release,
- "release-group" => EntityType.ReleaseGroup, // for Annotation
- "release_group" => EntityType.ReleaseGroup, // for Collection and Relationship
- "series" => EntityType.Series,
- "url" => EntityType.Url,
- "work" => EntityType.Work,
- _ => EntityType.Unknown
- };
- }
+ public static EntityType ParseEntityType(string? text) => text switch {
+ "area" => EntityType.Area,
+ "artist" => EntityType.Artist,
+ "collection" => EntityType.Collection,
+ "event" => EntityType.Event,
+ "genre" => EntityType.Genre,
+ "instrument" => EntityType.Instrument,
+ "label" => EntityType.Label,
+ "place" => EntityType.Place,
+ "recording" => EntityType.Recording,
+ "release" => EntityType.Release,
+ "release-group" => EntityType.ReleaseGroup, // for Annotation
+ "release_group" => EntityType.ReleaseGroup, // for Collection and Relationship
+ "series" => EntityType.Series,
+ "url" => EntityType.Url,
+ "work" => EntityType.Work,
+ _ => EntityType.Unknown
+ };
}
diff --git a/MetaBrainz.MusicBrainz/Json/Readers/AuthorizationErrorReader.cs b/MetaBrainz.MusicBrainz/Json/Readers/AuthorizationErrorReader.cs
new file mode 100644
index 0000000..5ec6dbd
--- /dev/null
+++ b/MetaBrainz.MusicBrainz/Json/Readers/AuthorizationErrorReader.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.Text.Json;
+
+using MetaBrainz.Common.Json;
+using MetaBrainz.Common.Json.Converters;
+using MetaBrainz.MusicBrainz.Objects;
+
+namespace MetaBrainz.MusicBrainz.Json.Readers;
+
+internal sealed class AuthorizationErrorReader : ObjectReader {
+
+ public static readonly AuthorizationErrorReader Instance = new();
+
+ protected override AuthorizationError ReadObjectContents(ref Utf8JsonReader reader, JsonSerializerOptions options) {
+ string? error = null;
+ string? description = null;
+ Dictionary? rest = null;
+ while (reader.TokenType == JsonTokenType.PropertyName) {
+ var prop = reader.GetPropertyName();
+ try {
+ reader.Read();
+ switch (prop) {
+ case "error":
+ error = reader.GetString();
+ break;
+ case "error_description":
+ description = reader.GetString();
+ break;
+ default:
+ rest ??= new Dictionary();
+ rest[prop] = reader.GetOptionalObject(options);
+ break;
+ }
+ }
+ catch (Exception e) {
+ throw new JsonException($"Failed to deserialize the '{prop}' property.", e);
+ }
+ reader.Read();
+ }
+ return new AuthorizationError {
+ Error = error,
+ Description = description,
+ UnhandledProperties = rest
+ };
+ }
+
+}
diff --git a/MetaBrainz.MusicBrainz/Json/Readers/DiscIdLookupResultReader.cs b/MetaBrainz.MusicBrainz/Json/Readers/DiscIdLookupResultReader.cs
index d12b8f1..a487f77 100644
--- a/MetaBrainz.MusicBrainz/Json/Readers/DiscIdLookupResultReader.cs
+++ b/MetaBrainz.MusicBrainz/Json/Readers/DiscIdLookupResultReader.cs
@@ -88,8 +88,9 @@ internal sealed class DiscIdLookupResultReader : ObjectReader {
+internal sealed class ErrorResultReader : ObjectReader {
- public static readonly MessageOrErrorReader Instance = new();
+ public static readonly ErrorResultReader Instance = new();
- protected override MessageOrError ReadObjectContents(ref Utf8JsonReader reader, JsonSerializerOptions options) {
+ protected override ErrorResult ReadObjectContents(ref Utf8JsonReader reader, JsonSerializerOptions options) {
string? error = null;
string? help = null;
- string? message = null;
Dictionary? rest = null;
while (reader.TokenType == JsonTokenType.PropertyName) {
var prop = reader.GetPropertyName();
@@ -28,9 +27,6 @@ internal sealed class MessageOrErrorReader : ObjectReader {
case "help":
help = reader.GetString();
break;
- case "message":
- message = reader.GetString();
- break;
default:
rest ??= new Dictionary();
rest[prop] = reader.GetOptionalObject(options);
@@ -42,10 +38,9 @@ internal sealed class MessageOrErrorReader : ObjectReader {
}
reader.Read();
}
- return new MessageOrError {
+ return new ErrorResult {
Error = error,
Help = help,
- Message = message,
UnhandledProperties = rest
};
}
diff --git a/MetaBrainz.MusicBrainz/Json/Readers/MessageResultReader.cs b/MetaBrainz.MusicBrainz/Json/Readers/MessageResultReader.cs
new file mode 100644
index 0000000..86331fa
--- /dev/null
+++ b/MetaBrainz.MusicBrainz/Json/Readers/MessageResultReader.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Text.Json;
+
+using MetaBrainz.Common.Json;
+using MetaBrainz.Common.Json.Converters;
+using MetaBrainz.MusicBrainz.Objects;
+
+namespace MetaBrainz.MusicBrainz.Json.Readers;
+
+internal sealed class MessageResultReader : ObjectReader {
+
+ public static readonly MessageResultReader Instance = new();
+
+ protected override MessageResult ReadObjectContents(ref Utf8JsonReader reader, JsonSerializerOptions options) {
+ string? message = null;
+ Dictionary? rest = null;
+ while (reader.TokenType == JsonTokenType.PropertyName) {
+ var prop = reader.GetPropertyName();
+ try {
+ reader.Read();
+ switch (prop) {
+ case "message":
+ message = reader.GetString();
+ break;
+ default:
+ rest ??= new Dictionary();
+ rest[prop] = reader.GetOptionalObject(options);
+ break;
+ }
+ }
+ catch (Exception e) {
+ throw new JsonException($"Failed to deserialize the '{prop}' property.", e);
+ }
+ reader.Read();
+ }
+ return new MessageResult {
+ Message = message,
+ UnhandledProperties = rest
+ };
+ }
+
+}
diff --git a/MetaBrainz.MusicBrainz/MetaBrainz.MusicBrainz.csproj b/MetaBrainz.MusicBrainz/MetaBrainz.MusicBrainz.csproj
index 7b37c6f..a7f941f 100644
--- a/MetaBrainz.MusicBrainz/MetaBrainz.MusicBrainz.csproj
+++ b/MetaBrainz.MusicBrainz/MetaBrainz.MusicBrainz.csproj
@@ -1,7 +1,7 @@
-
+
Zastai
diff --git a/MetaBrainz.MusicBrainz/OAuth2.cs b/MetaBrainz.MusicBrainz/OAuth2.cs
index 56be494..b68a235 100644
--- a/MetaBrainz.MusicBrainz/OAuth2.cs
+++ b/MetaBrainz.MusicBrainz/OAuth2.cs
@@ -63,7 +63,7 @@ public sealed class OAuth2 : IDisposable {
private static string _defaultUrlScheme = "https";
- /// The default internet access protocol to use for requests.
+ /// The default URL scheme (internet access protocol) to use for requests.
public static string DefaultUrlScheme {
get => OAuth2._defaultUrlScheme;
set {
@@ -150,7 +150,7 @@ public sealed class OAuth2 : IDisposable {
private string _urlScheme = OAuth2.DefaultUrlScheme;
- /// The internet access protocol to use for requests.
+ /// The URL scheme (internet access protocol) to use for requests.
public string UrlScheme {
get => this._urlScheme;
set {
@@ -241,8 +241,6 @@ public IAuthorizationToken RefreshBearerToken(string refreshToken, string client
#endregion
- #region Internals
-
#region HttpClient / IDisposable
private static readonly MediaTypeWithQualityHeaderValue AcceptHeader = new("application/json");
@@ -263,11 +261,15 @@ public IAuthorizationToken RefreshBearerToken(string refreshToken, string client
private HttpClient Client {
get {
+#if NET6_0
if (this._disposed) {
- throw new ObjectDisposedException(nameof(OAuth2));
+ throw new ObjectDisposedException(typeof(OAuth2).FullName);
}
+#else
+ ObjectDisposedException.ThrowIf(this._disposed, typeof(OAuth2));
+#endif
if (this._client is null) {
- var client = this._clientCreation is not null ? this._clientCreation() : new HttpClient();
+ var client = this._clientCreation?.Invoke() ?? new HttpClient();
this._clientConfiguration?.Invoke(client);
this._client = client;
}
@@ -333,8 +335,10 @@ public IAuthorizationToken RefreshBearerToken(string refreshToken, string client
#endregion
+ #region Internals
+
private static readonly JsonSerializerOptions JsonReaderOptions =
- JsonUtils.CreateReaderOptions(AuthorizationTokenReader.Instance);
+ JsonUtils.CreateReaderOptions(AuthorizationTokenReader.Instance, AuthorizationErrorReader.Instance);
private async Task PerformRequestAsync(Uri uri, HttpMethod method, HttpContent? body,
CancellationToken cancellationToken) {
@@ -349,26 +353,51 @@ public IAuthorizationToken RefreshBearerToken(string refreshToken, string client
}
request.Headers.UserAgent.Add(OAuth2.LibraryProductInfo);
request.Headers.UserAgent.Add(OAuth2.LibraryComment);
- Debug.Print($"[{DateTime.UtcNow}] => HEADERS: {TextUtils.FormatMultiLine(request.Headers.ToString())}");
+ Debug.Print("[{0}] => HEADERS: {1}", DateTime.UtcNow, TextUtils.FormatMultiLine(request.Headers.ToString()));
if (body is not null) {
// FIXME: Should this include the actual body text too?
- Debug.Print($"[{DateTime.UtcNow}] => BODY ({body.Headers.ContentType}): {body.Headers.ContentLength ?? 0} bytes");
+ Debug.Print("[{0}] => BODY ({1}): {2} bytes", DateTime.UtcNow, body.Headers.ContentType, body.Headers.ContentLength ?? 0);
}
var response = await client.SendAsync(request, cancellationToken).ConfigureAwait(false);
- Debug.Print($"[{DateTime.UtcNow}] WEB SERVICE RESPONSE: {(int) response.StatusCode}/{response.StatusCode} " +
- $"'{response.ReasonPhrase}' (v{response.Version})");
- Debug.Print($"[{DateTime.UtcNow}] => HEADERS: {TextUtils.FormatMultiLine(response.Headers.ToString())}");
- Debug.Print($"[{DateTime.UtcNow}] => CONTENT ({response.Content.Headers.ContentType}): " +
- $"{response.Content.Headers.ContentLength ?? 0} bytes");
- return response;
+ Debug.Print("[{0}] WEB SERVICE RESPONSE: {1}/{2} '{3}' (v{4})", DateTime.UtcNow, (int) response.StatusCode, response.StatusCode,
+ response.ReasonPhrase, response.Version);
+ Debug.Print("[{0}] => HEADERS: {1}", DateTime.UtcNow, TextUtils.FormatMultiLine(response.Headers.ToString()));
+ Debug.Print("[{0}] => CONTENT ({1}): {2} bytes", DateTime.UtcNow, response.Content.Headers.ContentType,
+ response.Content.Headers.ContentLength ?? 0);
+ try {
+ return await response.EnsureSuccessfulAsync(cancellationToken);
+ }
+ catch (HttpError error) {
+ if (!string.IsNullOrWhiteSpace(error.Content)) {
+ AuthorizationError? ae;
+ try {
+ ae = JsonSerializer.Deserialize(error.Content, OAuth2.JsonReaderOptions);
+ if (ae is null) {
+ throw new JsonException("Error response had null content.");
+ }
+ Debug.Print("[{0}] => ERROR '{1}' / '{2}'", DateTime.UtcNow, ae.Error, ae.Description);
+ // FIXME: What is the best way to compose this value?
+ if (ae.UnhandledProperties is not null) {
+ foreach (var prop in ae.UnhandledProperties) {
+ Debug.Print("[{0}] => UNEXPECTED ERROR PROPERTY: {1} -> {2}", DateTime.UtcNow, prop.Key, prop.Value);
+ }
+ }
+ }
+ catch (Exception e) {
+ Debug.Print("[{0}] => FAILED TO PARSE ERROR RESPONSE CONTENT AS JSON: {1}", DateTime.UtcNow, e.Message);
+ ae = null;
+ }
+ if (ae is not null) {
+ throw new HttpError(error.Status, ae.Error, response.Version, ae.Description, error);
+ }
+ }
+ throw;
+ }
}
private async Task PostAsync(HttpContent content, CancellationToken cancellationToken) {
var uri = new UriBuilder(this.UrlScheme, this.Server, this.Port, OAuth2.TokenEndPoint).Uri;
var response = await this.PerformRequestAsync(uri, HttpMethod.Post, content, cancellationToken).ConfigureAwait(false);
- if (!response.IsSuccessStatusCode) {
- throw await QueryException.FromResponseAsync(response, cancellationToken).ConfigureAwait(false);
- }
var jsonTask = JsonUtils.GetJsonContentAsync(response, OAuth2.JsonReaderOptions, cancellationToken);
return await jsonTask.ConfigureAwait(false);
}
@@ -382,19 +411,19 @@ public IAuthorizationToken RefreshBearerToken(string refreshToken, string client
return token;
}
- private async Task RefreshTokenAsync(string type, string codeOrToken, string clientSecret,
- CancellationToken cancellationToken) {
+ private Task RefreshTokenAsync(string type, string codeOrToken, string clientSecret,
+ CancellationToken cancellationToken) {
var body = new StringBuilder();
body.Append("client_id=").Append(Uri.EscapeDataString(this.ClientId));
body.Append("&client_secret=").Append(Uri.EscapeDataString(clientSecret));
body.Append("&token_type=").Append(Uri.EscapeDataString(type));
body.Append("&grant_type=refresh_token");
body.Append("&refresh_token=").Append(Uri.EscapeDataString(codeOrToken));
- return await this.PostAsync(type, body.ToString(), cancellationToken).ConfigureAwait(false);
+ return this.PostAsync(type, body.ToString(), cancellationToken);
}
- private async Task RequestTokenAsync(string type, string codeOrToken, string clientSecret, Uri redirectUri,
- CancellationToken cancellationToken) {
+ private Task RequestTokenAsync(string type, string codeOrToken, string clientSecret, Uri redirectUri,
+ CancellationToken cancellationToken) {
var body = new StringBuilder();
body.Append("client_id=").Append(Uri.EscapeDataString(this.ClientId));
body.Append("&client_secret=").Append(Uri.EscapeDataString(clientSecret));
@@ -402,7 +431,7 @@ public IAuthorizationToken RefreshBearerToken(string refreshToken, string client
body.Append("&grant_type=authorization_code");
body.Append("&code=").Append(Uri.EscapeDataString(codeOrToken));
body.Append("&redirect_uri=").Append(Uri.EscapeDataString(redirectUri.ToString()));
- return await this.PostAsync(type, body.ToString(), cancellationToken).ConfigureAwait(false);
+ return this.PostAsync(type, body.ToString(), cancellationToken);
}
private static IEnumerable ScopeStrings(AuthorizationScope scope) {
diff --git a/MetaBrainz.MusicBrainz/Objects/AuthorizationError.cs b/MetaBrainz.MusicBrainz/Objects/AuthorizationError.cs
new file mode 100644
index 0000000..4d91019
--- /dev/null
+++ b/MetaBrainz.MusicBrainz/Objects/AuthorizationError.cs
@@ -0,0 +1,11 @@
+using MetaBrainz.Common.Json;
+
+namespace MetaBrainz.MusicBrainz.Objects;
+
+internal sealed class AuthorizationError : JsonBasedObject {
+
+ public string? Error { get; init; }
+
+ public string? Description { get; init; }
+
+}
diff --git a/MetaBrainz.MusicBrainz/Objects/DiscIdLookupResult.cs b/MetaBrainz.MusicBrainz/Objects/DiscIdLookupResult.cs
index 77f3887..fda8ca6 100644
--- a/MetaBrainz.MusicBrainz/Objects/DiscIdLookupResult.cs
+++ b/MetaBrainz.MusicBrainz/Objects/DiscIdLookupResult.cs
@@ -8,25 +8,40 @@ namespace MetaBrainz.MusicBrainz.Objects;
internal sealed class DiscIdLookupResult : JsonBasedObject, IDiscIdLookupResult {
- public IDisc? Disc { get; set; }
+ public DiscIdLookupResult() {
+ }
+
+ public DiscIdLookupResult(IDisc? disc) {
+ this.Disc = disc;
+ }
+
+ public DiscIdLookupResult(IReadOnlyList? releases) {
+ this.Releases = releases;
+ }
+
+ public DiscIdLookupResult(ICdStub? stub) {
+ this.Stub = stub;
+ }
+
+ public IDisc? Disc { get; }
- public IReadOnlyList? Releases { get; set; }
+ public IReadOnlyList? Releases { get; }
- public ICdStub? Stub { get; set; }
+ public ICdStub? Stub { get; }
/// Gets the textual representation of the disc ID lookup result.
/// A string describing the lookup results.
public override string ToString() {
if (this.Disc is not null) {
- return "Disc: " + this.Disc;
+ return $"Disc: {this.Disc}";
}
if (this.Stub is not null) {
- return "CD Stub: " + this.Stub;
+ return $"CD Stub: {this.Stub}";
}
if (this.Releases is not null) {
return $"{this.Releases.Count} Release(s)";
}
- return string.Empty; // should be impossible
+ return "Result Data Not Recognized";
}
}
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/Alias.cs b/MetaBrainz.MusicBrainz/Objects/Entities/Alias.cs
index b7f620f..8e1b569 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/Alias.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/Alias.cs
@@ -12,23 +12,23 @@ internal sealed class Alias : JsonBasedObject, IAlias {
this.Primary = primary;
}
- public PartialDate? Begin { get; set; }
+ public PartialDate? Begin { get; init; }
- public PartialDate? End { get; set; }
+ public PartialDate? End { get; init; }
- public bool Ended { get; set; }
+ public bool Ended { get; init; }
- public string? Locale { get; set; }
+ public string? Locale { get; init; }
public string Name { get; }
public bool Primary { get; }
- public string? SortName { get; set; }
+ public string? SortName { get; init; }
- public string? Type { get; set; }
+ public string? Type { get; init; }
- public Guid? TypeId { get; set; }
+ public Guid? TypeId { get; init; }
public override string ToString() {
var text = this.Name;
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/Annotation.cs b/MetaBrainz.MusicBrainz/Objects/Entities/Annotation.cs
index 5843ab3..35898df 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/Annotation.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/Annotation.cs
@@ -7,13 +7,13 @@ namespace MetaBrainz.MusicBrainz.Objects.Entities;
internal sealed class Annotation : JsonBasedObject, IAnnotation {
- public Guid? Entity { get; set; }
+ public Guid? Entity { get; init; }
- public string? Name { get; set; }
+ public string? Name { get; init; }
- public string? Text { get; set; }
+ public string? Text { get; init; }
- public EntityType? Type { get; set; }
+ public EntityType? Type { get; init; }
public override string? ToString() => this.Text;
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/Area.cs b/MetaBrainz.MusicBrainz/Objects/Entities/Area.cs
index 6eebfd6..5fc12f7 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/Area.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/Area.cs
@@ -10,37 +10,37 @@ internal sealed class Area : Entity, IArea {
public Area(Guid id) : base(EntityType.Area, id) {
}
- public IReadOnlyList? Aliases { get; set; }
+ public IReadOnlyList? Aliases { get; init; }
- public string? Annotation { get; set; }
+ public string? Annotation { get; init; }
- public string? Disambiguation { get; set; }
+ public string? Disambiguation { get; init; }
- public IReadOnlyList? Genres { get; set; }
+ public IReadOnlyList? Genres { get; init; }
- public IReadOnlyList? Iso31661Codes { get; set; }
+ public IReadOnlyList? Iso31661Codes { get; init; }
- public IReadOnlyList? Iso31662Codes { get; set; }
+ public IReadOnlyList? Iso31662Codes { get; init; }
- public IReadOnlyList? Iso31663Codes { get; set; }
+ public IReadOnlyList? Iso31663Codes { get; init; }
- public ILifeSpan? LifeSpan { get; set; }
+ public ILifeSpan? LifeSpan { get; init; }
- public string? Name { get; set; }
+ public string? Name { get; init; }
- public IReadOnlyList? Relationships { get; set; }
+ public IReadOnlyList? Relationships { get; init; }
- public string? SortName { get; set; }
+ public string? SortName { get; init; }
- public IReadOnlyList? Tags { get; set; }
+ public IReadOnlyList? Tags { get; init; }
- public string? Type { get; set; }
+ public string? Type { get; init; }
- public Guid? TypeId { get; set; }
+ public Guid? TypeId { get; init; }
- public IReadOnlyList? UserGenres { get; set; }
+ public IReadOnlyList? UserGenres { get; init; }
- public IReadOnlyList? UserTags { get; set; }
+ public IReadOnlyList? UserTags { get; init; }
public override string ToString() {
var text = this.Name ?? string.Empty;
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/Artist.cs b/MetaBrainz.MusicBrainz/Objects/Entities/Artist.cs
index 22f9b92..89d758f 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/Artist.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/Artist.cs
@@ -10,59 +10,59 @@ internal sealed class Artist : Entity, IArtist {
public Artist(Guid id) : base(EntityType.Artist, id) {
}
- public IReadOnlyList? Aliases { get; set; }
+ public IReadOnlyList? Aliases { get; init; }
- public string? Annotation { get; set; }
+ public string? Annotation { get; init; }
- public IArea? Area { get; set; }
+ public IArea? Area { get; init; }
- public IArea? BeginArea { get; set; }
+ public IArea? BeginArea { get; init; }
- public string? Country { get; set; }
+ public string? Country { get; init; }
- public string? Disambiguation { get; set; }
+ public string? Disambiguation { get; init; }
- public IArea? EndArea { get; set; }
+ public IArea? EndArea { get; init; }
- public string? Gender { get; set; }
+ public string? Gender { get; init; }
- public Guid? GenderId { get; set; }
+ public Guid? GenderId { get; init; }
- public IReadOnlyList? Genres { get; set; }
+ public IReadOnlyList? Genres { get; init; }
- public IReadOnlyList? Ipis { get; set; }
+ public IReadOnlyList? Ipis { get; init; }
- public IReadOnlyList? Isnis { get; set; }
+ public IReadOnlyList? Isnis { get; init; }
- public ILifeSpan? LifeSpan { get; set; }
+ public ILifeSpan? LifeSpan { get; init; }
- public string? Name { get; set; }
+ public string? Name { get; init; }
- public IRating? Rating { get; set; }
+ public IRating? Rating { get; init; }
- public IReadOnlyList? Recordings { get; set; }
+ public IReadOnlyList? Recordings { get; init; }
- public IReadOnlyList? Relationships { get; set; }
+ public IReadOnlyList? Relationships { get; init; }
- public IReadOnlyList? ReleaseGroups { get; set; }
+ public IReadOnlyList? ReleaseGroups { get; init; }
- public IReadOnlyList? Releases { get; set; }
+ public IReadOnlyList? Releases { get; init; }
- public string? SortName { get; set; }
+ public string? SortName { get; init; }
- public IReadOnlyList? Tags { get; set; }
+ public IReadOnlyList? Tags { get; init; }
- public string? Type { get; set; }
+ public string? Type { get; init; }
- public Guid? TypeId { get; set; }
+ public Guid? TypeId { get; init; }
- public IReadOnlyList? UserGenres { get; set; }
+ public IReadOnlyList? UserGenres { get; init; }
- public IRating? UserRating { get; set; }
+ public IRating? UserRating { get; init; }
- public IReadOnlyList? UserTags { get; set; }
+ public IReadOnlyList? UserTags { get; init; }
- public IReadOnlyList? Works { get; set; }
+ public IReadOnlyList? Works { get; init; }
public override string ToString() {
var text = this.Name ?? string.Empty;
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/CdStub.cs b/MetaBrainz.MusicBrainz/Objects/Entities/CdStub.cs
index 705d32a..d0b78ce 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/CdStub.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/CdStub.cs
@@ -14,17 +14,17 @@ internal sealed class CdStub : JsonBasedObject, ICdStub {
public string Id { get; }
- public string? Artist { get; set; }
+ public string? Artist { get; init; }
- public string? Barcode { get; set; }
+ public string? Barcode { get; init; }
- public string? Disambiguation { get; set; }
+ public string? Disambiguation { get; init; }
public string Title { get; }
- public int TrackCount { get; set; }
+ public int TrackCount { get; init; }
- public IReadOnlyList? Tracks { get; set; }
+ public IReadOnlyList? Tracks { get; init; }
public override string ToString() {
var text = string.Empty;
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/Collection.cs b/MetaBrainz.MusicBrainz/Objects/Entities/Collection.cs
index a7c1276..62e9113 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/Collection.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/Collection.cs
@@ -11,15 +11,15 @@ internal sealed class Collection : Entity, ICollection {
this.ItemCount = itemCount;
}
- public string? Editor { get; set; }
+ public string? Editor { get; init; }
public EntityType ContentType { get; }
- public string? Name { get; set; }
+ public string? Name { get; init; }
- public string? Type { get; set; }
+ public string? Type { get; init; }
- public Guid? TypeId { get; set; }
+ public Guid? TypeId { get; init; }
public int ItemCount { get; }
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/CoverArtArchive.cs b/MetaBrainz.MusicBrainz/Objects/Entities/CoverArtArchive.cs
index 84380c9..5b9d26c 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/CoverArtArchive.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/CoverArtArchive.cs
@@ -5,15 +5,15 @@ namespace MetaBrainz.MusicBrainz.Objects.Entities;
internal sealed class CoverArtArchive : JsonBasedObject, ICoverArtArchive {
- public bool Artwork { get; set; }
+ public bool Artwork { get; init; }
- public bool Back { get; set; }
+ public bool Back { get; init; }
- public int Count { get; set; }
+ public int Count { get; init; }
- public bool Darkened { get; set; }
+ public bool Darkened { get; init; }
- public bool Front { get; set; }
+ public bool Front { get; init; }
public override string ToString() {
if (this.Darkened) {
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/Disc.cs b/MetaBrainz.MusicBrainz/Objects/Entities/Disc.cs
index c71a312..7e42e1e 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/Disc.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/Disc.cs
@@ -18,7 +18,7 @@ internal sealed class Disc : JsonBasedObject, IDisc {
public IReadOnlyList Offsets { get; }
- public IReadOnlyList? Releases { get; set; }
+ public IReadOnlyList? Releases { get; init; }
public int Sectors { get; }
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/Event.cs b/MetaBrainz.MusicBrainz/Objects/Entities/Event.cs
index 18f6569..8fd59a1 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/Event.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/Event.cs
@@ -10,39 +10,39 @@ internal sealed class Event : Entity, IEvent {
public Event(Guid id) : base(EntityType.Event, id) {
}
- public IReadOnlyList? Aliases { get; set; }
+ public IReadOnlyList? Aliases { get; init; }
- public string? Annotation { get; set; }
+ public string? Annotation { get; init; }
- public bool Cancelled { get; set; }
+ public bool Cancelled { get; init; }
- public string? Disambiguation { get; set; }
+ public string? Disambiguation { get; init; }
- public IReadOnlyList? Genres { get; set; }
+ public IReadOnlyList? Genres { get; init; }
- public ILifeSpan? LifeSpan { get; set; }
+ public ILifeSpan? LifeSpan { get; init; }
- public string? Name { get; set; }
+ public string? Name { get; init; }
- public IRating? Rating { get; set; }
+ public IRating? Rating { get; init; }
- public IReadOnlyList? Relationships { get; set; }
+ public IReadOnlyList? Relationships { get; init; }
- public string? Setlist { get; set; }
+ public string? Setlist { get; init; }
- public IReadOnlyList? Tags { get; set; }
+ public IReadOnlyList? Tags { get; init; }
- public string? Time { get; set; }
+ public string? Time { get; init; }
- public string? Type { get; set; }
+ public string? Type { get; init; }
- public Guid? TypeId { get; set; }
+ public Guid? TypeId { get; init; }
- public IReadOnlyList? UserGenres { get; set; }
+ public IReadOnlyList? UserGenres { get; init; }
- public IRating? UserRating { get; set; }
+ public IRating? UserRating { get; init; }
- public IReadOnlyList? UserTags { get; set; }
+ public IReadOnlyList? UserTags { get; init; }
public override string ToString() {
var text = this.Name ?? string.Empty;
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/Genre.cs b/MetaBrainz.MusicBrainz/Objects/Entities/Genre.cs
index cdfa459..3b8560e 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/Genre.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/Genre.cs
@@ -10,11 +10,11 @@ internal sealed class Genre : Entity, IGenre {
this.Name = name;
}
- public string? Disambiguation { get; set; }
+ public string? Disambiguation { get; init; }
public string Name { get; }
- public int? VoteCount { get; set; }
+ public int? VoteCount { get; init; }
public override string ToString() {
var text = this.Name;
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/Instrument.cs b/MetaBrainz.MusicBrainz/Objects/Entities/Instrument.cs
index 016bfd2..cb7ec75 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/Instrument.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/Instrument.cs
@@ -10,29 +10,29 @@ internal sealed class Instrument : Entity, IInstrument {
public Instrument(Guid id) : base(EntityType.Instrument, id) {
}
- public IReadOnlyList? Aliases { get; set; }
+ public IReadOnlyList? Aliases { get; init; }
- public string? Annotation { get; set; }
+ public string? Annotation { get; init; }
- public string? Description { get; set; }
+ public string? Description { get; init; }
- public string? Disambiguation { get; set; }
+ public string? Disambiguation { get; init; }
- public IReadOnlyList? Genres { get; set; }
+ public IReadOnlyList? Genres { get; init; }
- public string? Name { get; set; }
+ public string? Name { get; init; }
- public IReadOnlyList? Relationships { get; set; }
+ public IReadOnlyList? Relationships { get; init; }
- public IReadOnlyList? Tags { get; set; }
+ public IReadOnlyList? Tags { get; init; }
- public string? Type { get; set; }
+ public string? Type { get; init; }
- public Guid? TypeId { get; set; }
+ public Guid? TypeId { get; init; }
- public IReadOnlyList? UserGenres { get; set; }
+ public IReadOnlyList? UserGenres { get; init; }
- public IReadOnlyList? UserTags { get; set; }
+ public IReadOnlyList? UserTags { get; init; }
public override string ToString() {
var text = this.Name ?? string.Empty;
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/Label.cs b/MetaBrainz.MusicBrainz/Objects/Entities/Label.cs
index d661539..2747adc 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/Label.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/Label.cs
@@ -10,47 +10,47 @@ internal sealed class Label : Entity, ILabel {
public Label(Guid id) : base(EntityType.Label, id) {
}
- public IReadOnlyList? Aliases { get; set; }
+ public IReadOnlyList? Aliases { get; init; }
- public string? Annotation { get; set; }
+ public string? Annotation { get; init; }
- public IArea? Area { get; set; }
+ public IArea? Area { get; init; }
- public string? Country { get; set; }
+ public string? Country { get; init; }
- public string? Disambiguation { get; set; }
+ public string? Disambiguation { get; init; }
- public IReadOnlyList? Genres { get; set; }
+ public IReadOnlyList? Genres { get; init; }
- public IReadOnlyList? Ipis { get; set; }
+ public IReadOnlyList? Ipis { get; init; }
- public IReadOnlyList? Isnis { get; set; }
+ public IReadOnlyList? Isnis { get; init; }
- public int? LabelCode { get; set; }
+ public int? LabelCode { get; init; }
- public ILifeSpan? LifeSpan { get; set; }
+ public ILifeSpan? LifeSpan { get; init; }
- public string? Name { get; set; }
+ public string? Name { get; init; }
- public IRating? Rating { get; set; }
+ public IRating? Rating { get; init; }
- public IReadOnlyList? Relationships { get; set; }
+ public IReadOnlyList? Relationships { get; init; }
- public IReadOnlyList? Releases { get; set; }
+ public IReadOnlyList? Releases { get; init; }
- public string? SortName { get; set; }
+ public string? SortName { get; init; }
- public IReadOnlyList? Tags { get; set; }
+ public IReadOnlyList? Tags { get; init; }
- public string? Type { get; set; }
+ public string? Type { get; init; }
- public Guid? TypeId { get; set; }
+ public Guid? TypeId { get; init; }
- public IReadOnlyList? UserGenres { get; set; }
+ public IReadOnlyList? UserGenres { get; init; }
- public IRating? UserRating { get; set; }
+ public IRating? UserRating { get; init; }
- public IReadOnlyList? UserTags { get; set; }
+ public IReadOnlyList? UserTags { get; init; }
public override string ToString() {
var text = this.Name ?? string.Empty;
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/LabelInfo.cs b/MetaBrainz.MusicBrainz/Objects/Entities/LabelInfo.cs
index 7c26e37..28390a2 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/LabelInfo.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/LabelInfo.cs
@@ -5,9 +5,9 @@ namespace MetaBrainz.MusicBrainz.Objects.Entities;
internal sealed class LabelInfo : JsonBasedObject, ILabelInfo {
- public string? CatalogNumber { get; set; }
+ public string? CatalogNumber { get; init; }
- public ILabel? Label { get; set; }
+ public ILabel? Label { get; init; }
public override string ToString() {
var text = string.Empty;
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/LifeSpan.cs b/MetaBrainz.MusicBrainz/Objects/Entities/LifeSpan.cs
index 20ecf44..7444a1a 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/LifeSpan.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/LifeSpan.cs
@@ -5,11 +5,11 @@ namespace MetaBrainz.MusicBrainz.Objects.Entities;
internal sealed class LifeSpan : JsonBasedObject, ILifeSpan {
- public PartialDate? Begin { get; set; }
+ public PartialDate? Begin { get; init; }
- public PartialDate? End { get; set; }
+ public PartialDate? End { get; init; }
- public bool Ended { get; set; }
+ public bool Ended { get; init; }
public override string ToString() {
var text = this.Begin?.ToString() ?? "????";
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/Medium.cs b/MetaBrainz.MusicBrainz/Objects/Entities/Medium.cs
index 87c6d43..d6a9bca 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/Medium.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/Medium.cs
@@ -8,25 +8,25 @@ namespace MetaBrainz.MusicBrainz.Objects.Entities;
internal sealed class Medium : JsonBasedObject, IMedium {
- public IReadOnlyList? DataTracks { get; set; }
+ public IReadOnlyList? DataTracks { get; init; }
- public IReadOnlyList? Discs { get; set; }
+ public IReadOnlyList? Discs { get; init; }
- public string? Format { get; set; }
+ public string? Format { get; init; }
- public Guid? FormatId { get; set; }
+ public Guid? FormatId { get; init; }
- public int Position { get; set; }
+ public int Position { get; init; }
- public ITrack? Pregap { get; set; }
+ public ITrack? Pregap { get; init; }
- public string? Title { get; set; }
+ public string? Title { get; init; }
- public int TrackCount { get; set; }
+ public int TrackCount { get; init; }
- public int? TrackOffset { get; set; }
+ public int? TrackOffset { get; init; }
- public IReadOnlyList? Tracks { get; set; }
+ public IReadOnlyList? Tracks { get; init; }
public override string ToString() {
var text = this.Format ?? "Medium";
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/NameCredit.cs b/MetaBrainz.MusicBrainz/Objects/Entities/NameCredit.cs
index 2045739..8771be7 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/NameCredit.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/NameCredit.cs
@@ -5,11 +5,11 @@ namespace MetaBrainz.MusicBrainz.Objects.Entities;
internal sealed class NameCredit : JsonBasedObject, INameCredit {
- public IArtist? Artist { get; set; }
+ public IArtist? Artist { get; init; }
- public string? JoinPhrase { get; set; }
+ public string? JoinPhrase { get; init; }
- public string? Name { get; set; }
+ public string? Name { get; init; }
public override string ToString() {
var text = string.Empty;
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/Place.cs b/MetaBrainz.MusicBrainz/Objects/Entities/Place.cs
index 79856d0..9659b81 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/Place.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/Place.cs
@@ -10,35 +10,35 @@ internal sealed class Place : Entity, IPlace {
public Place(Guid id) : base(EntityType.Place, id) {
}
- public string? Address { get; set; }
+ public string? Address { get; init; }
- public IReadOnlyList? Aliases { get; set; }
+ public IReadOnlyList? Aliases { get; init; }
- public string? Annotation { get; set; }
+ public string? Annotation { get; init; }
- public IArea? Area { get; set; }
+ public IArea? Area { get; init; }
- public ICoordinates? Coordinates { get; set; }
+ public ICoordinates? Coordinates { get; init; }
- public string? Disambiguation { get; set; }
+ public string? Disambiguation { get; init; }
- public IReadOnlyList? Genres { get; set; }
+ public IReadOnlyList? Genres { get; init; }
- public ILifeSpan? LifeSpan { get; set; }
+ public ILifeSpan? LifeSpan { get; init; }
- public string? Name { get; set; }
+ public string? Name { get; init; }
- public IReadOnlyList? Relationships { get; set; }
+ public IReadOnlyList? Relationships { get; init; }
- public IReadOnlyList? Tags { get; set; }
+ public IReadOnlyList? Tags { get; init; }
- public string? Type { get; set; }
+ public string? Type { get; init; }
- public Guid? TypeId { get; set; }
+ public Guid? TypeId { get; init; }
- public IReadOnlyList? UserGenres { get; set; }
+ public IReadOnlyList? UserGenres { get; init; }
- public IReadOnlyList? UserTags { get; set; }
+ public IReadOnlyList? UserTags { get; init; }
public override string ToString() {
var text = this.Name ?? string.Empty;
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/Rating.cs b/MetaBrainz.MusicBrainz/Objects/Entities/Rating.cs
index 9cf786e..1cf1367 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/Rating.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/Rating.cs
@@ -7,9 +7,9 @@ namespace MetaBrainz.MusicBrainz.Objects.Entities;
internal sealed class Rating : JsonBasedObject, IRating {
- public decimal? Value { get; set; }
+ public decimal? Value { get; init; }
- public int? VoteCount { get; set; }
+ public int? VoteCount { get; init; }
public override string ToString() {
var text = string.Empty;
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/Recording.cs b/MetaBrainz.MusicBrainz/Objects/Entities/Recording.cs
index 798029a..207ff8f 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/Recording.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/Recording.cs
@@ -10,39 +10,39 @@ internal sealed class Recording : Entity, IRecording {
public Recording(Guid id) : base(EntityType.Recording, id) {
}
- public IReadOnlyList? Aliases { get; set; }
+ public IReadOnlyList? Aliases { get; init; }
- public string? Annotation { get; set; }
+ public string? Annotation { get; init; }
- public IReadOnlyList? ArtistCredit { get; set; }
+ public IReadOnlyList? ArtistCredit { get; init; }
- public string? Disambiguation { get; set; }
+ public string? Disambiguation { get; init; }
- public PartialDate? FirstReleaseDate { get; set; }
+ public PartialDate? FirstReleaseDate { get; init; }
- public IReadOnlyList? Genres { get; set; }
+ public IReadOnlyList? Genres { get; init; }
- public IReadOnlyList? Isrcs { get; set; }
+ public IReadOnlyList? Isrcs { get; init; }
- public TimeSpan? Length { get; set; }
+ public TimeSpan? Length { get; init; }
- public IRating? Rating { get; set; }
+ public IRating? Rating { get; init; }
- public IReadOnlyList? Relationships { get; set; }
+ public IReadOnlyList? Relationships { get; init; }
- public IReadOnlyList? Releases { get; set; }
+ public IReadOnlyList? Releases { get; init; }
- public IReadOnlyList? Tags { get; set; }
+ public IReadOnlyList? Tags { get; init; }
- public string? Title { get; set; }
+ public string? Title { get; init; }
- public IReadOnlyList? UserGenres { get; set; }
+ public IReadOnlyList? UserGenres { get; init; }
- public IRating? UserRating { get; set; }
+ public IRating? UserRating { get; init; }
- public IReadOnlyList? UserTags { get; set; }
+ public IReadOnlyList? UserTags { get; init; }
- public bool Video { get; set; }
+ public bool Video { get; init; }
public override string ToString() {
var text = string.Empty;
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/Relationship.cs b/MetaBrainz.MusicBrainz/Objects/Entities/Relationship.cs
index 4eda5b5..ed20bbc 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/Relationship.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/Relationship.cs
@@ -8,45 +8,45 @@ namespace MetaBrainz.MusicBrainz.Objects.Entities;
internal sealed class Relationship : JsonBasedObject, IRelationship {
- public IArea? Area { get; set; }
+ public IArea? Area { get; init; }
- public IArtist? Artist { get; set; }
+ public IArtist? Artist { get; init; }
- public IReadOnlyList? Attributes { get; set; }
+ public IReadOnlyList? Attributes { get; init; }
- public IReadOnlyDictionary? AttributeCredits { get; set; }
+ public IReadOnlyDictionary? AttributeCredits { get; init; }
- public IReadOnlyDictionary? AttributeIds { get; set; }
+ public IReadOnlyDictionary? AttributeIds { get; init; }
- public IReadOnlyDictionary? AttributeValues { get; set; }
+ public IReadOnlyDictionary? AttributeValues { get; init; }
- public PartialDate? Begin { get; set; }
+ public PartialDate? Begin { get; init; }
- public string? Direction { get; set; }
+ public string? Direction { get; init; }
- public PartialDate? End { get; set; }
+ public PartialDate? End { get; init; }
- public bool Ended { get; set; }
+ public bool Ended { get; init; }
- public IEvent? Event { get; set; }
+ public IEvent? Event { get; init; }
- public IInstrument? Instrument { get; set; }
+ public IInstrument? Instrument { get; init; }
- public ILabel? Label { get; set; }
+ public ILabel? Label { get; init; }
- public int? OrderingKey { get; set; }
+ public int? OrderingKey { get; init; }
- public IPlace? Place { get; set; }
+ public IPlace? Place { get; init; }
- public IRecording? Recording { get; set; }
+ public IRecording? Recording { get; init; }
- public IRelease? Release { get; set; }
+ public IRelease? Release { get; init; }
- public IReleaseGroup? ReleaseGroup { get; set; }
+ public IReleaseGroup? ReleaseGroup { get; init; }
- public ISeries? Series { get; set; }
+ public ISeries? Series { get; init; }
- public string? SourceCredit { get; set; }
+ public string? SourceCredit { get; init; }
public IRelatableEntity? Target => this.TargetType switch {
EntityType.Area => this.Area,
@@ -64,19 +64,19 @@ internal sealed class Relationship : JsonBasedObject, IRelationship {
_ => null
};
- public string? TargetCredit { get; set; }
+ public string? TargetCredit { get; init; }
- public Guid? TargetId { get; set; }
+ public Guid? TargetId { get; init; }
- public EntityType? TargetType { get; set; }
+ public EntityType? TargetType { get; init; }
- public string? Type { get; set; }
+ public string? Type { get; init; }
- public Guid? TypeId { get; set; }
+ public Guid? TypeId { get; init; }
- public IUrl? Url { get; set; }
+ public IUrl? Url { get; init; }
- public IWork? Work { get; set; }
+ public IWork? Work { get; init; }
public override string ToString() => $"{this.Type} → {this.TargetType}: {this.Target}";
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/Release.cs b/MetaBrainz.MusicBrainz/Objects/Entities/Release.cs
index a2a4bc5..51a2a5f 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/Release.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/Release.cs
@@ -10,57 +10,57 @@ internal sealed class Release : Entity, IRelease {
public Release(Guid id) : base(EntityType.Release, id) {
}
- public IReadOnlyList? Aliases { get; set; }
+ public IReadOnlyList? Aliases { get; init; }
- public string? Annotation { get; set; }
+ public string? Annotation { get; init; }
- public IReadOnlyList? ArtistCredit { get; set; }
+ public IReadOnlyList? ArtistCredit { get; init; }
- public string? Asin { get; set; }
+ public string? Asin { get; init; }
- public string? Barcode { get; set; }
+ public string? Barcode { get; init; }
- public IReadOnlyList? Collections { get; set; }
+ public IReadOnlyList? Collections { get; init; }
- public string? Country { get; set; }
+ public string? Country { get; init; }
- public ICoverArtArchive? CoverArtArchive { get; set; }
+ public ICoverArtArchive? CoverArtArchive { get; init; }
- public PartialDate? Date { get; set; }
+ public PartialDate? Date { get; init; }
- public string? Disambiguation { get; set; }
+ public string? Disambiguation { get; init; }
- public IReadOnlyList? Genres { get; set; }
+ public IReadOnlyList? Genres { get; init; }
- public IReadOnlyList? LabelInfo { get; set; }
+ public IReadOnlyList? LabelInfo { get; init; }
- public IReadOnlyList? Media { get; set; }
+ public IReadOnlyList? Media { get; init; }
- public string? Packaging { get; set; }
+ public string? Packaging { get; init; }
- public Guid? PackagingId { get; set; }
+ public Guid? PackagingId { get; init; }
- public string? Quality { get; set; }
+ public string? Quality { get; init; }
- public IReadOnlyList? Relationships { get; set; }
+ public IReadOnlyList? Relationships { get; init; }
- public IReadOnlyList? ReleaseEvents { get; set; }
+ public IReadOnlyList? ReleaseEvents { get; init; }
- public IReleaseGroup? ReleaseGroup { get; set; }
+ public IReleaseGroup? ReleaseGroup { get; init; }
- public string? Status { get; set; }
+ public string? Status { get; init; }
- public Guid? StatusId { get; set; }
+ public Guid? StatusId { get; init; }
- public IReadOnlyList? Tags { get; set; }
+ public IReadOnlyList? Tags { get; init; }
- public ITextRepresentation? TextRepresentation { get; set; }
+ public ITextRepresentation? TextRepresentation { get; init; }
- public string? Title { get; set; }
+ public string? Title { get; init; }
- public IReadOnlyList? UserGenres { get; set; }
+ public IReadOnlyList? UserGenres { get; init; }
- public IReadOnlyList? UserTags { get; set; }
+ public IReadOnlyList? UserTags { get; init; }
public override string ToString() {
var text = string.Empty;
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/ReleaseEvent.cs b/MetaBrainz.MusicBrainz/Objects/Entities/ReleaseEvent.cs
index e04aa21..5116d9a 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/ReleaseEvent.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/ReleaseEvent.cs
@@ -5,9 +5,9 @@ namespace MetaBrainz.MusicBrainz.Objects.Entities;
internal sealed class ReleaseEvent : JsonBasedObject, IReleaseEvent {
- public IArea? Area { get; set; }
+ public IArea? Area { get; init; }
- public PartialDate? Date { get; set; }
+ public PartialDate? Date { get; init; }
public override string ToString() {
if (this.Date is null) {
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/ReleaseGroup.cs b/MetaBrainz.MusicBrainz/Objects/Entities/ReleaseGroup.cs
index 291f875..943932b 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/ReleaseGroup.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/ReleaseGroup.cs
@@ -13,41 +13,41 @@ internal sealed class ReleaseGroup : Entity, IReleaseGroup {
public ReleaseGroup(Guid id) : base(EntityType.ReleaseGroup, id) {
}
- public IReadOnlyList? Aliases { get; set; }
+ public IReadOnlyList? Aliases { get; init; }
- public string? Annotation { get; set; }
+ public string? Annotation { get; init; }
- public IReadOnlyList? ArtistCredit { get; set; }
+ public IReadOnlyList? ArtistCredit { get; init; }
- public string? Disambiguation { get; set; }
+ public string? Disambiguation { get; init; }
- public PartialDate? FirstReleaseDate { get; set; }
+ public PartialDate? FirstReleaseDate { get; init; }
- public IReadOnlyList? Genres { get; set; }
+ public IReadOnlyList? Genres { get; init; }
- public string? PrimaryType { get; set; }
+ public string? PrimaryType { get; init; }
- public Guid? PrimaryTypeId { get; set; }
+ public Guid? PrimaryTypeId { get; init; }
- public IRating? Rating { get; set; }
+ public IRating? Rating { get; init; }
- public IReadOnlyList? Relationships { get; set; }
+ public IReadOnlyList? Relationships { get; init; }
- public IReadOnlyList? Releases { get; set; }
+ public IReadOnlyList? Releases { get; init; }
- public IReadOnlyList? SecondaryTypes { get; set; }
+ public IReadOnlyList? SecondaryTypes { get; init; }
- public IReadOnlyList? SecondaryTypeIds { get; set; }
+ public IReadOnlyList? SecondaryTypeIds { get; init; }
- public IReadOnlyList? Tags { get; set; }
+ public IReadOnlyList? Tags { get; init; }
- public string? Title { get; set; }
+ public string? Title { get; init; }
- public IReadOnlyList? UserGenres { get; set; }
+ public IReadOnlyList? UserGenres { get; init; }
- public IRating? UserRating { get; set; }
+ public IRating? UserRating { get; init; }
- public IReadOnlyList? UserTags { get; set; }
+ public IReadOnlyList? UserTags { get; init; }
public override string ToString() {
var text = string.Empty;
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/Series.cs b/MetaBrainz.MusicBrainz/Objects/Entities/Series.cs
index 8f25e25..627a238 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/Series.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/Series.cs
@@ -10,27 +10,27 @@ internal sealed class Series : Entity, ISeries {
public Series(Guid id) : base(EntityType.Series, id) {
}
- public IReadOnlyList? Aliases { get; set; }
+ public IReadOnlyList? Aliases { get; init; }
- public string? Annotation { get; set; }
+ public string? Annotation { get; init; }
- public string? Disambiguation { get; set; }
+ public string? Disambiguation { get; init; }
- public IReadOnlyList? Genres { get; set; }
+ public IReadOnlyList? Genres { get; init; }
- public string? Name { get; set; }
+ public string? Name { get; init; }
- public IReadOnlyList? Relationships { get; set; }
+ public IReadOnlyList? Relationships { get; init; }
- public IReadOnlyList? Tags { get; set; }
+ public IReadOnlyList? Tags { get; init; }
- public string? Type { get; set; }
+ public string? Type { get; init; }
- public Guid? TypeId { get; set; }
+ public Guid? TypeId { get; init; }
- public IReadOnlyList? UserGenres { get; set; }
+ public IReadOnlyList? UserGenres { get; init; }
- public IReadOnlyList? UserTags { get; set; }
+ public IReadOnlyList? UserTags { get; init; }
public override string ToString() {
var text = this.Name ?? string.Empty;
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/SimpleTrack.cs b/MetaBrainz.MusicBrainz/Objects/Entities/SimpleTrack.cs
index 74a3905..8128517 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/SimpleTrack.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/SimpleTrack.cs
@@ -12,7 +12,7 @@ internal sealed class SimpleTrack : JsonBasedObject, ISimpleTrack {
this.Length = length;
}
- public string? Artist { get; set; }
+ public string? Artist { get; init; }
public TimeSpan Length { get; }
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/Tag.cs b/MetaBrainz.MusicBrainz/Objects/Entities/Tag.cs
index dc9efec..fd1f7b4 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/Tag.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/Tag.cs
@@ -11,7 +11,7 @@ internal sealed class Tag : JsonBasedObject, ITag {
public string Name { get; }
- public int? VoteCount { get; set; }
+ public int? VoteCount { get; init; }
public override string ToString() {
var text = this.Name;
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/TextRepresentation.cs b/MetaBrainz.MusicBrainz/Objects/Entities/TextRepresentation.cs
index 5ea8339..d965dbd 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/TextRepresentation.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/TextRepresentation.cs
@@ -5,9 +5,9 @@ namespace MetaBrainz.MusicBrainz.Objects.Entities;
internal sealed class TextRepresentation : JsonBasedObject, ITextRepresentation {
- public string? Language { get; set; }
+ public string? Language { get; init; }
- public string? Script { get; set; }
+ public string? Script { get; init; }
public override string ToString() => $"{this.Language ?? "???"} / {this.Script ?? "???"}";
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/Track.cs b/MetaBrainz.MusicBrainz/Objects/Entities/Track.cs
index 6e64adb..127406b 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/Track.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/Track.cs
@@ -13,17 +13,17 @@ internal sealed class Track : JsonBasedObject, ITrack {
this.Title = title;
}
- public IReadOnlyList? ArtistCredit { get; set; }
+ public IReadOnlyList? ArtistCredit { get; init; }
public Guid Id { get; }
- public TimeSpan? Length { get; set; }
+ public TimeSpan? Length { get; init; }
- public string? Number { get; set; }
+ public string? Number { get; init; }
- public int? Position { get; set; }
+ public int? Position { get; init; }
- public IRecording? Recording { get; set; }
+ public IRecording? Recording { get; init; }
public string Title { get; }
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/Url.cs b/MetaBrainz.MusicBrainz/Objects/Entities/Url.cs
index 8f49ba9..0fa32f9 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/Url.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/Url.cs
@@ -11,7 +11,7 @@ internal sealed class Url : Entity, IUrl {
this.Resource = resource;
}
- public IReadOnlyList? Relationships { get; set; }
+ public IReadOnlyList? Relationships { get; init; }
public Uri Resource { get; }
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/Work.cs b/MetaBrainz.MusicBrainz/Objects/Entities/Work.cs
index 8eb60ab..60b659b 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/Work.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/Work.cs
@@ -10,39 +10,39 @@ internal sealed class Work : Entity, IWork {
public Work(Guid id) : base(EntityType.Work, id) {
}
- public IReadOnlyList? Aliases { get; set; }
+ public IReadOnlyList? Aliases { get; init; }
- public string? Annotation { get; set; }
+ public string? Annotation { get; init; }
- public IReadOnlyList? Attributes { get; set; }
+ public IReadOnlyList? Attributes { get; init; }
- public string? Disambiguation { get; set; }
+ public string? Disambiguation { get; init; }
- public IReadOnlyList? Genres { get; set; }
+ public IReadOnlyList? Genres { get; init; }
- public IReadOnlyList? Iswcs { get; set; }
+ public IReadOnlyList? Iswcs { get; init; }
- public string? Language { get; set; }
+ public string? Language { get; init; }
- public IReadOnlyList? Languages { get; set; }
+ public IReadOnlyList? Languages { get; init; }
- public IRating? Rating { get; set; }
+ public IRating? Rating { get; init; }
- public IReadOnlyList? Relationships { get; set; }
+ public IReadOnlyList? Relationships { get; init; }
- public IReadOnlyList? Tags { get; set; }
+ public IReadOnlyList? Tags { get; init; }
- public string? Title { get; set; }
+ public string? Title { get; init; }
- public string? Type { get; set; }
+ public string? Type { get; init; }
- public Guid? TypeId { get; set; }
+ public Guid? TypeId { get; init; }
- public IReadOnlyList? UserGenres { get; set; }
+ public IReadOnlyList? UserGenres { get; init; }
- public IRating? UserRating { get; set; }
+ public IRating? UserRating { get; init; }
- public IReadOnlyList? UserTags { get; set; }
+ public IReadOnlyList? UserTags { get; init; }
public override string ToString() {
var text = this.Title ?? string.Empty;
diff --git a/MetaBrainz.MusicBrainz/Objects/Entities/WorkAttribute.cs b/MetaBrainz.MusicBrainz/Objects/Entities/WorkAttribute.cs
index 0dd935d..394b974 100644
--- a/MetaBrainz.MusicBrainz/Objects/Entities/WorkAttribute.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Entities/WorkAttribute.cs
@@ -7,13 +7,13 @@ namespace MetaBrainz.MusicBrainz.Objects.Entities;
internal sealed class WorkAttribute : JsonBasedObject, IWorkAttribute {
- public string? Type { get; set; }
+ public string? Type { get; init; }
- public Guid? TypeId { get; set; }
+ public Guid? TypeId { get; init; }
- public string? Value { get; set; }
+ public string? Value { get; init; }
- public Guid? ValueId { get; set; }
+ public Guid? ValueId { get; init; }
public override string ToString() => $"{this.Type}: {this.Value}";
diff --git a/MetaBrainz.MusicBrainz/Objects/ErrorResult.cs b/MetaBrainz.MusicBrainz/Objects/ErrorResult.cs
new file mode 100644
index 0000000..f61d0f2
--- /dev/null
+++ b/MetaBrainz.MusicBrainz/Objects/ErrorResult.cs
@@ -0,0 +1,11 @@
+using MetaBrainz.Common.Json;
+
+namespace MetaBrainz.MusicBrainz.Objects;
+
+internal sealed class ErrorResult : JsonBasedObject {
+
+ public string? Error { get; init; }
+
+ public string? Help { get; init; }
+
+}
diff --git a/MetaBrainz.MusicBrainz/Objects/MessageOrError.cs b/MetaBrainz.MusicBrainz/Objects/MessageOrError.cs
deleted file mode 100644
index 587c27f..0000000
--- a/MetaBrainz.MusicBrainz/Objects/MessageOrError.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using MetaBrainz.Common.Json;
-
-namespace MetaBrainz.MusicBrainz.Objects;
-
-internal sealed class MessageOrError : JsonBasedObject {
-
- public string? Error;
-
- public string? Help;
-
- public string? Message;
-
-}
diff --git a/MetaBrainz.MusicBrainz/Objects/MessageResult.cs b/MetaBrainz.MusicBrainz/Objects/MessageResult.cs
new file mode 100644
index 0000000..6ffb25d
--- /dev/null
+++ b/MetaBrainz.MusicBrainz/Objects/MessageResult.cs
@@ -0,0 +1,9 @@
+using MetaBrainz.Common.Json;
+
+namespace MetaBrainz.MusicBrainz.Objects;
+
+internal sealed class MessageResult : JsonBasedObject {
+
+ public string? Message { get; init; }
+
+}
diff --git a/MetaBrainz.MusicBrainz/Objects/PagedQueryResults.cs b/MetaBrainz.MusicBrainz/Objects/PagedQueryResults.cs
index 785be5a..b2c40ff 100644
--- a/MetaBrainz.MusicBrainz/Objects/PagedQueryResults.cs
+++ b/MetaBrainz.MusicBrainz/Objects/PagedQueryResults.cs
@@ -26,7 +26,7 @@ internal abstract class PagedQueryResults : IPag
public IStreamingQueryResults AsStream() => new StreamingQueryResults(this);
- bool IPagedQueryResults.IsActive => this.CurrentResult != null;
+ bool IPagedQueryResults.IsActive => this.CurrentResult is not null;
public int? Limit { get; set; }
diff --git a/MetaBrainz.MusicBrainz/Objects/Submissions/ModifyCollection.cs b/MetaBrainz.MusicBrainz/Objects/Submissions/ModifyCollection.cs
index ccc3e84..3801ba0 100644
--- a/MetaBrainz.MusicBrainz/Objects/Submissions/ModifyCollection.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Submissions/ModifyCollection.cs
@@ -61,22 +61,19 @@ internal sealed class ModifyCollection : ISubmission {
string? ISubmission.RequestBody => null;
- private static string MapType(EntityType entityType) {
- return entityType switch {
- EntityType.Area => "areas",
- EntityType.Artist => "artists",
- EntityType.Event => "events",
- EntityType.Instrument => "instruments",
- EntityType.Label => "labels",
- EntityType.Place => "places",
- EntityType.Recording => "recordings",
- EntityType.Release => "releases",
- EntityType.ReleaseGroup => "release-groups",
- EntityType.Series => "series",
- EntityType.Work => "works",
- _ => throw new ArgumentOutOfRangeException(nameof(entityType), entityType,
- "The specified entity type cannot be stored in a collection.")
- };
- }
+ private static string MapType(EntityType type) => type switch {
+ EntityType.Area => "areas",
+ EntityType.Artist => "artists",
+ EntityType.Event => "events",
+ EntityType.Instrument => "instruments",
+ EntityType.Label => "labels",
+ EntityType.Place => "places",
+ EntityType.Recording => "recordings",
+ EntityType.Release => "releases",
+ EntityType.ReleaseGroup => "release-groups",
+ EntityType.Series => "series",
+ EntityType.Work => "works",
+ _ => throw new ArgumentOutOfRangeException(nameof(type), type, "The specified entity type cannot be stored in a collection.")
+ };
}
diff --git a/MetaBrainz.MusicBrainz/Objects/Submissions/RatingSubmission.cs b/MetaBrainz.MusicBrainz/Objects/Submissions/RatingSubmission.cs
index d246492..e62c9d7 100644
--- a/MetaBrainz.MusicBrainz/Objects/Submissions/RatingSubmission.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Submissions/RatingSubmission.cs
@@ -49,9 +49,7 @@ public sealed class RatingSubmission : Submission {
/// The rating to add (1-100), or 0 to remove the rating.
/// The entity to rate.
/// This submission request.
- public RatingSubmission Add(byte rating, IRatableEntity entity) {
- return this.Add(rating, entity.EntityType, entity.Id);
- }
+ public RatingSubmission Add(byte rating, IRatableEntity entity) => this.Add(rating, entity.EntityType, entity.Id);
/// Adds the specified rating to the specified entity.
/// The rating to add (1-100), or 0 to remove the rating.
@@ -86,17 +84,15 @@ private class RatingMap : Dictionary {
private readonly RatingMap _works = new();
- private RatingMap GetMap(EntityType entityType) {
- return entityType switch {
- EntityType.Artist => this._artists,
- EntityType.Event => this._events,
- EntityType.Label => this._labels,
- EntityType.Recording => this._recordings,
- EntityType.ReleaseGroup => this._releaseGroups,
- EntityType.Work => this._works,
- _ => throw new ArgumentOutOfRangeException(nameof(entityType), entityType, "Entities of this type cannot be rated.")
- };
- }
+ private RatingMap GetMap(EntityType entityType) => entityType switch {
+ EntityType.Artist => this._artists,
+ EntityType.Event => this._events,
+ EntityType.Label => this._labels,
+ EntityType.Recording => this._recordings,
+ EntityType.ReleaseGroup => this._releaseGroups,
+ EntityType.Work => this._works,
+ _ => throw new ArgumentOutOfRangeException(nameof(entityType), entityType, "Entities of this type cannot be rated.")
+ };
internal override string RequestBody {
get {
diff --git a/MetaBrainz.MusicBrainz/Objects/Submissions/Submission.cs b/MetaBrainz.MusicBrainz/Objects/Submissions/Submission.cs
index 0bf9aeb..0a6bcfc 100644
--- a/MetaBrainz.MusicBrainz/Objects/Submissions/Submission.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Submissions/Submission.cs
@@ -20,15 +20,15 @@ public abstract class Submission : ISubmission {
/// Submits the request.
/// A message describing the result (usually "OK").
- /// When the MusicBrainz web service reports an error.
- /// When the MusicBrainz web service could not be contacted.
+ /// When the web service reports an error.
+ /// When something goes wrong with the request.
public string Submit() => AsyncUtils.ResultOf(this.SubmitAsync());
/// Submits the request asynchronously.
/// The cancellation token to cancel the operation.
/// A message describing the result (usually "OK").
- /// When the MusicBrainz web service reports an error.
- /// When the MusicBrainz web service could not be contacted.
+ /// When the web service reports an error.
+ /// When something goes wrong with the request.
public async Task SubmitAsync(CancellationToken cancellationToken = default)
=> await this._query.PerformSubmissionAsync(this, cancellationToken).ConfigureAwait(false);
diff --git a/MetaBrainz.MusicBrainz/Objects/Submissions/TagSubmission.cs b/MetaBrainz.MusicBrainz/Objects/Submissions/TagSubmission.cs
index a1692c3..47e8f69 100644
--- a/MetaBrainz.MusicBrainz/Objects/Submissions/TagSubmission.cs
+++ b/MetaBrainz.MusicBrainz/Objects/Submissions/TagSubmission.cs
@@ -79,9 +79,7 @@ public sealed class TagSubmission : Submission {
/// The vote to apply to the tag.
/// The entity to tag.
/// This submission request.
- public TagSubmission Add(string tag, TagVote vote, ITaggableEntity entity) {
- return this.Add(tag, vote, entity.EntityType, entity.Id);
- }
+ public TagSubmission Add(string tag, TagVote vote, ITaggableEntity entity) => this.Add(tag, vote, entity.EntityType, entity.Id);
/// Votes for the specified tag on the specified entities.
/// The tag to vote for.
@@ -131,22 +129,20 @@ private class TagMap : Dictionary {
private readonly TagMap _works = new();
- private TagMap GetMap(EntityType entityType) {
- return entityType switch {
- EntityType.Area => this._areas,
- EntityType.Artist => this._artists,
- EntityType.Event => this._events,
- EntityType.Instrument => this._instruments,
- EntityType.Label => this._labels,
- EntityType.Place => this._places,
- EntityType.Recording => this._recordings,
- EntityType.Release => this._releases,
- EntityType.ReleaseGroup => this._releaseGroups,
- EntityType.Series => this._series,
- EntityType.Work => this._works,
- _ => throw new ArgumentOutOfRangeException(nameof(entityType), entityType, "Entities of this type cannot be tagged.")
- };
- }
+ private TagMap GetMap(EntityType entityType) => entityType switch {
+ EntityType.Area => this._areas,
+ EntityType.Artist => this._artists,
+ EntityType.Event => this._events,
+ EntityType.Instrument => this._instruments,
+ EntityType.Label => this._labels,
+ EntityType.Place => this._places,
+ EntityType.Recording => this._recordings,
+ EntityType.Release => this._releases,
+ EntityType.ReleaseGroup => this._releaseGroups,
+ EntityType.Series => this._series,
+ EntityType.Work => this._works,
+ _ => throw new ArgumentOutOfRangeException(nameof(entityType), entityType, "Entities of this type cannot be tagged.")
+ };
internal override string RequestBody {
get {
diff --git a/MetaBrainz.MusicBrainz/Query.Browse.Areas.cs b/MetaBrainz.MusicBrainz/Query.Browse.Areas.cs
index 57ec145..d5a50e4 100644
--- a/MetaBrainz.MusicBrainz/Query.Browse.Areas.cs
+++ b/MetaBrainz.MusicBrainz/Query.Browse.Areas.cs
@@ -1,5 +1,5 @@
using System;
-using System.Net;
+using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
@@ -24,8 +24,8 @@ public sealed partial class Query {
/// once: once at the end of a page, then again in the next page, if a new entry was inserted earlier in the sequence. Similarly,
/// a result may be skipped if an item that was already returned is deleted (but deletions are far less likely).
///
- /// When the web service reports an error.
- /// When something goes wrong with the web request.
+ /// When the web service reports an error.
+ /// When something goes wrong with the request.
public IStreamingQueryResults BrowseAllAreas(ICollection collection, int? pageSize = null, int? offset = null,
Include inc = Include.None)
=> new BrowseAreas(this, Query.BuildExtraText(inc, "collection", collection.Id), pageSize, offset).AsStream();
@@ -41,8 +41,8 @@ public sealed partial class Query {
/// once: once at the end of a page, then again in the next page, if a new entry was inserted earlier in the sequence. Similarly,
/// a result may be skipped if an item that was already returned is deleted (but deletions are far less likely).
///
- /// When the web service reports an error.
- /// When something goes wrong with the web request.
+ /// When the web service reports an error.
+ /// When something goes wrong with the request.
public IStreamingQueryResults BrowseAllCollectionAreas(Guid mbid, int? pageSize = null, int? offset = null,
Include inc = Include.None)
=> new BrowseAreas(this, Query.BuildExtraText(inc, "collection", mbid), pageSize, offset).AsStream();
@@ -53,8 +53,8 @@ public sealed partial class Query {
/// The offset at which to start (i.e. the number of results to skip).
/// Additional information to include in the result.
/// The browse request, including the initial results.
- /// When the web service reports an error.
- /// When something goes wrong with the web request.
+ /// When the web service reports an error.
+ /// When something goes wrong with the request.
public IBrowseResults BrowseAreas(ICollection collection, int? limit = null, int? offset = null,
Include inc = Include.None)
=> AsyncUtils.ResultOf(this.BrowseAreasAsync(collection, limit, offset, inc));
@@ -66,8 +66,8 @@ public sealed partial class Query {
/// Additional information to include in the result.
/// The cancellation token to cancel the operation.
/// The browse request, including the initial results.
- /// When the web service reports an error.
- /// When something goes wrong with the web request.
+ /// When the web service reports an error.
+ /// When something goes wrong with the request.
public Task> BrowseAreasAsync(ICollection collection, int? limit = null, int? offset = null,
Include inc = Include.None, CancellationToken cancellationToken = default)
=> new BrowseAreas(this, Query.BuildExtraText(inc, "collection", collection.Id), limit, offset).NextAsync(cancellationToken);
@@ -78,8 +78,8 @@ public sealed partial class Query {
/// The offset at which to start (i.e. the number of results to skip).
/// Additional information to include in the result.
/// The browse request, including the initial results.
- /// When the web service reports an error.
- /// When something goes wrong with the web request.
+ /// When the web service reports an error.
+ /// When something goes wrong with the request.
public IBrowseResults BrowseCollectionAreas(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None)
=> AsyncUtils.ResultOf(this.BrowseCollectionAreasAsync(mbid, limit, offset, inc));
@@ -90,8 +90,8 @@ public IBrowseResults BrowseCollectionAreas(Guid mbid, int? limit = null,
/// Additional information to include in the result.
/// The cancellation token to cancel the operation.
/// The browse request, including the initial results.
- /// When the web service reports an error.
- /// When something goes wrong with the web request.
+ /// When the web service reports an error.
+ /// When something goes wrong with the request.
public Task> BrowseCollectionAreasAsync(Guid mbid, int? limit = null, int? offset = null,
Include inc = Include.None,
CancellationToken cancellationToken = default)
diff --git a/MetaBrainz.MusicBrainz/Query.Browse.Artists.cs b/MetaBrainz.MusicBrainz/Query.Browse.Artists.cs
index 4370092..9c367f7 100644
--- a/MetaBrainz.MusicBrainz/Query.Browse.Artists.cs
+++ b/MetaBrainz.MusicBrainz/Query.Browse.Artists.cs
@@ -1,5 +1,5 @@
using System;
-using System.Net;
+using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
@@ -24,8 +24,8 @@ public sealed partial class Query {
/// once: once at the end of a page, then again in the next page, if a new entry was inserted earlier in the sequence. Similarly,
/// a result may be skipped if an item that was already returned is deleted (but deletions are far less likely).
///
- /// When the web service reports an error.
- /// When something goes wrong with the web request.
+ /// When the web service reports an error.
+ /// When something goes wrong with the request.
public IStreamingQueryResults BrowseAllAreaArtists(Guid mbid, int? pageSize = null, int? offset = null,
Include inc = Include.None)
=> new BrowseArtists(this, Query.BuildExtraText(inc, "area", mbid), pageSize, offset).AsStream();
@@ -41,8 +41,8 @@ public sealed partial class Query {
/// once: once at the end of a page, then again in the next page, if a new entry was inserted earlier in the sequence. Similarly,
/// a result may be skipped if an item that was already returned is deleted (but deletions are far less likely).
///
- ///