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 "github.com/bluesky-social/indigo/xrpc"
14)
15
16// ModerationGetRepos_Output is the output of a tools.ozone.moderation.getRepos call.
17type ModerationGetRepos_Output struct {
18 Repos []*ModerationGetRepos_Output_Repos_Elem `json:"repos" cborgen:"repos"`
19}
20
21type ModerationGetRepos_Output_Repos_Elem struct {
22 ModerationDefs_RepoViewDetail *ModerationDefs_RepoViewDetail
23 ModerationDefs_RepoViewNotFound *ModerationDefs_RepoViewNotFound
24}
25
26func (t *ModerationGetRepos_Output_Repos_Elem) MarshalJSON() ([]byte, error) {
27 if t.ModerationDefs_RepoViewDetail != nil {
28 t.ModerationDefs_RepoViewDetail.LexiconTypeID = "tools.ozone.moderation.defs#repoViewDetail"
29 return json.Marshal(t.ModerationDefs_RepoViewDetail)
30 }
31 if t.ModerationDefs_RepoViewNotFound != nil {
32 t.ModerationDefs_RepoViewNotFound.LexiconTypeID = "tools.ozone.moderation.defs#repoViewNotFound"
33 return json.Marshal(t.ModerationDefs_RepoViewNotFound)
34 }
35 return nil, fmt.Errorf("cannot marshal empty enum")
36}
37func (t *ModerationGetRepos_Output_Repos_Elem) UnmarshalJSON(b []byte) error {
38 typ, err := util.TypeExtract(b)
39 if err != nil {
40 return err
41 }
42
43 switch typ {
44 case "tools.ozone.moderation.defs#repoViewDetail":
45 t.ModerationDefs_RepoViewDetail = new(ModerationDefs_RepoViewDetail)
46 return json.Unmarshal(b, t.ModerationDefs_RepoViewDetail)
47 case "tools.ozone.moderation.defs#repoViewNotFound":
48 t.ModerationDefs_RepoViewNotFound = new(ModerationDefs_RepoViewNotFound)
49 return json.Unmarshal(b, t.ModerationDefs_RepoViewNotFound)
50
51 default:
52 return nil
53 }
54}
55
56// ModerationGetRepos calls the XRPC method "tools.ozone.moderation.getRepos".
57func ModerationGetRepos(ctx context.Context, c *xrpc.Client, dids []string) (*ModerationGetRepos_Output, error) {
58 var out ModerationGetRepos_Output
59
60 params := map[string]interface{}{
61 "dids": dids,
62 }
63 if err := c.Do(ctx, xrpc.Query, "", "tools.ozone.moderation.getRepos", params, nil, &out); err != nil {
64 return nil, err
65 }
66
67 return &out, nil
68}