Skip to content

feat(entries)!: use options structs for GetEntries and GetByName#34

Merged
Raphaël Larivière (Sylfwood) merged 1 commit intomasterfrom
devops/3818
Feb 25, 2026
Merged

feat(entries)!: use options structs for GetEntries and GetByName#34
Raphaël Larivière (Sylfwood) merged 1 commit intomasterfrom
devops/3818

Conversation

@Sylfwood
Copy link
Contributor

  • 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
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) and GetByNameOptions (Path) and update the Credential/Folder service method signatures to use them.
  • Update the internal getEntriesOptions to 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.
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
// 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.

Copilot uses AI. Check for mistakes.
Comment on lines +455 to 459
// 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)
}
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
@Sylfwood Raphaël Larivière (Sylfwood) merged commit 837568c into master Feb 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants