1// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
2
3package ozone
4
5// schema: tools.ozone.hosting.getAccountHistory
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// HostingGetAccountHistory_AccountCreated is a "accountCreated" in the tools.ozone.hosting.getAccountHistory schema.
17//
18// RECORDTYPE: HostingGetAccountHistory_AccountCreated
19type HostingGetAccountHistory_AccountCreated struct {
20 LexiconTypeID string `json:"$type,const=tools.ozone.hosting.getAccountHistory#accountCreated" cborgen:"$type,const=tools.ozone.hosting.getAccountHistory#accountCreated"`
21 Email *string `json:"email,omitempty" cborgen:"email,omitempty"`
22 Handle *string `json:"handle,omitempty" cborgen:"handle,omitempty"`
23}
24
25// HostingGetAccountHistory_EmailConfirmed is a "emailConfirmed" in the tools.ozone.hosting.getAccountHistory schema.
26//
27// RECORDTYPE: HostingGetAccountHistory_EmailConfirmed
28type HostingGetAccountHistory_EmailConfirmed struct {
29 LexiconTypeID string `json:"$type,const=tools.ozone.hosting.getAccountHistory#emailConfirmed" cborgen:"$type,const=tools.ozone.hosting.getAccountHistory#emailConfirmed"`
30 Email string `json:"email" cborgen:"email"`
31}
32
33// HostingGetAccountHistory_EmailUpdated is a "emailUpdated" in the tools.ozone.hosting.getAccountHistory schema.
34//
35// RECORDTYPE: HostingGetAccountHistory_EmailUpdated
36type HostingGetAccountHistory_EmailUpdated struct {
37 LexiconTypeID string `json:"$type,const=tools.ozone.hosting.getAccountHistory#emailUpdated" cborgen:"$type,const=tools.ozone.hosting.getAccountHistory#emailUpdated"`
38 Email string `json:"email" cborgen:"email"`
39}
40
41// HostingGetAccountHistory_Event is a "event" in the tools.ozone.hosting.getAccountHistory schema.
42type HostingGetAccountHistory_Event struct {
43 CreatedAt string `json:"createdAt" cborgen:"createdAt"`
44 CreatedBy string `json:"createdBy" cborgen:"createdBy"`
45 Details *HostingGetAccountHistory_Event_Details `json:"details" cborgen:"details"`
46}
47
48type HostingGetAccountHistory_Event_Details struct {
49 HostingGetAccountHistory_AccountCreated *HostingGetAccountHistory_AccountCreated
50 HostingGetAccountHistory_EmailUpdated *HostingGetAccountHistory_EmailUpdated
51 HostingGetAccountHistory_EmailConfirmed *HostingGetAccountHistory_EmailConfirmed
52 HostingGetAccountHistory_PasswordUpdated *HostingGetAccountHistory_PasswordUpdated
53 HostingGetAccountHistory_HandleUpdated *HostingGetAccountHistory_HandleUpdated
54}
55
56func (t *HostingGetAccountHistory_Event_Details) MarshalJSON() ([]byte, error) {
57 if t.HostingGetAccountHistory_AccountCreated != nil {
58 t.HostingGetAccountHistory_AccountCreated.LexiconTypeID = "tools.ozone.hosting.getAccountHistory#accountCreated"
59 return json.Marshal(t.HostingGetAccountHistory_AccountCreated)
60 }
61 if t.HostingGetAccountHistory_EmailUpdated != nil {
62 t.HostingGetAccountHistory_EmailUpdated.LexiconTypeID = "tools.ozone.hosting.getAccountHistory#emailUpdated"
63 return json.Marshal(t.HostingGetAccountHistory_EmailUpdated)
64 }
65 if t.HostingGetAccountHistory_EmailConfirmed != nil {
66 t.HostingGetAccountHistory_EmailConfirmed.LexiconTypeID = "tools.ozone.hosting.getAccountHistory#emailConfirmed"
67 return json.Marshal(t.HostingGetAccountHistory_EmailConfirmed)
68 }
69 if t.HostingGetAccountHistory_PasswordUpdated != nil {
70 t.HostingGetAccountHistory_PasswordUpdated.LexiconTypeID = "tools.ozone.hosting.getAccountHistory#passwordUpdated"
71 return json.Marshal(t.HostingGetAccountHistory_PasswordUpdated)
72 }
73 if t.HostingGetAccountHistory_HandleUpdated != nil {
74 t.HostingGetAccountHistory_HandleUpdated.LexiconTypeID = "tools.ozone.hosting.getAccountHistory#handleUpdated"
75 return json.Marshal(t.HostingGetAccountHistory_HandleUpdated)
76 }
77 return nil, fmt.Errorf("cannot marshal empty enum")
78}
79func (t *HostingGetAccountHistory_Event_Details) UnmarshalJSON(b []byte) error {
80 typ, err := util.TypeExtract(b)
81 if err != nil {
82 return err
83 }
84
85 switch typ {
86 case "tools.ozone.hosting.getAccountHistory#accountCreated":
87 t.HostingGetAccountHistory_AccountCreated = new(HostingGetAccountHistory_AccountCreated)
88 return json.Unmarshal(b, t.HostingGetAccountHistory_AccountCreated)
89 case "tools.ozone.hosting.getAccountHistory#emailUpdated":
90 t.HostingGetAccountHistory_EmailUpdated = new(HostingGetAccountHistory_EmailUpdated)
91 return json.Unmarshal(b, t.HostingGetAccountHistory_EmailUpdated)
92 case "tools.ozone.hosting.getAccountHistory#emailConfirmed":
93 t.HostingGetAccountHistory_EmailConfirmed = new(HostingGetAccountHistory_EmailConfirmed)
94 return json.Unmarshal(b, t.HostingGetAccountHistory_EmailConfirmed)
95 case "tools.ozone.hosting.getAccountHistory#passwordUpdated":
96 t.HostingGetAccountHistory_PasswordUpdated = new(HostingGetAccountHistory_PasswordUpdated)
97 return json.Unmarshal(b, t.HostingGetAccountHistory_PasswordUpdated)
98 case "tools.ozone.hosting.getAccountHistory#handleUpdated":
99 t.HostingGetAccountHistory_HandleUpdated = new(HostingGetAccountHistory_HandleUpdated)
100 return json.Unmarshal(b, t.HostingGetAccountHistory_HandleUpdated)
101
102 default:
103 return nil
104 }
105}
106
107// HostingGetAccountHistory_HandleUpdated is a "handleUpdated" in the tools.ozone.hosting.getAccountHistory schema.
108//
109// RECORDTYPE: HostingGetAccountHistory_HandleUpdated
110type HostingGetAccountHistory_HandleUpdated struct {
111 LexiconTypeID string `json:"$type,const=tools.ozone.hosting.getAccountHistory#handleUpdated" cborgen:"$type,const=tools.ozone.hosting.getAccountHistory#handleUpdated"`
112 Handle string `json:"handle" cborgen:"handle"`
113}
114
115// HostingGetAccountHistory_Output is the output of a tools.ozone.hosting.getAccountHistory call.
116type HostingGetAccountHistory_Output struct {
117 Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
118 Events []*HostingGetAccountHistory_Event `json:"events" cborgen:"events"`
119}
120
121// HostingGetAccountHistory_PasswordUpdated is a "passwordUpdated" in the tools.ozone.hosting.getAccountHistory schema.
122//
123// RECORDTYPE: HostingGetAccountHistory_PasswordUpdated
124type HostingGetAccountHistory_PasswordUpdated struct {
125 LexiconTypeID string `json:"$type,const=tools.ozone.hosting.getAccountHistory#passwordUpdated" cborgen:"$type,const=tools.ozone.hosting.getAccountHistory#passwordUpdated"`
126}
127
128// HostingGetAccountHistory calls the XRPC method "tools.ozone.hosting.getAccountHistory".
129func HostingGetAccountHistory(ctx context.Context, c *xrpc.Client, cursor string, did string, events []string, limit int64) (*HostingGetAccountHistory_Output, error) {
130 var out HostingGetAccountHistory_Output
131
132 params := map[string]interface{}{
133 "cursor": cursor,
134 "did": did,
135 "events": events,
136 "limit": limit,
137 }
138 if err := c.Do(ctx, xrpc.Query, "", "tools.ozone.hosting.getAccountHistory", params, nil, &out); err != nil {
139 return nil, err
140 }
141
142 return &out, nil
143}