~james/core

core/api/org_tangled/queryenrichResponse.go -rw-r--r-- 4.8 KiB
452f17b7 — james chore(import): snapshot james.dad.town/core at f70c71c7696a 16 hours ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.

package org_tangled

// schema: org.tangled.query.enrichResponse

import (
	"context"

	comatprototypes "github.com/bluesky-social/indigo/api/atproto"
	"github.com/bluesky-social/indigo/lex/util"
)

const (
	QueryEnrichResponseNSID = "org.tangled.query.enrichResponse"
)

// QueryEnrichResponse_Input is the input argument to a org.tangled.query.enrichResponse call.
type QueryEnrichResponse_Input struct {
	// enrich: Payloads to compute for each found reference.
	Enrich []*QueryEnrichResponse_LinkDescriptor `json:"enrich" cborgen:"enrich"`
	// params: Parameters for the inner query, exactly as it declares them.
	Params *util.LexiconTypeDecoder `json:"params,omitempty" cborgen:"params,omitempty"`
	// viewer: DID whose own relation to each reference is looked up for viewer payloads and views. Required when any descriptor requests a viewer payload.
	Viewer *string `json:"viewer,omitempty" cborgen:"viewer,omitempty"`
	// xrpc: NSID of the inner query to run, e.g. org.tangled.repo.listRepos.
	Xrpc string `json:"xrpc" cborgen:"xrpc"`
}

// QueryEnrichResponse_Labels is a "labels" in the org.tangled.query.enrichResponse schema.
//
// Moderation labels the configured labeler applied. Only !hide and !warn are served, takedowns leave subjects out instead. Use collection:. for labels on the record, collection:.repo for labels on its author's account. Absent when there are none.
type QueryEnrichResponse_Labels struct {
	Labels []*comatprototypes.LabelDefs_Label `json:"labels" cborgen:"labels"`
}

// QueryEnrichResponse_LinkDescriptor is a "linkDescriptor" in the org.tangled.query.enrichResponse schema.
//
// One sidecar payload, computed from the records at a link source whose reference equals the found reference.
type QueryEnrichResponse_LinkDescriptor struct {
	// source: Collection whose records are linked, a colon, then an index-backed path (subject or .repo), or . for the record the reference names, which hydrates into that collection's view.
	Source string `json:"source" cborgen:"source"`
	// targets: Record paths into the inner response selecting references for this payload. A path can end in an envelope: path:.repo for a ref's author, path:.rkey for the did its rkey names, path:. for the ref itself. All references are considered when omitted.
	Targets []string `json:"targets,omitempty" cborgen:"targets,omitempty"`
	// type: NSID of the payload type to produce, which also defines the payload's shape. Results land at data[ref][source][type].
	Type string `json:"type" cborgen:"type"`
}

// QueryEnrichResponse_Output is the output of a org.tangled.query.enrichResponse call.
type QueryEnrichResponse_Output struct {
	// data: Reference (did or at-uri) -> link source -> payload type nsid -> payload. References no descriptor applies to are absent.
	Data *util.LexiconTypeDecoder `json:"data" cborgen:"data"`
	// output: The inner query's response, unmodified.
	Output *util.LexiconTypeDecoder `json:"output" cborgen:"output"`
}

// QueryEnrichResponse_ReactionSummary is a "reactionSummary" in the org.tangled.query.enrichResponse schema.
type QueryEnrichResponse_ReactionSummary struct {
	Count    int64  `json:"count" cborgen:"count"`
	Reaction string `json:"reaction" cborgen:"reaction"`
	// reactors: The newest few who reacted with this emoji, at most 10.
	Reactors []string `json:"reactors" cborgen:"reactors"`
	// viewer: The viewer's own reaction with this emoji, when a viewer was given and has one.
	Viewer *QueryEnrichResponse_ViewerReaction `json:"viewer,omitempty" cborgen:"viewer,omitempty"`
}

// QueryEnrichResponse_Reactions is a "reactions" in the org.tangled.query.enrichResponse schema.
//
// Reaction counts per emoji on a subject, each with its newest reactors and the viewer's own reaction. Use org.tangled.feed.reaction:subject. Reactors' profiles come back as blue.microcosm.identity.resolveMiniDoc payloads under their dids when cached. Emojis keep a fixed order, not by count. Absent when nobody reacted.
type QueryEnrichResponse_Reactions struct {
	Reactions []*QueryEnrichResponse_ReactionSummary `json:"reactions" cborgen:"reactions"`
}

// QueryEnrichResponse_ViewerReaction is a "viewerReaction" in the org.tangled.query.enrichResponse schema.
type QueryEnrichResponse_ViewerReaction struct {
	// cid: Absent when the record couldn't be fetched.
	Cid *string `json:"cid,omitempty" cborgen:"cid,omitempty"`
	Uri string  `json:"uri" cborgen:"uri"`
}

// QueryEnrichResponse calls the XRPC method "org.tangled.query.enrichResponse".
func QueryEnrichResponse(ctx context.Context, c util.LexClient, input *QueryEnrichResponse_Input) (*QueryEnrichResponse_Output, error) {
	var out QueryEnrichResponse_Output
	if err := c.LexDo(ctx, util.Procedure, "application/json", "org.tangled.query.enrichResponse", nil, input, &out); err != nil {
		return nil, err
	}

	return &out, nil
}