-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Description
client: remove "convenience" methods
The client gained various methods that were created for convenience. Some
of those methods were created because the existing methods did not have
the right options, and adding more options would break the signature. As
we're not making a breaking change, and are adding option-structs (or
function options), we can remove such functions, and combine them.
Why it's important
We should reduce the number of methods to provide a shallower interface,
but also because more methods may result in more client option-structs,
and with functional options, may require us to (re)define functional options
for each method.
Reducing the number of methods and make them more useful will help with
this. Consumers of the client module can still define their own wrappers
or convenience functions for ergonomics.
Example: client.ContainerStatsOneShot
The client.ContainerStatsOneShot method is identical to client.ContainerStats.
It's using the same endpoint, the same return-type, but with some options
set by default. Having two separate methods for this is confusing, so we
should remove one.
Checklist of client methods to update
- TODO
- remove
client.ExecAttach; see this comment - remove
Client.HTTPClient()client: remove unused Client.HTTPClient() method #51011 - remove
Client.ContainerStatsOneShotclient: ContainerStats: add option, output-structs, remove ContainerStatsOneShot #51293 - remove
Client. NegotiateAPIVersion()client: remove NegotiateAPIVersion, NegotiateAPIVersionPing #51307 - remove
Client. NegotiateAPIVersionPing()client: remove NegotiateAPIVersion, NegotiateAPIVersionPing #51307 - remove / un-export
Client.NewVersionError()client: un-export NewVersionError, rename to requiresVersion #51327