feat(pinning): expose name-partial helper and match strategies - #104
Merged
Conversation
ListPins gained WithFilterMatch (shipped in v0.1.80), but the TextMatchingStrategy type stays internal to ippinning, so a caller cannot express match=partial substring search through the public SDK surface without naming an internal type. Re-export the strategy type and its four spec values (exact/iexact/partial/ ipartial), and add WithFilterNamePartial(name) which composes a name filter with match=partial in a single ListOption - the IPFS Pinning Services API's contains-style substring match. Tests guard both the helper and the re-exported consts.
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
Code Coverage ReportTotal Coverage: 11.3% Generated from commit: a770bc0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Follow-up to #102 (WithFilterMatch, shipped in v0.1.80). The TextMatchingStrategy type lives in the internal ippinning package, so a consumer cannot send a server-side substring name search (match=partial) through the public SDK surface without naming an internal type.
Adds:
Tests guard the helper and the re-exported consts. This unblocks pinner-cli's pins_list server-side substring search.
Summary
This pull request enhances the pinning API by exposing the name-match strategies from the underlying IPFS Pinning Services API and adds a convenient helper for performing substring (partial) name searches.
Key Changes
1. Re-exported Text Matching Strategies (
pinning.go)The
TextMatchingStrategytype is now publicly re-exported, along with four named constants that mirror the IPFS Pinning Services API:MatchExact(exact match)MatchIExact(case-insensitive exact match)MatchPartial(substring/contains match)MatchIPartial(case-insensitive substring match)This removes the need for callers to reference the underlying package directly when specifying name-match strategies.
2. New
WithFilterNamePartialHelper (pinning.go)Added a convenience function that combines
WithFilterName()andWithFilterMatch(partial)into a singleListOption. This simplifies the API for callers who want to perform a server-side substring (contains-style) name search, as they no longer need to specify the match strategy type separately.3. Test Coverage (
pinning_test.go)Added two new tests:
TestWithFilterNamePartial: Verifies that the new helper correctly sets both the name and thepartialmatch strategy.TestReExportedMatchStrategies: Confirms that the re-exported strategy constants correctly map to the underlying IPFS Pinning Services API values.Impact
These changes provide a more ergonomic and intuitive API surface for developers performing pin list filtering by name, especially for partial/substring matching scenarios, while maintaining full compatibility with the underlying IPFS Pinning Services API specification.