1// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
3package ozone
4
5// schema: tools.ozone.verification.defs
6
7import (
8 "encoding/json"
9 "fmt"
10
11 "github.com/bluesky-social/indigo/lex/util"
12)
13
14// VerificationDefs_VerificationView is a "verificationView" in the tools.ozone.verification.defs schema.
15//
16// Verification data for the associated subject.
17type VerificationDefs_VerificationView struct {
18 // createdAt: Timestamp when the verification was created.
19 CreatedAt string `json:"createdAt" cborgen:"createdAt"`
20 // displayName: Display name of the subject the verification applies to at the moment of verifying, which might not be the same at the time of viewing. The verification is only valid if the current displayName matches the one at the time of verifying.
21 DisplayName string `json:"displayName" cborgen:"displayName"`
22 // handle: Handle of the subject the verification applies to at the moment of verifying, which might not be the same at the time of viewing. The verification is only valid if the current handle matches the one at the time of verifying.
23 Handle string `json:"handle" cborgen:"handle"`
24 // issuer: The user who issued this verification.
25 Issuer string `json:"issuer" cborgen:"issuer"`
26 IssuerProfile *util.LexiconTypeDecoder `json:"issuerProfile,omitempty" cborgen:"issuerProfile,omitempty"`
27 IssuerRepo *VerificationDefs_VerificationView_IssuerRepo `json:"issuerRepo,omitempty" cborgen:"issuerRepo,omitempty"`
28 // revokeReason: Describes the reason for revocation, also indicating that the verification is no longer valid.
29 RevokeReason *string `json:"revokeReason,omitempty" cborgen:"revokeReason,omitempty"`
30 // revokedAt: Timestamp when the verification was revoked.
31 RevokedAt *string `json:"revokedAt,omitempty" cborgen:"revokedAt,omitempty"`
32 // revokedBy: The user who revoked this verification.
33 RevokedBy *string `json:"revokedBy,omitempty" cborgen:"revokedBy,omitempty"`
34 // subject: The subject of the verification.
35 Subject string `json:"subject" cborgen:"subject"`
36 SubjectProfile *util.LexiconTypeDecoder `json:"subjectProfile,omitempty" cborgen:"subjectProfile,omitempty"`
37 SubjectRepo *VerificationDefs_VerificationView_SubjectRepo `json:"subjectRepo,omitempty" cborgen:"subjectRepo,omitempty"`
38 // uri: The AT-URI of the verification record.
39 Uri string `json:"uri" cborgen:"uri"`
40}
41
42type VerificationDefs_VerificationView_IssuerRepo struct {
43 ModerationDefs_RepoViewDetail *ModerationDefs_RepoViewDetail
44 ModerationDefs_RepoViewNotFound *ModerationDefs_RepoViewNotFound
45}
46
47func (t *VerificationDefs_VerificationView_IssuerRepo) MarshalJSON() ([]byte, error) {
48 if t.ModerationDefs_RepoViewDetail != nil {
49 t.ModerationDefs_RepoViewDetail.LexiconTypeID = "tools.ozone.moderation.defs#repoViewDetail"
50 return json.Marshal(t.ModerationDefs_RepoViewDetail)
51 }
52 if t.ModerationDefs_RepoViewNotFound != nil {
53 t.ModerationDefs_RepoViewNotFound.LexiconTypeID = "tools.ozone.moderation.defs#repoViewNotFound"
54 return json.Marshal(t.ModerationDefs_RepoViewNotFound)
55 }
56 return nil, fmt.Errorf("cannot marshal empty enum")
57}
58func (t *VerificationDefs_VerificationView_IssuerRepo) UnmarshalJSON(b []byte) error {
59 typ, err := util.TypeExtract(b)
60 if err != nil {
61 return err
62 }
63
64 switch typ {
65 case "tools.ozone.moderation.defs#repoViewDetail":
66 t.ModerationDefs_RepoViewDetail = new(ModerationDefs_RepoViewDetail)
67 return json.Unmarshal(b, t.ModerationDefs_RepoViewDetail)
68 case "tools.ozone.moderation.defs#repoViewNotFound":
69 t.ModerationDefs_RepoViewNotFound = new(ModerationDefs_RepoViewNotFound)
70 return json.Unmarshal(b, t.ModerationDefs_RepoViewNotFound)
71
72 default:
73 return nil
74 }
75}
76
77type VerificationDefs_VerificationView_SubjectRepo struct {
78 ModerationDefs_RepoViewDetail *ModerationDefs_RepoViewDetail
79 ModerationDefs_RepoViewNotFound *ModerationDefs_RepoViewNotFound
80}
81
82func (t *VerificationDefs_VerificationView_SubjectRepo) MarshalJSON() ([]byte, error) {
83 if t.ModerationDefs_RepoViewDetail != nil {
84 t.ModerationDefs_RepoViewDetail.LexiconTypeID = "tools.ozone.moderation.defs#repoViewDetail"
85 return json.Marshal(t.ModerationDefs_RepoViewDetail)
86 }
87 if t.ModerationDefs_RepoViewNotFound != nil {
88 t.ModerationDefs_RepoViewNotFound.LexiconTypeID = "tools.ozone.moderation.defs#repoViewNotFound"
89 return json.Marshal(t.ModerationDefs_RepoViewNotFound)
90 }
91 return nil, fmt.Errorf("cannot marshal empty enum")
92}
93func (t *VerificationDefs_VerificationView_SubjectRepo) UnmarshalJSON(b []byte) error {
94 typ, err := util.TypeExtract(b)
95 if err != nil {
96 return err
97 }
98
99 switch typ {
100 case "tools.ozone.moderation.defs#repoViewDetail":
101 t.ModerationDefs_RepoViewDetail = new(ModerationDefs_RepoViewDetail)
102 return json.Unmarshal(b, t.ModerationDefs_RepoViewDetail)
103 case "tools.ozone.moderation.defs#repoViewNotFound":
104 t.ModerationDefs_RepoViewNotFound = new(ModerationDefs_RepoViewNotFound)
105 return json.Unmarshal(b, t.ModerationDefs_RepoViewNotFound)
106
107 default:
108 return nil
109 }
110}