repos / hub.go.git


Evgenii Akentev  ·  2024-09-02

server-entities.go

 1package main
 2
 3import (
 4//  "encoding/json"
 5)
 6
 7type Address string
 8type AddressType int
 9
10const (
11  Wallet = iota
12  Contract
13)
14
15type SubMessage struct {
16  addressType AddressType
17  address Address
18  client *Client
19}
20
21type Query interface { isQuery() } 
22
23type GetCopyrightsQuery []Address
24func (gc GetCopyrightsQuery) isQuery() {}
25
26type GetCopyrightsByWalletsQuery []Address
27func (gc GetCopyrightsByWalletsQuery) isQuery() {}
28
29type GetCopyrightStatesQuery []Address
30func (gc GetCopyrightStatesQuery) isQuery() {}
31
32type ClientQuery struct {
33  client *Client
34  query Query
35}
36
37type HubResponse interface { isHubResponse() }
38
39type CopyrightsHubResponse []*Copyright
40func (cr CopyrightsHubResponse) isHubResponse() {}
41
42type CopyrightStatesHubResponse map[Address]*CopyrightState
43func (cr CopyrightStatesHubResponse) isHubResponse() {}
44
45type Message struct {
46  Event string `json:"event"`
47  Addrs []Address `json:"addresses"`
48}
49
50type CopyrightsResponse struct {
51  Event string `json:"event"`
52  Data any `json:"data"`
53}
54
55type CopyrightStatesResponse struct {
56  Event string `json:"event"`
57  States map[Address]*CopyrightState `json:"states"`
58}
59
60type Response struct {
61  copyrightsResponse *CopyrightsResponse
62  copyrightStatesResponse *CopyrightStatesResponse
63}