1// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
3package bsky
4
5// schema: app.bsky.feed.searchPosts
6
7import (
8 "context"
9
10 "github.com/bluesky-social/indigo/xrpc"
11)
12
13// FeedSearchPosts_Output is the output of a app.bsky.feed.searchPosts call.
14type FeedSearchPosts_Output struct {
15 Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
16 // hitsTotal: Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits.
17 HitsTotal *int64 `json:"hitsTotal,omitempty" cborgen:"hitsTotal,omitempty"`
18 Posts []*FeedDefs_PostView `json:"posts" cborgen:"posts"`
19}
20
21// FeedSearchPosts calls the XRPC method "app.bsky.feed.searchPosts".
22//
23// author: Filter to posts by the given account. Handles are resolved to DID before query-time.
24// cursor: Optional pagination mechanism; may not necessarily allow scrolling through entire result set.
25// domain: Filter to posts with URLs (facet links or embeds) linking to the given domain (hostname). Server may apply hostname normalization.
26// lang: Filter to posts in the given language. Expected to be based on post language field, though server may override language detection.
27// mentions: Filter to posts which mention the given account. Handles are resolved to DID before query-time. Only matches rich-text facet mentions.
28// q: Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended.
29// since: Filter results for posts after the indicated datetime (inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYYY-MM-DD).
30// sort: Specifies the ranking order of results.
31// tag: Filter to posts with the given tag (hashtag), based on rich-text facet or tag field. Do not include the hash (#) prefix. Multiple tags can be specified, with 'AND' matching.
32// until: Filter results for posts before the indicated datetime (not inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYY-MM-DD).
33// url: Filter to posts with links (facet links or embeds) pointing to this URL. Server may apply URL normalization or fuzzy matching.
34func FeedSearchPosts(ctx context.Context, c *xrpc.Client, author string, cursor string, domain string, lang string, limit int64, mentions string, q string, since string, sort string, tag []string, until string, url string) (*FeedSearchPosts_Output, error) {
35 var out FeedSearchPosts_Output
36
37 params := map[string]interface{}{
38 "author": author,
39 "cursor": cursor,
40 "domain": domain,
41 "lang": lang,
42 "limit": limit,
43 "mentions": mentions,
44 "q": q,
45 "since": since,
46 "sort": sort,
47 "tag": tag,
48 "until": until,
49 "url": url,
50 }
51 if err := c.Do(ctx, xrpc.Query, "", "app.bsky.feed.searchPosts", params, nil, &out); err != nil {
52 return nil, err
53 }
54
55 return &out, nil
56}