From 302ff2c7d7e5371f1a0645473333141027a796e4 Mon Sep 17 00:00:00 2001 From: Tim Van Holder Date: Wed, 26 Jan 2022 22:19:40 +0100 Subject: [PATCH 1/3] Drop the use of a client lock `HttpClient` is fully thread-safe so does not need extra locking around it. This also renames `RequestLock` to `DelayLock`, to better describe what it is used for, and avoids during more work inside the lock than is strictly needed. --- MetaBrainz.MusicBrainz/OAuth2.cs | 82 ++++++++----------- MetaBrainz.MusicBrainz/Query.Internals.cs | 95 ++++++++++------------- 2 files changed, 76 insertions(+), 101 deletions(-) diff --git a/MetaBrainz.MusicBrainz/OAuth2.cs b/MetaBrainz.MusicBrainz/OAuth2.cs index f0fee21..3d5ebce 100644 --- a/MetaBrainz.MusicBrainz/OAuth2.cs +++ b/MetaBrainz.MusicBrainz/OAuth2.cs @@ -256,8 +256,6 @@ public Task RefreshBearerTokenAsync(string refreshToken, st private Func? _clientCreation; - private readonly SemaphoreSlim _clientLock = new(1); - private readonly bool _clientOwned; private bool _disposed; @@ -285,14 +283,7 @@ public void Close() { if (!this._clientOwned) { throw new InvalidOperationException("An explicitly provided client instance is in use."); } - this._clientLock.Wait(); - try { - this._client?.Dispose(); - this._client = null; - } - finally { - this._clientLock.Release(); - } + Interlocked.Exchange(ref this._client, null)?.Dispose(); } /// Sets up code to run to configure a newly-created HTTP client. @@ -328,7 +319,6 @@ private void Dispose(bool disposing) { this.Close(); } this._client = null; - this._clientLock.Dispose(); } finally { this._disposed = true; @@ -348,52 +338,48 @@ private void Dispose(bool disposing) { private async Task PerformRequestAsync(Uri uri, HttpMethod method, HttpContent? body, CancellationToken cancellationToken) { Debug.Print($"[{DateTime.UtcNow}] WEB SERVICE REQUEST: {method.Method} {uri}"); - await this._clientLock.WaitAsync(cancellationToken); - try { - var client = this.Client; - using var request = new HttpRequestMessage(method, uri) { - Content = body, - Headers = { - Accept = { - OAuth2.AcceptHeader, - }, - } - }; - // Use whatever user agent the client has set, plus our own. - foreach (var userAgent in client.DefaultRequestHeaders.UserAgent) { - request.Headers.UserAgent.Add(userAgent); + var client = this.Client; + using var request = new HttpRequestMessage(method, uri) { + Content = body, + Headers = { + Accept = { + OAuth2.AcceptHeader, + }, } - request.Headers.UserAgent.Add(OAuth2.LibraryProductInfo); - request.Headers.UserAgent.Add(OAuth2.LibraryComment); - Debug.Print($"[{DateTime.UtcNow}] => HEADERS: {Utils.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"); - } - var response = await client.SendAsync(request, cancellationToken); - Debug.Print($"[{DateTime.UtcNow}] WEB SERVICE RESPONSE: {(int) response.StatusCode}/{response.StatusCode} " + - $"'{response.ReasonPhrase}' (v{response.Version})"); - Debug.Print($"[{DateTime.UtcNow}] => HEADERS: {Utils.FormatMultiLine(response.Headers.ToString())}"); - Debug.Print($"[{DateTime.UtcNow}] => CONTENT ({response.Content.Headers.ContentType}): " + - $"{response.Content.Headers.ContentLength ?? 0} bytes"); - return response; + }; + // Use whatever user agent the client has set, plus our own. + foreach (var userAgent in client.DefaultRequestHeaders.UserAgent) { + request.Headers.UserAgent.Add(userAgent); } - finally { - this._clientLock.Release(); + request.Headers.UserAgent.Add(OAuth2.LibraryProductInfo); + request.Headers.UserAgent.Add(OAuth2.LibraryComment); + Debug.Print($"[{DateTime.UtcNow}] => HEADERS: {Utils.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"); } + 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: {Utils.FormatMultiLine(response.Headers.ToString())}"); + Debug.Print($"[{DateTime.UtcNow}] => CONTENT ({response.Content.Headers.ContentType}): " + + $"{response.Content.Headers.ContentLength ?? 0} bytes"); + return response; } - private async Task PostAsync(HttpContent body, CancellationToken cancellationToken) { + 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, body, cancellationToken); + var response = await this.PerformRequestAsync(uri, HttpMethod.Post, content, cancellationToken).ConfigureAwait(false); if (!response.IsSuccessStatusCode) { - throw await Utils.CreateQueryExceptionForAsync(response, cancellationToken); + throw await Utils.CreateQueryExceptionForAsync(response, cancellationToken).ConfigureAwait(false); } - return await Utils.GetJsonContentAsync(response, OAuth2.JsonReaderOptions, cancellationToken); + var jsonTask = Utils.GetJsonContentAsync(response, OAuth2.JsonReaderOptions, cancellationToken); + return await jsonTask.ConfigureAwait(false); } private async Task PostAsync(string type, string body, CancellationToken cancellationToken) { - var token = await this.PostAsync(new StringContent(body, Encoding.UTF8, OAuth2.TokenRequestBodyType), cancellationToken); + var content = new StringContent(body, Encoding.UTF8, OAuth2.TokenRequestBodyType); + var token = await this.PostAsync(content, cancellationToken).ConfigureAwait(false); if (token.TokenType != type) { throw new InvalidOperationException($"Token request returned a token of the wrong type ('{token.TokenType}' != '{type}')."); } @@ -408,7 +394,7 @@ private async Task RefreshTokenAsync(string type, string co 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); + return await this.PostAsync(type, body.ToString(), cancellationToken).ConfigureAwait(false); } private async Task RequestTokenAsync(string type, string codeOrToken, string clientSecret, Uri redirectUri, @@ -420,7 +406,7 @@ private async Task RequestTokenAsync(string type, string co 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); + return await this.PostAsync(type, body.ToString(), cancellationToken).ConfigureAwait(false); } private static IEnumerable ScopeStrings(AuthorizationScope scope) { diff --git a/MetaBrainz.MusicBrainz/Query.Internals.cs b/MetaBrainz.MusicBrainz/Query.Internals.cs index 6d0667f..da1b254 100644 --- a/MetaBrainz.MusicBrainz/Query.Internals.cs +++ b/MetaBrainz.MusicBrainz/Query.Internals.cs @@ -20,7 +20,7 @@ public sealed partial class Query : IDisposable { #region Delay Processing - private static readonly SemaphoreSlim RequestLock = new(1); + private static readonly SemaphoreSlim DelayLock = new(1); private static DateTime _lastRequestTime; @@ -29,15 +29,20 @@ private static async Task ApplyDelayAsync(Func> request, Cancellat return await request().ConfigureAwait(false); } while (true) { - await Query.RequestLock.WaitAsync(cancellationToken); + await Query.DelayLock.WaitAsync(cancellationToken).ConfigureAwait(false); + var ready = false; try { - if ((DateTime.UtcNow - Query._lastRequestTime).TotalSeconds >= Query.DelayBetweenRequests) { - Query._lastRequestTime = DateTime.UtcNow; - return await request().ConfigureAwait(false); + var now = DateTime.UtcNow; + if ((now - Query._lastRequestTime).TotalSeconds >= Query.DelayBetweenRequests) { + Query._lastRequestTime = now; + ready = true; } } finally { - Query.RequestLock.Release(); + Query.DelayLock.Release(); + } + if (ready) { + return await request().ConfigureAwait(false); } await Task.Delay((int) (500 * Query.DelayBetweenRequests), cancellationToken).ConfigureAwait(false); } @@ -354,8 +359,6 @@ private static string BuildExtraText(string field, string value) { private Func? _clientCreation; - private readonly SemaphoreSlim _clientLock = new(1); - private readonly bool _clientOwned; private bool _disposed; @@ -388,14 +391,7 @@ public void Close() { if (!this._clientOwned) { throw new InvalidOperationException("An explicitly provided client instance is in use."); } - this._clientLock.Wait(); - try { - this._client?.Dispose(); - this._client = null; - } - finally { - this._clientLock.Release(); - } + Interlocked.Exchange(ref this._client, null)?.Dispose(); } /// Sets up code to run to configure a newly-created HTTP client. @@ -432,7 +428,6 @@ private void Dispose(bool disposing) { this.Close(); } this._client = null; - this._clientLock.Dispose(); } finally { this._disposed = true; @@ -507,43 +502,37 @@ private Uri BuildUri(string path, string? extra = null) private async Task PerformRequestAsync(Uri uri, HttpMethod method, HttpContent? body, CancellationToken cancellationToken) { Debug.Print($"[{DateTime.UtcNow}] WEB SERVICE REQUEST: {method.Method} {uri}"); - await this._clientLock.WaitAsync(cancellationToken); - try { - var client = this.Client; - using var request = new HttpRequestMessage(method, uri) { - Content = body, - Headers = { - Accept = { - Query.AcceptHeader, - }, - Authorization = this.BearerToken == null ? null : new AuthenticationHeaderValue("Bearer", this.BearerToken), - } - }; - // Use whatever user agent the client has set, plus our own. - foreach (var userAgent in client.DefaultRequestHeaders.UserAgent) { - request.Headers.UserAgent.Add(userAgent); - } - request.Headers.UserAgent.Add(Query.LibraryProductInfo); - request.Headers.UserAgent.Add(Query.LibraryComment); - Debug.Print($"[{DateTime.UtcNow}] => HEADERS: {Utils.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"); - } - var response = await client.SendAsync(request, cancellationToken); - Debug.Print($"[{DateTime.UtcNow}] WEB SERVICE RESPONSE: {(int) response.StatusCode}/{response.StatusCode} " + - $"'{response.ReasonPhrase}' (v{response.Version})"); - Debug.Print($"[{DateTime.UtcNow}] => HEADERS: {Utils.FormatMultiLine(response.Headers.ToString())}"); - Debug.Print($"[{DateTime.UtcNow}] => CONTENT ({response.Content.Headers.ContentType}): " + - $"{response.Content.Headers.ContentLength ?? 0} bytes"); - if (!response.IsSuccessStatusCode) { - throw await Utils.CreateQueryExceptionForAsync(response, cancellationToken); + var client = this.Client; + using var request = new HttpRequestMessage(method, uri) { + Content = body, + Headers = { + Accept = { + Query.AcceptHeader, + }, + Authorization = this.BearerToken == null ? null : new AuthenticationHeaderValue("Bearer", this.BearerToken), } - return response; - } - finally { - this._clientLock.Release(); - } + }; + // Use whatever user agent the client has set, plus our own. + foreach (var userAgent in client.DefaultRequestHeaders.UserAgent) { + request.Headers.UserAgent.Add(userAgent); + } + request.Headers.UserAgent.Add(Query.LibraryProductInfo); + request.Headers.UserAgent.Add(Query.LibraryComment); + Debug.Print($"[{DateTime.UtcNow}] => HEADERS: {Utils.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"); + } + 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: {Utils.FormatMultiLine(response.Headers.ToString())}"); + Debug.Print($"[{DateTime.UtcNow}] => CONTENT ({response.Content.Headers.ContentType}): " + + $"{response.Content.Headers.ContentLength ?? 0} bytes"); + if (!response.IsSuccessStatusCode) { + throw await Utils.CreateQueryExceptionForAsync(response, cancellationToken); + } + return response; } internal Task PerformRequestAsync(string entity, Guid id, string extra, CancellationToken cancellationToken) From 9029f0a90ed4d86cb3f0ef6575d38602a7c74a88 Mon Sep 17 00:00:00 2001 From: Tim Van Holder Date: Thu, 27 Jan 2022 23:38:18 +0100 Subject: [PATCH 2/3] Ensure use of `ConfigureAwait(false)` --- .../Objects/Browses/BrowseResults.cs | 3 ++- .../Objects/Searches/SearchResults.cs | 3 ++- .../Objects/StreamingQueryResults.cs | 4 ++-- MetaBrainz.MusicBrainz/Query.Internals.cs | 16 +++++++++------- MetaBrainz.MusicBrainz/Utils.cs | 16 ++++++++-------- 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/MetaBrainz.MusicBrainz/Objects/Browses/BrowseResults.cs b/MetaBrainz.MusicBrainz/Objects/Browses/BrowseResults.cs index 4658975..7e9b918 100644 --- a/MetaBrainz.MusicBrainz/Objects/Browses/BrowseResults.cs +++ b/MetaBrainz.MusicBrainz/Objects/Browses/BrowseResults.cs @@ -22,7 +22,8 @@ protected BrowseResults(Query query, string endpoint, string? value, string extr protected sealed override async Task> DeserializeAsync(HttpResponseMessage response, CancellationToken cancellationToken) { - this.CurrentResult = await Utils.GetJsonContentAsync(response, Query.JsonReaderOptions, cancellationToken); + var task = Utils.GetJsonContentAsync(response, Query.JsonReaderOptions, cancellationToken); + this.CurrentResult = await task.ConfigureAwait(false); return this; } diff --git a/MetaBrainz.MusicBrainz/Objects/Searches/SearchResults.cs b/MetaBrainz.MusicBrainz/Objects/Searches/SearchResults.cs index 29ccf14..3a91fda 100644 --- a/MetaBrainz.MusicBrainz/Objects/Searches/SearchResults.cs +++ b/MetaBrainz.MusicBrainz/Objects/Searches/SearchResults.cs @@ -75,7 +75,8 @@ protected SearchResults(Query query, string endpoint, string queryString, int? l protected sealed override async Task> DeserializeAsync(HttpResponseMessage response, CancellationToken cancellationToken) { - this.CurrentResult = await Utils.GetJsonContentAsync(response, Query.JsonReaderOptions, cancellationToken); + var task = Utils.GetJsonContentAsync(response, Query.JsonReaderOptions, cancellationToken); + this.CurrentResult = await task.ConfigureAwait(false); if (this.Offset != this.CurrentResult.Offset) { Debug.Print($"Unexpected offset in search results: {this.Offset} != {this.CurrentResult.Offset}."); } diff --git a/MetaBrainz.MusicBrainz/Objects/StreamingQueryResults.cs b/MetaBrainz.MusicBrainz/Objects/StreamingQueryResults.cs index 76758c4..285b7b1 100644 --- a/MetaBrainz.MusicBrainz/Objects/StreamingQueryResults.cs +++ b/MetaBrainz.MusicBrainz/Objects/StreamingQueryResults.cs @@ -21,7 +21,7 @@ public StreamingQueryResults(PagedQueryResults pa public async IAsyncEnumerator GetAsyncEnumerator(CancellationToken cancellationToken = new()) { IPagedQueryResults currentPage = this._pagedResults; if (!currentPage.IsActive) { - currentPage = await currentPage.NextAsync(cancellationToken); + currentPage = await currentPage.NextAsync(cancellationToken).ConfigureAwait(false); if (cancellationToken.IsCancellationRequested) { yield break; } @@ -36,7 +36,7 @@ public StreamingQueryResults(PagedQueryResults pa if (currentPage.Offset + currentPage.Results.Count >= currentPage.TotalResults || cancellationToken.IsCancellationRequested) { break; } - currentPage = await currentPage.NextAsync(cancellationToken); + currentPage = await currentPage.NextAsync(cancellationToken).ConfigureAwait(false); } } diff --git a/MetaBrainz.MusicBrainz/Query.Internals.cs b/MetaBrainz.MusicBrainz/Query.Internals.cs index da1b254..4271bbb 100644 --- a/MetaBrainz.MusicBrainz/Query.Internals.cs +++ b/MetaBrainz.MusicBrainz/Query.Internals.cs @@ -8,6 +8,8 @@ using System.Threading; using System.Threading.Tasks; +using JetBrains.Annotations; + using MetaBrainz.Common.Json; using MetaBrainz.MusicBrainz.Interfaces.Submissions; using MetaBrainz.MusicBrainz.Json; @@ -24,7 +26,7 @@ public sealed partial class Query : IDisposable { private static DateTime _lastRequestTime; - private static async Task ApplyDelayAsync(Func> request, CancellationToken cancellationToken) { + private static async Task ApplyDelayAsync([InstantHandle] Func> request, CancellationToken cancellationToken) { if (Query.DelayBetweenRequests <= 0.0) { return await request().ConfigureAwait(false); } @@ -530,7 +532,7 @@ private async Task PerformRequestAsync(Uri uri, HttpMethod Debug.Print($"[{DateTime.UtcNow}] => CONTENT ({response.Content.Headers.ContentType}): " + $"{response.Content.Headers.ContentLength ?? 0} bytes"); if (!response.IsSuccessStatusCode) { - throw await Utils.CreateQueryExceptionForAsync(response, cancellationToken); + throw await Utils.CreateQueryExceptionForAsync(response, cancellationToken).ConfigureAwait(false); } return response; } @@ -543,15 +545,15 @@ internal async Task PerformRequestAsync(string entity, stri return await Query.ApplyDelayAsync(() => { var uri = this.BuildUri($"{entity}/{id}", extra); return this.PerformRequestAsync(uri, HttpMethod.Get, null, cancellationToken); - }, cancellationToken); + }, cancellationToken).ConfigureAwait(false); } internal Task PerformRequestAsync(string entity, Guid id, string extra, CancellationToken cancellationToken) => this.PerformRequestAsync(entity, id.ToString("D"), extra, cancellationToken); internal async Task PerformRequestAsync(string entity, string? id, string extra, CancellationToken cancellationToken) { - using var response = await this.PerformRequestAsync(entity, id, extra, cancellationToken); - return await Utils.GetJsonContentAsync(response, Query.JsonReaderOptions, cancellationToken); + using var response = await this.PerformRequestAsync(entity, id, extra, cancellationToken).ConfigureAwait(false); + return await Utils.GetJsonContentAsync(response, Query.JsonReaderOptions, cancellationToken).ConfigureAwait(false); } internal async Task PerformSubmissionAsync(ISubmission submission, CancellationToken cancellationToken) { @@ -560,8 +562,8 @@ internal async Task PerformSubmissionAsync(ISubmission submission, Cance var body = submission.RequestBody; using var content = body is null ? null : new StringContent(body, Encoding.UTF8, submission.ContentType); using var response = await Query.ApplyDelayAsync(() => this.PerformRequestAsync(uri, method, content, cancellationToken), - cancellationToken); - return await Query.ExtractMessageAsync(response, cancellationToken) ?? ""; + cancellationToken).ConfigureAwait(false); + return await Query.ExtractMessageAsync(response, cancellationToken).ConfigureAwait(false) ?? ""; } #endregion diff --git a/MetaBrainz.MusicBrainz/Utils.cs b/MetaBrainz.MusicBrainz/Utils.cs index b5f689e..4942b3f 100644 --- a/MetaBrainz.MusicBrainz/Utils.cs +++ b/MetaBrainz.MusicBrainz/Utils.cs @@ -20,7 +20,7 @@ public static async Task CreateQueryExceptionForAsync(HttpRespon CancellationToken cancellationToken = new()) { string? errorInfo = null; if (response.Content.Headers.ContentLength > 0) { - errorInfo = await Utils.GetStringContentAsync(response, cancellationToken); + errorInfo = await Utils.GetStringContentAsync(response, cancellationToken).ConfigureAwait(false); if (string.IsNullOrWhiteSpace(errorInfo)) { Debug.Print($"[{DateTime.UtcNow}] => NO ERROR RESPONSE TEXT"); errorInfo = null; @@ -109,13 +109,13 @@ public static async Task GetJsonContentAsync(HttpResponseMessage response, var content = response.Content; Debug.Print($"[{DateTime.UtcNow}] => RESPONSE ({content.Headers.ContentType}): {content.Headers.ContentLength} bytes"); #if NET - var stream = await response.Content.ReadAsStreamAsync(cancellationToken); + var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); await using var _ = stream.ConfigureAwait(false); #elif NETSTANDARD2_1_OR_GREATER - var stream = await response.Content.ReadAsStreamAsync(); + var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); await using var _ = stream.ConfigureAwait(false); #else - using var stream = await content.ReadAsStreamAsync(); + using var stream = await content.ReadAsStreamAsync().ConfigureAwait(false); #endif if (stream is null || stream.Length == 0) { throw new QueryException(HttpStatusCode.NoContent, "Response contained no data."); @@ -123,7 +123,7 @@ public static async Task GetJsonContentAsync(HttpResponseMessage response, var characterSet = Utils.GetContentEncoding(content.Headers); #if !DEBUG if (characterSet == "utf-8") { // Directly use the stream - var jsonObject = await JsonSerializer.DeserializeAsync(stream, options, cancellationToken); + var jsonObject = await JsonSerializer.DeserializeAsync(stream, options, cancellationToken).ConfigureAwait(false); return jsonObject ?? throw new JsonException("The received content was null."); } #endif @@ -143,13 +143,13 @@ public static async Task GetStringContentAsync(HttpResponseMessage respo var content = response.Content; Debug.Print($"[{DateTime.UtcNow}] => RESPONSE ({content.Headers.ContentType}): {content.Headers.ContentLength} bytes"); #if NET - var stream = await response.Content.ReadAsStreamAsync(cancellationToken); + var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); await using var _ = stream.ConfigureAwait(false); #elif NETSTANDARD2_1_OR_GREATER - var stream = await response.Content.ReadAsStreamAsync(); + var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); await using var _ = stream.ConfigureAwait(false); #else - using var stream = await response.Content.ReadAsStreamAsync(); + using var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); #endif #if !NET if (stream is null) { From 85d50fcbfcd4664aa52418887c08fc023ad8ecb7 Mon Sep 17 00:00:00 2001 From: Tim Van Holder Date: Thu, 27 Jan 2022 23:51:22 +0100 Subject: [PATCH 3/3] Use `default` instead of `new()` This is for the default value of `cancellationToken` parameters. It's longer, leading to more line breaks, but it also reads better. --- .../Interfaces/IPagedQueryResults.cs | 4 +- MetaBrainz.MusicBrainz/OAuth2.cs | 4 +- .../Objects/PagedQueryResults.cs | 4 +- .../Objects/StreamingQueryResults.cs | 2 +- .../Objects/Submissions/Submission.cs | 2 +- MetaBrainz.MusicBrainz/Query.Browse.Areas.cs | 4 +- .../Query.Browse.Artists.cs | 25 +++++----- .../Query.Browse.Collections.cs | 46 +++++++++---------- MetaBrainz.MusicBrainz/Query.Browse.Events.cs | 17 +++---- .../Query.Browse.Instruments.cs | 4 +- MetaBrainz.MusicBrainz/Query.Browse.Labels.cs | 13 +++--- MetaBrainz.MusicBrainz/Query.Browse.Places.cs | 9 ++-- .../Query.Browse.Recordings.cs | 12 ++--- .../Query.Browse.ReleaseGroups.cs | 12 ++--- .../Query.Browse.Releases.cs | 32 ++++++------- MetaBrainz.MusicBrainz/Query.Browse.Series.cs | 4 +- MetaBrainz.MusicBrainz/Query.Browse.Works.cs | 9 ++-- .../Query.Collections.Areas.cs | 17 +++---- .../Query.Collections.Artists.cs | 16 +++---- .../Query.Collections.Events.cs | 16 +++---- .../Query.Collections.Instruments.cs | 16 +++---- .../Query.Collections.Labels.cs | 16 +++---- .../Query.Collections.Places.cs | 16 +++---- .../Query.Collections.Recordings.cs | 16 +++---- .../Query.Collections.ReleaseGroups.cs | 16 +++---- .../Query.Collections.Releases.cs | 16 +++---- .../Query.Collections.Series.cs | 16 +++---- .../Query.Collections.Works.cs | 17 +++---- MetaBrainz.MusicBrainz/Query.Collections.cs | 32 ++++++------- MetaBrainz.MusicBrainz/Query.Lookup.cs | 37 +++++++-------- .../Query.Search.Annotations.cs | 2 +- MetaBrainz.MusicBrainz/Query.Search.Areas.cs | 3 +- .../Query.Search.Artists.cs | 2 +- .../Query.Search.CdStubs.cs | 2 +- MetaBrainz.MusicBrainz/Query.Search.Events.cs | 2 +- .../Query.Search.Instruments.cs | 2 +- MetaBrainz.MusicBrainz/Query.Search.Labels.cs | 2 +- MetaBrainz.MusicBrainz/Query.Search.Places.cs | 2 +- .../Query.Search.Recordings.cs | 2 +- .../Query.Search.ReleaseGroups.cs | 2 +- .../Query.Search.Releases.cs | 2 +- MetaBrainz.MusicBrainz/Query.Search.Series.cs | 2 +- MetaBrainz.MusicBrainz/Query.Search.Tags.cs | 2 +- MetaBrainz.MusicBrainz/Query.Search.Urls.cs | 2 +- MetaBrainz.MusicBrainz/Query.Search.Works.cs | 3 +- MetaBrainz.MusicBrainz/Utils.cs | 6 +-- 46 files changed, 249 insertions(+), 239 deletions(-) diff --git a/MetaBrainz.MusicBrainz/Interfaces/IPagedQueryResults.cs b/MetaBrainz.MusicBrainz/Interfaces/IPagedQueryResults.cs index 4ab3b63..1e91f41 100644 --- a/MetaBrainz.MusicBrainz/Interfaces/IPagedQueryResults.cs +++ b/MetaBrainz.MusicBrainz/Interfaces/IPagedQueryResults.cs @@ -58,7 +58,7 @@ public interface IPagedQueryResults : IJsonBasedObject /// This result set (with updated values). /// When the web service reports an error. /// When something goes wrong with the web request. - Task NextAsync(CancellationToken cancellationToken = new()); + Task NextAsync(CancellationToken cancellationToken = default); /// /// The offset to use for the next request (via and/or ), or @@ -89,7 +89,7 @@ public interface IPagedQueryResults : IJsonBasedObject /// This result set (with updated values). /// When the web service reports an error. /// When something goes wrong with the web request. - Task PreviousAsync(CancellationToken cancellationToken = new()); + Task PreviousAsync(CancellationToken cancellationToken = default); /// The current results. IReadOnlyList Results { get; } diff --git a/MetaBrainz.MusicBrainz/OAuth2.cs b/MetaBrainz.MusicBrainz/OAuth2.cs index 3d5ebce..0ecff6b 100644 --- a/MetaBrainz.MusicBrainz/OAuth2.cs +++ b/MetaBrainz.MusicBrainz/OAuth2.cs @@ -219,7 +219,7 @@ public IAuthorizationToken GetBearerToken(string code, string clientSecret, Uri /// The cancellation token to cancel the operation. /// The obtained bearer token. public Task GetBearerTokenAsync(string code, string clientSecret, Uri redirectUri, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RequestTokenAsync("bearer", code, clientSecret, redirectUri, cancellationToken); /// Refreshes a bearer token. @@ -235,7 +235,7 @@ public IAuthorizationToken RefreshBearerToken(string refreshToken, string client /// The cancellation token to cancel the operation. /// The obtained bearer token. public Task RefreshBearerTokenAsync(string refreshToken, string clientSecret, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RefreshTokenAsync("bearer", refreshToken, clientSecret, cancellationToken); #endregion diff --git a/MetaBrainz.MusicBrainz/Objects/PagedQueryResults.cs b/MetaBrainz.MusicBrainz/Objects/PagedQueryResults.cs index 909c289..e44b003 100644 --- a/MetaBrainz.MusicBrainz/Objects/PagedQueryResults.cs +++ b/MetaBrainz.MusicBrainz/Objects/PagedQueryResults.cs @@ -33,7 +33,7 @@ protected PagedQueryResults(Query query, string endpoint, string? value, int? li public TResults Next() => Utils.ResultOf(this.NextAsync()); - public async Task NextAsync(CancellationToken cancellationToken = new()) { + public async Task NextAsync(CancellationToken cancellationToken = default) { this.UpdateOffset(this.Results.Count); return await this.PerformRequestAsync(cancellationToken).ConfigureAwait(false); } @@ -44,7 +44,7 @@ protected PagedQueryResults(Query query, string endpoint, string? value, int? li public TResults Previous() => Utils.ResultOf(this.PreviousAsync()); - public async Task PreviousAsync(CancellationToken cancellationToken = new()) { + public async Task PreviousAsync(CancellationToken cancellationToken = default) { this.UpdateOffset(); return await this.PerformRequestAsync(cancellationToken).ConfigureAwait(false); } diff --git a/MetaBrainz.MusicBrainz/Objects/StreamingQueryResults.cs b/MetaBrainz.MusicBrainz/Objects/StreamingQueryResults.cs index 285b7b1..c737d44 100644 --- a/MetaBrainz.MusicBrainz/Objects/StreamingQueryResults.cs +++ b/MetaBrainz.MusicBrainz/Objects/StreamingQueryResults.cs @@ -18,7 +18,7 @@ public StreamingQueryResults(PagedQueryResults pa #region IAsyncEnumerable - public async IAsyncEnumerator GetAsyncEnumerator(CancellationToken cancellationToken = new()) { + public async IAsyncEnumerator GetAsyncEnumerator(CancellationToken cancellationToken = default) { IPagedQueryResults currentPage = this._pagedResults; if (!currentPage.IsActive) { currentPage = await currentPage.NextAsync(cancellationToken).ConfigureAwait(false); diff --git a/MetaBrainz.MusicBrainz/Objects/Submissions/Submission.cs b/MetaBrainz.MusicBrainz/Objects/Submissions/Submission.cs index 1439879..d761132 100644 --- a/MetaBrainz.MusicBrainz/Objects/Submissions/Submission.cs +++ b/MetaBrainz.MusicBrainz/Objects/Submissions/Submission.cs @@ -28,7 +28,7 @@ public abstract class Submission : ISubmission { /// A message describing the result (usually "OK"). /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. - public async Task SubmitAsync(CancellationToken cancellationToken = new()) + public async Task SubmitAsync(CancellationToken cancellationToken = default) => await this._query.PerformSubmissionAsync(this, cancellationToken).ConfigureAwait(false); #endregion diff --git a/MetaBrainz.MusicBrainz/Query.Browse.Areas.cs b/MetaBrainz.MusicBrainz/Query.Browse.Areas.cs index 5a899cf..401ff11 100644 --- a/MetaBrainz.MusicBrainz/Query.Browse.Areas.cs +++ b/MetaBrainz.MusicBrainz/Query.Browse.Areas.cs @@ -68,7 +68,7 @@ public IBrowseResults BrowseAreas(ICollection collection, int? limit = nu /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseAreasAsync(ICollection collection, int? limit = null, int? offset = null, - Include inc = Include.None, CancellationToken cancellationToken = new()) + Include inc = Include.None, CancellationToken cancellationToken = default) => new BrowseAreas(this, Query.BuildExtraText(inc, "collection", collection.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the areas in the given collection. @@ -93,7 +93,7 @@ public IBrowseResults BrowseCollectionAreas(Guid mbid, int? limit = null, /// When something goes wrong with the web request. public Task> BrowseCollectionAreasAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseAreas(this, Query.BuildExtraText(inc, "collection", mbid), limit, offset).NextAsync(cancellationToken); } diff --git a/MetaBrainz.MusicBrainz/Query.Browse.Artists.cs b/MetaBrainz.MusicBrainz/Query.Browse.Artists.cs index 990a1ae..37abe68 100644 --- a/MetaBrainz.MusicBrainz/Query.Browse.Artists.cs +++ b/MetaBrainz.MusicBrainz/Query.Browse.Artists.cs @@ -238,7 +238,7 @@ public IBrowseResults BrowseAreaArtists(Guid mbid, int? limit = null, i /// When something goes wrong with the web request. public Task> BrowseAreaArtistsAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseArtists(this, Query.BuildExtraText(inc, "area", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the releases associated with the given area. @@ -320,7 +320,7 @@ public IBrowseResults BrowseArtists(IWork work, int? limit = null, int? /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseArtistsAsync(IArea area, int? limit = null, int? offset = null, - Include inc = Include.None, CancellationToken cancellationToken = new()) + Include inc = Include.None, CancellationToken cancellationToken = default) => new BrowseArtists(this, Query.BuildExtraText(inc, "area", area.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the artists in the given collection. @@ -333,7 +333,7 @@ public Task> BrowseArtistsAsync(IArea area, int? limit = /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseArtistsAsync(ICollection collection, int? limit = null, int? offset = null, - Include inc = Include.None, CancellationToken cancellationToken = new()) + Include inc = Include.None, CancellationToken cancellationToken = default) => new BrowseArtists(this, Query.BuildExtraText(inc, "collection", collection.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the releases associated with the given recording. @@ -346,7 +346,7 @@ public Task> BrowseArtistsAsync(ICollection collection, /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseArtistsAsync(IRecording recording, int? limit = null, int? offset = null, - Include inc = Include.None, CancellationToken cancellationToken = new()) + Include inc = Include.None, CancellationToken cancellationToken = default) => new BrowseArtists(this, Query.BuildExtraText(inc, "recording", recording.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the releases associated with the given release. @@ -359,7 +359,7 @@ public Task> BrowseArtistsAsync(IRecording recording, in /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseArtistsAsync(IRelease release, int? limit = null, int? offset = null, - Include inc = Include.None, CancellationToken cancellationToken = new()) + Include inc = Include.None, CancellationToken cancellationToken = default) => new BrowseArtists(this, Query.BuildExtraText(inc, "release", release.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the releases associated with the given release group. @@ -372,7 +372,8 @@ public Task> BrowseArtistsAsync(IRelease release, int? l /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseArtistsAsync(IReleaseGroup releaseGroup, int? limit = null, int? offset = null, - Include inc = Include.None, CancellationToken cancellationToken = new()) { + Include inc = Include.None, + CancellationToken cancellationToken = default) { var browse = new BrowseArtists(this, Query.BuildExtraText(inc, "release-group", releaseGroup.Id), limit, offset); return browse.NextAsync(cancellationToken); } @@ -387,7 +388,7 @@ public Task> BrowseArtistsAsync(IReleaseGroup releaseGro /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseArtistsAsync(IWork work, int? limit = null, int? offset = null, - Include inc = Include.None, CancellationToken cancellationToken = new()) + Include inc = Include.None, CancellationToken cancellationToken = default) => new BrowseArtists(this, Query.BuildExtraText(inc, "work", work.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the artists in the given collection. @@ -413,7 +414,7 @@ public IBrowseResults BrowseCollectionArtists(Guid mbid, int? limit = n /// When something goes wrong with the web request. public Task> BrowseCollectionArtistsAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseArtists(this, Query.BuildExtraText(inc, "collection", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the artists associated with the given recording. @@ -439,7 +440,7 @@ public IBrowseResults BrowseRecordingArtists(Guid mbid, int? limit = nu /// When something goes wrong with the web request. public Task> BrowseRecordingArtistsAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseArtists(this, Query.BuildExtraText(inc, "recording", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the artists associated with the given release. @@ -464,7 +465,7 @@ public IBrowseResults BrowseReleaseArtists(Guid mbid, int? limit = null /// When something goes wrong with the web request. public Task> BrowseReleaseArtistsAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseArtists(this, Query.BuildExtraText(inc, "release", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the artists associated with the given release group. @@ -490,7 +491,7 @@ public IBrowseResults BrowseReleaseGroupArtists(Guid mbid, int? limit = /// When something goes wrong with the web request. public Task> BrowseReleaseGroupArtistsAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseArtists(this, Query.BuildExtraText(inc, "release-group", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the artists associated with the given work. @@ -515,7 +516,7 @@ public IBrowseResults BrowseWorkArtists(Guid mbid, int? limit = null, i /// When something goes wrong with the web request. public Task> BrowseWorkArtistsAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseArtists(this, Query.BuildExtraText(inc, "work", mbid), limit, offset).NextAsync(cancellationToken); } diff --git a/MetaBrainz.MusicBrainz/Query.Browse.Collections.cs b/MetaBrainz.MusicBrainz/Query.Browse.Collections.cs index c30eedf..394ed08 100644 --- a/MetaBrainz.MusicBrainz/Query.Browse.Collections.cs +++ b/MetaBrainz.MusicBrainz/Query.Browse.Collections.cs @@ -377,7 +377,7 @@ public IBrowseResults BrowseAreaCollections(Guid mbid, int? limit = /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseAreaCollectionsAsync(Guid mbid, int? limit = null, int? offset = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseCollections(this, Query.BuildExtraText("area", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the collections that include the given artist. @@ -399,7 +399,7 @@ public IBrowseResults BrowseArtistCollections(Guid mbid, int? limit /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseArtistCollectionsAsync(Guid mbid, int? limit = null, int? offset = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseCollections(this, Query.BuildExtraText("artist", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the collections that include the given area. @@ -521,7 +521,7 @@ public IBrowseResults BrowseCollections(IWork work, int? limit = nu /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseCollectionsAsync(IArea area, int? limit = null, int? offset = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseCollections(this, Query.BuildExtraText("area", area.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the collections that include the given artist. @@ -533,7 +533,7 @@ public Task> BrowseCollectionsAsync(IArea area, int? /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseCollectionsAsync(IArtist artist, int? limit = null, int? offset = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseCollections(this, Query.BuildExtraText("artist", artist.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the collections that include the given event. @@ -545,7 +545,7 @@ public Task> BrowseCollectionsAsync(IArtist artist, /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseCollectionsAsync(IEvent @event, int? limit = null, int? offset = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseCollections(this, Query.BuildExtraText("event", @event.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the collections that include the given instrument. @@ -557,7 +557,7 @@ public Task> BrowseCollectionsAsync(IEvent @event, i /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseCollectionsAsync(IInstrument instrument, int? limit = null, int? offset = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseCollections(this, Query.BuildExtraText("instrument", instrument.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the collections that include the given label. @@ -569,7 +569,7 @@ public Task> BrowseCollectionsAsync(IInstrument inst /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseCollectionsAsync(ILabel label, int? limit = null, int? offset = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseCollections(this, Query.BuildExtraText("label", label.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the collections that include the given place. @@ -581,7 +581,7 @@ public Task> BrowseCollectionsAsync(ILabel label, in /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseCollectionsAsync(IPlace place, int? limit = null, int? offset = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseCollections(this, Query.BuildExtraText("place", place.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the collections that include the given recording. @@ -593,7 +593,7 @@ public Task> BrowseCollectionsAsync(IPlace place, in /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseCollectionsAsync(IRecording recording, int? limit = null, int? offset = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseCollections(this, Query.BuildExtraText("recording", recording.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the collections that include the given release. @@ -605,7 +605,7 @@ public Task> BrowseCollectionsAsync(IRecording recor /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseCollectionsAsync(IRelease release, int? limit = null, int? offset = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseCollections(this, Query.BuildExtraText("release", release.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the collections that include the given release group. @@ -617,7 +617,7 @@ public Task> BrowseCollectionsAsync(IRelease release /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseCollectionsAsync(IReleaseGroup releaseGroup, int? limit = null, int? offset = null, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var browse = new BrowseCollections(this, Query.BuildExtraText("release-group", releaseGroup.Id), limit, offset); return browse.NextAsync(cancellationToken); } @@ -631,7 +631,7 @@ public Task> BrowseCollectionsAsync(IReleaseGroup re /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseCollectionsAsync(ISeries series, int? limit = null, int? offset = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseCollections(this, Query.BuildExtraText("series", series.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the collections that include the given work. @@ -643,7 +643,7 @@ public Task> BrowseCollectionsAsync(ISeries series, /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseCollectionsAsync(IWork work, int? limit = null, int? offset = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseCollections(this, Query.BuildExtraText("work", work.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the collections of the given editor. @@ -665,7 +665,7 @@ public IBrowseResults BrowseEditorCollections(string editor, int? l /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseEditorCollectionsAsync(string editor, int? limit = null, int? offset = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseCollections(this, Query.BuildExtraText("editor", editor), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the collections that include the given event. @@ -687,7 +687,7 @@ public IBrowseResults BrowseEventCollections(Guid mbid, int? limit /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseEventCollectionsAsync(Guid mbid, int? limit = null, int? offset = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseCollections(this, Query.BuildExtraText("event", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the collections that include the given instrument. @@ -709,7 +709,7 @@ public IBrowseResults BrowseInstrumentCollections(Guid mbid, int? l /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseInstrumentCollectionsAsync(Guid mbid, int? limit = null, int? offset = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseCollections(this, Query.BuildExtraText("instrument", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the collections that include the given label. @@ -731,7 +731,7 @@ public IBrowseResults BrowseLabelCollections(Guid mbid, int? limit /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseLabelCollectionsAsync(Guid mbid, int? limit = null, int? offset = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseCollections(this, Query.BuildExtraText("label", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the collections that include the given place. @@ -753,7 +753,7 @@ public IBrowseResults BrowsePlaceCollections(Guid mbid, int? limit /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowsePlaceCollectionsAsync(Guid mbid, int? limit = null, int? offset = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseCollections(this, Query.BuildExtraText("place", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the collections that include the given recording. @@ -775,7 +775,7 @@ public IBrowseResults BrowseRecordingCollections(Guid mbid, int? li /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseRecordingCollectionsAsync(Guid mbid, int? limit = null, int? offset = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseCollections(this, Query.BuildExtraText("recording", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the collections that include the given release. @@ -797,7 +797,7 @@ public IBrowseResults BrowseReleaseCollections(Guid mbid, int? limi /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseReleaseCollectionsAsync(Guid mbid, int? limit = null, int? offset = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseCollections(this, Query.BuildExtraText("release", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the collections that include the given release group. @@ -819,7 +819,7 @@ public IBrowseResults BrowseReleaseGroupCollections(Guid mbid, int? /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseReleaseGroupCollectionsAsync(Guid mbid, int? limit = null, int? offset = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseCollections(this, Query.BuildExtraText("release-group", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the collections that include the given series. @@ -841,7 +841,7 @@ public IBrowseResults BrowseSeriesCollections(Guid mbid, int? limit /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseSeriesCollectionsAsync(Guid mbid, int? limit = null, int? offset = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseCollections(this, Query.BuildExtraText("series", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the collections that include the given work. @@ -863,7 +863,7 @@ public IBrowseResults BrowseWorkCollections(Guid mbid, int? limit = /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseWorkCollectionsAsync(Guid mbid, int? limit = null, int? offset = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseCollections(this, Query.BuildExtraText("work", mbid), limit, offset).NextAsync(cancellationToken); } diff --git a/MetaBrainz.MusicBrainz/Query.Browse.Events.cs b/MetaBrainz.MusicBrainz/Query.Browse.Events.cs index 5bab01a..93581c2 100644 --- a/MetaBrainz.MusicBrainz/Query.Browse.Events.cs +++ b/MetaBrainz.MusicBrainz/Query.Browse.Events.cs @@ -169,7 +169,8 @@ public IBrowseResults BrowseAreaEvents(Guid mbid, int? limit = null, int /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseAreaEventsAsync(Guid mbid, int? limit = null, int? offset = null, - Include inc = Include.None, CancellationToken cancellationToken = new()) + Include inc = Include.None, + CancellationToken cancellationToken = default) => new BrowseEvents(this, Query.BuildExtraText(inc, "area", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the events associated with the given artist. @@ -194,7 +195,7 @@ public IBrowseResults BrowseArtistEvents(Guid mbid, int? limit = null, i /// When something goes wrong with the web request. public Task> BrowseArtistEventsAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseEvents(this, Query.BuildExtraText(inc, "artist", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the events in the given collection. @@ -219,7 +220,7 @@ public IBrowseResults BrowseCollectionEvents(Guid mbid, int? limit = nul /// When something goes wrong with the web request. public Task> BrowseCollectionEventsAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseEvents(this, Query.BuildExtraText(inc, "collection", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the events associated with the given area. @@ -277,7 +278,7 @@ public IBrowseResults BrowseEvents(IPlace place, int? limit = null, int? /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseEventsAsync(IArea area, int? limit = null, int? offset = null, - Include inc = Include.None, CancellationToken cancellationToken = new()) + Include inc = Include.None, CancellationToken cancellationToken = default) => new BrowseEvents(this, Query.BuildExtraText(inc, "area", area.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the events associated with the given artist. @@ -290,7 +291,7 @@ public Task> BrowseEventsAsync(IArea area, int? limit = n /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseEventsAsync(IArtist artist, int? limit = null, int? offset = null, - Include inc = Include.None, CancellationToken cancellationToken = new()) + Include inc = Include.None, CancellationToken cancellationToken = default) => new BrowseEvents(this, Query.BuildExtraText(inc, "artist", artist.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the events in the given collection. @@ -303,7 +304,7 @@ public Task> BrowseEventsAsync(IArtist artist, int? limit /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseEventsAsync(ICollection collection, int? limit = null, int? offset = null, - Include inc = Include.None, CancellationToken cancellationToken = new()) + Include inc = Include.None, CancellationToken cancellationToken = default) => new BrowseEvents(this, Query.BuildExtraText(inc, "collection", collection.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the events associated with the given place. @@ -316,7 +317,7 @@ public Task> BrowseEventsAsync(ICollection collection, in /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseEventsAsync(IPlace place, int? limit = null, int? offset = null, - Include inc = Include.None, CancellationToken cancellationToken = new()) + Include inc = Include.None, CancellationToken cancellationToken = default) => new BrowseEvents(this, Query.BuildExtraText(inc, "place", place.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the events associated with the given place. @@ -341,7 +342,7 @@ public IBrowseResults BrowsePlaceEvents(Guid mbid, int? limit = null, in /// When something goes wrong with the web request. public Task> BrowsePlaceEventsAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseEvents(this, Query.BuildExtraText(inc, "place", mbid), limit, offset).NextAsync(cancellationToken); } diff --git a/MetaBrainz.MusicBrainz/Query.Browse.Instruments.cs b/MetaBrainz.MusicBrainz/Query.Browse.Instruments.cs index a21b26f..0c052ff 100644 --- a/MetaBrainz.MusicBrainz/Query.Browse.Instruments.cs +++ b/MetaBrainz.MusicBrainz/Query.Browse.Instruments.cs @@ -69,7 +69,7 @@ public IBrowseResults BrowseInstruments(ICollection collection, int /// When something goes wrong with the web request. public Task> BrowseInstrumentsAsync(ICollection collection, int? limit = null, int? offset = null, Include inc = Include.None, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var browse = new BrowseInstruments(this, Query.BuildExtraText(inc, "collection", collection.Id), limit, offset); return browse.NextAsync(cancellationToken); } @@ -97,7 +97,7 @@ public IBrowseResults BrowseCollectionInstruments(Guid mbid, int? l /// When something goes wrong with the web request. public Task> BrowseCollectionInstrumentsAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseInstruments(this, Query.BuildExtraText(inc, "collection", mbid), limit, offset).NextAsync(cancellationToken); } diff --git a/MetaBrainz.MusicBrainz/Query.Browse.Labels.cs b/MetaBrainz.MusicBrainz/Query.Browse.Labels.cs index 3dccad4..cc2eb96 100644 --- a/MetaBrainz.MusicBrainz/Query.Browse.Labels.cs +++ b/MetaBrainz.MusicBrainz/Query.Browse.Labels.cs @@ -135,7 +135,8 @@ public IBrowseResults BrowseAreaLabels(Guid mbid, int? limit = null, int /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseAreaLabelsAsync(Guid mbid, int? limit = null, int? offset = null, - Include inc = Include.None, CancellationToken cancellationToken = new()) + Include inc = Include.None, + CancellationToken cancellationToken = default) => new BrowseLabels(this, Query.BuildExtraText(inc, "area", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the labels in the given collection. @@ -160,7 +161,7 @@ public IBrowseResults BrowseCollectionLabels(Guid mbid, int? limit = nul /// When something goes wrong with the web request. public Task> BrowseCollectionLabelsAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseLabels(this, Query.BuildExtraText(inc, "collection", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the labels associated with the given area. @@ -207,7 +208,7 @@ public IBrowseResults BrowseLabels(IRelease release, int? limit = null, /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseLabelsAsync(IArea area, int? limit = null, int? offset = null, - Include inc = Include.None, CancellationToken cancellationToken = new()) + Include inc = Include.None, CancellationToken cancellationToken = default) => new BrowseLabels(this, Query.BuildExtraText(inc, "area", area.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the labels in the given collection. @@ -220,7 +221,7 @@ public Task> BrowseLabelsAsync(IArea area, int? limit = n /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseLabelsAsync(ICollection collection, int? limit = null, int? offset = null, - Include inc = Include.None, CancellationToken cancellationToken = new()) + Include inc = Include.None, CancellationToken cancellationToken = default) => new BrowseLabels(this, Query.BuildExtraText(inc, "collection", collection.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the labels associated with the given release. @@ -233,7 +234,7 @@ public Task> BrowseLabelsAsync(ICollection collection, in /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseLabelsAsync(IRelease release, int? limit = null, int? offset = null, - Include inc = Include.None, CancellationToken cancellationToken = new()) + Include inc = Include.None, CancellationToken cancellationToken = default) => new BrowseLabels(this, Query.BuildExtraText(inc, "release", release.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the labels associated with the given release. @@ -258,7 +259,7 @@ public IBrowseResults BrowseReleaseLabels(Guid mbid, int? limit = null, /// When something goes wrong with the web request. public Task> BrowseReleaseLabelsAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseLabels(this, Query.BuildExtraText(inc, "release", mbid), limit, offset).NextAsync(cancellationToken); } diff --git a/MetaBrainz.MusicBrainz/Query.Browse.Places.cs b/MetaBrainz.MusicBrainz/Query.Browse.Places.cs index 4dbc5e7..efd412d 100644 --- a/MetaBrainz.MusicBrainz/Query.Browse.Places.cs +++ b/MetaBrainz.MusicBrainz/Query.Browse.Places.cs @@ -101,7 +101,8 @@ public IBrowseResults BrowseAreaPlaces(Guid mbid, int? limit = null, int /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseAreaPlacesAsync(Guid mbid, int? limit = null, int? offset = null, - Include inc = Include.None, CancellationToken cancellationToken = new()) + Include inc = Include.None, + CancellationToken cancellationToken = default) => new BrowsePlaces(this, Query.BuildExtraText(inc, "area", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the places in the given collection. @@ -126,7 +127,7 @@ public IBrowseResults BrowseCollectionPlaces(Guid mbid, int? limit = nul /// When something goes wrong with the web request. public Task> BrowseCollectionPlacesAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowsePlaces(this, Query.BuildExtraText(inc, "collection", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the places associated with the given area. @@ -162,7 +163,7 @@ public IBrowseResults BrowsePlaces(ICollection collection, int? limit = /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowsePlacesAsync(IArea area, int? limit = null, int? offset = null, - Include inc = Include.None, CancellationToken cancellationToken = new()) + Include inc = Include.None, CancellationToken cancellationToken = default) => new BrowsePlaces(this, Query.BuildExtraText(inc, "area", area.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the places in the given collection. @@ -175,7 +176,7 @@ public Task> BrowsePlacesAsync(IArea area, int? limit = n /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowsePlacesAsync(ICollection collection, int? limit = null, int? offset = null, - Include inc = Include.None, CancellationToken cancellationToken = new()) + Include inc = Include.None, CancellationToken cancellationToken = default) => new BrowsePlaces(this, Query.BuildExtraText(inc, "collection", collection.Id), limit, offset).NextAsync(cancellationToken); } diff --git a/MetaBrainz.MusicBrainz/Query.Browse.Recordings.cs b/MetaBrainz.MusicBrainz/Query.Browse.Recordings.cs index bf29a49..06340e7 100644 --- a/MetaBrainz.MusicBrainz/Query.Browse.Recordings.cs +++ b/MetaBrainz.MusicBrainz/Query.Browse.Recordings.cs @@ -137,7 +137,7 @@ public IBrowseResults BrowseArtistRecordings(Guid mbid, int? limit = /// When something goes wrong with the web request. public Task> BrowseArtistRecordingsAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseRecordings(this, Query.BuildExtraText(inc, "artist", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the recordings in the given collection. @@ -163,7 +163,7 @@ public IBrowseResults BrowseCollectionRecordings(Guid mbid, int? lim /// When something goes wrong with the web request. public Task> BrowseCollectionRecordingsAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseRecordings(this, Query.BuildExtraText(inc, "collection", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the recordings associated with the given artist. @@ -213,7 +213,7 @@ public IBrowseResults BrowseRecordings(IRelease release, int? limit /// When something goes wrong with the web request. public Task> BrowseRecordingsAsync(IArtist artist, int? limit = null, int? offset = null, Include inc = Include.None, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseRecordings(this, Query.BuildExtraText(inc, "artist", artist.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the recordings in the given collection. @@ -227,7 +227,7 @@ public Task> BrowseRecordingsAsync(IArtist artist, in /// When something goes wrong with the web request. public Task> BrowseRecordingsAsync(ICollection collection, int? limit = null, int? offset = null, Include inc = Include.None, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var browse = new BrowseRecordings(this, Query.BuildExtraText(inc, "collection", collection.Id), limit, offset); return browse.NextAsync(cancellationToken); } @@ -243,7 +243,7 @@ public Task> BrowseRecordingsAsync(ICollection collec /// When something goes wrong with the web request. public Task> BrowseRecordingsAsync(IRelease release, int? limit = null, int? offset = null, Include inc = Include.None, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseRecordings(this, Query.BuildExtraText(inc, "release", release.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the recordings associated with the given release. @@ -269,7 +269,7 @@ public IBrowseResults BrowseReleaseRecordings(Guid mbid, int? limit /// When something goes wrong with the web request. public Task> BrowseReleaseRecordingsAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseRecordings(this, Query.BuildExtraText(inc, "release", mbid), limit, offset).NextAsync(cancellationToken); } diff --git a/MetaBrainz.MusicBrainz/Query.Browse.ReleaseGroups.cs b/MetaBrainz.MusicBrainz/Query.Browse.ReleaseGroups.cs index 6e6d8a2..3ddd8d0 100644 --- a/MetaBrainz.MusicBrainz/Query.Browse.ReleaseGroups.cs +++ b/MetaBrainz.MusicBrainz/Query.Browse.ReleaseGroups.cs @@ -146,7 +146,7 @@ public IBrowseResults BrowseArtistReleaseGroups(Guid mbid, int? l /// When something goes wrong with the web request. public Task> BrowseArtistReleaseGroupsAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, ReleaseType? type = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseReleaseGroups(this, Query.BuildExtraText(inc, "artist", mbid, type), limit, offset).NextAsync(cancellationToken); /// @@ -167,7 +167,7 @@ public IBrowseResults BrowseCollectionReleaseGroups(Guid mbid, in public Task> BrowseCollectionReleaseGroupsAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, ReleaseType? type = null, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var browse = new BrowseReleaseGroups(this, Query.BuildExtraText(inc, "collection", mbid, type), limit, offset); return browse.NextAsync(cancellationToken); } @@ -193,7 +193,7 @@ public IBrowseResults BrowseReleaseReleaseGroups(Guid mbid, int? /// public Task> BrowseReleaseReleaseGroupsAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, ReleaseType? type = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseReleaseGroups(this, Query.BuildExtraText(inc, "release", mbid, type), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the release groups associated with the given artist. @@ -250,7 +250,7 @@ public IBrowseResults BrowseReleaseGroups(IRelease release, int? /// When something goes wrong with the web request. public Task> BrowseReleaseGroupsAsync(IArtist artist, int? limit = null, int? offset = null, Include inc = Include.None, ReleaseType? type = null, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var browse = new BrowseReleaseGroups(this, Query.BuildExtraText(inc, "artist", artist.Id, type), limit, offset); return browse.NextAsync(cancellationToken); } @@ -267,7 +267,7 @@ public Task> BrowseReleaseGroupsAsync(IArtist arti /// When something goes wrong with the web request. public Task> BrowseReleaseGroupsAsync(ICollection collection, int? limit = null, int? offset = null, Include inc = Include.None, ReleaseType? type = null, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var browse = new BrowseReleaseGroups(this, Query.BuildExtraText(inc, "collection", collection.Id, type), limit, offset); return browse.NextAsync(cancellationToken); } @@ -287,7 +287,7 @@ public Task> BrowseReleaseGroupsAsync(ICollection /// public Task> BrowseReleaseGroupsAsync(IRelease release, int? limit = null, int? offset = null, Include inc = Include.None, ReleaseType? type = null, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var browse = new BrowseReleaseGroups(this, Query.BuildExtraText(inc, "release", release.Id, type), limit, offset); return browse.NextAsync(cancellationToken); } diff --git a/MetaBrainz.MusicBrainz/Query.Browse.Releases.cs b/MetaBrainz.MusicBrainz/Query.Browse.Releases.cs index 364aa31..8389726 100644 --- a/MetaBrainz.MusicBrainz/Query.Browse.Releases.cs +++ b/MetaBrainz.MusicBrainz/Query.Browse.Releases.cs @@ -366,7 +366,7 @@ public IBrowseResults BrowseAreaReleases(Guid mbid, int? limit = null, public Task> BrowseAreaReleasesAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, ReleaseType? type = null, ReleaseStatus? status = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseReleases(this, Query.BuildExtraText(inc, "area", mbid, type, status), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the releases associated with the given artist. @@ -397,7 +397,7 @@ public IBrowseResults BrowseArtistReleases(Guid mbid, int? limit = nul public Task> BrowseArtistReleasesAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, ReleaseType? type = null, ReleaseStatus? status = null, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var browse = new BrowseReleases(this, Query.BuildExtraText(inc, "artist", mbid, type, status), limit, offset); return browse.NextAsync(cancellationToken); } @@ -431,7 +431,7 @@ public IBrowseResults BrowseCollectionReleases(Guid mbid, int? limit = public Task> BrowseCollectionReleasesAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, ReleaseType? type = null, ReleaseStatus? status = null, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var browse = new BrowseReleases(this, Query.BuildExtraText(inc, "collection", mbid, type, status), limit, offset); return browse.NextAsync(cancellationToken); } @@ -464,7 +464,7 @@ public IBrowseResults BrowseLabelReleases(Guid mbid, int? limit = null public Task> BrowseLabelReleasesAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, ReleaseType? type = null, ReleaseStatus? status = null, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseReleases(this, Query.BuildExtraText(inc, "label", mbid, type, status), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the releases associated with the given recording. @@ -496,7 +496,7 @@ public IBrowseResults BrowseRecordingReleases(Guid mbid, int? limit = public Task> BrowseRecordingReleasesAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, ReleaseType? type = null, ReleaseStatus? status = null, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var browse = new BrowseReleases(this, Query.BuildExtraText(inc, "recording", mbid, type, status), limit, offset); return browse.NextAsync(cancellationToken); } @@ -530,7 +530,7 @@ public IBrowseResults BrowseReleaseGroupReleases(Guid mbid, int? limit public Task> BrowseReleaseGroupReleasesAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, ReleaseType? type = null, ReleaseStatus? status = null, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var browse = new BrowseReleases(this, Query.BuildExtraText(inc, "release-group", mbid, type, status), limit, offset); return browse.NextAsync(cancellationToken); } @@ -648,7 +648,7 @@ public IBrowseResults BrowseReleases(ITrack track, int? limit = null, public Task> BrowseReleasesAsync(IArea area, int? limit = null, int? offset = null, Include inc = Include.None, ReleaseType? type = null, ReleaseStatus? status = null, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var browse = new BrowseReleases(this, Query.BuildExtraText(inc, "area", area.Id, type, status), limit, offset); return browse.NextAsync(cancellationToken); } @@ -667,7 +667,7 @@ public Task> BrowseReleasesAsync(IArea area, int? limit public Task> BrowseReleasesAsync(IArtist artist, int? limit = null, int? offset = null, Include inc = Include.None, ReleaseType? type = null, ReleaseStatus? status = null, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var browse = new BrowseReleases(this, Query.BuildExtraText(inc, "artist", artist.Id, type, status), limit, offset); return browse.NextAsync(cancellationToken); } @@ -686,7 +686,7 @@ public Task> BrowseReleasesAsync(IArtist artist, int? l public Task> BrowseReleasesAsync(ICollection collection, int? limit = null, int? offset = null, Include inc = Include.None, ReleaseType? type = null, ReleaseStatus? status = null, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var browse = new BrowseReleases(this, Query.BuildExtraText(inc, "collection", collection.Id, type, status), limit, offset); return browse.NextAsync(cancellationToken); } @@ -705,7 +705,7 @@ public Task> BrowseReleasesAsync(ICollection collection public Task> BrowseReleasesAsync(ILabel label, int? limit = null, int? offset = null, Include inc = Include.None, ReleaseType? type = null, ReleaseStatus? status = null, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var browse = new BrowseReleases(this, Query.BuildExtraText(inc, "label", label.Id, type, status), limit, offset); return browse.NextAsync(cancellationToken); } @@ -724,7 +724,7 @@ public Task> BrowseReleasesAsync(ILabel label, int? lim public Task> BrowseReleasesAsync(IRecording recording, int? limit = null, int? offset = null, Include inc = Include.None, ReleaseType? type = null, ReleaseStatus? status = null, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var browse = new BrowseReleases(this, Query.BuildExtraText(inc, "recording", recording.Id, type, status), limit, offset); return browse.NextAsync(cancellationToken); } @@ -743,7 +743,7 @@ public Task> BrowseReleasesAsync(IRecording recording, public Task> BrowseReleasesAsync(IReleaseGroup releaseGroup, int? limit = null, int? offset = null, Include inc = Include.None, ReleaseType? type = null, ReleaseStatus? status = null, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var browse = new BrowseReleases(this, Query.BuildExtraText(inc, "release-group", releaseGroup.Id, type, status), limit, offset); return browse.NextAsync(cancellationToken); } @@ -762,7 +762,7 @@ public Task> BrowseReleasesAsync(IReleaseGroup releaseG public Task> BrowseReleasesAsync(ITrack track, int? limit = null, int? offset = null, Include inc = Include.None, ReleaseType? type = null, ReleaseStatus? status = null, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var browse = new BrowseReleases(this, Query.BuildExtraText(inc, "track", track.Id, type, status), limit, offset); return browse.NextAsync(cancellationToken); } @@ -817,7 +817,7 @@ public IBrowseResults BrowseTrackArtistReleases(IArtist artist, int? l public Task> BrowseTrackArtistReleasesAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, ReleaseType? type = null, ReleaseStatus? status = null, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var browse = new BrowseReleases(this, Query.BuildExtraText(inc, "track_artist", mbid, type, status), limit, offset); return browse.NextAsync(cancellationToken); } @@ -838,7 +838,7 @@ public Task> BrowseTrackArtistReleasesAsync(Guid mbid, public Task> BrowseTrackArtistReleasesAsync(IArtist artist, int? limit = null, int? offset = null, Include inc = Include.None, ReleaseType? type = null, ReleaseStatus? status = null, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var browse = new BrowseReleases(this, Query.BuildExtraText(inc, "track_artist", artist.Id, type, status), limit, offset); return browse.NextAsync(cancellationToken); } @@ -871,7 +871,7 @@ public IBrowseResults BrowseTrackReleases(Guid mbid, int? limit = null public Task> BrowseTrackReleasesAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, ReleaseType? type = null, ReleaseStatus? status = null, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var browse = new BrowseReleases(this, Query.BuildExtraText(inc, "track", mbid, type, status), limit, offset); return browse.NextAsync(cancellationToken); } diff --git a/MetaBrainz.MusicBrainz/Query.Browse.Series.cs b/MetaBrainz.MusicBrainz/Query.Browse.Series.cs index 9626dbc..ce59ed4 100644 --- a/MetaBrainz.MusicBrainz/Query.Browse.Series.cs +++ b/MetaBrainz.MusicBrainz/Query.Browse.Series.cs @@ -69,7 +69,7 @@ public IBrowseResults BrowseCollectionSeries(Guid mbid, int? limit = nu /// When something goes wrong with the web request. public Task> BrowseCollectionSeriesAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseSeries(this, Query.BuildExtraText(inc, "collection", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the series in the given collection. @@ -94,7 +94,7 @@ public IBrowseResults BrowseSeries(ICollection collection, int? limit = /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseSeriesAsync(ICollection collection, int? limit = null, int? offset = null, - Include inc = Include.None, CancellationToken cancellationToken = new()) + Include inc = Include.None, CancellationToken cancellationToken = default) => new BrowseSeries(this, Query.BuildExtraText(inc, "collection", collection.Id), limit, offset).NextAsync(cancellationToken); } diff --git a/MetaBrainz.MusicBrainz/Query.Browse.Works.cs b/MetaBrainz.MusicBrainz/Query.Browse.Works.cs index c1abf0f..d147fb1 100644 --- a/MetaBrainz.MusicBrainz/Query.Browse.Works.cs +++ b/MetaBrainz.MusicBrainz/Query.Browse.Works.cs @@ -101,7 +101,8 @@ public IBrowseResults BrowseArtistWorks(Guid mbid, int? limit = null, int /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseArtistWorksAsync(Guid mbid, int? limit = null, int? offset = null, - Include inc = Include.None, CancellationToken cancellationToken = new()) + Include inc = Include.None, + CancellationToken cancellationToken = default) => new BrowseWorks(this, Query.BuildExtraText(inc, "artist", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the works in the given collection. @@ -126,7 +127,7 @@ public IBrowseResults BrowseCollectionWorks(Guid mbid, int? limit = null, /// When something goes wrong with the web request. public Task> BrowseCollectionWorksAsync(Guid mbid, int? limit = null, int? offset = null, Include inc = Include.None, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => new BrowseWorks(this, Query.BuildExtraText(inc, "collection", mbid), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the works associated with the given artist. @@ -162,7 +163,7 @@ public IBrowseResults BrowseWorks(ICollection collection, int? limit = nu /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseWorksAsync(IArtist artist, int? limit = null, int? offset = null, - Include inc = Include.None, CancellationToken cancellationToken = new()) + Include inc = Include.None, CancellationToken cancellationToken = default) => new BrowseWorks(this, Query.BuildExtraText(inc, "artist", artist.Id), limit, offset).NextAsync(cancellationToken); /// Returns (the specified subset of) the works in the given collection. @@ -175,7 +176,7 @@ public Task> BrowseWorksAsync(IArtist artist, int? limit = /// When the web service reports an error. /// When something goes wrong with the web request. public Task> BrowseWorksAsync(ICollection collection, int? limit = null, int? offset = null, - Include inc = Include.None, CancellationToken cancellationToken = new()) + Include inc = Include.None, CancellationToken cancellationToken = default) => new BrowseWorks(this, Query.BuildExtraText(inc, "collection", collection.Id), limit, offset).NextAsync(cancellationToken); } diff --git a/MetaBrainz.MusicBrainz/Query.Collections.Areas.cs b/MetaBrainz.MusicBrainz/Query.Collections.Areas.cs index 556da9c..d13b8a8 100644 --- a/MetaBrainz.MusicBrainz/Query.Collections.Areas.cs +++ b/MetaBrainz.MusicBrainz/Query.Collections.Areas.cs @@ -132,7 +132,8 @@ public Task AddToCollectionAsync(string client, Guid collection, Cancell /// When is blank. /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. - public Task AddToCollectionAsync(string client, Guid collection, IArea area, CancellationToken cancellationToken = new()) + public Task AddToCollectionAsync(string client, Guid collection, IArea area, + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Area, area, cancellationToken); /// Adds the specified areas to the specified collection. @@ -164,7 +165,7 @@ public Task AddToCollectionAsync(string client, Guid collection, params /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, Guid collection, IEnumerable areas, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Area, areas, cancellationToken); /// Adds the specified areas to the specified collection. @@ -198,7 +199,7 @@ public Task AddToCollectionAsync(string client, ICollection collection, /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, ICollection collection, IArea area, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Area, area, cancellationToken); /// Adds the specified areas to the specified collection. @@ -230,7 +231,7 @@ public Task AddToCollectionAsync(string client, ICollection collection, /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, ICollection collection, IEnumerable areas, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Area, areas, cancellationToken); #endregion @@ -358,7 +359,7 @@ public Task RemoveFromCollectionAsync(string client, Guid collection, Ca /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, Guid collection, IArea area, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Area, area, cancellationToken); /// Removes the specified areas from the specified collection. @@ -390,7 +391,7 @@ public Task RemoveFromCollectionAsync(string client, Guid collection, pa /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, Guid collection, IEnumerable areas, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Area, areas, cancellationToken); /// Removes the specified areas from the specified collection. @@ -424,7 +425,7 @@ public Task RemoveFromCollectionAsync(string client, ICollection collect /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, ICollection collection, IArea area, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Area, area, cancellationToken); /// Removes the specified areas from the specified collection. @@ -456,7 +457,7 @@ public Task RemoveFromCollectionAsync(string client, ICollection collect /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, ICollection collection, IEnumerable areas, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Area, areas, cancellationToken); #endregion diff --git a/MetaBrainz.MusicBrainz/Query.Collections.Artists.cs b/MetaBrainz.MusicBrainz/Query.Collections.Artists.cs index ea04216..5dec1d9 100644 --- a/MetaBrainz.MusicBrainz/Query.Collections.Artists.cs +++ b/MetaBrainz.MusicBrainz/Query.Collections.Artists.cs @@ -133,7 +133,7 @@ public Task AddToCollectionAsync(string client, Guid collection, Cancell /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, Guid collection, IArtist artist, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Artist, artist, cancellationToken); /// Adds the specified artists to the specified collection. @@ -165,7 +165,7 @@ public Task AddToCollectionAsync(string client, Guid collection, params /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, Guid collection, IEnumerable artists, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Artist, artists, cancellationToken); /// Adds the specified artists to the specified collection. @@ -199,7 +199,7 @@ public Task AddToCollectionAsync(string client, ICollection collection, /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, ICollection collection, IArtist artist, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Artist, artist, cancellationToken); /// Adds the specified artists to the specified collection. @@ -231,7 +231,7 @@ public Task AddToCollectionAsync(string client, ICollection collection, /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, ICollection collection, IEnumerable artists, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Artist, artists, cancellationToken); #endregion @@ -359,7 +359,7 @@ public Task RemoveFromCollectionAsync(string client, Guid collection, Ca /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, Guid collection, IArtist artist, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Artist, artist, cancellationToken); /// Removes the specified artists from the specified collection. @@ -391,7 +391,7 @@ public Task RemoveFromCollectionAsync(string client, Guid collection, pa /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, Guid collection, IEnumerable artists, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Artist, artists, cancellationToken); /// Removes the specified artists from the specified collection. @@ -425,7 +425,7 @@ public Task RemoveFromCollectionAsync(string client, ICollection collect /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, ICollection collection, IArtist artist, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Artist, artist, cancellationToken); /// Removes the specified artists from the specified collection. @@ -457,7 +457,7 @@ public Task RemoveFromCollectionAsync(string client, ICollection collect /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, ICollection collection, IEnumerable artists, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Artist, artists, cancellationToken); #endregion diff --git a/MetaBrainz.MusicBrainz/Query.Collections.Events.cs b/MetaBrainz.MusicBrainz/Query.Collections.Events.cs index 2f45f8d..b256ed0 100644 --- a/MetaBrainz.MusicBrainz/Query.Collections.Events.cs +++ b/MetaBrainz.MusicBrainz/Query.Collections.Events.cs @@ -133,7 +133,7 @@ public Task AddToCollectionAsync(string client, Guid collection, Cancell /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, Guid collection, IEvent @event, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Event, @event, cancellationToken); /// Adds the specified events to the specified collection. @@ -165,7 +165,7 @@ public Task AddToCollectionAsync(string client, Guid collection, params /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, Guid collection, IEnumerable events, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Event, events, cancellationToken); /// Adds the specified events to the specified collection. @@ -199,7 +199,7 @@ public Task AddToCollectionAsync(string client, ICollection collection, /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, ICollection collection, IEvent @event, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Event, @event, cancellationToken); /// Adds the specified events to the specified collection. @@ -231,7 +231,7 @@ public Task AddToCollectionAsync(string client, ICollection collection, /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, ICollection collection, IEnumerable events, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Event, events, cancellationToken); #endregion @@ -359,7 +359,7 @@ public Task RemoveFromCollectionAsync(string client, Guid collection, Ca /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, Guid collection, IEvent @event, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Event, @event, cancellationToken); /// Removes the specified events from the specified collection. @@ -391,7 +391,7 @@ public Task RemoveFromCollectionAsync(string client, Guid collection, pa /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, Guid collection, IEnumerable events, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Event, events, cancellationToken); /// Removes the specified events from the specified collection. @@ -425,7 +425,7 @@ public Task RemoveFromCollectionAsync(string client, ICollection collect /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, ICollection collection, IEvent @event, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Event, @event, cancellationToken); /// Removes the specified events from the specified collection. @@ -457,7 +457,7 @@ public Task RemoveFromCollectionAsync(string client, ICollection collect /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, ICollection collection, IEnumerable events, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Event, events, cancellationToken); #endregion diff --git a/MetaBrainz.MusicBrainz/Query.Collections.Instruments.cs b/MetaBrainz.MusicBrainz/Query.Collections.Instruments.cs index fab3d7b..185a47a 100644 --- a/MetaBrainz.MusicBrainz/Query.Collections.Instruments.cs +++ b/MetaBrainz.MusicBrainz/Query.Collections.Instruments.cs @@ -133,7 +133,7 @@ public Task AddToCollectionAsync(string client, Guid collection, Cancell /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, Guid collection, IInstrument instrument, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Instrument, instrument, cancellationToken); /// Adds the specified instruments to the specified collection. @@ -165,7 +165,7 @@ public Task AddToCollectionAsync(string client, Guid collection, params /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, Guid collection, IEnumerable instruments, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Instrument, instruments, cancellationToken); /// Adds the specified instruments to the specified collection. @@ -199,7 +199,7 @@ public Task AddToCollectionAsync(string client, ICollection collection, /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, ICollection collection, IInstrument instrument, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Instrument, instrument, cancellationToken); /// Adds the specified instruments to the specified collection. @@ -231,7 +231,7 @@ public Task AddToCollectionAsync(string client, ICollection collection, /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, ICollection collection, IEnumerable instruments, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Instrument, instruments, cancellationToken); #endregion @@ -359,7 +359,7 @@ public Task RemoveFromCollectionAsync(string client, Guid collection, Ca /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, Guid collection, IInstrument instrument, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Instrument, instrument, cancellationToken); /// Removes the specified instruments from the specified collection. @@ -391,7 +391,7 @@ public Task RemoveFromCollectionAsync(string client, Guid collection, pa /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, Guid collection, IEnumerable instruments, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Instrument, instruments, cancellationToken); /// Removes the specified instruments from the specified collection. @@ -425,7 +425,7 @@ public Task RemoveFromCollectionAsync(string client, ICollection collect /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, ICollection collection, IInstrument instrument, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Instrument, instrument, cancellationToken); /// Removes the specified instruments from the specified collection. @@ -457,7 +457,7 @@ public Task RemoveFromCollectionAsync(string client, ICollection collect /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, ICollection collection, IEnumerable instruments, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Instrument, instruments, cancellationToken); #endregion diff --git a/MetaBrainz.MusicBrainz/Query.Collections.Labels.cs b/MetaBrainz.MusicBrainz/Query.Collections.Labels.cs index dbc9721..3ae7d46 100644 --- a/MetaBrainz.MusicBrainz/Query.Collections.Labels.cs +++ b/MetaBrainz.MusicBrainz/Query.Collections.Labels.cs @@ -133,7 +133,7 @@ public Task AddToCollectionAsync(string client, Guid collection, Cancell /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, Guid collection, ILabel label, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Label, label, cancellationToken); /// Adds the specified labels to the specified collection. @@ -165,7 +165,7 @@ public Task AddToCollectionAsync(string client, Guid collection, params /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, Guid collection, IEnumerable labels, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Label, labels, cancellationToken); /// Adds the specified labels to the specified collection. @@ -199,7 +199,7 @@ public Task AddToCollectionAsync(string client, ICollection collection, /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, ICollection collection, ILabel label, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Label, label, cancellationToken); /// Adds the specified labels to the specified collection. @@ -231,7 +231,7 @@ public Task AddToCollectionAsync(string client, ICollection collection, /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, ICollection collection, IEnumerable labels, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Label, labels, cancellationToken); #endregion @@ -359,7 +359,7 @@ public Task RemoveFromCollectionAsync(string client, Guid collection, Ca /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, Guid collection, ILabel label, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Label, label, cancellationToken); /// Removes the specified labels from the specified collection. @@ -391,7 +391,7 @@ public Task RemoveFromCollectionAsync(string client, Guid collection, pa /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, Guid collection, IEnumerable labels, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Label, labels, cancellationToken); /// Removes the specified labels from the specified collection. @@ -425,7 +425,7 @@ public Task RemoveFromCollectionAsync(string client, ICollection collect /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, ICollection collection, ILabel label, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Label, label, cancellationToken); /// Removes the specified labels from the specified collection. @@ -457,7 +457,7 @@ public Task RemoveFromCollectionAsync(string client, ICollection collect /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, ICollection collection, IEnumerable labels, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Label, labels, cancellationToken); #endregion diff --git a/MetaBrainz.MusicBrainz/Query.Collections.Places.cs b/MetaBrainz.MusicBrainz/Query.Collections.Places.cs index e9c227b..af669e9 100644 --- a/MetaBrainz.MusicBrainz/Query.Collections.Places.cs +++ b/MetaBrainz.MusicBrainz/Query.Collections.Places.cs @@ -133,7 +133,7 @@ public Task AddToCollectionAsync(string client, Guid collection, Cancell /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, Guid collection, IPlace place, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Place, place, cancellationToken); /// Adds the specified places to the specified collection. @@ -165,7 +165,7 @@ public Task AddToCollectionAsync(string client, Guid collection, params /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, Guid collection, IEnumerable places, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Place, places, cancellationToken); /// Adds the specified places to the specified collection. @@ -199,7 +199,7 @@ public Task AddToCollectionAsync(string client, ICollection collection, /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, ICollection collection, IPlace place, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Place, place, cancellationToken); /// Adds the specified places to the specified collection. @@ -231,7 +231,7 @@ public Task AddToCollectionAsync(string client, ICollection collection, /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, ICollection collection, IEnumerable places, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Place, places, cancellationToken); #endregion @@ -359,7 +359,7 @@ public Task RemoveFromCollectionAsync(string client, Guid collection, Ca /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, Guid collection, IPlace place, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Place, place, cancellationToken); /// Removes the specified places from the specified collection. @@ -391,7 +391,7 @@ public Task RemoveFromCollectionAsync(string client, Guid collection, pa /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, Guid collection, IEnumerable places, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Place, places, cancellationToken); /// Removes the specified places from the specified collection. @@ -425,7 +425,7 @@ public Task RemoveFromCollectionAsync(string client, ICollection collect /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, ICollection collection, IPlace place, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Place, place, cancellationToken); /// Removes the specified places from the specified collection. @@ -457,7 +457,7 @@ public Task RemoveFromCollectionAsync(string client, ICollection collect /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, ICollection collection, IEnumerable places, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Place, places, cancellationToken); #endregion diff --git a/MetaBrainz.MusicBrainz/Query.Collections.Recordings.cs b/MetaBrainz.MusicBrainz/Query.Collections.Recordings.cs index cfb0a0f..4a4762c 100644 --- a/MetaBrainz.MusicBrainz/Query.Collections.Recordings.cs +++ b/MetaBrainz.MusicBrainz/Query.Collections.Recordings.cs @@ -133,7 +133,7 @@ public Task AddToCollectionAsync(string client, Guid collection, Cancell /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, Guid collection, IRecording recording, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Recording, recording, cancellationToken); /// Adds the specified recordings to the specified collection. @@ -165,7 +165,7 @@ public Task AddToCollectionAsync(string client, Guid collection, params /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, Guid collection, IEnumerable recordings, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Recording, recordings, cancellationToken); /// Adds the specified recordings to the specified collection. @@ -199,7 +199,7 @@ public Task AddToCollectionAsync(string client, ICollection collection, /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, ICollection collection, IRecording recording, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Recording, recording, cancellationToken); /// Adds the specified recordings to the specified collection. @@ -231,7 +231,7 @@ public Task AddToCollectionAsync(string client, ICollection collection, /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, ICollection collection, IEnumerable recordings, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Recording, recordings, cancellationToken); #endregion @@ -359,7 +359,7 @@ public Task RemoveFromCollectionAsync(string client, Guid collection, Ca /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, Guid collection, IRecording recording, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Recording, recording, cancellationToken); /// Removes the specified recordings from the specified collection. @@ -391,7 +391,7 @@ public Task RemoveFromCollectionAsync(string client, Guid collection, pa /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, Guid collection, IEnumerable recordings, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Recording, recordings, cancellationToken); /// Removes the specified recordings from the specified collection. @@ -425,7 +425,7 @@ public Task RemoveFromCollectionAsync(string client, ICollection collect /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, ICollection collection, IRecording recording, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Recording, recording, cancellationToken); /// Removes the specified recordings from the specified collection. @@ -457,7 +457,7 @@ public Task RemoveFromCollectionAsync(string client, ICollection collect /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, ICollection collection, IEnumerable recordings, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Recording, recordings, cancellationToken); #endregion diff --git a/MetaBrainz.MusicBrainz/Query.Collections.ReleaseGroups.cs b/MetaBrainz.MusicBrainz/Query.Collections.ReleaseGroups.cs index c9972da..a9de1ed 100644 --- a/MetaBrainz.MusicBrainz/Query.Collections.ReleaseGroups.cs +++ b/MetaBrainz.MusicBrainz/Query.Collections.ReleaseGroups.cs @@ -133,7 +133,7 @@ public Task AddToCollectionAsync(string client, Guid collection, Cancell /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, Guid collection, IReleaseGroup releaseGroup, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.ReleaseGroup, releaseGroup, cancellationToken); /// Adds the specified release groups to the specified collection. @@ -165,7 +165,7 @@ public Task AddToCollectionAsync(string client, Guid collection, params /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, Guid collection, IEnumerable releaseGroups, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.ReleaseGroup, releaseGroups, cancellationToken); /// Adds the specified release groups to the specified collection. @@ -199,7 +199,7 @@ public Task AddToCollectionAsync(string client, ICollection collection, /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, ICollection collection, IReleaseGroup releaseGroup, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.ReleaseGroup, releaseGroup, cancellationToken); /// Adds the specified release groups to the specified collection. @@ -231,7 +231,7 @@ public Task AddToCollectionAsync(string client, ICollection collection, /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, ICollection collection, IEnumerable releaseGroups, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.ReleaseGroup, releaseGroups, cancellationToken); #endregion @@ -359,7 +359,7 @@ public Task RemoveFromCollectionAsync(string client, Guid collection, Ca /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, Guid collection, IReleaseGroup releaseGroup, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.ReleaseGroup, releaseGroup, cancellationToken); /// Removes the specified release groups from the specified collection. @@ -391,7 +391,7 @@ public Task RemoveFromCollectionAsync(string client, Guid collection, pa /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, Guid collection, IEnumerable releaseGroups, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.ReleaseGroup, releaseGroups, cancellationToken); /// Removes the specified release groups from the specified collection. @@ -425,7 +425,7 @@ public Task RemoveFromCollectionAsync(string client, ICollection collect /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, ICollection collection, IReleaseGroup releaseGroup, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.ReleaseGroup, releaseGroup, cancellationToken); /// Removes the specified release groups from the specified collection. @@ -457,7 +457,7 @@ public Task RemoveFromCollectionAsync(string client, ICollection collect /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, ICollection collection, IEnumerable releaseGroups, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.ReleaseGroup, releaseGroups, cancellationToken); #endregion diff --git a/MetaBrainz.MusicBrainz/Query.Collections.Releases.cs b/MetaBrainz.MusicBrainz/Query.Collections.Releases.cs index 6994e7a..7d18971 100644 --- a/MetaBrainz.MusicBrainz/Query.Collections.Releases.cs +++ b/MetaBrainz.MusicBrainz/Query.Collections.Releases.cs @@ -133,7 +133,7 @@ public Task AddToCollectionAsync(string client, Guid collection, Cancell /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, Guid collection, IRelease release, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Release, release, cancellationToken); /// Adds the specified releases to the specified collection. @@ -165,7 +165,7 @@ public Task AddToCollectionAsync(string client, Guid collection, params /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, Guid collection, IEnumerable releases, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Release, releases, cancellationToken); /// Adds the specified releases to the specified collection. @@ -199,7 +199,7 @@ public Task AddToCollectionAsync(string client, ICollection collection, /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, ICollection collection, IRelease release, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Release, release, cancellationToken); /// Adds the specified releases to the specified collection. @@ -231,7 +231,7 @@ public Task AddToCollectionAsync(string client, ICollection collection, /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, ICollection collection, IEnumerable releases, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Release, releases, cancellationToken); #endregion @@ -359,7 +359,7 @@ public Task RemoveFromCollectionAsync(string client, Guid collection, Ca /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, Guid collection, IRelease release, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Release, release, cancellationToken); /// Removes the specified releases from the specified collection. @@ -391,7 +391,7 @@ public Task RemoveFromCollectionAsync(string client, Guid collection, pa /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, Guid collection, IEnumerable releases, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Release, releases, cancellationToken); /// Removes the specified releases from the specified collection. @@ -425,7 +425,7 @@ public Task RemoveFromCollectionAsync(string client, ICollection collect /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, ICollection collection, IRelease release, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Release, release, cancellationToken); /// Removes the specified releases from the specified collection. @@ -457,7 +457,7 @@ public Task RemoveFromCollectionAsync(string client, ICollection collect /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, ICollection collection, IEnumerable releases, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Release, releases, cancellationToken); #endregion diff --git a/MetaBrainz.MusicBrainz/Query.Collections.Series.cs b/MetaBrainz.MusicBrainz/Query.Collections.Series.cs index 615f82e..3dfdf97 100644 --- a/MetaBrainz.MusicBrainz/Query.Collections.Series.cs +++ b/MetaBrainz.MusicBrainz/Query.Collections.Series.cs @@ -133,7 +133,7 @@ public Task AddToCollectionAsync(string client, Guid collection, Cancell /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, Guid collection, ISeries series, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Series, series, cancellationToken); /// Adds the specified series to the specified collection. @@ -165,7 +165,7 @@ public Task AddToCollectionAsync(string client, Guid collection, params /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, Guid collection, IEnumerable series, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Series, series, cancellationToken); /// Adds the specified series to the specified collection. @@ -199,7 +199,7 @@ public Task AddToCollectionAsync(string client, ICollection collection, /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, ICollection collection, ISeries series, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Series, series, cancellationToken); /// Adds the specified series to the specified collection. @@ -231,7 +231,7 @@ public Task AddToCollectionAsync(string client, ICollection collection, /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, ICollection collection, IEnumerable series, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Series, series, cancellationToken); #endregion @@ -359,7 +359,7 @@ public Task RemoveFromCollectionAsync(string client, Guid collection, Ca /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, Guid collection, ISeries series, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Series, series, cancellationToken); /// Removes the specified series from the specified collection. @@ -391,7 +391,7 @@ public Task RemoveFromCollectionAsync(string client, Guid collection, pa /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, Guid collection, IEnumerable series, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Series, series, cancellationToken); /// Removes the specified series from the specified collection. @@ -425,7 +425,7 @@ public Task RemoveFromCollectionAsync(string client, ICollection collect /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, ICollection collection, ISeries series, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Series, series, cancellationToken); /// Removes the specified series from the specified collection. @@ -457,7 +457,7 @@ public Task RemoveFromCollectionAsync(string client, ICollection collect /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, ICollection collection, IEnumerable series, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Series, series, cancellationToken); #endregion diff --git a/MetaBrainz.MusicBrainz/Query.Collections.Works.cs b/MetaBrainz.MusicBrainz/Query.Collections.Works.cs index 2ab29b1..c8fe82a 100644 --- a/MetaBrainz.MusicBrainz/Query.Collections.Works.cs +++ b/MetaBrainz.MusicBrainz/Query.Collections.Works.cs @@ -132,7 +132,8 @@ public Task AddToCollectionAsync(string client, Guid collection, Cancell /// When is blank. /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. - public Task AddToCollectionAsync(string client, Guid collection, IWork work, CancellationToken cancellationToken = new()) + public Task AddToCollectionAsync(string client, Guid collection, IWork work, + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Work, work, cancellationToken); /// Adds the specified works to the specified collection. @@ -164,7 +165,7 @@ public Task AddToCollectionAsync(string client, Guid collection, params /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, Guid collection, IEnumerable works, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Work, works, cancellationToken); /// Adds the specified works to the specified collection. @@ -198,7 +199,7 @@ public Task AddToCollectionAsync(string client, ICollection collection, /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, ICollection collection, IWork work, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Work, work, cancellationToken); /// Adds the specified works to the specified collection. @@ -230,7 +231,7 @@ public Task AddToCollectionAsync(string client, ICollection collection, /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, ICollection collection, IEnumerable works, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection, EntityType.Work, works, cancellationToken); #endregion @@ -358,7 +359,7 @@ public Task RemoveFromCollectionAsync(string client, Guid collection, Ca /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, Guid collection, IWork work, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Work, work, cancellationToken); /// Removes the specified works from the specified collection. @@ -390,7 +391,7 @@ public Task RemoveFromCollectionAsync(string client, Guid collection, pa /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, Guid collection, IEnumerable works, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Work, works, cancellationToken); /// Removes the specified works from the specified collection. @@ -424,7 +425,7 @@ public Task RemoveFromCollectionAsync(string client, ICollection collect /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, ICollection collection, IWork work, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Work, work, cancellationToken); /// Removes the specified works from the specified collection. @@ -456,7 +457,7 @@ public Task RemoveFromCollectionAsync(string client, ICollection collect /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, ICollection collection, IEnumerable works, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection, EntityType.Work, works, cancellationToken); #endregion diff --git a/MetaBrainz.MusicBrainz/Query.Collections.cs b/MetaBrainz.MusicBrainz/Query.Collections.cs index 8baf7e0..c978b22 100644 --- a/MetaBrainz.MusicBrainz/Query.Collections.cs +++ b/MetaBrainz.MusicBrainz/Query.Collections.cs @@ -140,7 +140,7 @@ public Task AddToCollectionAsync(string client, Guid collection, EntityT /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, Guid collection, EntityType entityType, Guid item, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var submission = new ModifyCollection(HttpMethod.Put, client, collection, entityType).Add(item); return this.PerformSubmissionAsync(submission, cancellationToken); } @@ -162,7 +162,7 @@ public Task AddToCollectionAsync(string client, Guid collection, EntityT => this.AddToCollectionAsync(client, collection, entityType, (IEnumerable) items); private Task AddToCollectionAsync(string client, Guid collection, EntityType entityType, IEntity item, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var submission = new ModifyCollection(HttpMethod.Put, client, collection, entityType).Add(item); return this.PerformSubmissionAsync(submission, cancellationToken); } @@ -182,13 +182,13 @@ private Task AddToCollectionAsync(string client, Guid collection, Entity /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, Guid collection, EntityType entityType, IEnumerable items, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var submission = new ModifyCollection(HttpMethod.Put, client, collection, entityType).Add(items); return this.PerformSubmissionAsync(submission, cancellationToken); } private Task AddToCollectionAsync(string client, Guid collection, EntityType entityType, IEnumerable items, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var submission = new ModifyCollection(HttpMethod.Put, client, collection, entityType).Add(items); return this.PerformSubmissionAsync(submission, cancellationToken); } @@ -211,7 +211,7 @@ public Task AddToCollectionAsync(string client, ICollection collection, => this.AddToCollectionAsync(client, collection.Id, collection.ContentType, items, cancellationToken); private Task AddToCollectionAsync(string client, ICollection collection, EntityType entityType, IEntity item, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var id = collection.Id; var type = collection.ContentType; if (type != entityType) { @@ -221,7 +221,7 @@ private Task AddToCollectionAsync(string client, ICollection collection, } private Task AddToCollectionAsync(string client, ICollection collection, EntityType entityType, - IEnumerable items, CancellationToken cancellationToken = new()) { + IEnumerable items, CancellationToken cancellationToken = default) { var id = collection.Id; var type = collection.ContentType; if (type != entityType) { @@ -244,7 +244,7 @@ private Task AddToCollectionAsync(string client, ICollection collection, /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, ICollection collection, Guid item, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection.Id, collection.ContentType, item, cancellationToken); /// Adds the specified items to the specified collection. @@ -276,7 +276,7 @@ public Task AddToCollectionAsync(string client, ICollection collection, /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task AddToCollectionAsync(string client, ICollection collection, IEnumerable items, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.AddToCollectionAsync(client, collection.Id, collection.ContentType, items, cancellationToken); #endregion @@ -409,7 +409,7 @@ public Task RemoveFromCollectionAsync(string client, Guid collection, En /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, Guid collection, EntityType entityType, Guid item, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var submission = new ModifyCollection(HttpMethod.Delete, client, collection, entityType).Add(item); return this.PerformSubmissionAsync(submission, cancellationToken); } @@ -431,7 +431,7 @@ public Task RemoveFromCollectionAsync(string client, Guid collection, En => this.RemoveFromCollectionAsync(client, collection, entityType, (IEnumerable) items); private Task RemoveFromCollectionAsync(string client, Guid collection, EntityType entityType, IEntity item, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var submission = new ModifyCollection(HttpMethod.Delete, client, collection, entityType).Add(item); return this.PerformSubmissionAsync(submission, cancellationToken); } @@ -451,13 +451,13 @@ private Task RemoveFromCollectionAsync(string client, Guid collection, E /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, Guid collection, EntityType entityType, IEnumerable items, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var submission = new ModifyCollection(HttpMethod.Delete, client, collection, entityType).Add(items); return this.PerformSubmissionAsync(submission, cancellationToken); } private Task RemoveFromCollectionAsync(string client, Guid collection, EntityType entityType, IEnumerable items, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var submission = new ModifyCollection(HttpMethod.Delete, client, collection, entityType).Add(items); return this.PerformSubmissionAsync(submission, cancellationToken); } @@ -480,7 +480,7 @@ public Task RemoveFromCollectionAsync(string client, ICollection collect => this.RemoveFromCollectionAsync(client, collection.Id, collection.ContentType, items, cancellationToken); private Task RemoveFromCollectionAsync(string client, ICollection collection, EntityType entityType, IEntity item, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var id = collection.Id; var type = collection.ContentType; if (type != entityType) { @@ -490,7 +490,7 @@ private Task RemoveFromCollectionAsync(string client, ICollection collec } private Task RemoveFromCollectionAsync(string client, ICollection collection, EntityType entityType, - IEnumerable items, CancellationToken cancellationToken = new()) { + IEnumerable items, CancellationToken cancellationToken = default) { var id = collection.Id; var type = collection.ContentType; if (type != entityType) { @@ -513,7 +513,7 @@ private Task RemoveFromCollectionAsync(string client, ICollection collec /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, ICollection collection, Guid item, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection.Id, collection.ContentType, item, cancellationToken); /// Removes the specified items from the specified collection. @@ -545,7 +545,7 @@ public Task RemoveFromCollectionAsync(string client, ICollection collect /// When the MusicBrainz web service reports an error. /// When the MusicBrainz web service could not be contacted. public Task RemoveFromCollectionAsync(string client, ICollection collection, IEnumerable items, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => this.RemoveFromCollectionAsync(client, collection.Id, collection.ContentType, items, cancellationToken); #endregion diff --git a/MetaBrainz.MusicBrainz/Query.Lookup.cs b/MetaBrainz.MusicBrainz/Query.Lookup.cs index c97321e..8821a69 100644 --- a/MetaBrainz.MusicBrainz/Query.Lookup.cs +++ b/MetaBrainz.MusicBrainz/Query.Lookup.cs @@ -29,7 +29,7 @@ public sealed partial class Query { /// The requested area. /// When the web service reports an error. /// When something goes wrong with the web request. - public async Task LookupAreaAsync(Guid mbid, Include inc = Include.None, CancellationToken cancellationToken = new()) + public async Task LookupAreaAsync(Guid mbid, Include inc = Include.None, CancellationToken cancellationToken = default) => await this.PerformRequestAsync("area", mbid, Query.BuildExtraText(inc), cancellationToken).ConfigureAwait(false); /// Looks up the specified artist. @@ -63,7 +63,7 @@ public IArtist LookupArtist(Guid mbid, Include inc = Include.None, ReleaseType? /// When the web service reports an error. /// When something goes wrong with the web request. public async Task LookupArtistAsync(Guid mbid, Include inc = Include.None, ReleaseType? type = null, - ReleaseStatus? status = null, CancellationToken cancellationToken = new()) + ReleaseStatus? status = null, CancellationToken cancellationToken = default) => await this.PerformRequestAsync("artist", mbid, Query.BuildExtraText(inc, status, type), cancellationToken) .ConfigureAwait(false); @@ -84,7 +84,7 @@ public ICollection LookupCollection(Guid mbid, Include inc = Include.None) /// When the web service reports an error. /// When something goes wrong with the web request. public async Task LookupCollectionAsync(Guid mbid, Include inc = Include.None, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => await this.PerformRequestAsync("collection", mbid, Query.BuildExtraText(inc), cancellationToken) .ConfigureAwait(false); @@ -133,7 +133,7 @@ public IDiscIdLookupResult LookupDiscId(string discid, int[]? toc = null, Includ /// When something goes wrong with the web request. public async Task LookupDiscIdAsync(string discid, int[]? toc = null, Include inc = Include.None, bool allMediaFormats = false, bool noStubs = false, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { var extra = Query.BuildExtraText(inc, toc, allMediaFormats, noStubs); return await this.PerformRequestAsync("discid", discid, extra, cancellationToken).ConfigureAwait(false); } @@ -153,7 +153,7 @@ public async Task LookupDiscIdAsync(string discid, int[]? t /// The requested event. /// When the web service reports an error. /// When something goes wrong with the web request. - public async Task LookupEventAsync(Guid mbid, Include inc = Include.None, CancellationToken cancellationToken = new()) + public async Task LookupEventAsync(Guid mbid, Include inc = Include.None, CancellationToken cancellationToken = default) => await this.PerformRequestAsync("event", mbid, Query.BuildExtraText(inc), cancellationToken).ConfigureAwait(false); /// Looks up the specified genre. @@ -169,7 +169,7 @@ public async Task LookupDiscIdAsync(string discid, int[]? t /// The requested genre. /// When the web service reports an error. /// When something goes wrong with the web request. - public async Task LookupGenreAsync(Guid mbid, CancellationToken cancellationToken = new()) + public async Task LookupGenreAsync(Guid mbid, CancellationToken cancellationToken = default) => await this.PerformRequestAsync("genre", mbid, string.Empty, cancellationToken).ConfigureAwait(false); /// Looks up the specified instrument. @@ -189,7 +189,7 @@ public IInstrument LookupInstrument(Guid mbid, Include inc = Include.None) /// When the web service reports an error. /// When something goes wrong with the web request. public async Task LookupInstrumentAsync(Guid mbid, Include inc = Include.None, - CancellationToken cancellationToken = new()) + CancellationToken cancellationToken = default) => await this.PerformRequestAsync("instrument", mbid, Query.BuildExtraText(inc), cancellationToken) .ConfigureAwait(false); @@ -208,7 +208,7 @@ public async Task LookupInstrumentAsync(Guid mbid, Include inc = In /// The recordings associated with the requested ISRC. /// When the web service reports an error. /// When something goes wrong with the web request. - public async Task LookupIsrcAsync(string isrc, Include inc = Include.None, CancellationToken cancellationToken = new()) + public async Task LookupIsrcAsync(string isrc, Include inc = Include.None, CancellationToken cancellationToken = default) => await this.PerformRequestAsync("isrc", isrc, Query.BuildExtraText(inc), cancellationToken).ConfigureAwait(false); /// Looks up the works associated with the specified ISWC. @@ -228,7 +228,7 @@ public IReadOnlyList LookupIswc(string iswc, Include inc = Include.None) /// When the web service reports an error. /// When something goes wrong with the web request. public async Task> LookupIswcAsync(string iswc, Include inc = Include.None, - CancellationToken cancellationToken = new()) { + CancellationToken cancellationToken = default) { // This "lookup" behaves like a browse, except that it does not support offset/limit. var lookup = new IswcLookup(this, iswc, Query.BuildExtraText(inc)); var results = await lookup.NextAsync(cancellationToken).ConfigureAwait(false); @@ -264,7 +264,7 @@ public ILabel LookupLabel(Guid mbid, Include inc = Include.None, ReleaseType? ty /// When the web service reports an error. /// When something goes wrong with the web request. public async Task LookupLabelAsync(Guid mbid, Include inc = Include.None, ReleaseType? type = null, - ReleaseStatus? status = null, CancellationToken cancellationToken = new()) + ReleaseStatus? status = null, CancellationToken cancellationToken = default) => await this.PerformRequestAsync