@@ -19,6 +19,94 @@ import qualified Proto3.Suite as Proto3
19
19
import Proto3.Suite.JSONPB as JSONPB
20
20
import Proto3.Wire (at , oneof )
21
21
22
+ data PingRequest = PingRequest
23
+ { service :: Text
24
+ } deriving stock (Eq , Ord , Show , Generic )
25
+ deriving anyclass (Proto3.Named , NFData )
26
+
27
+ instance FromJSONPB PingRequest where
28
+ parseJSONPB = A. withObject " PingRequest" $ \ obj -> PingRequest
29
+ <$> obj .: " service"
30
+
31
+ instance ToJSONPB PingRequest where
32
+ toJSONPB PingRequest {.. } = object
33
+ [
34
+ " service" .= service
35
+ ]
36
+ toEncodingPB PingRequest {.. } = pairs
37
+ [
38
+ " service" .= service
39
+ ]
40
+
41
+ instance FromJSON PingRequest where
42
+ parseJSON = parseJSONPB
43
+
44
+ instance ToJSON PingRequest where
45
+ toJSON = toAesonValue
46
+ toEncoding = toAesonEncoding
47
+
48
+ instance Proto3. Message PingRequest where
49
+ encodeMessage _ PingRequest {.. } = mconcat
50
+ [
51
+ encodeMessageField 1 service
52
+ ]
53
+ decodeMessage _ = PingRequest
54
+ <$> at decodeMessageField 1
55
+ dotProto = undefined
56
+
57
+ data PingResponse = PingResponse
58
+ { status :: Text
59
+ , hostname :: Text
60
+ , timestamp :: Text
61
+ , sha :: Text
62
+ } deriving stock (Eq , Ord , Show , Generic )
63
+ deriving anyclass (Proto3.Named , NFData )
64
+
65
+ instance FromJSONPB PingResponse where
66
+ parseJSONPB = A. withObject " PingResponse" $ \ obj -> PingResponse
67
+ <$> obj .: " status"
68
+ <*> obj .: " hostname"
69
+ <*> obj .: " timestamp"
70
+ <*> obj .: " sha"
71
+
72
+ instance ToJSONPB PingResponse where
73
+ toJSONPB PingResponse {.. } = object
74
+ [
75
+ " status" .= status
76
+ , " hostname" .= hostname
77
+ , " timestamp" .= timestamp
78
+ , " sha" .= sha
79
+ ]
80
+ toEncodingPB PingResponse {.. } = pairs
81
+ [
82
+ " status" .= status
83
+ , " hostname" .= hostname
84
+ , " timestamp" .= timestamp
85
+ , " sha" .= sha
86
+ ]
87
+
88
+ instance FromJSON PingResponse where
89
+ parseJSON = parseJSONPB
90
+
91
+ instance ToJSON PingResponse where
92
+ toJSON = toAesonValue
93
+ toEncoding = toAesonEncoding
94
+
95
+ instance Proto3. Message PingResponse where
96
+ encodeMessage _ PingResponse {.. } = mconcat
97
+ [
98
+ encodeMessageField 1 status
99
+ , encodeMessageField 2 hostname
100
+ , encodeMessageField 3 timestamp
101
+ , encodeMessageField 4 sha
102
+ ]
103
+ decodeMessage _ = PingResponse
104
+ <$> at decodeMessageField 1
105
+ <*> at decodeMessageField 2
106
+ <*> at decodeMessageField 3
107
+ <*> at decodeMessageField 4
108
+ dotProto = undefined
109
+
22
110
data ParseTreeRequest = ParseTreeRequest
23
111
{ blobs :: Vector Blob
24
112
} deriving stock (Eq , Ord , Show , Generic )
0 commit comments