this repo has no description
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/lex/util"
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 util.LexClient, 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 if author != "" {
39 params["author"] = author
40 }
41 if cursor != "" {
42 params["cursor"] = cursor
43 }
44 if domain != "" {
45 params["domain"] = domain
46 }
47 if lang != "" {
48 params["lang"] = lang
49 }
50 if limit != 0 {
51 params["limit"] = limit
52 }
53 if mentions != "" {
54 params["mentions"] = mentions
55 }
56 params["q"] = q
57 if since != "" {
58 params["since"] = since
59 }
60 if sort != "" {
61 params["sort"] = sort
62 }
63 if len(tag) != 0 {
64 params["tag"] = tag
65 }
66 if until != "" {
67 params["until"] = until
68 }
69 if url != "" {
70 params["url"] = url
71 }
72 if err := c.LexDo(ctx, util.Query, "", "app.bsky.feed.searchPosts", params, nil, &out); err != nil {
73 return nil, err
74 }
75
76 return &out, nil
77}