1package atkafka
2
3import (
4 "github.com/bluesky-social/indigo/api/bsky"
5 "github.com/bluesky-social/indigo/atproto/identity"
6)
7
8type AtKafkaOp struct {
9 Action string `json:"action"`
10 Collection string `json:"collection"`
11 Rkey string `json:"rkey"`
12 Uri string `json:"uri"`
13 Cid string `json:"cid"`
14 Path string `json:"path"`
15 Record map[string]any `json:"record"`
16}
17
18type AtKafkaIdentity struct {
19 Seq int64 `json:"seq"`
20 Handle string `json:"handle"`
21}
22
23type AtKafkaInfo struct {
24 Name string `json:"name"`
25 Message *string `json:"message,omitempty"`
26}
27
28type AtKafkaAccount struct {
29 Active bool `json:"active"`
30 Seq int64 `json:"seq"`
31 Status *string `json:"status,omitempty"`
32}
33
34type AtKafkaEvent struct {
35 Did string `json:"did"`
36 Timestamp string `json:"timestamp"`
37 Metadata *EventMetadata `json:"eventMetadata"`
38
39 Operation *AtKafkaOp `json:"operation,omitempty"`
40 Account *AtKafkaAccount `json:"account,omitempty"`
41 Identity *AtKafkaIdentity `json:"identity,omitempty"`
42 Info *AtKafkaInfo `json:"info,omitempty"`
43}
44
45// Intentionally using snake case since that is what Osprey expects
46type OspreyEventData struct {
47 ActionName string `json:"action_name"`
48 ActionId int64 `json:"action_id"`
49 Data AtKafkaEvent `json:"data"`
50 Timestamp string `json:"timestamp"`
51 SecretData map[string]string `json:"secret_data"`
52 Encoding string `json:"encoding"`
53}
54
55type OspreyAtKafkaEvent struct {
56 Data OspreyEventData `json:"data"`
57 SendTime string `json:"send_time"`
58}
59
60type EventMetadata struct {
61 DidDocument identity.DIDDocument `json:"didDocument,omitempty"`
62 PdsHost string `json:"pdsHost,omitempty"`
63 Handle string `json:"handle,omitempty"`
64 DidCreatedAt string `json:"didCreatedAt,omitempty"`
65 AccountAge int64 `json:"accountAge"`
66 Profile *bsky.ActorDefs_ProfileViewDetailed `json:"profile"`
67}
68
69type TapEvent struct {
70 Id uint `json:"id"`
71 Type string `json:"type"`
72 Record *TapEventRecord `json:"record,omitempty"`
73 Identity *TapEventIdentity `json:"identity,omitempty"`
74}
75
76type TapEventRecord struct {
77 Live bool `json:"live"`
78 Rev string `json:"rev"`
79 Did string `json:"did"`
80 Collection string `json:"collection"`
81 Rkey string `json:"rkey"`
82 Action string `json:"action"`
83 Cid string `json:"cid"`
84 Record *map[string]any `json:"record,omitempty"`
85}
86
87type TapEventIdentity struct {
88 Did string `json:"did"`
89 Handle string `json:"handle"`
90 IsActive bool `json:"isActive"`
91 Status string `json:"status"`
92}
93
94type TapAck struct {
95 Type string `json:"type"`
96 Id uint `json:"id"`
97}