Replace OctopusRepositoryExtensions with methods that reuse RootResource #869
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.
IOctopusAsyncRepository
andIOctopusRepository
have extension methodsForSpace
andForSystem
which return a new repository with a different scope. This had the unintended consequence of discarding a cachedRootResource
if the repository had one, meaning the repository with the changed scope will have to do a fresh HTTP request to/api
to get the root resource that could potentially have been avoided.This PR replaces these extension methods with methods on the repository themselves, which call a new constructor that is able to keep track of the cached
RootResource
if there was one, solving this problem.While I would expect most consumers to be unaffected by this change, it is technically a breaking change for certain niche scenarios. A few examples:
ForSpace
/ForSystem
extension methods, but now method resolution prefers the actual instance methods over those extension methods; solvable via renaming the extension method(s) to avoid the conflictForSpace
/ForSystem
method(s); these now must specify theoverride
keywordIOctopus(Async)Repository
; now they have two new methods to implement themselvesAs such, I will bump the major version here with
+semver: breaking
.