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