Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow HTTP client specification for ListenBrainz #51

Merged
merged 2 commits into from
Jan 1, 2024

Conversation

Zastai
Copy link
Owner

@Zastai Zastai commented Jan 1, 2024

This aligns the constructors to match the approach taken by the Query class of the MusicBrainz library. Either you use the constructor where you pass a client (in which case you are responsible for setting whatever default user agent you want), or you use one of the other a constructors to set up the user agent values to use with the internally-created client(s).

The [Default]ContactInfo and [Default]ProductInfo properties have been dropped in favour of a [Default]UserAgent property (a list of product info header values).

There are also two additional methods, ConfigureClient and ConfigureClientCreation, which allow exercising some control over clients created on-demand by the class.

In addition, ListenBrainz.cs has been split into multiple parts: ListenBrainz.Internals.cs contains all the internals, ListenBrainz.EndPoints.cs contains the public API for the various API endpoints, and ListenBrainz.cs contains the constructors, properties and HttpClient/IDispose handling.

Zastai added 2 commits January 1, 2024 14:55
This aligns the constructors to match the approach taken by the `Query`
class of the MusicBrainz library. Either you use the constructor where
you pass a client (in which case you are responsible for setting
whatever default user agent you want), or you use one of the other a
constructors to set up the user agent values to use with the
internally-created client(s).

The `[Default]ContactInfo` and `[Default]ProductInfo` properties have
been dropped in favour of a `[Default]UserAgent` property (a list of
product info header values).

There are also two additional methods, `ConfigureClient` and
`ConfigureClientCreation`, which allow exercising some control over
clients created on-demand by the class.
`ListenBrainz.Internals.cs` contains all the internals,
`ListenBrainz.EndPoints.cs` contains the public API for the various API
endpoints, and `ListenBrainz.cs` contains the constructors, properties
and `HttpClient`/`IDispose` handling.
@Zastai Zastai added breaking An incompatible change to a feature or API (requires a bump of the major version) feature A new feature or API was added (requires a bump of the minor version) labels Jan 1, 2024
@Zastai Zastai self-assigned this Jan 1, 2024
@Zastai Zastai merged commit 38f30fa into main Jan 1, 2024
2 checks passed
@Zastai Zastai deleted the enable-client-specification branch January 1, 2024 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking An incompatible change to a feature or API (requires a bump of the major version) feature A new feature or API was added (requires a bump of the minor version)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant