this repo has no description
1// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
3// Lexicon schema: com.atproto.admin.updateSubjectStatus
4
5package atproto
6
7import (
8 "context"
9 "encoding/json"
10 "fmt"
11
12 lexutil "github.com/bluesky-social/indigo/lex/util"
13)
14
15// AdminUpdateSubjectStatus_Input is the input argument to a com.atproto.admin.updateSubjectStatus call.
16type AdminUpdateSubjectStatus_Input struct {
17 Deactivated *AdminDefs_StatusAttr `json:"deactivated,omitempty" cborgen:"deactivated,omitempty"`
18 Subject *AdminUpdateSubjectStatus_Input_Subject `json:"subject" cborgen:"subject"`
19 Takedown *AdminDefs_StatusAttr `json:"takedown,omitempty" cborgen:"takedown,omitempty"`
20}
21
22type AdminUpdateSubjectStatus_Input_Subject struct {
23 AdminDefs_RepoRef *AdminDefs_RepoRef
24 RepoStrongRef *RepoStrongRef
25 AdminDefs_RepoBlobRef *AdminDefs_RepoBlobRef
26}
27
28func (t *AdminUpdateSubjectStatus_Input_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("can not marshal empty union as JSON")
42}
43
44func (t *AdminUpdateSubjectStatus_Input_Subject) UnmarshalJSON(b []byte) error {
45 typ, err := lexutil.TypeExtract(b)
46 if err != nil {
47 return err
48 }
49
50 switch typ {
51 case "com.atproto.admin.defs#repoRef":
52 t.AdminDefs_RepoRef = new(AdminDefs_RepoRef)
53 return json.Unmarshal(b, t.AdminDefs_RepoRef)
54 case "com.atproto.repo.strongRef":
55 t.RepoStrongRef = new(RepoStrongRef)
56 return json.Unmarshal(b, t.RepoStrongRef)
57 case "com.atproto.admin.defs#repoBlobRef":
58 t.AdminDefs_RepoBlobRef = new(AdminDefs_RepoBlobRef)
59 return json.Unmarshal(b, t.AdminDefs_RepoBlobRef)
60 default:
61 return nil
62 }
63}
64
65// AdminUpdateSubjectStatus_Output is the output of a com.atproto.admin.updateSubjectStatus call.
66type AdminUpdateSubjectStatus_Output struct {
67 Subject *AdminUpdateSubjectStatus_Output_Subject `json:"subject" cborgen:"subject"`
68 Takedown *AdminDefs_StatusAttr `json:"takedown,omitempty" cborgen:"takedown,omitempty"`
69}
70
71type AdminUpdateSubjectStatus_Output_Subject struct {
72 AdminDefs_RepoRef *AdminDefs_RepoRef
73 RepoStrongRef *RepoStrongRef
74 AdminDefs_RepoBlobRef *AdminDefs_RepoBlobRef
75}
76
77func (t *AdminUpdateSubjectStatus_Output_Subject) MarshalJSON() ([]byte, error) {
78 if t.AdminDefs_RepoRef != nil {
79 t.AdminDefs_RepoRef.LexiconTypeID = "com.atproto.admin.defs#repoRef"
80 return json.Marshal(t.AdminDefs_RepoRef)
81 }
82 if t.RepoStrongRef != nil {
83 t.RepoStrongRef.LexiconTypeID = "com.atproto.repo.strongRef"
84 return json.Marshal(t.RepoStrongRef)
85 }
86 if t.AdminDefs_RepoBlobRef != nil {
87 t.AdminDefs_RepoBlobRef.LexiconTypeID = "com.atproto.admin.defs#repoBlobRef"
88 return json.Marshal(t.AdminDefs_RepoBlobRef)
89 }
90 return nil, fmt.Errorf("can not marshal empty union as JSON")
91}
92
93func (t *AdminUpdateSubjectStatus_Output_Subject) UnmarshalJSON(b []byte) error {
94 typ, err := lexutil.TypeExtract(b)
95 if err != nil {
96 return err
97 }
98
99 switch typ {
100 case "com.atproto.admin.defs#repoRef":
101 t.AdminDefs_RepoRef = new(AdminDefs_RepoRef)
102 return json.Unmarshal(b, t.AdminDefs_RepoRef)
103 case "com.atproto.repo.strongRef":
104 t.RepoStrongRef = new(RepoStrongRef)
105 return json.Unmarshal(b, t.RepoStrongRef)
106 case "com.atproto.admin.defs#repoBlobRef":
107 t.AdminDefs_RepoBlobRef = new(AdminDefs_RepoBlobRef)
108 return json.Unmarshal(b, t.AdminDefs_RepoBlobRef)
109 default:
110 return nil
111 }
112}
113
114// AdminUpdateSubjectStatus calls the XRPC method "com.atproto.admin.updateSubjectStatus".
115func AdminUpdateSubjectStatus(ctx context.Context, c lexutil.LexClient, input *AdminUpdateSubjectStatus_Input) (*AdminUpdateSubjectStatus_Output, error) {
116 var out AdminUpdateSubjectStatus_Output
117 if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "com.atproto.admin.updateSubjectStatus", nil, input, &out); err != nil {
118 return nil, err
119 }
120
121 return &out, nil
122}