1// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
3package ozone
4
5// schema: tools.ozone.moderation.getRepos
6
7import (
8 "context"
9 "encoding/json"
10 "fmt"
11
12 "github.com/bluesky-social/indigo/lex/util"
13)
14
15// ModerationGetRepos_Output is the output of a tools.ozone.moderation.getRepos call.
16type ModerationGetRepos_Output struct {
17 Repos []*ModerationGetRepos_Output_Repos_Elem `json:"repos" cborgen:"repos"`
18}
19
20type ModerationGetRepos_Output_Repos_Elem struct {
21 ModerationDefs_RepoViewDetail *ModerationDefs_RepoViewDetail
22 ModerationDefs_RepoViewNotFound *ModerationDefs_RepoViewNotFound
23}
24
25func (t *ModerationGetRepos_Output_Repos_Elem) MarshalJSON() ([]byte, error) {
26 if t.ModerationDefs_RepoViewDetail != nil {
27 t.ModerationDefs_RepoViewDetail.LexiconTypeID = "tools.ozone.moderation.defs#repoViewDetail"
28 return json.Marshal(t.ModerationDefs_RepoViewDetail)
29 }
30 if t.ModerationDefs_RepoViewNotFound != nil {
31 t.ModerationDefs_RepoViewNotFound.LexiconTypeID = "tools.ozone.moderation.defs#repoViewNotFound"
32 return json.Marshal(t.ModerationDefs_RepoViewNotFound)
33 }
34 return nil, fmt.Errorf("cannot marshal empty enum")
35}
36func (t *ModerationGetRepos_Output_Repos_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#repoViewDetail":
44 t.ModerationDefs_RepoViewDetail = new(ModerationDefs_RepoViewDetail)
45 return json.Unmarshal(b, t.ModerationDefs_RepoViewDetail)
46 case "tools.ozone.moderation.defs#repoViewNotFound":
47 t.ModerationDefs_RepoViewNotFound = new(ModerationDefs_RepoViewNotFound)
48 return json.Unmarshal(b, t.ModerationDefs_RepoViewNotFound)
49
50 default:
51 return nil
52 }
53}
54
55// ModerationGetRepos calls the XRPC method "tools.ozone.moderation.getRepos".
56func ModerationGetRepos(ctx context.Context, c util.LexClient, dids []string) (*ModerationGetRepos_Output, error) {
57 var out ModerationGetRepos_Output
58
59 params := map[string]interface{}{}
60 params["dids"] = dids
61 if err := c.LexDo(ctx, util.Query, "", "tools.ozone.moderation.getRepos", params, nil, &out); err != nil {
62 return nil, err
63 }
64
65 return &out, nil
66}