// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
package org_tangled
// schema: org.tangled.search.query
import (
"context"
"github.com/bluesky-social/indigo/lex/util"
)
const (
SearchQueryNSID = "org.tangled.search.query"
)
// SearchQuery_Hit is a "hit" in the org.tangled.search.query schema.
type SearchQuery_Hit struct {
// author: Present for tickets. The account that opened the ticket, the editor of its first version.
Author *string `json:"author,omitempty" cborgen:"author,omitempty"`
Cid *string `json:"cid,omitempty" cborgen:"cid,omitempty"`
// commentCount: Present for tickets.
CommentCount *int64 `json:"commentCount,omitempty" cborgen:"commentCount,omitempty"`
// nsid: Collection of the matched record.
Nsid string `json:"nsid" cborgen:"nsid"`
// score: Relevance score of the hit, a floating-point number where higher ranks first.
Score *util.LexiconTypeDecoder `json:"score" cborgen:"score"`
// state: Present for tickets.
State *string `json:"state,omitempty" cborgen:"state,omitempty"`
Uri string `json:"uri" cborgen:"uri"`
// value: Embedded matched record.
Value *util.LexiconTypeDecoder `json:"value" cborgen:"value"`
}
// SearchQuery_Output is the output of a org.tangled.search.query call.
type SearchQuery_Output struct {
Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
Hits []*SearchQuery_Hit `json:"hits" cborgen:"hits"`
// stateCounts: Matches per ticket state, without the state filters.
StateCounts *SearchQuery_StateCounts `json:"stateCounts,omitempty" cborgen:"stateCounts,omitempty"`
// total: Number of matches across all pages.
Total *int64 `json:"total,omitempty" cborgen:"total,omitempty"`
}
// SearchQuery_StateCounts is a "stateCounts" in the org.tangled.search.query schema.
type SearchQuery_StateCounts struct {
Closed int64 `json:"closed" cborgen:"closed"`
Completed int64 `json:"completed" cborgen:"completed"`
Open int64 `json:"open" cborgen:"open"`
}
// SearchQuery calls the XRPC method "org.tangled.search.query".
//
// author: Restrict to records authored by this DID.
// cursor: Pagination cursor
// kind: Restrict tickets to issues or pull requests.
// label: Restrict tickets to those with all of these label names. Requires repo.
// nsid: Restrict to records of this collection.
// offset: Absolute offset for numbered pages. Mutually exclusive with cursor.
// q: Search query: free text plus key:value qualifiers. See the docs for more information.
// repo: Restrict to records under this repo DID.
// since: Restrict to records created at or after this time.
// sort: Result order.
// until: Restrict to records created at or before this time.
func SearchQuery(ctx context.Context, c util.LexClient, author string, cursor string, kind string, label []string, limit int64, nsid string, offset int64, q string, repo string, since string, sort string, until string) (*SearchQuery_Output, error) {
var out SearchQuery_Output
params := map[string]interface{}{}
if author != "" {
params["author"] = author
}
if cursor != "" {
params["cursor"] = cursor
}
if kind != "" {
params["kind"] = kind
}
if len(label) != 0 {
params["label"] = label
}
if limit != 0 {
params["limit"] = limit
}
if nsid != "" {
params["nsid"] = nsid
}
if offset != 0 {
params["offset"] = offset
}
if q != "" {
params["q"] = q
}
if repo != "" {
params["repo"] = repo
}
if since != "" {
params["since"] = since
}
if sort != "" {
params["sort"] = sort
}
if until != "" {
params["until"] = until
}
if err := c.LexDo(ctx, util.Query, "", "org.tangled.search.query", params, nil, &out); err != nil {
return nil, err
}
return &out, nil
}