1// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
3package ozone
4
5// schema: tools.ozone.moderation.getRecords
6
7import (
8 "context"
9 "encoding/json"
10 "fmt"
11
12 "github.com/bluesky-social/indigo/lex/util"
13)
14
15// ModerationGetRecords_Output is the output of a tools.ozone.moderation.getRecords call.
16type ModerationGetRecords_Output struct {
17 Records []*ModerationGetRecords_Output_Records_Elem `json:"records" cborgen:"records"`
18}
19
20type ModerationGetRecords_Output_Records_Elem struct {
21 ModerationDefs_RecordViewDetail *ModerationDefs_RecordViewDetail
22 ModerationDefs_RecordViewNotFound *ModerationDefs_RecordViewNotFound
23}
24
25func (t *ModerationGetRecords_Output_Records_Elem) MarshalJSON() ([]byte, error) {
26 if t.ModerationDefs_RecordViewDetail != nil {
27 t.ModerationDefs_RecordViewDetail.LexiconTypeID = "tools.ozone.moderation.defs#recordViewDetail"
28 return json.Marshal(t.ModerationDefs_RecordViewDetail)
29 }
30 if t.ModerationDefs_RecordViewNotFound != nil {
31 t.ModerationDefs_RecordViewNotFound.LexiconTypeID = "tools.ozone.moderation.defs#recordViewNotFound"
32 return json.Marshal(t.ModerationDefs_RecordViewNotFound)
33 }
34 return nil, fmt.Errorf("cannot marshal empty enum")
35}
36func (t *ModerationGetRecords_Output_Records_Elem) UnmarshalJSON(b []byte) error {
37 typ, err := util.TypeExtract(b)
38 if err != nil {
39 return err
40 }
41
42 switch typ {
43 case "tools.ozone.moderation.defs#recordViewDetail":
44 t.ModerationDefs_RecordViewDetail = new(ModerationDefs_RecordViewDetail)
45 return json.Unmarshal(b, t.ModerationDefs_RecordViewDetail)
46 case "tools.ozone.moderation.defs#recordViewNotFound":
47 t.ModerationDefs_RecordViewNotFound = new(ModerationDefs_RecordViewNotFound)
48 return json.Unmarshal(b, t.ModerationDefs_RecordViewNotFound)
49
50 default:
51 return nil
52 }
53}
54
55// ModerationGetRecords calls the XRPC method "tools.ozone.moderation.getRecords".
56func ModerationGetRecords(ctx context.Context, c util.LexClient, uris []string) (*ModerationGetRecords_Output, error) {
57 var out ModerationGetRecords_Output
58
59 params := map[string]interface{}{}
60 params["uris"] = uris
61 if err := c.LexDo(ctx, util.Query, "", "tools.ozone.moderation.getRecords", params, nil, &out); err != nil {
62 return nil, err
63 }
64
65 return &out, nil
66}