This repository has been archived by the owner on Aug 23, 2023. It is now read-only.
refactor!: reorganize repo towards more ergonomic API #41
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #40 WIP
Motivation
Pursuant to #40, this is my idea of reorganizing the repo to make it more ergonomic. Marking this as a draft since it is an unsolicited major, breaking change. Hopefully this can serve as a source of discussion.
Features:
*http.Transport
for a configurable base and only usinghttp.Roundtripper
internally.errors.As
using theAPIErr
andServerErr
interface types.IsNotFound(error)
function can identify errors that are simply the result of something not existingapi_
andclient_
prefixes help navigation, and the types can be grouped under endpoint if less files are desired.What's next?
Since I really needed this for work, I will probably continue to work on it in the coming weeks by adding integration testing using the a current Pulsar Image and testcontainers-go The first priority is making sure all of the auth methods work correctly so a mock server like mock-oauth2-server with testcontainers will probably also play a role. Then I would probably start to exercise the various APIs using various authentication methods for better coverage. At some point, I'd also like to experiment with unifying the various function signatures, such as the way topics/list requires the special
NamespaceName
type, but many other methods take(tenant, namespace)
. Would love to discuss those things. Also keen to make a special type for topic lists that will present as a unified list, but allow you to break it into partitioned/non-partitioned, etc...Modifications
See above
Verification
All current tests have been updated.