redpine

package module
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 14 Imported by: 0

README

redpine (Go)

Go client for the Redpine search API. Go 1.24+.

go get github.com/redpine-ai/redpine-sdk-go@latest
import redpine "github.com/redpine-ai/redpine-sdk-go"

client, err := redpine.New() // reads REDPINE_API_KEY
r, err := client.Search(ctx, "crispr delivery", redpine.SearchOptions{Collections: []string{"corpus"}})

Docs: https://docs.redpine.ai/docs/sdks

Documentation

Overview

Package redpine is the Go client for the Redpine search API.

client, err := redpine.New()            // reads REDPINE_API_KEY
r, err := client.Search(ctx, "crispr", redpine.SearchOptions{
    Collections: []string{"corpus"},
    Filters:     redpine.F("issn").Eq("1664-302X").Or(redpine.F("issn").Eq("1932-6203")),
})

Package redpine provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT.

Index

Constants

View Source
const DefaultBaseURL = "https://api.redpine.ai"

DefaultBaseURL is the production API. Override only via env REDPINE_BASE_URL.

Variables

This section is empty.

Functions

func NewGetCachedResultRequest

func NewGetCachedResultRequest(server string, queryId string, params *GetCachedResultParams) (*http.Request, error)

NewGetCachedResultRequest constructs an http.Request for the GetCachedResult method

func NewGetQuotaRequest

func NewGetQuotaRequest(server string) (*http.Request, error)

NewGetQuotaRequest constructs an http.Request for the GetQuota method

func NewListCollectionsRequest

func NewListCollectionsRequest(server string) (*http.Request, error)

NewListCollectionsRequest constructs an http.Request for the ListCollections method

func NewSearchAssistedRequest

func NewSearchAssistedRequest(server string, body SearchAssistedJSONRequestBody) (*http.Request, error)

NewSearchAssistedRequest calls the generic SearchAssisted builder with application/json body

func NewSearchAssistedRequestWithBody

func NewSearchAssistedRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewSearchAssistedRequestWithBody constructs an http.Request for the SearchAssisted method, with any body, and a specified content type

func NewSearchCollectionRequest

func NewSearchCollectionRequest(server string, collection string, body SearchCollectionJSONRequestBody) (*http.Request, error)

NewSearchCollectionRequest calls the generic SearchCollection builder with application/json body

func NewSearchCollectionRequestWithBody

func NewSearchCollectionRequestWithBody(server string, collection string, contentType string, body io.Reader) (*http.Request, error)

NewSearchCollectionRequestWithBody constructs an http.Request for the SearchCollection method, with any body, and a specified content type

func NewSearchPreviewRequest added in v0.1.4

func NewSearchPreviewRequest(server string, params *SearchPreviewParams, body SearchPreviewJSONRequestBody) (*http.Request, error)

NewSearchPreviewRequest calls the generic SearchPreview builder with application/json body

func NewSearchPreviewRequestWithBody added in v0.1.4

func NewSearchPreviewRequestWithBody(server string, params *SearchPreviewParams, contentType string, body io.Reader) (*http.Request, error)

NewSearchPreviewRequestWithBody constructs an http.Request for the SearchPreview method, with any body, and a specified content type

func NewSearchQueryRequest

func NewSearchQueryRequest(server string, body SearchQueryJSONRequestBody) (*http.Request, error)

NewSearchQueryRequest calls the generic SearchQuery builder with application/json body

func NewSearchQueryRequestWithBody

func NewSearchQueryRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewSearchQueryRequestWithBody constructs an http.Request for the SearchQuery method, with any body, and a specified content type

func NewSearchUnlockRequest added in v0.1.4

func NewSearchUnlockRequest(server string, body SearchUnlockJSONRequestBody) (*http.Request, error)

NewSearchUnlockRequest calls the generic SearchUnlock builder with application/json body

func NewSearchUnlockRequestWithBody added in v0.1.4

func NewSearchUnlockRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewSearchUnlockRequestWithBody constructs an http.Request for the SearchUnlock method, with any body, and a specified content type

Types

type APIError

type APIError struct {
	Status    int
	Code      string
	Message   string
	RequestID string
	Body      map[string]any
}

APIError is the base for every error the SDK returns on a non-2xx response. (Named APIError because the generated code already declares the model type Error.)

func (*APIError) Error

func (e *APIError) Error() string

type AccessDeniedError

type AccessDeniedError struct{ APIError }

AccessDeniedError is 403: key has no access to the requested collection.

func (*AccessDeniedError) Unwrap

func (e *AccessDeniedError) Unwrap() error

type AssistedBillingInfo

type AssistedBillingInfo struct {
	// ChargedResults Number of results billed
	ChargedResults int `json:"chargedResults"`

	// TokensCharged Tokens billed (0 for clarification/no-result)
	TokensCharged int `json:"tokensCharged"`
}

AssistedBillingInfo What was actually charged — only delivered, verified results are billed.

type AssistedSearchOptions

type AssistedSearchOptions struct {
	Collection         string
	Collections        []string
	Limit              int
	Filters            any
	AllowClarification *bool
	IncludeMetadata    *bool
}

AssistedSearchOptions for AssistedSearch. Exactly one of Collection / Collections is required. IncludeFigures is not offered here: the API always forces it false for assisted search (matches the TS client), so there is no user-facing knob for it.

type AssistedSearchRequest

type AssistedSearchRequest struct {
	// AllowClarification If true, the endpoint may return a clarifying question instead of results when the query is too underspecified. Set false if your client cannot do a follow-up turn.
	AllowClarification *bool `json:"allowClarification,omitempty"`

	// Collection Collection to search. Provide either this or `collections`, not both.
	Collection *string `json:"collection,omitempty"`

	// Collections Collections to search together (max 5). Results are merged into one relevance-ranked list and each result is labeled with its origin collection. Provide either this or 'collection', not both.
	Collections *[]string `json:"collections,omitempty"`

	// Filters Same filter forms as `/api/v1/search/query`; applied to every internal search.
	Filters *map[string]interface{} `json:"filters,omitempty"`

	// ImageMaxHeight Maximum image height in pixels
	ImageMaxHeight *int `json:"imageMaxHeight,omitempty"`

	// ImageMaxWidth Maximum image width in pixels
	ImageMaxWidth *int `json:"imageMaxWidth,omitempty"`

	// ImageQuality JPEG quality for fetched images
	ImageQuality *int `json:"imageQuality,omitempty"`

	// IncludeFigures Fetch and attach figure images (base64, in metadata.figures[].image_data) for the delivered results only. Adds latency; requires `includeMetadata`. `includeImages` is accepted as a deprecated alias.
	IncludeFigures *bool `json:"includeFigures,omitempty"`

	// IncludeMetadata Whether to include metadata in results
	IncludeMetadata *bool `json:"includeMetadata,omitempty"`

	// Limit Maximum verified results to return.
	Limit *int `json:"limit,omitempty"`

	// Query Search query text
	Query string `json:"query"`
}

AssistedSearchRequest defines model for AssistedSearchRequest.

type AssistedSearchResponse

type AssistedSearchResponse struct {
	// Billing What was billed
	Billing AssistedBillingInfo `json:"billing"`

	// Clarification Set only when status is `clarification_needed`.
	Clarification *ClarificationInfo `json:"clarification,omitempty"`

	// FilterWarnings Advisory warnings about the supplied filter — for example filtering on a known field with no payload index, which is matched by scanning, or a collection excluded because it holds only open-access content and the filter asked for open_access=false. The search still runs. Omitted when there are none.
	FilterWarnings *[]FilterWarning `json:"filterWarnings,omitempty"`

	// IterationsRun Number of search+replan rounds executed
	IterationsRun int `json:"iterationsRun"`

	// JournalMetricExpansions How each journal-metric condition resolved to ISSNs; omitted when no metric filter was used
	JournalMetricExpansions *[]JournalMetricExpansion `json:"journalMetricExpansions,omitempty"`

	// LatencyMs End-to-end latency in milliseconds
	LatencyMs int `json:"latencyMs"`

	// QueryId Query ID for audit reference
	QueryId string `json:"queryId"`

	// QueryUnderstanding How the query was interpreted
	QueryUnderstanding QueryUnderstanding `json:"queryUnderstanding"`

	// Results Verified results (empty unless status='results')
	Results *[]AssistedSearchResult `json:"results,omitempty"`

	// Status Outcome of the assisted search
	Status AssistedSearchResponseStatus `json:"status"`
}

AssistedSearchResponse defines model for AssistedSearchResponse.

type AssistedSearchResponseStatus

type AssistedSearchResponseStatus string

AssistedSearchResponseStatus Outcome of the assisted search

const (
	ClarificationNeeded AssistedSearchResponseStatus = "clarification_needed"
	NoRelevantResults   AssistedSearchResponseStatus = "no_relevant_results"
	Results             AssistedSearchResponseStatus = "results"
)

Defines values for AssistedSearchResponseStatus.

func (AssistedSearchResponseStatus) Valid

Valid indicates whether the value is a known member of the AssistedSearchResponseStatus enum.

type AssistedSearchResult

type AssistedSearchResult struct {
	// Collection Origin collection of this result. Populated only for requests made with the 'collections' (multi-collection) form.
	Collection *string `json:"collection,omitempty"`

	// DoiUrl Resolvable DOI link (https://doi.org/{doi})
	DoiUrl *string `json:"doiUrl,omitempty"`

	// Id Chunk/point ID
	Id string `json:"id"`

	// Metadata Document metadata (title, authors, journal, etc.). Null when includeMetadata is false.
	Metadata *map[string]interface{} `json:"metadata,omitempty"`

	// Relevance Relevance verdict for this result
	Relevance RelevanceInfo `json:"relevance"`

	// Section Comma-joined source section(s) of the article, from the normalized vocabulary (abstract, introduction, background, methods, results, discussion, conclusion, case, supplementary, other)
	Section *string `json:"section,omitempty"`

	// Text Chunk text content
	Text string `json:"text"`
}

AssistedSearchResult defines model for AssistedSearchResult.

type AssistedUnavailableError

type AssistedUnavailableError struct{ APIError }

AssistedUnavailableError is 503: assisted search temporarily unavailable.

func (*AssistedUnavailableError) Unwrap

func (e *AssistedUnavailableError) Unwrap() error

type AuthError

type AuthError struct{ APIError }

AuthError is 401: missing or invalid API key.

func (*AuthError) Unwrap

func (e *AuthError) Unwrap() error

type ClarificationInfo

type ClarificationInfo struct {
	// Question The clarifying question to ask the user
	Question string `json:"question"`

	// Reason Why clarification is needed
	Reason *string `json:"reason,omitempty"`
}

ClarificationInfo defines model for ClarificationInfo.

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) GetCachedResult

func (c *Client) GetCachedResult(ctx context.Context, queryId string, params *GetCachedResultParams, reqEditors ...RequestEditorFn) (*http.Response, error)

GetCachedResult Re-fetch cached results

Retrieve previously returned search results using the queryId from a prior search response. Returns the same results without billing. The request must use the same API key that performed the original search. Results are available for 7 days.

Each result carries `locked`/`tokens`/`cost`: a result not yet paid for through POST /api/v1/search/unlock comes back as a teaser (`locked: true`), never the full text.

Corresponds with GET /api/v1/search/results/{queryId} (the `GetCachedResult` operationId).

func (*Client) GetQuota

func (c *Client) GetQuota(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

GetQuota Current quota usage and limits

Daily and monthly query usage and limits for the authenticated organization.

Corresponds with GET /api/v1/search/quota (the `GetQuota` operationId).

func (*Client) ListCollections

func (c *Client) ListCollections(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

ListCollections List collections

List all document collections accessible to the authenticated API key.

Corresponds with GET /api/v1/search/collections (the `ListCollections` operationId).

func (*Client) SearchAssisted

func (c *Client) SearchAssisted(ctx context.Context, body SearchAssistedJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

SearchAssisted Assisted search (verified results only)

Agentic search: the query is interpreted, one or more internal searches are planned and run, every candidate is verified as actually addressing the query, and only verified results are returned.

**Billing differs from `/search/query`:** only delivered, verified results are charged. A clarification request or an honest no-results answer costs nothing. Internal search fan-out and LLM tokens are absorbed by Redpine.

Accepts the same `filters` as `/search/query`, applied to every internal search.

Takes a body of the `application/json` content type.

Corresponds with POST /api/v1/search/assisted (the `SearchAssisted` operationId).

func (*Client) SearchAssistedWithBody

func (c *Client) SearchAssistedWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

SearchAssistedWithBody Assisted search (verified results only)

Agentic search: the query is interpreted, one or more internal searches are planned and run, every candidate is verified as actually addressing the query, and only verified results are returned.

**Billing differs from `/search/query`:** only delivered, verified results are charged. A clarification request or an honest no-results answer costs nothing. Internal search fan-out and LLM tokens are absorbed by Redpine.

Accepts the same `filters` as `/search/query`, applied to every internal search.

Takes any type of body and a specified content type.

Corresponds with POST /api/v1/search/assisted (the `SearchAssisted` operationId).

func (*Client) SearchCollection

func (c *Client) SearchCollection(ctx context.Context, collection string, body SearchCollectionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

SearchCollection Search a single collection by name

Shorthand for POST /api/v1/search/query with the collection named in the path instead of the body. Same pipeline, same response shape, one collection per call — use /query's `collections` form to search several at once.

Takes a body of the `application/json` content type.

Corresponds with POST /api/v1/search/{collection} (the `SearchCollection` operationId).

func (*Client) SearchCollectionWithBody

func (c *Client) SearchCollectionWithBody(ctx context.Context, collection string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

SearchCollectionWithBody Search a single collection by name

Shorthand for POST /api/v1/search/query with the collection named in the path instead of the body. Same pipeline, same response shape, one collection per call — use /query's `collections` form to search several at once.

Takes any type of body and a specified content type.

Corresponds with POST /api/v1/search/{collection} (the `SearchCollection` operationId).

func (*Client) SearchPreview added in v0.1.4

func (c *Client) SearchPreview(ctx context.Context, params *SearchPreviewParams, body SearchPreviewJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

SearchPreview Preview search results without charging

Run the same pipeline as POST /api/v1/search/query -- same entitlement checks, same retraction filtering, same relevance ranking -- but never charge for it. Every result comes back locked, with a teaser snippet in `text` and the cost to unlock it. Works even at a zero balance. Consumes no credits, no trial query and no quota.

Call POST /api/v1/search/unlock with the returned `queryId` to pay for and receive some or all of the results in full.

Send an `Idempotency-Key` header to make retries safe: a repeat with the same key and body returns the original `queryId` instead of buying the same results again under a new one.

Takes a body of the `application/json` content type.

Corresponds with POST /api/v1/search/preview (the `SearchPreview` operationId).

func (*Client) SearchPreviewWithBody added in v0.1.4

func (c *Client) SearchPreviewWithBody(ctx context.Context, params *SearchPreviewParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

SearchPreviewWithBody Preview search results without charging

Run the same pipeline as POST /api/v1/search/query -- same entitlement checks, same retraction filtering, same relevance ranking -- but never charge for it. Every result comes back locked, with a teaser snippet in `text` and the cost to unlock it. Works even at a zero balance. Consumes no credits, no trial query and no quota.

Call POST /api/v1/search/unlock with the returned `queryId` to pay for and receive some or all of the results in full.

Send an `Idempotency-Key` header to make retries safe: a repeat with the same key and body returns the original `queryId` instead of buying the same results again under a new one.

Takes any type of body and a specified content type.

Corresponds with POST /api/v1/search/preview (the `SearchPreview` operationId).

func (*Client) SearchQuery

func (c *Client) SearchQuery(ctx context.Context, body SearchQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

SearchQuery Search documents

Search one or more collections using natural language or keyword queries. Results are ranked by relevance using hybrid retrieval (dense + sparse + reranking). Pass `collections` (up to 5) to search several collections in one call and receive a single merged, relevance-ranked list with per-result origin labels.

Takes a body of the `application/json` content type.

Corresponds with POST /api/v1/search/query (the `SearchQuery` operationId).

func (*Client) SearchQueryWithBody

func (c *Client) SearchQueryWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

SearchQueryWithBody Search documents

Search one or more collections using natural language or keyword queries. Results are ranked by relevance using hybrid retrieval (dense + sparse + reranking). Pass `collections` (up to 5) to search several collections in one call and receive a single merged, relevance-ranked list with per-result origin labels.

Takes any type of body and a specified content type.

Corresponds with POST /api/v1/search/query (the `SearchQuery` operationId).

func (*Client) SearchUnlock added in v0.1.4

func (c *Client) SearchUnlock(ctx context.Context, body SearchUnlockJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

SearchUnlock Pay for previewed results and receive them in full

Charges only for results not already unlocked by an earlier call against the same `queryId` -- re-sending the same ids costs nothing. Omit `resultIds` (or pass `null`) to unlock everything from the preview.

Set `includeFigures` to receive figure images as base64 in `metadata.figures[].image_data`. Images are returned for every result unlocked under this `queryId`, including ones unlocked by an earlier call -- so re-sending ids you have already paid for is how you fetch images you skipped the first time, and it charges nothing. At most 50 images are fetched per call; the ids in `resultIds` (or, when it is omitted, the results this call unlocked) get that budget first. Figures are free: they are not priced into the token cost, so the flag changes latency and response size and never the charge. Use the preview's `figureCount` to decide whether to ask.

Takes a body of the `application/json` content type.

Corresponds with POST /api/v1/search/unlock (the `SearchUnlock` operationId).

func (*Client) SearchUnlockWithBody added in v0.1.4

func (c *Client) SearchUnlockWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

SearchUnlockWithBody Pay for previewed results and receive them in full

Charges only for results not already unlocked by an earlier call against the same `queryId` -- re-sending the same ids costs nothing. Omit `resultIds` (or pass `null`) to unlock everything from the preview.

Set `includeFigures` to receive figure images as base64 in `metadata.figures[].image_data`. Images are returned for every result unlocked under this `queryId`, including ones unlocked by an earlier call -- so re-sending ids you have already paid for is how you fetch images you skipped the first time, and it charges nothing. At most 50 images are fetched per call; the ids in `resultIds` (or, when it is omitted, the results this call unlocked) get that budget first. Figures are free: they are not priced into the token cost, so the flag changes latency and response size and never the charge. Use the preview's `figureCount` to decide whether to ask.

Takes any type of body and a specified content type.

Corresponds with POST /api/v1/search/unlock (the `SearchUnlock` operationId).

type ClientInterface

type ClientInterface interface {

	// SearchAssistedWithBody Assisted search (verified results only)
	//
	// Agentic search: the query is interpreted, one or more internal searches are planned and run, every candidate is verified as actually addressing the query, and only verified results are returned.
	//
	// **Billing differs from `/search/query`:** only delivered, verified results are charged. A clarification request or an honest no-results answer costs nothing. Internal search fan-out and LLM tokens are absorbed by Redpine.
	//
	// Accepts the same `filters` as `/search/query`, applied to every internal search.
	//
	// Takes any type of body and a specified content type.
	//
	// Corresponds with POST /api/v1/search/assisted (the `SearchAssisted` operationId).
	SearchAssistedWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SearchAssisted Assisted search (verified results only)
	//
	// Agentic search: the query is interpreted, one or more internal searches are planned and run, every candidate is verified as actually addressing the query, and only verified results are returned.
	//
	// **Billing differs from `/search/query`:** only delivered, verified results are charged. A clarification request or an honest no-results answer costs nothing. Internal search fan-out and LLM tokens are absorbed by Redpine.
	//
	// Accepts the same `filters` as `/search/query`, applied to every internal search.
	//
	// Takes a body of the `application/json` content type.
	//
	// Corresponds with POST /api/v1/search/assisted (the `SearchAssisted` operationId).
	SearchAssisted(ctx context.Context, body SearchAssistedJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// ListCollections List collections
	//
	// List all document collections accessible to the authenticated API key.
	//
	// Corresponds with GET /api/v1/search/collections (the `ListCollections` operationId).
	ListCollections(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SearchPreviewWithBody Preview search results without charging
	//
	// Run the same pipeline as POST /api/v1/search/query -- same entitlement checks, same retraction filtering, same relevance ranking -- but never charge for it. Every result comes back locked, with a teaser snippet in `text` and the cost to unlock it. Works even at a zero balance. Consumes no credits, no trial query and no quota.
	//
	// Call POST /api/v1/search/unlock with the returned `queryId` to pay for and receive some or all of the results in full.
	//
	// Send an `Idempotency-Key` header to make retries safe: a repeat with the same key and body returns the original `queryId` instead of buying the same results again under a new one.
	//
	// Takes any type of body and a specified content type.
	//
	// Corresponds with POST /api/v1/search/preview (the `SearchPreview` operationId).
	SearchPreviewWithBody(ctx context.Context, params *SearchPreviewParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SearchPreview Preview search results without charging
	//
	// Run the same pipeline as POST /api/v1/search/query -- same entitlement checks, same retraction filtering, same relevance ranking -- but never charge for it. Every result comes back locked, with a teaser snippet in `text` and the cost to unlock it. Works even at a zero balance. Consumes no credits, no trial query and no quota.
	//
	// Call POST /api/v1/search/unlock with the returned `queryId` to pay for and receive some or all of the results in full.
	//
	// Send an `Idempotency-Key` header to make retries safe: a repeat with the same key and body returns the original `queryId` instead of buying the same results again under a new one.
	//
	// Takes a body of the `application/json` content type.
	//
	// Corresponds with POST /api/v1/search/preview (the `SearchPreview` operationId).
	SearchPreview(ctx context.Context, params *SearchPreviewParams, body SearchPreviewJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SearchQueryWithBody Search documents
	//
	// Search one or more collections using natural language or keyword queries. Results are ranked by relevance using hybrid retrieval (dense + sparse + reranking). Pass `collections` (up to 5) to search several collections in one call and receive a single merged, relevance-ranked list with per-result origin labels.
	//
	// Takes any type of body and a specified content type.
	//
	// Corresponds with POST /api/v1/search/query (the `SearchQuery` operationId).
	SearchQueryWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SearchQuery Search documents
	//
	// Search one or more collections using natural language or keyword queries. Results are ranked by relevance using hybrid retrieval (dense + sparse + reranking). Pass `collections` (up to 5) to search several collections in one call and receive a single merged, relevance-ranked list with per-result origin labels.
	//
	// Takes a body of the `application/json` content type.
	//
	// Corresponds with POST /api/v1/search/query (the `SearchQuery` operationId).
	SearchQuery(ctx context.Context, body SearchQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetQuota Current quota usage and limits
	//
	// Daily and monthly query usage and limits for the authenticated organization.
	//
	// Corresponds with GET /api/v1/search/quota (the `GetQuota` operationId).
	GetQuota(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetCachedResult Re-fetch cached results
	//
	// Retrieve previously returned search results using the queryId from a prior search response. Returns the same results without billing. The request must use the same API key that performed the original search. Results are available for 7 days.
	//
	// Each result carries `locked`/`tokens`/`cost`: a result not yet paid for through POST /api/v1/search/unlock comes back as a teaser (`locked: true`), never the full text.
	//
	// Corresponds with GET /api/v1/search/results/{queryId} (the `GetCachedResult` operationId).
	GetCachedResult(ctx context.Context, queryId string, params *GetCachedResultParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SearchUnlockWithBody Pay for previewed results and receive them in full
	//
	// Charges only for results not already unlocked by an earlier call against the same `queryId` -- re-sending the same ids costs nothing. Omit `resultIds` (or pass `null`) to unlock everything from the preview.
	//
	// Set `includeFigures` to receive figure images as base64 in `metadata.figures[].image_data`. Images are returned for every result unlocked under this `queryId`, including ones unlocked by an earlier call -- so re-sending ids you have already paid for is how you fetch images you skipped the first time, and it charges nothing. At most 50 images are fetched per call; the ids in `resultIds` (or, when it is omitted, the results this call unlocked) get that budget first. Figures are free: they are not priced into the token cost, so the flag changes latency and response size and never the charge. Use the preview's `figureCount` to decide whether to ask.
	//
	// Takes any type of body and a specified content type.
	//
	// Corresponds with POST /api/v1/search/unlock (the `SearchUnlock` operationId).
	SearchUnlockWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SearchUnlock Pay for previewed results and receive them in full
	//
	// Charges only for results not already unlocked by an earlier call against the same `queryId` -- re-sending the same ids costs nothing. Omit `resultIds` (or pass `null`) to unlock everything from the preview.
	//
	// Set `includeFigures` to receive figure images as base64 in `metadata.figures[].image_data`. Images are returned for every result unlocked under this `queryId`, including ones unlocked by an earlier call -- so re-sending ids you have already paid for is how you fetch images you skipped the first time, and it charges nothing. At most 50 images are fetched per call; the ids in `resultIds` (or, when it is omitted, the results this call unlocked) get that budget first. Figures are free: they are not priced into the token cost, so the flag changes latency and response size and never the charge. Use the preview's `figureCount` to decide whether to ask.
	//
	// Takes a body of the `application/json` content type.
	//
	// Corresponds with POST /api/v1/search/unlock (the `SearchUnlock` operationId).
	SearchUnlock(ctx context.Context, body SearchUnlockJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SearchCollectionWithBody Search a single collection by name
	//
	// Shorthand for POST /api/v1/search/query with the collection named in the path instead of the body. Same pipeline, same response shape, one collection per call — use /query's `collections` form to search several at once.
	//
	// Takes any type of body and a specified content type.
	//
	// Corresponds with POST /api/v1/search/{collection} (the `SearchCollection` operationId).
	SearchCollectionWithBody(ctx context.Context, collection string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SearchCollection Search a single collection by name
	//
	// Shorthand for POST /api/v1/search/query with the collection named in the path instead of the body. Same pipeline, same response shape, one collection per call — use /query's `collections` form to search several at once.
	//
	// Takes a body of the `application/json` content type.
	//
	// Corresponds with POST /api/v1/search/{collection} (the `SearchCollection` operationId).
	SearchCollection(ctx context.Context, collection string, body SearchCollectionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) GetCachedResultWithResponse

func (c *ClientWithResponses) GetCachedResultWithResponse(ctx context.Context, queryId string, params *GetCachedResultParams, reqEditors ...RequestEditorFn) (*GetCachedResultResponse, error)

GetCachedResultWithResponse Re-fetch cached results

Retrieve previously returned search results using the queryId from a prior search response. Returns the same results without billing. The request must use the same API key that performed the original search. Results are available for 7 days.

Each result carries `locked`/`tokens`/`cost`: a result not yet paid for through POST /api/v1/search/unlock comes back as a teaser (`locked: true`), never the full text.

Returns a wrapper object for the known response body format(s).

Corresponds with GET /api/v1/search/results/{queryId} (the `GetCachedResult` operationId).

func (*ClientWithResponses) GetQuotaWithResponse

func (c *ClientWithResponses) GetQuotaWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetQuotaResponse, error)

GetQuotaWithResponse Current quota usage and limits

Daily and monthly query usage and limits for the authenticated organization.

Returns a wrapper object for the known response body format(s).

Corresponds with GET /api/v1/search/quota (the `GetQuota` operationId).

func (*ClientWithResponses) ListCollectionsWithResponse

func (c *ClientWithResponses) ListCollectionsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListCollectionsResponse, error)

ListCollectionsWithResponse List collections

List all document collections accessible to the authenticated API key.

Returns a wrapper object for the known response body format(s).

Corresponds with GET /api/v1/search/collections (the `ListCollections` operationId).

func (*ClientWithResponses) SearchAssistedWithBodyWithResponse

func (c *ClientWithResponses) SearchAssistedWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SearchAssistedResponse, error)

SearchAssistedWithBodyWithResponse Assisted search (verified results only)

Agentic search: the query is interpreted, one or more internal searches are planned and run, every candidate is verified as actually addressing the query, and only verified results are returned.

**Billing differs from `/search/query`:** only delivered, verified results are charged. A clarification request or an honest no-results answer costs nothing. Internal search fan-out and LLM tokens are absorbed by Redpine.

Accepts the same `filters` as `/search/query`, applied to every internal search.

Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).

Corresponds with POST /api/v1/search/assisted (the `SearchAssisted` operationId).

func (*ClientWithResponses) SearchAssistedWithResponse

func (c *ClientWithResponses) SearchAssistedWithResponse(ctx context.Context, body SearchAssistedJSONRequestBody, reqEditors ...RequestEditorFn) (*SearchAssistedResponse, error)

SearchAssistedWithResponse Assisted search (verified results only)

Agentic search: the query is interpreted, one or more internal searches are planned and run, every candidate is verified as actually addressing the query, and only verified results are returned.

**Billing differs from `/search/query`:** only delivered, verified results are charged. A clarification request or an honest no-results answer costs nothing. Internal search fan-out and LLM tokens are absorbed by Redpine.

Accepts the same `filters` as `/search/query`, applied to every internal search.

Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).

Corresponds with POST /api/v1/search/assisted (the `SearchAssisted` operationId).

func (*ClientWithResponses) SearchCollectionWithBodyWithResponse

func (c *ClientWithResponses) SearchCollectionWithBodyWithResponse(ctx context.Context, collection string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SearchCollectionResponse, error)

SearchCollectionWithBodyWithResponse Search a single collection by name

Shorthand for POST /api/v1/search/query with the collection named in the path instead of the body. Same pipeline, same response shape, one collection per call — use /query's `collections` form to search several at once.

Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).

Corresponds with POST /api/v1/search/{collection} (the `SearchCollection` operationId).

func (*ClientWithResponses) SearchCollectionWithResponse

func (c *ClientWithResponses) SearchCollectionWithResponse(ctx context.Context, collection string, body SearchCollectionJSONRequestBody, reqEditors ...RequestEditorFn) (*SearchCollectionResponse, error)

SearchCollectionWithResponse Search a single collection by name

Shorthand for POST /api/v1/search/query with the collection named in the path instead of the body. Same pipeline, same response shape, one collection per call — use /query's `collections` form to search several at once.

Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).

Corresponds with POST /api/v1/search/{collection} (the `SearchCollection` operationId).

func (*ClientWithResponses) SearchPreviewWithBodyWithResponse added in v0.1.4

func (c *ClientWithResponses) SearchPreviewWithBodyWithResponse(ctx context.Context, params *SearchPreviewParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SearchPreviewResponse, error)

SearchPreviewWithBodyWithResponse Preview search results without charging

Run the same pipeline as POST /api/v1/search/query -- same entitlement checks, same retraction filtering, same relevance ranking -- but never charge for it. Every result comes back locked, with a teaser snippet in `text` and the cost to unlock it. Works even at a zero balance. Consumes no credits, no trial query and no quota.

Call POST /api/v1/search/unlock with the returned `queryId` to pay for and receive some or all of the results in full.

Send an `Idempotency-Key` header to make retries safe: a repeat with the same key and body returns the original `queryId` instead of buying the same results again under a new one.

Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).

Corresponds with POST /api/v1/search/preview (the `SearchPreview` operationId).

func (*ClientWithResponses) SearchPreviewWithResponse added in v0.1.4

func (c *ClientWithResponses) SearchPreviewWithResponse(ctx context.Context, params *SearchPreviewParams, body SearchPreviewJSONRequestBody, reqEditors ...RequestEditorFn) (*SearchPreviewResponse, error)

SearchPreviewWithResponse Preview search results without charging

Run the same pipeline as POST /api/v1/search/query -- same entitlement checks, same retraction filtering, same relevance ranking -- but never charge for it. Every result comes back locked, with a teaser snippet in `text` and the cost to unlock it. Works even at a zero balance. Consumes no credits, no trial query and no quota.

Call POST /api/v1/search/unlock with the returned `queryId` to pay for and receive some or all of the results in full.

Send an `Idempotency-Key` header to make retries safe: a repeat with the same key and body returns the original `queryId` instead of buying the same results again under a new one.

Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).

Corresponds with POST /api/v1/search/preview (the `SearchPreview` operationId).

func (*ClientWithResponses) SearchQueryWithBodyWithResponse

func (c *ClientWithResponses) SearchQueryWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SearchQueryResponse, error)

SearchQueryWithBodyWithResponse Search documents

Search one or more collections using natural language or keyword queries. Results are ranked by relevance using hybrid retrieval (dense + sparse + reranking). Pass `collections` (up to 5) to search several collections in one call and receive a single merged, relevance-ranked list with per-result origin labels.

Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).

Corresponds with POST /api/v1/search/query (the `SearchQuery` operationId).

func (*ClientWithResponses) SearchQueryWithResponse

func (c *ClientWithResponses) SearchQueryWithResponse(ctx context.Context, body SearchQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*SearchQueryResponse, error)

SearchQueryWithResponse Search documents

Search one or more collections using natural language or keyword queries. Results are ranked by relevance using hybrid retrieval (dense + sparse + reranking). Pass `collections` (up to 5) to search several collections in one call and receive a single merged, relevance-ranked list with per-result origin labels.

Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).

Corresponds with POST /api/v1/search/query (the `SearchQuery` operationId).

func (*ClientWithResponses) SearchUnlockWithBodyWithResponse added in v0.1.4

func (c *ClientWithResponses) SearchUnlockWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SearchUnlockResponse, error)

SearchUnlockWithBodyWithResponse Pay for previewed results and receive them in full

Charges only for results not already unlocked by an earlier call against the same `queryId` -- re-sending the same ids costs nothing. Omit `resultIds` (or pass `null`) to unlock everything from the preview.

Set `includeFigures` to receive figure images as base64 in `metadata.figures[].image_data`. Images are returned for every result unlocked under this `queryId`, including ones unlocked by an earlier call -- so re-sending ids you have already paid for is how you fetch images you skipped the first time, and it charges nothing. At most 50 images are fetched per call; the ids in `resultIds` (or, when it is omitted, the results this call unlocked) get that budget first. Figures are free: they are not priced into the token cost, so the flag changes latency and response size and never the charge. Use the preview's `figureCount` to decide whether to ask.

Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).

Corresponds with POST /api/v1/search/unlock (the `SearchUnlock` operationId).

func (*ClientWithResponses) SearchUnlockWithResponse added in v0.1.4

func (c *ClientWithResponses) SearchUnlockWithResponse(ctx context.Context, body SearchUnlockJSONRequestBody, reqEditors ...RequestEditorFn) (*SearchUnlockResponse, error)

SearchUnlockWithResponse Pay for previewed results and receive them in full

Charges only for results not already unlocked by an earlier call against the same `queryId` -- re-sending the same ids costs nothing. Omit `resultIds` (or pass `null`) to unlock everything from the preview.

Set `includeFigures` to receive figure images as base64 in `metadata.figures[].image_data`. Images are returned for every result unlocked under this `queryId`, including ones unlocked by an earlier call -- so re-sending ids you have already paid for is how you fetch images you skipped the first time, and it charges nothing. At most 50 images are fetched per call; the ids in `resultIds` (or, when it is omitted, the results this call unlocked) get that budget first. Figures are free: they are not priced into the token cost, so the flag changes latency and response size and never the charge. Use the preview's `figureCount` to decide whether to ask.

Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).

Corresponds with POST /api/v1/search/unlock (the `SearchUnlock` operationId).

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {

	// SearchAssistedWithBodyWithResponse Assisted search (verified results only)
	//
	// Agentic search: the query is interpreted, one or more internal searches are planned and run, every candidate is verified as actually addressing the query, and only verified results are returned.
	//
	// **Billing differs from `/search/query`:** only delivered, verified results are charged. A clarification request or an honest no-results answer costs nothing. Internal search fan-out and LLM tokens are absorbed by Redpine.
	//
	// Accepts the same `filters` as `/search/query`, applied to every internal search.
	//
	// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
	//
	// Corresponds with POST /api/v1/search/assisted (the `SearchAssisted` operationId).
	SearchAssistedWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SearchAssistedResponse, error)

	// SearchAssistedWithResponse Assisted search (verified results only)
	//
	// Agentic search: the query is interpreted, one or more internal searches are planned and run, every candidate is verified as actually addressing the query, and only verified results are returned.
	//
	// **Billing differs from `/search/query`:** only delivered, verified results are charged. A clarification request or an honest no-results answer costs nothing. Internal search fan-out and LLM tokens are absorbed by Redpine.
	//
	// Accepts the same `filters` as `/search/query`, applied to every internal search.
	//
	// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
	//
	// Corresponds with POST /api/v1/search/assisted (the `SearchAssisted` operationId).
	SearchAssistedWithResponse(ctx context.Context, body SearchAssistedJSONRequestBody, reqEditors ...RequestEditorFn) (*SearchAssistedResponse, error)

	// ListCollectionsWithResponse List collections
	//
	// List all document collections accessible to the authenticated API key.
	//
	// Returns a wrapper object for the known response body format(s).
	//
	// Corresponds with GET /api/v1/search/collections (the `ListCollections` operationId).
	ListCollectionsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListCollectionsResponse, error)

	// SearchPreviewWithBodyWithResponse Preview search results without charging
	//
	// Run the same pipeline as POST /api/v1/search/query -- same entitlement checks, same retraction filtering, same relevance ranking -- but never charge for it. Every result comes back locked, with a teaser snippet in `text` and the cost to unlock it. Works even at a zero balance. Consumes no credits, no trial query and no quota.
	//
	// Call POST /api/v1/search/unlock with the returned `queryId` to pay for and receive some or all of the results in full.
	//
	// Send an `Idempotency-Key` header to make retries safe: a repeat with the same key and body returns the original `queryId` instead of buying the same results again under a new one.
	//
	// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
	//
	// Corresponds with POST /api/v1/search/preview (the `SearchPreview` operationId).
	SearchPreviewWithBodyWithResponse(ctx context.Context, params *SearchPreviewParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SearchPreviewResponse, error)

	// SearchPreviewWithResponse Preview search results without charging
	//
	// Run the same pipeline as POST /api/v1/search/query -- same entitlement checks, same retraction filtering, same relevance ranking -- but never charge for it. Every result comes back locked, with a teaser snippet in `text` and the cost to unlock it. Works even at a zero balance. Consumes no credits, no trial query and no quota.
	//
	// Call POST /api/v1/search/unlock with the returned `queryId` to pay for and receive some or all of the results in full.
	//
	// Send an `Idempotency-Key` header to make retries safe: a repeat with the same key and body returns the original `queryId` instead of buying the same results again under a new one.
	//
	// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
	//
	// Corresponds with POST /api/v1/search/preview (the `SearchPreview` operationId).
	SearchPreviewWithResponse(ctx context.Context, params *SearchPreviewParams, body SearchPreviewJSONRequestBody, reqEditors ...RequestEditorFn) (*SearchPreviewResponse, error)

	// SearchQueryWithBodyWithResponse Search documents
	//
	// Search one or more collections using natural language or keyword queries. Results are ranked by relevance using hybrid retrieval (dense + sparse + reranking). Pass `collections` (up to 5) to search several collections in one call and receive a single merged, relevance-ranked list with per-result origin labels.
	//
	// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
	//
	// Corresponds with POST /api/v1/search/query (the `SearchQuery` operationId).
	SearchQueryWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SearchQueryResponse, error)

	// SearchQueryWithResponse Search documents
	//
	// Search one or more collections using natural language or keyword queries. Results are ranked by relevance using hybrid retrieval (dense + sparse + reranking). Pass `collections` (up to 5) to search several collections in one call and receive a single merged, relevance-ranked list with per-result origin labels.
	//
	// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
	//
	// Corresponds with POST /api/v1/search/query (the `SearchQuery` operationId).
	SearchQueryWithResponse(ctx context.Context, body SearchQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*SearchQueryResponse, error)

	// GetQuotaWithResponse Current quota usage and limits
	//
	// Daily and monthly query usage and limits for the authenticated organization.
	//
	// Returns a wrapper object for the known response body format(s).
	//
	// Corresponds with GET /api/v1/search/quota (the `GetQuota` operationId).
	GetQuotaWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetQuotaResponse, error)

	// GetCachedResultWithResponse Re-fetch cached results
	//
	// Retrieve previously returned search results using the queryId from a prior search response. Returns the same results without billing. The request must use the same API key that performed the original search. Results are available for 7 days.
	//
	// Each result carries `locked`/`tokens`/`cost`: a result not yet paid for through POST /api/v1/search/unlock comes back as a teaser (`locked: true`), never the full text.
	//
	// Returns a wrapper object for the known response body format(s).
	//
	// Corresponds with GET /api/v1/search/results/{queryId} (the `GetCachedResult` operationId).
	GetCachedResultWithResponse(ctx context.Context, queryId string, params *GetCachedResultParams, reqEditors ...RequestEditorFn) (*GetCachedResultResponse, error)

	// SearchUnlockWithBodyWithResponse Pay for previewed results and receive them in full
	//
	// Charges only for results not already unlocked by an earlier call against the same `queryId` -- re-sending the same ids costs nothing. Omit `resultIds` (or pass `null`) to unlock everything from the preview.
	//
	// Set `includeFigures` to receive figure images as base64 in `metadata.figures[].image_data`. Images are returned for every result unlocked under this `queryId`, including ones unlocked by an earlier call -- so re-sending ids you have already paid for is how you fetch images you skipped the first time, and it charges nothing. At most 50 images are fetched per call; the ids in `resultIds` (or, when it is omitted, the results this call unlocked) get that budget first. Figures are free: they are not priced into the token cost, so the flag changes latency and response size and never the charge. Use the preview's `figureCount` to decide whether to ask.
	//
	// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
	//
	// Corresponds with POST /api/v1/search/unlock (the `SearchUnlock` operationId).
	SearchUnlockWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SearchUnlockResponse, error)

	// SearchUnlockWithResponse Pay for previewed results and receive them in full
	//
	// Charges only for results not already unlocked by an earlier call against the same `queryId` -- re-sending the same ids costs nothing. Omit `resultIds` (or pass `null`) to unlock everything from the preview.
	//
	// Set `includeFigures` to receive figure images as base64 in `metadata.figures[].image_data`. Images are returned for every result unlocked under this `queryId`, including ones unlocked by an earlier call -- so re-sending ids you have already paid for is how you fetch images you skipped the first time, and it charges nothing. At most 50 images are fetched per call; the ids in `resultIds` (or, when it is omitted, the results this call unlocked) get that budget first. Figures are free: they are not priced into the token cost, so the flag changes latency and response size and never the charge. Use the preview's `figureCount` to decide whether to ask.
	//
	// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
	//
	// Corresponds with POST /api/v1/search/unlock (the `SearchUnlock` operationId).
	SearchUnlockWithResponse(ctx context.Context, body SearchUnlockJSONRequestBody, reqEditors ...RequestEditorFn) (*SearchUnlockResponse, error)

	// SearchCollectionWithBodyWithResponse Search a single collection by name
	//
	// Shorthand for POST /api/v1/search/query with the collection named in the path instead of the body. Same pipeline, same response shape, one collection per call — use /query's `collections` form to search several at once.
	//
	// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
	//
	// Corresponds with POST /api/v1/search/{collection} (the `SearchCollection` operationId).
	SearchCollectionWithBodyWithResponse(ctx context.Context, collection string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SearchCollectionResponse, error)

	// SearchCollectionWithResponse Search a single collection by name
	//
	// Shorthand for POST /api/v1/search/query with the collection named in the path instead of the body. Same pipeline, same response shape, one collection per call — use /query's `collections` form to search several at once.
	//
	// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
	//
	// Corresponds with POST /api/v1/search/{collection} (the `SearchCollection` operationId).
	SearchCollectionWithResponse(ctx context.Context, collection string, body SearchCollectionJSONRequestBody, reqEditors ...RequestEditorFn) (*SearchCollectionResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type CollectionsResponse

type CollectionsResponse struct {
	// Collections List of accessible collections.
	Collections []struct {
		// DocumentCount Number of documents in the collection.
		DocumentCount int `json:"documentCount"`

		// Name Collection name.
		Name string `json:"name"`
	} `json:"collections"`

	// Count Total number of accessible collections.
	Count int `json:"count"`
}

CollectionsResponse defines model for CollectionsResponse.

type Error

type Error struct {
	Error struct {
		// Code Machine-readable error code.
		//
		// Examples: UNAUTHORIZED, FORBIDDEN, NOT_FOUND, VALIDATION_ERROR, RATE_LIMITED
		Code string `json:"code"`

		// Message Human-readable error description.
		Message string `json:"message"`

		// RequestId Request ID for debugging.
		RequestId *string `json:"requestId,omitempty"`
	} `json:"error"`
}

Error defines model for Error.

type ExpiredError added in v0.1.4

type ExpiredError struct{ APIError }

ExpiredError is 410: the cached result or preview is past its 7-day window. Run the search again.

func (*ExpiredError) Unwrap added in v0.1.4

func (e *ExpiredError) Unwrap() error

type Field

type Field struct {
	// contains filtered or unexported fields
}

Field names a filterable field; apply one operator to get a Filter.

func F

func F(name string) Field

F starts a filter on a field: F("issn").Eq("1664-302X").

func (Field) Between

func (fd Field) Between(lo, hi any) Filter

func (Field) Eq

func (fd Field) Eq(v any) Filter

func (Field) Gt

func (fd Field) Gt(v any) Filter

func (Field) Gte

func (fd Field) Gte(v any) Filter

func (Field) In

func (fd Field) In(v ...any) Filter

func (Field) Lt

func (fd Field) Lt(v any) Filter

func (Field) Lte

func (fd Field) Lte(v any) Filter

func (Field) Ne

func (fd Field) Ne(v any) Filter

func (Field) NotIn

func (fd Field) NotIn(v ...any) Filter

type Filter

type Filter struct {
	// contains filtered or unexported fields
}

Filter is an immutable node of the structured filter DSL the search API accepts:

leaf        {"field": name, "<op>": value}
combinator  {"and"|"or"|"not": [nodes]}   (always a list)
ops         eq ne in not_in gt gte lt lte between ([lo, hi])

F("issn").Eq("1664-302X").Or(F("issn").Eq("1932-6203"))
F("journal_metric.2yr_mean_citedness").Gte(5).And(F("doi").Eq("10.1/x").Not())

func (Filter) And

func (f Filter) And(other Filter) Filter

And combines two filters; chained Ands flatten into one list.

func (Filter) Map

func (f Filter) Map() map[string]any

Map returns a fresh copy of the wire representation.

func (Filter) Not

func (f Filter) Not() Filter

Not negates the filter.

func (Filter) Or

func (f Filter) Or(other Filter) Filter

Or combines two filters; chained Ors flatten into one list.

type FilterWarning

type FilterWarning struct {
	// Code Machine-readable code, e.g. `unindexed_filter_field`.
	Code string `json:"code"`

	// Field The filter field the warning concerns.
	Field string `json:"field"`

	// Message Human-readable explanation.
	Message string `json:"message"`
}

FilterWarning defines model for FilterWarning.

type GetCachedResultParams added in v0.1.5

type GetCachedResultParams struct {
	// IncludeFigures Include figure images for results already unlocked. Free, like the rest of this endpoint: it re-delivers content that is already paid for and unlocks nothing. Applies to results that came from POST /api/v1/search/preview; a cached POST /api/v1/search/query response does not retain figures.
	IncludeFigures *bool `form:"includeFigures,omitempty" json:"includeFigures,omitempty"`

	// ImageMaxWidth Maximum image width in pixels.
	ImageMaxWidth *int `form:"imageMaxWidth,omitempty" json:"imageMaxWidth,omitempty"`

	// ImageMaxHeight Maximum image height in pixels.
	ImageMaxHeight *int `form:"imageMaxHeight,omitempty" json:"imageMaxHeight,omitempty"`

	// ImageQuality JPEG quality for fetched images.
	ImageQuality *int `form:"imageQuality,omitempty" json:"imageQuality,omitempty"`
}

GetCachedResultParams defines parameters for GetCachedResult.

type GetCachedResultResponse

type GetCachedResultResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *SearchResultsPreviewResponse
	// JSON401 the response for an HTTP 401 `application/json` response
	JSON401 *Error
	// JSON404 the response for an HTTP 404 `application/json` response
	JSON404 *Error
	// JSON410 the response for an HTTP 410 `application/json` response
	JSON410 *Error
	// Headers200 the parsed response headers for an HTTP 200 response
	Headers200 *GetCachedResultResponse200Headers
}

func ParseGetCachedResultResponse

func ParseGetCachedResultResponse(rsp *http.Response) (*GetCachedResultResponse, error)

ParseGetCachedResultResponse parses an HTTP response from a GetCachedResultWithResponse call

func (GetCachedResultResponse) ContentType

func (r GetCachedResultResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (GetCachedResultResponse) GetBody

func (r GetCachedResultResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (GetCachedResultResponse) GetJSON200

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (GetCachedResultResponse) GetJSON401

func (r GetCachedResultResponse) GetJSON401() *Error

GetJSON401 returns the response for an HTTP 401 `application/json` response

func (GetCachedResultResponse) GetJSON404

func (r GetCachedResultResponse) GetJSON404() *Error

GetJSON404 returns the response for an HTTP 404 `application/json` response

func (GetCachedResultResponse) GetJSON410

func (r GetCachedResultResponse) GetJSON410() *Error

GetJSON410 returns the response for an HTTP 410 `application/json` response

func (GetCachedResultResponse) Status

func (r GetCachedResultResponse) Status() string

Status returns HTTPResponse.Status

func (GetCachedResultResponse) StatusCode

func (r GetCachedResultResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetCachedResultResponse200Headers

type GetCachedResultResponse200Headers struct {
	XCache        *string
	XCacheExpires *time.Time
}

GetCachedResultResponse200Headers the declared response headers of an HTTP 200 response for GetCachedResult

type GetQuotaResponse

type GetQuotaResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *QuotaInfo
	// JSON401 the response for an HTTP 401 `application/json` response
	JSON401 *Error
}

func ParseGetQuotaResponse

func ParseGetQuotaResponse(rsp *http.Response) (*GetQuotaResponse, error)

ParseGetQuotaResponse parses an HTTP response from a GetQuotaWithResponse call

func (GetQuotaResponse) ContentType

func (r GetQuotaResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (GetQuotaResponse) GetBody

func (r GetQuotaResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (GetQuotaResponse) GetJSON200

func (r GetQuotaResponse) GetJSON200() *QuotaInfo

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (GetQuotaResponse) GetJSON401

func (r GetQuotaResponse) GetJSON401() *Error

GetJSON401 returns the response for an HTTP 401 `application/json` response

func (GetQuotaResponse) Status

func (r GetQuotaResponse) Status() string

Status returns HTTPResponse.Status

func (GetQuotaResponse) StatusCode

func (r GetQuotaResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type InsufficientCreditsError added in v0.1.4

type InsufficientCreditsError struct{ APIError }

InsufficientCreditsError is 402: billing suspended, or not enough credits to unlock the requested rows.

func (*InsufficientCreditsError) Unwrap added in v0.1.4

func (e *InsufficientCreditsError) Unwrap() error

type JournalMetricExpansion

type JournalMetricExpansion struct {
	// Condition Threshold applied, e.g. `gte 5.0`.
	Condition string `json:"condition"`

	// Field Metric field expanded, e.g. `journal_metric.2yr_mean_citedness`.
	Field string `json:"field"`

	// IssnCount ISSNs pushed down (a journal usually has both a print and an electronic ISSN).
	IssnCount int `json:"issnCount"`

	// MatchedJournals Distinct journals matching the threshold.
	MatchedJournals int `json:"matchedJournals"`

	// SampleIssns First few ISSNs, for inspection.
	SampleIssns *[]string `json:"sampleIssns,omitempty"`
}

JournalMetricExpansion defines model for JournalMetricExpansion.

type ListCollectionsResponse

type ListCollectionsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *CollectionsResponse
	// JSON401 the response for an HTTP 401 `application/json` response
	JSON401 *Error
	// JSON403 the response for an HTTP 403 `application/json` response
	JSON403 *Error
	// JSON429 the response for an HTTP 429 `application/json` response
	JSON429 *Error
}

func ParseListCollectionsResponse

func ParseListCollectionsResponse(rsp *http.Response) (*ListCollectionsResponse, error)

ParseListCollectionsResponse parses an HTTP response from a ListCollectionsWithResponse call

func (ListCollectionsResponse) ContentType

func (r ListCollectionsResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (ListCollectionsResponse) GetBody

func (r ListCollectionsResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (ListCollectionsResponse) GetJSON200

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (ListCollectionsResponse) GetJSON401

func (r ListCollectionsResponse) GetJSON401() *Error

GetJSON401 returns the response for an HTTP 401 `application/json` response

func (ListCollectionsResponse) GetJSON403

func (r ListCollectionsResponse) GetJSON403() *Error

GetJSON403 returns the response for an HTTP 403 `application/json` response

func (ListCollectionsResponse) GetJSON429

func (r ListCollectionsResponse) GetJSON429() *Error

GetJSON429 returns the response for an HTTP 429 `application/json` response

func (ListCollectionsResponse) Status

func (r ListCollectionsResponse) Status() string

Status returns HTTPResponse.Status

func (ListCollectionsResponse) StatusCode

func (r ListCollectionsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type NotFoundError

type NotFoundError struct{ APIError }

NotFoundError is 404: collection or queryId not found.

func (*NotFoundError) Unwrap

func (e *NotFoundError) Unwrap() error

type Option

type Option func(*config)

Option configures New.

func WithAPIKey

func WithAPIKey(k string) Option

func WithHTTP

func WithHTTP(h *http.Client) Option

func WithMaxRetries

func WithMaxRetries(n int) Option

func WithTimeout

func WithTimeout(d time.Duration) Option

type PreviewOptions added in v0.1.4

type PreviewOptions struct {
	Collection  string
	Collections []string
	Limit       int
	Filters     any // Filter, map[string]any, or nil
}

PreviewOptions configures Preview. Exactly one of Collection / Collections.

type PreviewResult added in v0.1.4

type PreviewResult struct {
	// Collection Origin collection of this result — the name as requested, so a logical collection reports the logical name rather than the physical one it resolves to. Always populated.
	Collection *string `json:"collection,omitempty"`

	// Cost Cost to unlock this one result.
	Cost *string `json:"cost,omitempty"`

	// FigureCount How many figures this result carries. Reported on locked rows too — the captions and images stay behind the paywall, but the count is what tells you whether unlocking with includeFigures is worth it. 0 for text-only content.
	FigureCount int `json:"figureCount"`

	// Id Chunk/point ID
	Id string `json:"id"`

	// Locked True when text is a teaser rather than the full chunk
	Locked bool `json:"locked"`

	// Metadata Document metadata (title, authors, journal, etc.). Always present on /search/preview and /search/unlock, which take no includeMetadata option. On /search/results it is null when the original search set includeMetadata to false. `figures` (captions, and `image_data` when images were requested) is present only on unlocked results — a locked result reports `figureCount` and nothing else about its figures.
	Metadata *map[string]interface{} `json:"metadata,omitempty"`

	// Text Full chunk text when `locked` is false. A short teaser snippet — never the full chunk — when `locked` is true.
	Text string `json:"text"`

	// Tokens Billable tokens to unlock this result.
	Tokens *int `json:"tokens,omitempty"`
}

PreviewResult defines model for PreviewResult.

type PreviewUnlockResponse added in v0.1.4

type PreviewUnlockResponse struct {
	// CostCharged What THIS call charged — not a running total. Null on a preview (always free) and on an unlock whose entire delta was already unlocked.
	CostCharged *string `json:"costCharged,omitempty"`

	// CostToUnlockRemaining Cost to unlock every result not yet unlocked. An estimate, not a binding quote: it is summed from each result's own individually-rounded cost, while the amount actually charged on the next unlock is computed per collection at that call's combined token total — the two can differ by a rounding fraction.
	CostToUnlockRemaining string `json:"costToUnlockRemaining"`

	// FilterWarnings Advisory warnings about the supplied filter — for example filtering on a known field with no payload index, which is matched by scanning, or a collection excluded because it holds only open-access content and the filter asked for open_access=false. The search still runs. Omitted when there are none.
	FilterWarnings *[]FilterWarning `json:"filterWarnings,omitempty"`

	// FiltersApplied The filters you sent, after validation. Omitted when no filters were sent.
	FiltersApplied *map[string]interface{} `json:"filtersApplied,omitempty"`

	// JournalMetricExpansions How each journal-metric condition resolved to ISSNs; omitted when no metric filter was used.
	JournalMetricExpansions *[]JournalMetricExpansion `json:"journalMetricExpansions,omitempty"`

	// QueryId Pass this to POST /search/unlock.
	QueryId string `json:"queryId"`

	// Results Every result from the query, filtered through the unlock ledger.
	Results []PreviewResult `json:"results"`
}

PreviewUnlockResponse defines model for PreviewUnlockResponse.

type QueryUnderstanding

type QueryUnderstanding struct {
	// Aspects Facets asked about the entity (e.g. mechanism of action, dermal penetration, clinical outcomes)
	Aspects *[]string `json:"aspects,omitempty"`

	// Entities Entities the query is about (substances, genes, diseases, organisms, methods)
	Entities *[]string `json:"entities,omitempty"`

	// Filters Structured metadata constraints read off the query. Possible keys (snake_case, present only when the query named the constraint): 'journal' (str), 'publisher' (str), 'article_type' (str, JATS vocabulary), 'publication_date' ({'gte'?: 'YYYY-MM-DD', 'lt'?: 'YYYY-MM-DD'}). Empty object when the query named none.
	Filters *map[string]interface{} `json:"filters,omitempty"`

	// Intent What the query is asking for
	Intent *string `json:"intent,omitempty"`
}

QueryUnderstanding How the endpoint read the query.

type QuotaExceededError

type QuotaExceededError struct {
	APIError
	RetryAfter *float64
}

QuotaExceededError is 429. RetryAfter is seconds when the server said.

func (*QuotaExceededError) Unwrap

func (e *QuotaExceededError) Unwrap() error

type QuotaInfo

type QuotaInfo struct {
	// DailyLimit Max queries per day.
	DailyLimit int `json:"dailyLimit"`

	// DailyRemaining Queries remaining today.
	DailyRemaining int `json:"dailyRemaining"`

	// DailyUsed Queries used today.
	DailyUsed int `json:"dailyUsed"`

	// MonthlyLimit Max queries per month.
	MonthlyLimit int `json:"monthlyLimit"`

	// MonthlyRemaining Queries remaining this month.
	MonthlyRemaining int `json:"monthlyRemaining"`

	// MonthlyUsed Queries used this month.
	MonthlyUsed int `json:"monthlyUsed"`
}

QuotaInfo defines model for QuotaInfo.

type Redpine

type Redpine struct {
	// contains filtered or unexported fields
}

Redpine is the hand-written client over the generated core. Named Redpine (not Client) because generated.go already declares a low-level type Client; mirrors the TS SDK's exported Redpine class.

func New

func New(opts ...Option) (*Redpine, error)

New builds a Redpine client. Key from WithAPIKey, else REDPINE_API_KEY, else CONNECT_API_KEY.

func (*Redpine) AssistedSearch

func (c *Redpine) AssistedSearch(ctx context.Context, query string, o AssistedSearchOptions) (*AssistedSearchResponse, error)

func (*Redpine) Collections

func (c *Redpine) Collections(ctx context.Context) (*CollectionsResponse, error)

func (*Redpine) GetResults

func (c *Redpine) GetResults(ctx context.Context, queryID string) (*SearchResultsPreviewResponse, error)

func (*Redpine) Preview added in v0.1.4

func (c *Redpine) Preview(ctx context.Context, query string, o PreviewOptions) (*PreviewUnlockResponse, error)

Preview is free: teaser rows plus the cost to unlock each. Never charged, never a quota slot.

func (*Redpine) Quota

func (c *Redpine) Quota(ctx context.Context) (*QuotaInfo, error)

func (*Redpine) Search

func (c *Redpine) Search(ctx context.Context, query string, o SearchOptions) (*SearchResponse, error)

func (*Redpine) SearchCollection

func (c *Redpine) SearchCollection(ctx context.Context, collection, query string, o SearchCollectionOptions) (*SearchResponse, error)

func (*Redpine) Unlock added in v0.1.4

func (c *Redpine) Unlock(ctx context.Context, queryID string, resultIDs []string) (*PreviewUnlockResponse, error)

Unlock pays for previewed rows. A nil resultIDs unlocks every row; re-sending paid ids is free.

type RelevanceInfo

type RelevanceInfo struct {
	// JudgeScore Relevance score assigned by the judge (0..1)
	JudgeScore float32 `json:"judgeScore"`

	// MatchedTerms Entity/synonym surface forms found in the chunk (for highlighting)
	MatchedTerms *[]string `json:"matchedTerms,omitempty"`

	// Rationale One-sentence explanation of relevance
	Rationale *string `json:"rationale,omitempty"`
}

RelevanceInfo Why a result was judged relevant.

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type SearchAssistedJSONRequestBody

type SearchAssistedJSONRequestBody = AssistedSearchRequest

SearchAssistedJSONRequestBody defines body for SearchAssisted for application/json ContentType.

type SearchAssistedResponse

type SearchAssistedResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *AssistedSearchResponse
	// JSON401 the response for an HTTP 401 `application/json` response
	JSON401 *Error
	// JSON403 the response for an HTTP 403 `application/json` response
	JSON403 *Error
	// JSON422 the response for an HTTP 422 `application/json` response
	JSON422 *Error
	// JSON429 the response for an HTTP 429 `application/json` response
	JSON429 *Error
	// JSON503 the response for an HTTP 503 `application/json` response
	JSON503 *Error
	// Headers200 the parsed response headers for an HTTP 200 response
	Headers200 *SearchAssistedResponse200Headers
}

func ParseSearchAssistedResponse

func ParseSearchAssistedResponse(rsp *http.Response) (*SearchAssistedResponse, error)

ParseSearchAssistedResponse parses an HTTP response from a SearchAssistedWithResponse call

func (SearchAssistedResponse) ContentType

func (r SearchAssistedResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (SearchAssistedResponse) GetBody

func (r SearchAssistedResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (SearchAssistedResponse) GetJSON200

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (SearchAssistedResponse) GetJSON401

func (r SearchAssistedResponse) GetJSON401() *Error

GetJSON401 returns the response for an HTTP 401 `application/json` response

func (SearchAssistedResponse) GetJSON403

func (r SearchAssistedResponse) GetJSON403() *Error

GetJSON403 returns the response for an HTTP 403 `application/json` response

func (SearchAssistedResponse) GetJSON422

func (r SearchAssistedResponse) GetJSON422() *Error

GetJSON422 returns the response for an HTTP 422 `application/json` response

func (SearchAssistedResponse) GetJSON429

func (r SearchAssistedResponse) GetJSON429() *Error

GetJSON429 returns the response for an HTTP 429 `application/json` response

func (SearchAssistedResponse) GetJSON503

func (r SearchAssistedResponse) GetJSON503() *Error

GetJSON503 returns the response for an HTTP 503 `application/json` response

func (SearchAssistedResponse) Status

func (r SearchAssistedResponse) Status() string

Status returns HTTPResponse.Status

func (SearchAssistedResponse) StatusCode

func (r SearchAssistedResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type SearchAssistedResponse200Headers

type SearchAssistedResponse200Headers struct {
	XBillingMode        *string
	XCreditsRemaining   *string
	XQueryCost          *string
	XRateLimitLimit     *int
	XRateLimitRemaining *int
	XRateLimitReset     *int
	XTokensUsed         *int
}

SearchAssistedResponse200Headers the declared response headers of an HTTP 200 response for SearchAssisted

type SearchCollectionJSONBody

type SearchCollectionJSONBody struct {
	// Filters Optional metadata filter. Two accepted forms.
	//
	// Flat (top-level keys are ANDed): `{"journal": "Nature", "publication_date": {"gte": "2020-01-01"}}`.
	//
	// Structured DSL (for OR / nesting): `{"and": [{"field": "journal", "eq": "Nature"}]}`. Operators: `eq`, `ne`, `in`, `not_in`, `gt`, `gte`, `lt`, `lte`, `between`. Combinators: `and`, `or`, `not`. One operator per condition, except range bounds (`gt`, `gte`, `lt`, `lte`) together; put other combinations in separate conditions under `and`.
	//
	// Mixing the flat and structured forms in one filter is rejected.
	//
	// Exclusion uses `ne` / `not_in` / `not` — there is no separate syntax: `{"and": [{"field": "issn", "not_in": ["1234-5679"]}]}`.
	//
	// Indexed on every collection (a field that is not a known result metadata field is rejected; a known field without an index, such as `pmid`, is matched by scanning and returns a `filterWarnings` entry, and is rejected on a collection that has no index for it): `article_type`, `chapter_authors`, `chapter_number`, `chapter_title`, `doi`, `isbn`, `issn`, `journal`, `keywords`, `open_access`, `publication_date`, `publisher`, `section`.
	//
	// Indexed on the editorial collections only: `last_updated_date`, `medical_board_approved`, `topic`, `url`.
	//
	// `open_access` is also answered for a collection that holds only open-access content and carries no such field: `true` matches everything there, `false` (or the field under `or` / `not`) excludes that collection with a `filterWarnings` entry. `license` is returned in result metadata but is not filterable.
	//
	// `issn` accepts hyphenated or bare, upper- or lower-case X (`"1234-561X"`, `"1234561x"`). `doi` is matched case-insensitively and an optional `https://doi.org/` or `doi:` prefix is accepted.
	//
	// `journal_metric.2yr_mean_citedness`, `journal_metric.h_index`, `journal_metric.i10_index` and `journal_metric.impact_factor` accept range operators only and are resolved server-side into the matching ISSNs; see `journalMetricExpansions` in the response. `impact_factor` is an impact factor computed by Redpine from OpenAlex citation data with the JIF formula. It is not Clarivate's Journal Impact Factor. Journals that publish many news items, letters and editorials (for example BMJ, JAMA, The Lancet) score far below their JCR figure, because OpenAlex classifies those items as articles. A metric condition may match at most 35,000 journal ISSNs and a request may send at most 70,000 filter values. A threshold with one end must stay within its documented bound: journal_metric.2yr_mean_citedness: gte 1.1 or higher, or lte 0.0 or lower; journal_metric.h_index: gte 35 or higher, or lte 3 or lower; journal_metric.i10_index: gte 160 or higher (no upper bound alone); journal_metric.impact_factor: gte 0.9 or higher, or lte 0.2 or lower. On h_index and i10_index, gt N counts as gte N+1 and lt N as lte N-1. A range with both ends (gte with lte, or between) may sit anywhere if it matches no more than 35,000 ISSNs. For 'below X' use not with gte X, X at or above the metric's minimum; not also keeps documents with no journal metric, and on impact_factor journals with no impact_factor. Two conditions near their bounds use most of the 70,000 values, so a third, or a long in/not_in list beside them, can be refused.
	Filters *map[string]interface{} `json:"filters,omitempty"`

	// ImageMaxHeight Maximum image height in pixels
	ImageMaxHeight *int `json:"imageMaxHeight,omitempty"`

	// ImageMaxWidth Maximum image width in pixels
	ImageMaxWidth *int `json:"imageMaxWidth,omitempty"`

	// ImageQuality JPEG quality for fetched images
	ImageQuality *int `json:"imageQuality,omitempty"`

	// IncludeFigures Fetch and include figure images as base64 in metadata (adds latency). includeImages is accepted as a deprecated alias.
	IncludeFigures *bool `json:"includeFigures,omitempty"`

	// IncludeMetadata Whether to include metadata in results
	IncludeMetadata *bool `json:"includeMetadata,omitempty"`

	// Limit Maximum results to return (default 10, max 30)
	Limit *int `json:"limit,omitempty"`

	// Query Natural language or keyword search query.
	Query string `json:"query"`
}

SearchCollectionJSONBody defines parameters for SearchCollection.

type SearchCollectionJSONRequestBody

type SearchCollectionJSONRequestBody SearchCollectionJSONBody

SearchCollectionJSONRequestBody defines body for SearchCollection for application/json ContentType.

type SearchCollectionOptions

type SearchCollectionOptions struct {
	Limit           int
	Filters         any
	IncludeMetadata *bool
	IncludeFigures  *bool
}

SearchCollectionOptions for SearchCollection.

type SearchCollectionResponse

type SearchCollectionResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *SearchResponse
	// JSON401 the response for an HTTP 401 `application/json` response
	JSON401 *Error
	// JSON403 the response for an HTTP 403 `application/json` response
	JSON403 *Error
	// JSON404 the response for an HTTP 404 `application/json` response
	JSON404 *Error
	// JSON422 the response for an HTTP 422 `application/json` response
	JSON422 *Error
	// JSON429 the response for an HTTP 429 `application/json` response
	JSON429 *Error
	// JSON503 the response for an HTTP 503 `application/json` response
	JSON503 *Error
	// Headers200 the parsed response headers for an HTTP 200 response
	Headers200 *SearchCollectionResponse200Headers
}

func ParseSearchCollectionResponse

func ParseSearchCollectionResponse(rsp *http.Response) (*SearchCollectionResponse, error)

ParseSearchCollectionResponse parses an HTTP response from a SearchCollectionWithResponse call

func (SearchCollectionResponse) ContentType

func (r SearchCollectionResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (SearchCollectionResponse) GetBody

func (r SearchCollectionResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (SearchCollectionResponse) GetJSON200

func (r SearchCollectionResponse) GetJSON200() *SearchResponse

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (SearchCollectionResponse) GetJSON401

func (r SearchCollectionResponse) GetJSON401() *Error

GetJSON401 returns the response for an HTTP 401 `application/json` response

func (SearchCollectionResponse) GetJSON403

func (r SearchCollectionResponse) GetJSON403() *Error

GetJSON403 returns the response for an HTTP 403 `application/json` response

func (SearchCollectionResponse) GetJSON404

func (r SearchCollectionResponse) GetJSON404() *Error

GetJSON404 returns the response for an HTTP 404 `application/json` response

func (SearchCollectionResponse) GetJSON422

func (r SearchCollectionResponse) GetJSON422() *Error

GetJSON422 returns the response for an HTTP 422 `application/json` response

func (SearchCollectionResponse) GetJSON429

func (r SearchCollectionResponse) GetJSON429() *Error

GetJSON429 returns the response for an HTTP 429 `application/json` response

func (SearchCollectionResponse) GetJSON503

func (r SearchCollectionResponse) GetJSON503() *Error

GetJSON503 returns the response for an HTTP 503 `application/json` response

func (SearchCollectionResponse) Status

func (r SearchCollectionResponse) Status() string

Status returns HTTPResponse.Status

func (SearchCollectionResponse) StatusCode

func (r SearchCollectionResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type SearchCollectionResponse200Headers

type SearchCollectionResponse200Headers struct {
	XBillingMode        *string
	XCacheExpires       *time.Time
	XCreditsRemaining   *string
	XQueryCost          *string
	XRateLimitLimit     *int
	XRateLimitRemaining *int
	XRateLimitReset     *int
	XTokensUsed         *int
}

SearchCollectionResponse200Headers the declared response headers of an HTTP 200 response for SearchCollection

type SearchOptions

type SearchOptions struct {
	Collection      string
	Collections     []string
	Limit           int
	Filters         any // Filter, map[string]any, or nil
	IncludeMetadata *bool
	IncludeFigures  *bool
}

SearchOptions for Search. Exactly one of Collection / Collections is required.

type SearchPreviewJSONRequestBody added in v0.1.4

type SearchPreviewJSONRequestBody = SearchPreviewRequest

SearchPreviewJSONRequestBody defines body for SearchPreview for application/json ContentType.

type SearchPreviewParams added in v0.1.6

type SearchPreviewParams struct {
	// IdempotencyKey Optional, 1-255 characters, scoped to your organization and kept for 24 hours. A repeat with the same key and the same body runs no new search: it returns the original `queryId`, rendered through the unlock ledger, so rows already unlocked come back in full with `locked: false`. Every row keeps its `cost` and `tokens`. The same key with a different body is a 422 `IDEMPOTENCY_KEY_REUSED`. A repeat while the first request is still running is a 409 `IDEMPOTENCY_KEY_IN_PROGRESS`, so retry it. If the original preview has expired, the request runs a new preview and the key moves to it. The response says which happened in `Idempotency-Status`.
	IdempotencyKey *string `json:"Idempotency-Key,omitempty"`
}

SearchPreviewParams defines parameters for SearchPreview.

type SearchPreviewRequest added in v0.1.4

type SearchPreviewRequest struct {
	// Collection Name of the collection to search. Mutually exclusive with `collections`.
	Collection *string `json:"collection,omitempty"`

	// Collections Collections to search together (max 5, unique). Each collection is searched with its own access entitlements and the results are merged into one relevance-ranked list; each result carries its origin `collection`. Mutually exclusive with `collection`.
	Collections *[]string `json:"collections,omitempty"`

	// Filters Optional metadata filter. Two accepted forms.
	//
	// Flat (top-level keys are ANDed): `{"journal": "Nature", "publication_date": {"gte": "2020-01-01"}}`.
	//
	// Structured DSL (for OR / nesting): `{"and": [{"field": "journal", "eq": "Nature"}]}`. Operators: `eq`, `ne`, `in`, `not_in`, `gt`, `gte`, `lt`, `lte`, `between`. Combinators: `and`, `or`, `not`. One operator per condition, except range bounds (`gt`, `gte`, `lt`, `lte`) together; put other combinations in separate conditions under `and`.
	//
	// Mixing the flat and structured forms in one filter is rejected.
	//
	// Exclusion uses `ne` / `not_in` / `not` — there is no separate syntax: `{"and": [{"field": "issn", "not_in": ["1234-5679"]}]}`.
	//
	// Indexed on every collection (a field that is not a known result metadata field is rejected; a known field without an index, such as `pmid`, is matched by scanning and returns a `filterWarnings` entry, and is rejected on a collection that has no index for it): `article_type`, `chapter_authors`, `chapter_number`, `chapter_title`, `doi`, `isbn`, `issn`, `journal`, `keywords`, `open_access`, `publication_date`, `publisher`, `section`.
	//
	// Indexed on the editorial collections only: `last_updated_date`, `medical_board_approved`, `topic`, `url`.
	//
	// `open_access` is also answered for a collection that holds only open-access content and carries no such field: `true` matches everything there, `false` (or the field under `or` / `not`) excludes that collection with a `filterWarnings` entry. `license` is returned in result metadata but is not filterable.
	//
	// `issn` accepts hyphenated or bare, upper- or lower-case X (`"1234-561X"`, `"1234561x"`). `doi` is matched case-insensitively and an optional `https://doi.org/` or `doi:` prefix is accepted.
	//
	// `journal_metric.2yr_mean_citedness`, `journal_metric.h_index`, `journal_metric.i10_index` and `journal_metric.impact_factor` accept range operators only and are resolved server-side into the matching ISSNs; see `journalMetricExpansions` in the response. `impact_factor` is an impact factor computed by Redpine from OpenAlex citation data with the JIF formula. It is not Clarivate's Journal Impact Factor. Journals that publish many news items, letters and editorials (for example BMJ, JAMA, The Lancet) score far below their JCR figure, because OpenAlex classifies those items as articles. A metric condition may match at most 35,000 journal ISSNs and a request may send at most 70,000 filter values. A threshold with one end must stay within its documented bound: journal_metric.2yr_mean_citedness: gte 1.1 or higher, or lte 0.0 or lower; journal_metric.h_index: gte 35 or higher, or lte 3 or lower; journal_metric.i10_index: gte 160 or higher (no upper bound alone); journal_metric.impact_factor: gte 0.9 or higher, or lte 0.2 or lower. On h_index and i10_index, gt N counts as gte N+1 and lt N as lte N-1. A range with both ends (gte with lte, or between) may sit anywhere if it matches no more than 35,000 ISSNs. For 'below X' use not with gte X, X at or above the metric's minimum; not also keeps documents with no journal metric, and on impact_factor journals with no impact_factor. Two conditions near their bounds use most of the 70,000 values, so a third, or a long in/not_in list beside them, can be refused.
	Filters *map[string]interface{} `json:"filters,omitempty"`

	// Limit Maximum results to return (default 10, max 30)
	Limit *int `json:"limit,omitempty"`

	// Query Natural language or keyword search query.
	Query string `json:"query"`
}

SearchPreviewRequest The result-selection half of SearchRequest. A preview quotes results rather than delivering them, so it takes no content-delivery options: figures are never fetched (they are not priced into the quote) and metadata is always returned. Provide exactly one of `collection` (single) or `collections` (multi).

type SearchPreviewResponse added in v0.1.4

type SearchPreviewResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *PreviewUnlockResponse
	// JSON401 the response for an HTTP 401 `application/json` response
	JSON401 *Error
	// JSON403 the response for an HTTP 403 `application/json` response
	JSON403 *Error
	// JSON404 the response for an HTTP 404 `application/json` response
	JSON404 *Error
	// JSON409 the response for an HTTP 409 `application/json` response
	JSON409 *Error
	// JSON422 the response for an HTTP 422 `application/json` response
	JSON422 *Error
	// JSON429 the response for an HTTP 429 `application/json` response
	JSON429 *Error
	// JSON503 the response for an HTTP 503 `application/json` response
	JSON503 *Error
	// Headers200 the parsed response headers for an HTTP 200 response
	Headers200 *SearchPreviewResponse200Headers
}

func ParseSearchPreviewResponse added in v0.1.4

func ParseSearchPreviewResponse(rsp *http.Response) (*SearchPreviewResponse, error)

ParseSearchPreviewResponse parses an HTTP response from a SearchPreviewWithResponse call

func (SearchPreviewResponse) ContentType added in v0.1.4

func (r SearchPreviewResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (SearchPreviewResponse) GetBody added in v0.1.4

func (r SearchPreviewResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (SearchPreviewResponse) GetJSON200 added in v0.1.4

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (SearchPreviewResponse) GetJSON401 added in v0.1.4

func (r SearchPreviewResponse) GetJSON401() *Error

GetJSON401 returns the response for an HTTP 401 `application/json` response

func (SearchPreviewResponse) GetJSON403 added in v0.1.4

func (r SearchPreviewResponse) GetJSON403() *Error

GetJSON403 returns the response for an HTTP 403 `application/json` response

func (SearchPreviewResponse) GetJSON404 added in v0.1.4

func (r SearchPreviewResponse) GetJSON404() *Error

GetJSON404 returns the response for an HTTP 404 `application/json` response

func (SearchPreviewResponse) GetJSON409 added in v0.1.6

func (r SearchPreviewResponse) GetJSON409() *Error

GetJSON409 returns the response for an HTTP 409 `application/json` response

func (SearchPreviewResponse) GetJSON422 added in v0.1.4

func (r SearchPreviewResponse) GetJSON422() *Error

GetJSON422 returns the response for an HTTP 422 `application/json` response

func (SearchPreviewResponse) GetJSON429 added in v0.1.4

func (r SearchPreviewResponse) GetJSON429() *Error

GetJSON429 returns the response for an HTTP 429 `application/json` response

func (SearchPreviewResponse) GetJSON503 added in v0.1.4

func (r SearchPreviewResponse) GetJSON503() *Error

GetJSON503 returns the response for an HTTP 503 `application/json` response

func (SearchPreviewResponse) Status added in v0.1.4

func (r SearchPreviewResponse) Status() string

Status returns HTTPResponse.Status

func (SearchPreviewResponse) StatusCode added in v0.1.4

func (r SearchPreviewResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type SearchPreviewResponse200Headers added in v0.1.6

type SearchPreviewResponse200Headers struct {
	IdempotencyStatus *string
}

SearchPreviewResponse200Headers the declared response headers of an HTTP 200 response for SearchPreview

type SearchQueryJSONRequestBody

type SearchQueryJSONRequestBody = SearchRequest

SearchQueryJSONRequestBody defines body for SearchQuery for application/json ContentType.

type SearchQueryResponse

type SearchQueryResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *SearchResponse
	// JSON401 the response for an HTTP 401 `application/json` response
	JSON401 *Error
	// JSON403 the response for an HTTP 403 `application/json` response
	JSON403 *Error
	// JSON404 the response for an HTTP 404 `application/json` response
	JSON404 *Error
	// JSON422 the response for an HTTP 422 `application/json` response
	JSON422 *Error
	// JSON429 the response for an HTTP 429 `application/json` response
	JSON429 *Error
	// JSON503 the response for an HTTP 503 `application/json` response
	JSON503 *Error
	// Headers200 the parsed response headers for an HTTP 200 response
	Headers200 *SearchQueryResponse200Headers
}

func ParseSearchQueryResponse

func ParseSearchQueryResponse(rsp *http.Response) (*SearchQueryResponse, error)

ParseSearchQueryResponse parses an HTTP response from a SearchQueryWithResponse call

func (SearchQueryResponse) ContentType

func (r SearchQueryResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (SearchQueryResponse) GetBody

func (r SearchQueryResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (SearchQueryResponse) GetJSON200

func (r SearchQueryResponse) GetJSON200() *SearchResponse

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (SearchQueryResponse) GetJSON401

func (r SearchQueryResponse) GetJSON401() *Error

GetJSON401 returns the response for an HTTP 401 `application/json` response

func (SearchQueryResponse) GetJSON403

func (r SearchQueryResponse) GetJSON403() *Error

GetJSON403 returns the response for an HTTP 403 `application/json` response

func (SearchQueryResponse) GetJSON404

func (r SearchQueryResponse) GetJSON404() *Error

GetJSON404 returns the response for an HTTP 404 `application/json` response

func (SearchQueryResponse) GetJSON422

func (r SearchQueryResponse) GetJSON422() *Error

GetJSON422 returns the response for an HTTP 422 `application/json` response

func (SearchQueryResponse) GetJSON429

func (r SearchQueryResponse) GetJSON429() *Error

GetJSON429 returns the response for an HTTP 429 `application/json` response

func (SearchQueryResponse) GetJSON503

func (r SearchQueryResponse) GetJSON503() *Error

GetJSON503 returns the response for an HTTP 503 `application/json` response

func (SearchQueryResponse) Status

func (r SearchQueryResponse) Status() string

Status returns HTTPResponse.Status

func (SearchQueryResponse) StatusCode

func (r SearchQueryResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type SearchQueryResponse200Headers

type SearchQueryResponse200Headers struct {
	XBillingMode        *string
	XCacheExpires       *time.Time
	XCreditsRemaining   *string
	XQueryCost          *string
	XRateLimitLimit     *int
	XRateLimitRemaining *int
	XRateLimitReset     *int
	XTokensUsed         *int
}

SearchQueryResponse200Headers the declared response headers of an HTTP 200 response for SearchQuery

type SearchRequest

type SearchRequest struct {
	// Collection Name of the collection to search. Mutually exclusive with `collections`.
	Collection *string `json:"collection,omitempty"`

	// Collections Collections to search together (max 5, unique). Each collection is searched with its own access entitlements and the results are merged into one relevance-ranked list; each result carries its origin `collection`. Mutually exclusive with `collection`.
	Collections *[]string `json:"collections,omitempty"`

	// Filters Optional metadata filter. Two accepted forms.
	//
	// Flat (top-level keys are ANDed): `{"journal": "Nature", "publication_date": {"gte": "2020-01-01"}}`.
	//
	// Structured DSL (for OR / nesting): `{"and": [{"field": "journal", "eq": "Nature"}]}`. Operators: `eq`, `ne`, `in`, `not_in`, `gt`, `gte`, `lt`, `lte`, `between`. Combinators: `and`, `or`, `not`. One operator per condition, except range bounds (`gt`, `gte`, `lt`, `lte`) together; put other combinations in separate conditions under `and`.
	//
	// Mixing the flat and structured forms in one filter is rejected.
	//
	// Exclusion uses `ne` / `not_in` / `not` — there is no separate syntax: `{"and": [{"field": "issn", "not_in": ["1234-5679"]}]}`.
	//
	// Indexed on every collection (a field that is not a known result metadata field is rejected; a known field without an index, such as `pmid`, is matched by scanning and returns a `filterWarnings` entry, and is rejected on a collection that has no index for it): `article_type`, `chapter_authors`, `chapter_number`, `chapter_title`, `doi`, `isbn`, `issn`, `journal`, `keywords`, `open_access`, `publication_date`, `publisher`, `section`.
	//
	// Indexed on the editorial collections only: `last_updated_date`, `medical_board_approved`, `topic`, `url`.
	//
	// `open_access` is also answered for a collection that holds only open-access content and carries no such field: `true` matches everything there, `false` (or the field under `or` / `not`) excludes that collection with a `filterWarnings` entry. `license` is returned in result metadata but is not filterable.
	//
	// `issn` accepts hyphenated or bare, upper- or lower-case X (`"1234-561X"`, `"1234561x"`). `doi` is matched case-insensitively and an optional `https://doi.org/` or `doi:` prefix is accepted.
	//
	// `journal_metric.2yr_mean_citedness`, `journal_metric.h_index`, `journal_metric.i10_index` and `journal_metric.impact_factor` accept range operators only and are resolved server-side into the matching ISSNs; see `journalMetricExpansions` in the response. `impact_factor` is an impact factor computed by Redpine from OpenAlex citation data with the JIF formula. It is not Clarivate's Journal Impact Factor. Journals that publish many news items, letters and editorials (for example BMJ, JAMA, The Lancet) score far below their JCR figure, because OpenAlex classifies those items as articles. A metric condition may match at most 35,000 journal ISSNs and a request may send at most 70,000 filter values. A threshold with one end must stay within its documented bound: journal_metric.2yr_mean_citedness: gte 1.1 or higher, or lte 0.0 or lower; journal_metric.h_index: gte 35 or higher, or lte 3 or lower; journal_metric.i10_index: gte 160 or higher (no upper bound alone); journal_metric.impact_factor: gte 0.9 or higher, or lte 0.2 or lower. On h_index and i10_index, gt N counts as gte N+1 and lt N as lte N-1. A range with both ends (gte with lte, or between) may sit anywhere if it matches no more than 35,000 ISSNs. For 'below X' use not with gte X, X at or above the metric's minimum; not also keeps documents with no journal metric, and on impact_factor journals with no impact_factor. Two conditions near their bounds use most of the 70,000 values, so a third, or a long in/not_in list beside them, can be refused.
	Filters *map[string]interface{} `json:"filters,omitempty"`

	// ImageMaxHeight Maximum image height in pixels
	ImageMaxHeight *int `json:"imageMaxHeight,omitempty"`

	// ImageMaxWidth Maximum image width in pixels
	ImageMaxWidth *int `json:"imageMaxWidth,omitempty"`

	// ImageQuality JPEG quality for fetched images
	ImageQuality *int `json:"imageQuality,omitempty"`

	// IncludeFigures Fetch and include figure images as base64 in metadata (adds latency). includeImages is accepted as a deprecated alias.
	IncludeFigures *bool `json:"includeFigures,omitempty"`

	// IncludeMetadata Whether to include metadata in results
	IncludeMetadata *bool `json:"includeMetadata,omitempty"`

	// Limit Maximum results to return (default 10, max 30)
	Limit *int `json:"limit,omitempty"`

	// Query Natural language or keyword search query.
	Query string `json:"query"`
}

SearchRequest Provide exactly one of `collection` (single) or `collections` (multi-collection search).

type SearchResponse

type SearchResponse struct {
	// FilterWarnings Advisory warnings about the supplied filter — for example filtering on a known field with no payload index, which is matched by scanning, or a collection excluded because it holds only open-access content and the filter asked for open_access=false. The search still runs. Omitted when there are none.
	FilterWarnings *[]FilterWarning `json:"filterWarnings,omitempty"`

	// FiltersApplied The filters you sent, after validation. Omitted when no filters were sent.
	FiltersApplied *map[string]interface{} `json:"filtersApplied,omitempty"`

	// JournalMetricExpansions How each journal-metric condition resolved to ISSNs; omitted when no metric filter was used
	JournalMetricExpansions *[]JournalMetricExpansion `json:"journalMetricExpansions,omitempty"`

	// LatencyMs Search latency in milliseconds
	LatencyMs int `json:"latencyMs"`

	// QueryId Unique identifier for this query. Use it to re-fetch the same results for free within 7 days via GET /api/v1/search/results/{queryId}.
	QueryId string `json:"queryId"`

	// Results Ranked list of matching document chunks.
	Results []SearchResult `json:"results"`
}

SearchResponse defines model for SearchResponse.

type SearchResult

type SearchResult struct {
	// Collection Origin collection of this result — the name as requested, so a logical collection reports the logical name rather than the physical one it resolves to. Always populated.
	Collection *string `json:"collection,omitempty"`

	// Id Chunk/point ID
	Id string `json:"id"`

	// Metadata Document metadata (title, authors, journal, etc.). Null when includeMetadata is false.
	Metadata *map[string]interface{} `json:"metadata,omitempty"`

	// Text Chunk text content
	Text string `json:"text"`
}

SearchResult defines model for SearchResult.

type SearchResultsPreviewResponse added in v0.1.4

type SearchResultsPreviewResponse struct {
	// FilterWarnings Advisory warnings about the supplied filter — for example filtering on a known field with no payload index, which is matched by scanning, or a collection excluded because it holds only open-access content and the filter asked for open_access=false. The search still runs. Omitted when there are none.
	FilterWarnings *[]FilterWarning `json:"filterWarnings,omitempty"`

	// JournalMetricExpansions How each journal-metric condition resolved to ISSNs; omitted when no metric filter was used
	JournalMetricExpansions *[]JournalMetricExpansion `json:"journalMetricExpansions,omitempty"`

	// LatencyMs Search latency in milliseconds
	LatencyMs int `json:"latencyMs"`

	// QueryId Unique identifier for this query, matching the original search response.
	QueryId string `json:"queryId"`

	// Results Every result from the original search, filtered through the unlock ledger.
	Results []PreviewResult `json:"results"`
}

SearchResultsPreviewResponse defines model for SearchResultsPreviewResponse.

type SearchUnlockJSONRequestBody added in v0.1.4

type SearchUnlockJSONRequestBody = UnlockRequest

SearchUnlockJSONRequestBody defines body for SearchUnlock for application/json ContentType.

type SearchUnlockResponse added in v0.1.4

type SearchUnlockResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *PreviewUnlockResponse
	// JSON401 the response for an HTTP 401 `application/json` response
	JSON401 *Error
	// JSON402 the response for an HTTP 402 `application/json` response
	JSON402 *Error
	// JSON404 the response for an HTTP 404 `application/json` response
	JSON404 *Error
	// JSON410 the response for an HTTP 410 `application/json` response
	JSON410 *Error
	// JSON422 the response for an HTTP 422 `application/json` response
	JSON422 *Error
	// JSON429 the response for an HTTP 429 `application/json` response
	JSON429 *Error
	// JSON503 the response for an HTTP 503 `application/json` response
	JSON503 *Error
}

func ParseSearchUnlockResponse added in v0.1.4

func ParseSearchUnlockResponse(rsp *http.Response) (*SearchUnlockResponse, error)

ParseSearchUnlockResponse parses an HTTP response from a SearchUnlockWithResponse call

func (SearchUnlockResponse) ContentType added in v0.1.4

func (r SearchUnlockResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (SearchUnlockResponse) GetBody added in v0.1.4

func (r SearchUnlockResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (SearchUnlockResponse) GetJSON200 added in v0.1.4

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (SearchUnlockResponse) GetJSON401 added in v0.1.4

func (r SearchUnlockResponse) GetJSON401() *Error

GetJSON401 returns the response for an HTTP 401 `application/json` response

func (SearchUnlockResponse) GetJSON402 added in v0.1.4

func (r SearchUnlockResponse) GetJSON402() *Error

GetJSON402 returns the response for an HTTP 402 `application/json` response

func (SearchUnlockResponse) GetJSON404 added in v0.1.4

func (r SearchUnlockResponse) GetJSON404() *Error

GetJSON404 returns the response for an HTTP 404 `application/json` response

func (SearchUnlockResponse) GetJSON410 added in v0.1.4

func (r SearchUnlockResponse) GetJSON410() *Error

GetJSON410 returns the response for an HTTP 410 `application/json` response

func (SearchUnlockResponse) GetJSON422 added in v0.1.4

func (r SearchUnlockResponse) GetJSON422() *Error

GetJSON422 returns the response for an HTTP 422 `application/json` response

func (SearchUnlockResponse) GetJSON429 added in v0.1.4

func (r SearchUnlockResponse) GetJSON429() *Error

GetJSON429 returns the response for an HTTP 429 `application/json` response

func (SearchUnlockResponse) GetJSON503 added in v0.1.4

func (r SearchUnlockResponse) GetJSON503() *Error

GetJSON503 returns the response for an HTTP 503 `application/json` response

func (SearchUnlockResponse) Status added in v0.1.4

func (r SearchUnlockResponse) Status() string

Status returns HTTPResponse.Status

func (SearchUnlockResponse) StatusCode added in v0.1.4

func (r SearchUnlockResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type UnlockRequest added in v0.1.4

type UnlockRequest struct {
	// ImageMaxHeight Maximum image height in pixels
	ImageMaxHeight *int `json:"imageMaxHeight,omitempty"`

	// ImageMaxWidth Maximum image width in pixels
	ImageMaxWidth *int `json:"imageMaxWidth,omitempty"`

	// ImageQuality JPEG quality for fetched images
	ImageQuality *int `json:"imageQuality,omitempty"`

	// IncludeFigures Fetch figure images, returned as base64 in each result's metadata. Candidates are every result unlocked under this queryId, this call's and earlier calls' alike, but at most 50 images are fetched per call: the ids in resultIds — or, when it is omitted, the results this call unlocked — get that budget first, and figures past it come back as captions with no image_data. Ask again for the ids you still want; re-sending ids already unlocked charges nothing. Free — figures are not priced into the token cost, so this changes latency and response size, never the charge. Off by default: use the preview's figureCount to decide. includeImages is a deprecated alias.
	IncludeFigures *bool `json:"includeFigures,omitempty"`

	// QueryId The `queryId` from a previous POST /search/preview response.
	QueryId string `json:"queryId"`

	// ResultIds Result ids to unlock. Omit (or pass `null`) to unlock every result from the preview. Re-sending an id that is already unlocked costs nothing — only the delta is charged.
	ResultIds *[]string `json:"resultIds,omitempty"`
}

UnlockRequest defines model for UnlockRequest.

type ValidationError

type ValidationError struct{ APIError }

ValidationError is 422: request rejected (query too long, bad filter, ...).

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Jump to

Keyboard shortcuts

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