searchep

package
v1.4.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SearchEndpoint

type SearchEndpoint struct{}

Searches across multiple resource types at once and returns lightweight `entity` references to the matches.

Each result carries the matched record's ID, its resource type, and a display name and secondary handle, so it can be shown in a picker or turned into a link; fetch the record itself through its own endpoint for full detail.

`q` is required unless the search is narrowed with `types`; scoping to one or more types lets you omit `q` to browse that type's most recent records. Matches are drawn from every searchable type you can read, then interleaved so no single type crowds out the others, and the combined result set is capped at `limit`. Results are not paginated — `limit` is the total you get. If one resource type fails to respond, it contributes no results instead of failing the whole search.

func (*SearchEndpoint) Materialize

type SearchRequest

type SearchRequest struct {
	apiresource.PaginationRequest
	// Filter the search to specific resource types.
	//
	// Only a subset of resource types is searchable: `sales_order`, `purchase_order`, `invoice`, `customer`, `item`, `product`, `shipment`, `messaging_contact`, and `agent_definition`. Any other value is rejected. Types you lack read permission for are silently dropped rather than rejected, so narrowing to a type you cannot read simply returns no results. Omit to search every searchable type you can read.
	Types []constants.ObjectType `query:"types"`
	// Restrict the search to a single customer by their account ID.
	//
	// When set, only resource types that are safe to expose to a customer are searched (their sales orders, invoices, and shipments), and results are limited to records belonging to that customer. This is intended for composing customer-facing replies, so a reference can never point at a record the customer is not entitled to see.
	Customer *string `query:"customer"`
}

Request to search across resource types for a free-text term.

type SearchSvc

type SearchSvc interface {
	Search(ctx context.Context, req *SearchRequest) (*apiresource.List[apiresource.Entity], *apierror.APIError)
}

SearchSvc backs the unified search endpoint by fanning out to the per-type list RPCs and projecting their results into lightweight Entity references.

func NewSearchSvc

func NewSearchSvc(config *SearchSvcConfig) SearchSvc

type SearchSvcConfig

type SearchSvcConfig struct {
	// CoreClient (required) backs the invoice, customer, item, and product searches.
	CoreClient corepb.CoreServiceClient
	// SalesClient (required) backs the sales-order search.
	SalesClient corepb.CoreSalesServiceClient
	// PurchaseClient (required) backs the purchase-order search.
	PurchaseClient corepb.CorePurchaseServiceClient
	// ShippingClient (required) backs the shipment search.
	ShippingClient corepb.CoreShippingServiceClient
	// ChatClient (required) backs the messaging-contact search.
	ChatClient notifpb.ChatServiceClient
	// AgentClient (required) backs the agent search.
	AgentClient agentpb.AgentServiceClient
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL