feat(entries)!: use options structs for GetEntries and GetByName#34
feat(entries)!: use options structs for GetEntries and GetByName#34Raphaël Larivière (Sylfwood) merged 1 commit intomasterfrom
Conversation
Raphaël Larivière (Sylfwood)
commented
Feb 25, 2026
- add GetEntriesOptions with optional Name and Path (*string) fields
- add GetByNameOptions with optional Path (*string) field
- update GetEntries and GetEntriesWithContext on credential and folder services
- update GetByName and GetByNameWithContext to accept GetByNameOptions
- nil option fields mean the filter is not applied
- update tests accordingly
- add GetEntriesOptions with optional Name and Path (*string) fields - add GetByNameOptions with optional Path (*string) field - update GetEntries and GetEntriesWithContext on credential and folder services - update GetByName and GetByNameWithContext to accept GetByNameOptions - nil option fields mean the filter is not applied - update tests accordingly
b6d27a8 to
0906b0f
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the entries APIs to use option structs for filtering, enabling optional Name/Path filters via *string fields (nil meaning “no filter”), and adjusts internal query construction accordingly. It also updates affected tests and bumps the library version.
Changes:
- Introduce
GetEntriesOptions(Name/Path) andGetByNameOptions(Path) and update the Credential/Folder service method signatures to use them. - Update the internal
getEntriesOptionsto use pointer fields and only add query params when non-nil. - Update credential/folder entry tests to pass the new option structs; bump VERSION to
0.18.0.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| entry_credential.go | Adds options structs and updates Credential GetEntries* / GetByName* signatures and plumbing. |
| entry_folder.go | Updates Folder GetEntries* signatures to use GetEntriesOptions. |
| entries.go | Changes internal listing options to pointer fields and conditionally sets query params. |
| entry_credential_test.go | Updates credential entry filtering and GetByName tests to use options structs. |
| entry_folder_test.go | Updates folder entry filtering tests to use options structs. |
| VERSION | Bumps version from 0.17.0 to 0.18.0. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| // GetEntries returns a list of folder entries from a vault with optional name and path filters. | ||
| // GetEntries returns a list of folder entries from a vault with optional filters. |
There was a problem hiding this comment.
GetEntriesOptions is used by both EntryCredentialService and EntryFolderService, but the type is declared in entry_credential.go. That makes the Folder API harder to discover in GoDoc and can confuse readers who only look at entry_folder.go. Consider moving GetEntriesOptions to a more neutral/shared location (e.g., entries.go or a new entries_options.go) and/or referencing it explicitly in the Folder GetEntries doc comment so the public API is self-describing.
| // GetEntries returns a list of folder entries from a vault with optional filters. | |
| // GetEntries returns a list of folder entries from a vault with optional filters. | |
| // See GetEntriesOptions for the available filter fields. |
| // GetEntries returns a list of credential entries from a vault with optional filters. | ||
| // Note: The API does not support filtering by entry type, so all entries are fetched and filtered client-side. | ||
| func (c *EntryCredentialService) GetEntries(vaultId, name, path string) ([]Entry, error) { | ||
| return c.GetEntriesWithContext(context.Background(), vaultId, name, path) | ||
| func (c *EntryCredentialService) GetEntries(vaultId string, opts GetEntriesOptions) ([]Entry, error) { | ||
| return c.GetEntriesWithContext(context.Background(), vaultId, opts) | ||
| } |
There was a problem hiding this comment.
GetEntriesOptions is a package-level exported type and is also consumed by EntryFolderService, but it’s declared in entry_credential.go. To improve API discoverability (GoDoc) and keep shared types in a neutral place, consider moving it to entries.go or a dedicated shared options file (e.g., entries_options.go).