1// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
3package atproto
4
5// schema: com.atproto.admin.getSubjectStatus
6
7import (
8 "context"
9 "encoding/json"
10 "fmt"
11
12 "github.com/bluesky-social/indigo/lex/util"
13)
14
15// AdminGetSubjectStatus_Output is the output of a com.atproto.admin.getSubjectStatus call.
16type AdminGetSubjectStatus_Output struct {
17 Deactivated *AdminDefs_StatusAttr `json:"deactivated,omitempty" cborgen:"deactivated,omitempty"`
18 Subject *AdminGetSubjectStatus_Output_Subject `json:"subject" cborgen:"subject"`
19 Takedown *AdminDefs_StatusAttr `json:"takedown,omitempty" cborgen:"takedown,omitempty"`
20}
21
22type AdminGetSubjectStatus_Output_Subject struct {
23 AdminDefs_RepoRef *AdminDefs_RepoRef
24 RepoStrongRef *RepoStrongRef
25 AdminDefs_RepoBlobRef *AdminDefs_RepoBlobRef
26}
27
28func (t *AdminGetSubjectStatus_Output_Subject) MarshalJSON() ([]byte, error) {
29 if t.AdminDefs_RepoRef != nil {
30 t.AdminDefs_RepoRef.LexiconTypeID = "com.atproto.admin.defs#repoRef"
31 return json.Marshal(t.AdminDefs_RepoRef)
32 }
33 if t.RepoStrongRef != nil {
34 t.RepoStrongRef.LexiconTypeID = "com.atproto.repo.strongRef"
35 return json.Marshal(t.RepoStrongRef)
36 }
37 if t.AdminDefs_RepoBlobRef != nil {
38 t.AdminDefs_RepoBlobRef.LexiconTypeID = "com.atproto.admin.defs#repoBlobRef"
39 return json.Marshal(t.AdminDefs_RepoBlobRef)
40 }
41 return nil, fmt.Errorf("cannot marshal empty enum")
42}
43func (t *AdminGetSubjectStatus_Output_Subject) UnmarshalJSON(b []byte) error {
44 typ, err := util.TypeExtract(b)
45 if err != nil {
46 return err
47 }
48
49 switch typ {
50 case "com.atproto.admin.defs#repoRef":
51 t.AdminDefs_RepoRef = new(AdminDefs_RepoRef)
52 return json.Unmarshal(b, t.AdminDefs_RepoRef)
53 case "com.atproto.repo.strongRef":
54 t.RepoStrongRef = new(RepoStrongRef)
55 return json.Unmarshal(b, t.RepoStrongRef)
56 case "com.atproto.admin.defs#repoBlobRef":
57 t.AdminDefs_RepoBlobRef = new(AdminDefs_RepoBlobRef)
58 return json.Unmarshal(b, t.AdminDefs_RepoBlobRef)
59
60 default:
61 return nil
62 }
63}
64
65// AdminGetSubjectStatus calls the XRPC method "com.atproto.admin.getSubjectStatus".
66func AdminGetSubjectStatus(ctx context.Context, c util.LexClient, blob string, did string, uri string) (*AdminGetSubjectStatus_Output, error) {
67 var out AdminGetSubjectStatus_Output
68
69 params := map[string]interface{}{}
70 if blob != "" {
71 params["blob"] = blob
72 }
73 if did != "" {
74 params["did"] = did
75 }
76 if uri != "" {
77 params["uri"] = uri
78 }
79 if err := c.LexDo(ctx, util.Query, "", "com.atproto.admin.getSubjectStatus", params, nil, &out); err != nil {
80 return nil, err
81 }
82
83 return &out, nil
84}