cent 4.0.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2844 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Code generated by gen/generate.rb from proto/api.proto. DO NOT EDIT.
4
+
5
+ module Cent
6
+ # PublishResult is the result of a successful publish.
7
+ #
8
+ # @!attribute [r] offset
9
+ # @return [Integer] The offset of the publication in the channel history stream.
10
+ # @!attribute [r] epoch
11
+ # @return [String] The epoch of the channel history stream.
12
+ class PublishResult < Data.define(:offset, :epoch)
13
+ include Message
14
+
15
+ def initialize(offset: 0, epoch: "") = super
16
+
17
+ # The message as Centrifugo reads it, fields at their zero value left out.
18
+ #
19
+ # @api private
20
+ def to_wire(where = "")
21
+ w = {}
22
+ Wire.put(w, "offset", offset, where, :int)
23
+ Wire.put(w, "epoch", epoch, where, :str)
24
+ w
25
+ end
26
+
27
+ # The message from the Hash JSON.parse gives for it.
28
+ #
29
+ # @api private
30
+ def self.from_wire(v, where = "PublishResult")
31
+ d = Wire.obj(v, where)
32
+ new(
33
+ offset: Wire.get(d, "offset", where, :int),
34
+ epoch: Wire.get(d, "epoch", where, :str)
35
+ )
36
+ end
37
+ end
38
+
39
+ # FilterNode is a tree describing a predicate over client labels. Used as
40
+ # label_filter on Subscribe, Unsubscribe, Disconnect, Refresh and
41
+ # Connections requests. A node is either a leaf comparison (key, cmp, val or
42
+ # vals) or a logical operation (op) over child nodes.
43
+ # Centrifugo PRO only: defined here for protocol-surface consistency,
44
+ # Centrifugo OSS parses it but ignores it.
45
+ #
46
+ # @!attribute [r] op
47
+ # @return [String] The logical operation of a non-leaf node. Empty for a leaf node.
48
+ # One of: and, or, not.
49
+ # @!attribute [r] key
50
+ # @return [String] The label key a leaf node compares.
51
+ # @!attribute [r] cmp
52
+ # @return [String] The comparison of a leaf node. One of: eq, neq, in, nin, ex, nex,
53
+ # sw, ew, ct, gt, gte, lt, lte.
54
+ # @!attribute [r] val
55
+ # @return [String] The value to compare with, for single-value comparisons.
56
+ # @!attribute [r] vals
57
+ # @return [Array<String>] The values to compare with, for "in" and "nin".
58
+ # @!attribute [r] nodes
59
+ # @return [Array<FilterNode>] The child nodes of a logical operation.
60
+ class FilterNode < Data.define(:op, :key, :cmp, :val, :vals, :nodes)
61
+ include Message
62
+
63
+ def initialize(
64
+ op: "",
65
+ key: "",
66
+ cmp: "",
67
+ val: "",
68
+ vals: [],
69
+ nodes: []
70
+ )
71
+ super
72
+ end
73
+
74
+ # The message as Centrifugo reads it, fields at their zero value left out.
75
+ #
76
+ # @api private
77
+ def to_wire(where = "")
78
+ w = {}
79
+ Wire.put(w, "op", op, where, :str)
80
+ Wire.put(w, "key", key, where, :str)
81
+ Wire.put(w, "cmp", cmp, where, :str)
82
+ Wire.put(w, "val", val, where, :str)
83
+ Wire.put(w, "vals", vals, where, :str, :list)
84
+ Wire.put(w, "nodes", nodes, where, FilterNode, :list)
85
+ w
86
+ end
87
+
88
+ # The message from the Hash JSON.parse gives for it.
89
+ #
90
+ # @api private
91
+ def self.from_wire(v, where = "FilterNode")
92
+ d = Wire.obj(v, where)
93
+ new(
94
+ op: Wire.get(d, "op", where, :str),
95
+ key: Wire.get(d, "key", where, :str),
96
+ cmp: Wire.get(d, "cmp", where, :str),
97
+ val: Wire.get(d, "val", where, :str),
98
+ vals: Wire.get(d, "vals", where, :str, :list),
99
+ nodes: Wire.get(d, "nodes", where, FilterNode, :list)
100
+ )
101
+ end
102
+ end
103
+
104
+ # SubscribeOptionOverride overrides channel options for a server-side
105
+ # subscription. Unset fields keep the value from the channel configuration.
106
+ #
107
+ # @!attribute [r] presence
108
+ # @return [Boolean, nil] Overrides the presence channel option.
109
+ # @!attribute [r] join_leave
110
+ # @return [Boolean, nil] Overrides the join_leave channel option.
111
+ # @!attribute [r] force_recovery
112
+ # @return [Boolean, nil] Overrides the force_recovery channel option.
113
+ # @!attribute [r] force_positioning
114
+ # @return [Boolean, nil] Overrides the force_positioning channel option.
115
+ # @!attribute [r] force_push_join_leave
116
+ # @return [Boolean, nil] Overrides the force_push_join_leave channel
117
+ # option.
118
+ class SubscribeOptionOverride < Data.define(:presence, :join_leave, :force_recovery, :force_positioning, :force_push_join_leave)
119
+ include Message
120
+
121
+ def initialize(
122
+ presence: nil,
123
+ join_leave: nil,
124
+ force_recovery: nil,
125
+ force_positioning: nil,
126
+ force_push_join_leave: nil
127
+ )
128
+ super
129
+ end
130
+
131
+ # The message as Centrifugo reads it, fields at their zero value left out.
132
+ #
133
+ # @api private
134
+ def to_wire(where = "")
135
+ w = {}
136
+ Wire.put(w, "presence", presence, where, :bool_value)
137
+ Wire.put(w, "join_leave", join_leave, where, :bool_value)
138
+ Wire.put(w, "force_recovery", force_recovery, where, :bool_value)
139
+ Wire.put(w, "force_positioning", force_positioning, where, :bool_value)
140
+ Wire.put(w, "force_push_join_leave", force_push_join_leave, where, :bool_value)
141
+ w
142
+ end
143
+
144
+ # The message from the Hash JSON.parse gives for it.
145
+ #
146
+ # @api private
147
+ def self.from_wire(v, where = "SubscribeOptionOverride")
148
+ d = Wire.obj(v, where)
149
+ new(
150
+ presence: Wire.get(d, "presence", where, :bool_value),
151
+ join_leave: Wire.get(d, "join_leave", where, :bool_value),
152
+ force_recovery: Wire.get(d, "force_recovery", where, :bool_value),
153
+ force_positioning: Wire.get(d, "force_positioning", where, :bool_value),
154
+ force_push_join_leave: Wire.get(d, "force_push_join_leave", where, :bool_value)
155
+ )
156
+ end
157
+ end
158
+
159
+ # SubscribeResult is the result of a subscribe call. Empty at the moment.
160
+ class SubscribeResult < Data.define
161
+ include Message
162
+
163
+ # The message as Centrifugo reads it, fields at their zero value left out.
164
+ #
165
+ # @api private
166
+ def to_wire(_where = "")
167
+ {}
168
+ end
169
+
170
+ # The message from the Hash JSON.parse gives for it.
171
+ #
172
+ # @api private
173
+ def self.from_wire(v, where = "SubscribeResult")
174
+ Wire.obj(v, where)
175
+ new
176
+ end
177
+ end
178
+
179
+ # UnsubscribeResult is the result of an unsubscribe call. Empty at the
180
+ # moment.
181
+ class UnsubscribeResult < Data.define
182
+ include Message
183
+
184
+ # The message as Centrifugo reads it, fields at their zero value left out.
185
+ #
186
+ # @api private
187
+ def to_wire(_where = "")
188
+ {}
189
+ end
190
+
191
+ # The message from the Hash JSON.parse gives for it.
192
+ #
193
+ # @api private
194
+ def self.from_wire(v, where = "UnsubscribeResult")
195
+ Wire.obj(v, where)
196
+ new
197
+ end
198
+ end
199
+
200
+ # Disconnect describes the code and reason clients are disconnected with.
201
+ #
202
+ # @!attribute [r] code
203
+ # @return [Integer] The disconnect code.
204
+ # @!attribute [r] reason
205
+ # @return [String] The disconnect reason.
206
+ class Disconnect < Data.define(:code, :reason)
207
+ include Message
208
+
209
+ def initialize(code: 0, reason: "") = super
210
+
211
+ # The message as Centrifugo reads it, fields at their zero value left out.
212
+ #
213
+ # @api private
214
+ def to_wire(where = "")
215
+ w = {}
216
+ Wire.put(w, "code", code, where, :int)
217
+ Wire.put(w, "reason", reason, where, :str)
218
+ w
219
+ end
220
+
221
+ # The message from the Hash JSON.parse gives for it.
222
+ #
223
+ # @api private
224
+ def self.from_wire(v, where = "Disconnect")
225
+ d = Wire.obj(v, where)
226
+ new(
227
+ code: Wire.get(d, "code", where, :int),
228
+ reason: Wire.get(d, "reason", where, :str)
229
+ )
230
+ end
231
+ end
232
+
233
+ # DisconnectResult is the result of a disconnect call. Empty at the moment.
234
+ class DisconnectResult < Data.define
235
+ include Message
236
+
237
+ # The message as Centrifugo reads it, fields at their zero value left out.
238
+ #
239
+ # @api private
240
+ def to_wire(_where = "")
241
+ {}
242
+ end
243
+
244
+ # The message from the Hash JSON.parse gives for it.
245
+ #
246
+ # @api private
247
+ def self.from_wire(v, where = "DisconnectResult")
248
+ Wire.obj(v, where)
249
+ new
250
+ end
251
+ end
252
+
253
+ # ClientInfo describes a client connection.
254
+ #
255
+ # @!attribute [r] user
256
+ # @return [String] The user ID.
257
+ # @!attribute [r] client
258
+ # @return [String] The client ID.
259
+ # @!attribute [r] conn_info
260
+ # @return [Object, nil] Optional connection info.
261
+ # @!attribute [r] chan_info
262
+ # @return [Object, nil] Optional channel info.
263
+ class ClientInfo < Data.define(:user, :client, :conn_info, :chan_info)
264
+ include Message
265
+
266
+ def initialize(
267
+ user: "",
268
+ client: "",
269
+ conn_info: nil,
270
+ chan_info: nil
271
+ )
272
+ super
273
+ end
274
+
275
+ # The message as Centrifugo reads it, fields at their zero value left out.
276
+ #
277
+ # @api private
278
+ def to_wire(where = "")
279
+ w = {}
280
+ Wire.put(w, "user", user, where, :str)
281
+ Wire.put(w, "client", client, where, :str)
282
+ Wire.put(w, "conn_info", conn_info, where, :json)
283
+ Wire.put(w, "chan_info", chan_info, where, :json)
284
+ w
285
+ end
286
+
287
+ # The message from the Hash JSON.parse gives for it.
288
+ #
289
+ # @api private
290
+ def self.from_wire(v, where = "ClientInfo")
291
+ d = Wire.obj(v, where)
292
+ new(
293
+ user: Wire.get(d, "user", where, :str),
294
+ client: Wire.get(d, "client", where, :str),
295
+ conn_info: Wire.get(d, "conn_info", where, :json),
296
+ chan_info: Wire.get(d, "chan_info", where, :json)
297
+ )
298
+ end
299
+ end
300
+
301
+ # PresenceResult is the result of a presence call.
302
+ #
303
+ # @!attribute [r] presence
304
+ # @return [Hash{String => ClientInfo}] Maps client ID to information about the client.
305
+ class PresenceResult < Data.define(:presence)
306
+ include Message
307
+
308
+ def initialize(presence: {}) = super
309
+
310
+ # The message as Centrifugo reads it, fields at their zero value left out.
311
+ #
312
+ # @api private
313
+ def to_wire(where = "")
314
+ w = {}
315
+ Wire.put(w, "presence", presence, where, ClientInfo, :map)
316
+ w
317
+ end
318
+
319
+ # The message from the Hash JSON.parse gives for it.
320
+ #
321
+ # @api private
322
+ def self.from_wire(v, where = "PresenceResult")
323
+ d = Wire.obj(v, where)
324
+ new(
325
+ presence: Wire.get(d, "presence", where, ClientInfo, :map)
326
+ )
327
+ end
328
+ end
329
+
330
+ # PresenceStatsResult is the result of a presence stats call.
331
+ #
332
+ # @!attribute [r] num_clients
333
+ # @return [Integer] The total number of clients in the channel.
334
+ # @!attribute [r] num_users
335
+ # @return [Integer] The number of unique users in the channel.
336
+ class PresenceStatsResult < Data.define(:num_clients, :num_users)
337
+ include Message
338
+
339
+ def initialize(num_clients: 0, num_users: 0) = super
340
+
341
+ # The message as Centrifugo reads it, fields at their zero value left out.
342
+ #
343
+ # @api private
344
+ def to_wire(where = "")
345
+ w = {}
346
+ Wire.put(w, "num_clients", num_clients, where, :int)
347
+ Wire.put(w, "num_users", num_users, where, :int)
348
+ w
349
+ end
350
+
351
+ # The message from the Hash JSON.parse gives for it.
352
+ #
353
+ # @api private
354
+ def self.from_wire(v, where = "PresenceStatsResult")
355
+ d = Wire.obj(v, where)
356
+ new(
357
+ num_clients: Wire.get(d, "num_clients", where, :int),
358
+ num_users: Wire.get(d, "num_users", where, :int)
359
+ )
360
+ end
361
+ end
362
+
363
+ # StreamPosition is a position in a channel stream.
364
+ #
365
+ # @!attribute [r] offset
366
+ # @return [Integer] The offset in the stream.
367
+ # @!attribute [r] epoch
368
+ # @return [String] The stream epoch.
369
+ class StreamPosition < Data.define(:offset, :epoch)
370
+ include Message
371
+
372
+ def initialize(offset: 0, epoch: "") = super
373
+
374
+ # The message as Centrifugo reads it, fields at their zero value left out.
375
+ #
376
+ # @api private
377
+ def to_wire(where = "")
378
+ w = {}
379
+ Wire.put(w, "offset", offset, where, :int)
380
+ Wire.put(w, "epoch", epoch, where, :str)
381
+ w
382
+ end
383
+
384
+ # The message from the Hash JSON.parse gives for it.
385
+ #
386
+ # @api private
387
+ def self.from_wire(v, where = "StreamPosition")
388
+ d = Wire.obj(v, where)
389
+ new(
390
+ offset: Wire.get(d, "offset", where, :int),
391
+ epoch: Wire.get(d, "epoch", where, :str)
392
+ )
393
+ end
394
+ end
395
+
396
+ # Publication is a publication in a channel history.
397
+ #
398
+ # @!attribute [r] data
399
+ # @return [Object, nil] The publication payload.
400
+ # @!attribute [r] info
401
+ # @return [ClientInfo, nil] Information about the client that published, if any.
402
+ # @!attribute [r] offset
403
+ # @return [Integer] The offset of the publication in the history stream.
404
+ # @!attribute [r] tags
405
+ # @return [Hash{String => String}] The publication tags.
406
+ class Publication < Data.define(:data, :info, :offset, :tags)
407
+ include Message
408
+
409
+ def initialize(
410
+ data: nil,
411
+ info: nil,
412
+ offset: 0,
413
+ tags: {}
414
+ )
415
+ super
416
+ end
417
+
418
+ # The message as Centrifugo reads it, fields at their zero value left out.
419
+ #
420
+ # @api private
421
+ def to_wire(where = "")
422
+ w = {}
423
+ Wire.put(w, "data", data, where, :json)
424
+ Wire.put(w, "info", info, where, ClientInfo)
425
+ Wire.put(w, "offset", offset, where, :int)
426
+ Wire.put(w, "tags", tags, where, :str, :map)
427
+ w
428
+ end
429
+
430
+ # The message from the Hash JSON.parse gives for it.
431
+ #
432
+ # @api private
433
+ def self.from_wire(v, where = "Publication")
434
+ d = Wire.obj(v, where)
435
+ new(
436
+ data: Wire.get(d, "data", where, :json),
437
+ info: Wire.get(d, "info", where, ClientInfo),
438
+ offset: Wire.get(d, "offset", where, :int),
439
+ tags: Wire.get(d, "tags", where, :str, :map)
440
+ )
441
+ end
442
+ end
443
+
444
+ # HistoryResult is the result of a history call.
445
+ #
446
+ # @!attribute [r] publications
447
+ # @return [Array<Publication>] The list of publications.
448
+ # @!attribute [r] epoch
449
+ # @return [String] The epoch of the current stream.
450
+ # @!attribute [r] offset
451
+ # @return [Integer] The top offset of the history stream.
452
+ class HistoryResult < Data.define(:publications, :epoch, :offset)
453
+ include Message
454
+
455
+ def initialize(publications: [], epoch: "", offset: 0) = super
456
+
457
+ # The message as Centrifugo reads it, fields at their zero value left out.
458
+ #
459
+ # @api private
460
+ def to_wire(where = "")
461
+ w = {}
462
+ Wire.put(w, "publications", publications, where, Publication, :list)
463
+ Wire.put(w, "epoch", epoch, where, :str)
464
+ Wire.put(w, "offset", offset, where, :int)
465
+ w
466
+ end
467
+
468
+ # The message from the Hash JSON.parse gives for it.
469
+ #
470
+ # @api private
471
+ def self.from_wire(v, where = "HistoryResult")
472
+ d = Wire.obj(v, where)
473
+ new(
474
+ publications: Wire.get(d, "publications", where, Publication, :list),
475
+ epoch: Wire.get(d, "epoch", where, :str),
476
+ offset: Wire.get(d, "offset", where, :int)
477
+ )
478
+ end
479
+ end
480
+
481
+ # HistoryRemoveResult is the result of a history remove call. Empty at the
482
+ # moment.
483
+ class HistoryRemoveResult < Data.define
484
+ include Message
485
+
486
+ # The message as Centrifugo reads it, fields at their zero value left out.
487
+ #
488
+ # @api private
489
+ def to_wire(_where = "")
490
+ {}
491
+ end
492
+
493
+ # The message from the Hash JSON.parse gives for it.
494
+ #
495
+ # @api private
496
+ def self.from_wire(v, where = "HistoryRemoveResult")
497
+ Wire.obj(v, where)
498
+ new
499
+ end
500
+ end
501
+
502
+ # InfoResult is the result of an info call.
503
+ #
504
+ # @!attribute [r] nodes
505
+ # @return [Array<NodeResult>] Information about all nodes of the cluster.
506
+ class InfoResult < Data.define(:nodes)
507
+ include Message
508
+
509
+ def initialize(nodes: []) = super
510
+
511
+ # The message as Centrifugo reads it, fields at their zero value left out.
512
+ #
513
+ # @api private
514
+ def to_wire(where = "")
515
+ w = {}
516
+ Wire.put(w, "nodes", nodes, where, NodeResult, :list)
517
+ w
518
+ end
519
+
520
+ # The message from the Hash JSON.parse gives for it.
521
+ #
522
+ # @api private
523
+ def self.from_wire(v, where = "InfoResult")
524
+ d = Wire.obj(v, where)
525
+ new(
526
+ nodes: Wire.get(d, "nodes", where, NodeResult, :list)
527
+ )
528
+ end
529
+ end
530
+
531
+ # RefreshResult is the result of a refresh call. Empty at the moment.
532
+ class RefreshResult < Data.define
533
+ include Message
534
+
535
+ # The message as Centrifugo reads it, fields at their zero value left out.
536
+ #
537
+ # @api private
538
+ def to_wire(_where = "")
539
+ {}
540
+ end
541
+
542
+ # The message from the Hash JSON.parse gives for it.
543
+ #
544
+ # @api private
545
+ def self.from_wire(v, where = "RefreshResult")
546
+ Wire.obj(v, where)
547
+ new
548
+ end
549
+ end
550
+
551
+ # NodeResult is information about a Centrifugo node.
552
+ #
553
+ # @!attribute [r] uid
554
+ # @return [String] The unique ID of the node.
555
+ # @!attribute [r] name
556
+ # @return [String] The node name.
557
+ # @!attribute [r] version
558
+ # @return [String] The Centrifugo version of the node.
559
+ # @!attribute [r] num_clients
560
+ # @return [Integer] The number of clients connected to the node.
561
+ # @!attribute [r] num_users
562
+ # @return [Integer] The number of unique users connected to the node.
563
+ # @!attribute [r] num_channels
564
+ # @return [Integer] The number of active channels on the node.
565
+ # @!attribute [r] uptime
566
+ # @return [Integer] The node uptime in seconds.
567
+ # @!attribute [r] metrics
568
+ # @return [Metrics, nil] Aggregated node metrics, if available.
569
+ # @!attribute [r] process
570
+ # @return [Process, nil] CPU and memory usage of the node process.
571
+ # Centrifugo PRO only.
572
+ # @!attribute [r] num_subs
573
+ # @return [Integer] The number of subscriptions on the node.
574
+ class NodeResult < Data.define(:uid, :name, :version, :num_clients, :num_users, :num_channels, :uptime, :metrics, :process, :num_subs)
575
+ include Message
576
+
577
+ def initialize(
578
+ uid: "",
579
+ name: "",
580
+ version: "",
581
+ num_clients: 0,
582
+ num_users: 0,
583
+ num_channels: 0,
584
+ uptime: 0,
585
+ metrics: nil,
586
+ process: nil,
587
+ num_subs: 0
588
+ )
589
+ super
590
+ end
591
+
592
+ # The message as Centrifugo reads it, fields at their zero value left out.
593
+ #
594
+ # @api private
595
+ def to_wire(where = "")
596
+ w = {}
597
+ Wire.put(w, "uid", uid, where, :str)
598
+ Wire.put(w, "name", name, where, :str)
599
+ Wire.put(w, "version", version, where, :str)
600
+ Wire.put(w, "num_clients", num_clients, where, :int)
601
+ Wire.put(w, "num_users", num_users, where, :int)
602
+ Wire.put(w, "num_channels", num_channels, where, :int)
603
+ Wire.put(w, "uptime", uptime, where, :int)
604
+ Wire.put(w, "metrics", metrics, where, Metrics)
605
+ Wire.put(w, "process", process, where, Process)
606
+ Wire.put(w, "num_subs", num_subs, where, :int)
607
+ w
608
+ end
609
+
610
+ # The message from the Hash JSON.parse gives for it.
611
+ #
612
+ # @api private
613
+ def self.from_wire(v, where = "NodeResult")
614
+ d = Wire.obj(v, where)
615
+ new(
616
+ uid: Wire.get(d, "uid", where, :str),
617
+ name: Wire.get(d, "name", where, :str),
618
+ version: Wire.get(d, "version", where, :str),
619
+ num_clients: Wire.get(d, "num_clients", where, :int),
620
+ num_users: Wire.get(d, "num_users", where, :int),
621
+ num_channels: Wire.get(d, "num_channels", where, :int),
622
+ uptime: Wire.get(d, "uptime", where, :int),
623
+ metrics: Wire.get(d, "metrics", where, Metrics),
624
+ process: Wire.get(d, "process", where, Process),
625
+ num_subs: Wire.get(d, "num_subs", where, :int)
626
+ )
627
+ end
628
+ end
629
+
630
+ # Metrics are aggregated metrics of a node.
631
+ #
632
+ # @!attribute [r] interval
633
+ # @return [Float] The metrics aggregation interval in seconds.
634
+ # @!attribute [r] items
635
+ # @return [Hash{String => Float}] Maps metric name to value.
636
+ class Metrics < Data.define(:interval, :items)
637
+ include Message
638
+
639
+ def initialize(interval: 0.0, items: {}) = super
640
+
641
+ # The message as Centrifugo reads it, fields at their zero value left out.
642
+ #
643
+ # @api private
644
+ def to_wire(where = "")
645
+ w = {}
646
+ Wire.put(w, "interval", interval, where, :float)
647
+ Wire.put(w, "items", items, where, :float, :map)
648
+ w
649
+ end
650
+
651
+ # The message from the Hash JSON.parse gives for it.
652
+ #
653
+ # @api private
654
+ def self.from_wire(v, where = "Metrics")
655
+ d = Wire.obj(v, where)
656
+ new(
657
+ interval: Wire.get(d, "interval", where, :float),
658
+ items: Wire.get(d, "items", where, :float, :map)
659
+ )
660
+ end
661
+ end
662
+
663
+ # Process is resource usage of a node process. Centrifugo PRO only.
664
+ #
665
+ # @!attribute [r] cpu
666
+ # @return [Float] The CPU usage of the process in percent.
667
+ # @!attribute [r] rss
668
+ # @return [Integer] The resident set size of the process in bytes.
669
+ class Process < Data.define(:cpu, :rss)
670
+ include Message
671
+
672
+ def initialize(cpu: 0.0, rss: 0) = super
673
+
674
+ # The message as Centrifugo reads it, fields at their zero value left out.
675
+ #
676
+ # @api private
677
+ def to_wire(where = "")
678
+ w = {}
679
+ Wire.put(w, "cpu", cpu, where, :float)
680
+ Wire.put(w, "rss", rss, where, :int)
681
+ w
682
+ end
683
+
684
+ # The message from the Hash JSON.parse gives for it.
685
+ #
686
+ # @api private
687
+ def self.from_wire(v, where = "Process")
688
+ d = Wire.obj(v, where)
689
+ new(
690
+ cpu: Wire.get(d, "cpu", where, :float),
691
+ rss: Wire.get(d, "rss", where, :int)
692
+ )
693
+ end
694
+ end
695
+
696
+ # ChannelsResult is the result of a channels call.
697
+ #
698
+ # @!attribute [r] channels
699
+ # @return [Hash{String => ChannelInfo}] Maps channel name to information about the channel.
700
+ class ChannelsResult < Data.define(:channels)
701
+ include Message
702
+
703
+ def initialize(channels: {}) = super
704
+
705
+ # The message as Centrifugo reads it, fields at their zero value left out.
706
+ #
707
+ # @api private
708
+ def to_wire(where = "")
709
+ w = {}
710
+ Wire.put(w, "channels", channels, where, ChannelInfo, :map)
711
+ w
712
+ end
713
+
714
+ # The message from the Hash JSON.parse gives for it.
715
+ #
716
+ # @api private
717
+ def self.from_wire(v, where = "ChannelsResult")
718
+ d = Wire.obj(v, where)
719
+ new(
720
+ channels: Wire.get(d, "channels", where, ChannelInfo, :map)
721
+ )
722
+ end
723
+ end
724
+
725
+ # ChannelInfo is information about an active channel.
726
+ #
727
+ # @!attribute [r] num_clients
728
+ # @return [Integer] The number of connections subscribed to the channel.
729
+ class ChannelInfo < Data.define(:num_clients)
730
+ include Message
731
+
732
+ def initialize(num_clients: 0) = super
733
+
734
+ # The message as Centrifugo reads it, fields at their zero value left out.
735
+ #
736
+ # @api private
737
+ def to_wire(where = "")
738
+ w = {}
739
+ Wire.put(w, "num_clients", num_clients, where, :int)
740
+ w
741
+ end
742
+
743
+ # The message from the Hash JSON.parse gives for it.
744
+ #
745
+ # @api private
746
+ def self.from_wire(v, where = "ChannelInfo")
747
+ d = Wire.obj(v, where)
748
+ new(
749
+ num_clients: Wire.get(d, "num_clients", where, :int)
750
+ )
751
+ end
752
+ end
753
+
754
+ # ConnectionsResult is the result of a connections call.
755
+ # Centrifugo PRO only.
756
+ #
757
+ # @!attribute [r] connections
758
+ # @return [Hash{String => ConnectionInfo}] Maps client ID to information about the connection.
759
+ class ConnectionsResult < Data.define(:connections)
760
+ include Message
761
+
762
+ def initialize(connections: {}) = super
763
+
764
+ # The message as Centrifugo reads it, fields at their zero value left out.
765
+ #
766
+ # @api private
767
+ def to_wire(where = "")
768
+ w = {}
769
+ Wire.put(w, "connections", connections, where, ConnectionInfo, :map)
770
+ w
771
+ end
772
+
773
+ # The message from the Hash JSON.parse gives for it.
774
+ #
775
+ # @api private
776
+ def self.from_wire(v, where = "ConnectionsResult")
777
+ d = Wire.obj(v, where)
778
+ new(
779
+ connections: Wire.get(d, "connections", where, ConnectionInfo, :map)
780
+ )
781
+ end
782
+ end
783
+
784
+ # ConnectionInfo is information about a client connection.
785
+ # Centrifugo PRO only.
786
+ #
787
+ # @!attribute [r] app_name
788
+ # @return [String] The client application name, if provided by the client.
789
+ # @!attribute [r] app_version
790
+ # @return [String] The client application version, if provided by the
791
+ # client.
792
+ # @!attribute [r] transport
793
+ # @return [String] The name of the connection transport.
794
+ # @!attribute [r] protocol
795
+ # @return [String] The connection protocol: json or protobuf.
796
+ # @!attribute [r] user
797
+ # @return [String] The user ID of the connection.
798
+ # @!attribute [r] state
799
+ # @return [ConnectionState, nil] The connection state.
800
+ # @!attribute [r] connected_at_ms
801
+ # @return [Integer] The Unix time in milliseconds when the connection
802
+ # was established.
803
+ # @!attribute [r] ping_pong_latency_ms
804
+ # @return [Integer] The last measured client ping/pong round-trip
805
+ # latency in milliseconds. Can be -1 if not available.
806
+ # @!attribute [r] labels
807
+ # @return [Hash{String => String}] The client labels attached to the connection.
808
+ class ConnectionInfo < Data.define(:app_name, :app_version, :transport, :protocol, :user, :state, :connected_at_ms, :ping_pong_latency_ms, :labels)
809
+ include Message
810
+
811
+ def initialize(
812
+ app_name: "",
813
+ app_version: "",
814
+ transport: "",
815
+ protocol: "",
816
+ user: "",
817
+ state: nil,
818
+ connected_at_ms: 0,
819
+ ping_pong_latency_ms: 0,
820
+ labels: {}
821
+ )
822
+ super
823
+ end
824
+
825
+ # The message as Centrifugo reads it, fields at their zero value left out.
826
+ #
827
+ # @api private
828
+ def to_wire(where = "")
829
+ w = {}
830
+ Wire.put(w, "app_name", app_name, where, :str)
831
+ Wire.put(w, "app_version", app_version, where, :str)
832
+ Wire.put(w, "transport", transport, where, :str)
833
+ Wire.put(w, "protocol", protocol, where, :str)
834
+ Wire.put(w, "user", user, where, :str)
835
+ Wire.put(w, "state", state, where, ConnectionState)
836
+ Wire.put(w, "connected_at_ms", connected_at_ms, where, :int)
837
+ Wire.put(w, "ping_pong_latency_ms", ping_pong_latency_ms, where, :int)
838
+ Wire.put(w, "labels", labels, where, :str, :map)
839
+ w
840
+ end
841
+
842
+ # The message from the Hash JSON.parse gives for it.
843
+ #
844
+ # @api private
845
+ def self.from_wire(v, where = "ConnectionInfo")
846
+ d = Wire.obj(v, where)
847
+ new(
848
+ app_name: Wire.get(d, "app_name", where, :str),
849
+ app_version: Wire.get(d, "app_version", where, :str),
850
+ transport: Wire.get(d, "transport", where, :str),
851
+ protocol: Wire.get(d, "protocol", where, :str),
852
+ user: Wire.get(d, "user", where, :str),
853
+ state: Wire.get(d, "state", where, ConnectionState),
854
+ connected_at_ms: Wire.get(d, "connected_at_ms", where, :int),
855
+ ping_pong_latency_ms: Wire.get(d, "ping_pong_latency_ms", where, :int),
856
+ labels: Wire.get(d, "labels", where, :str, :map)
857
+ )
858
+ end
859
+ end
860
+
861
+ # ConnectionState is the state of a client connection.
862
+ # Centrifugo PRO only.
863
+ #
864
+ # @!attribute [r] channels
865
+ # @return [Hash{String => ChannelContext}] Maps the channels the client is subscribed to to their
866
+ # context.
867
+ # @!attribute [r] connection_token
868
+ # @return [ConnectionTokenInfo, nil] Information about the connection token.
869
+ # @!attribute [r] subscription_tokens
870
+ # @return [Hash{String => SubscriptionTokenInfo}] Maps channel to information about the subscription
871
+ # token used to subscribe to it.
872
+ # @!attribute [r] meta
873
+ # @return [Object, nil] The meta information attached to the connection. It is not
874
+ # visible to other clients: Centrifugo never sends it. Meta from a
875
+ # connection token is visible to the user owning the token, though: it
876
+ # must not hold anything that user must not see.
877
+ class ConnectionState < Data.define(:channels, :connection_token, :subscription_tokens, :meta)
878
+ include Message
879
+
880
+ def initialize(
881
+ channels: {},
882
+ connection_token: nil,
883
+ subscription_tokens: {},
884
+ meta: nil
885
+ )
886
+ super
887
+ end
888
+
889
+ # The message as Centrifugo reads it, fields at their zero value left out.
890
+ #
891
+ # @api private
892
+ def to_wire(where = "")
893
+ w = {}
894
+ Wire.put(w, "channels", channels, where, ChannelContext, :map)
895
+ Wire.put(w, "connection_token", connection_token, where, ConnectionTokenInfo)
896
+ Wire.put(w, "subscription_tokens", subscription_tokens, where, SubscriptionTokenInfo, :map)
897
+ Wire.put(w, "meta", meta, where, :json)
898
+ w
899
+ end
900
+
901
+ # The message from the Hash JSON.parse gives for it.
902
+ #
903
+ # @api private
904
+ def self.from_wire(v, where = "ConnectionState")
905
+ d = Wire.obj(v, where)
906
+ new(
907
+ channels: Wire.get(d, "channels", where, ChannelContext, :map),
908
+ connection_token: Wire.get(d, "connection_token", where, ConnectionTokenInfo),
909
+ subscription_tokens: Wire.get(d, "subscription_tokens", where, SubscriptionTokenInfo, :map),
910
+ meta: Wire.get(d, "meta", where, :json)
911
+ )
912
+ end
913
+ end
914
+
915
+ # ChannelContext is context of a channel subscription.
916
+ # Centrifugo PRO only.
917
+ #
918
+ # @!attribute [r] source
919
+ # @return [Integer] The source of the channel subscription (for example,
920
+ # subscription token, subscribe proxy or server API).
921
+ class ChannelContext < Data.define(:source)
922
+ include Message
923
+
924
+ def initialize(source: 0) = super
925
+
926
+ # The message as Centrifugo reads it, fields at their zero value left out.
927
+ #
928
+ # @api private
929
+ def to_wire(where = "")
930
+ w = {}
931
+ Wire.put(w, "source", source, where, :int)
932
+ w
933
+ end
934
+
935
+ # The message from the Hash JSON.parse gives for it.
936
+ #
937
+ # @api private
938
+ def self.from_wire(v, where = "ChannelContext")
939
+ d = Wire.obj(v, where)
940
+ new(
941
+ source: Wire.get(d, "source", where, :int)
942
+ )
943
+ end
944
+ end
945
+
946
+ # ConnectionTokenInfo is information about a connection token.
947
+ # Centrifugo PRO only.
948
+ #
949
+ # @!attribute [r] uid
950
+ # @return [String] The unique token ID (jti claim).
951
+ # @!attribute [r] issued_at
952
+ # @return [Integer] The Unix time in seconds when the token was issued.
953
+ class ConnectionTokenInfo < Data.define(:uid, :issued_at)
954
+ include Message
955
+
956
+ def initialize(uid: "", issued_at: 0) = super
957
+
958
+ # The message as Centrifugo reads it, fields at their zero value left out.
959
+ #
960
+ # @api private
961
+ def to_wire(where = "")
962
+ w = {}
963
+ Wire.put(w, "uid", uid, where, :str)
964
+ Wire.put(w, "issued_at", issued_at, where, :int)
965
+ w
966
+ end
967
+
968
+ # The message from the Hash JSON.parse gives for it.
969
+ #
970
+ # @api private
971
+ def self.from_wire(v, where = "ConnectionTokenInfo")
972
+ d = Wire.obj(v, where)
973
+ new(
974
+ uid: Wire.get(d, "uid", where, :str),
975
+ issued_at: Wire.get(d, "issued_at", where, :int)
976
+ )
977
+ end
978
+ end
979
+
980
+ # SubscriptionTokenInfo is information about a subscription token.
981
+ # Centrifugo PRO only.
982
+ #
983
+ # @!attribute [r] uid
984
+ # @return [String] The unique token ID (jti claim).
985
+ # @!attribute [r] issued_at
986
+ # @return [Integer] The Unix time in seconds when the token was issued.
987
+ class SubscriptionTokenInfo < Data.define(:uid, :issued_at)
988
+ include Message
989
+
990
+ def initialize(uid: "", issued_at: 0) = super
991
+
992
+ # The message as Centrifugo reads it, fields at their zero value left out.
993
+ #
994
+ # @api private
995
+ def to_wire(where = "")
996
+ w = {}
997
+ Wire.put(w, "uid", uid, where, :str)
998
+ Wire.put(w, "issued_at", issued_at, where, :int)
999
+ w
1000
+ end
1001
+
1002
+ # The message from the Hash JSON.parse gives for it.
1003
+ #
1004
+ # @api private
1005
+ def self.from_wire(v, where = "SubscriptionTokenInfo")
1006
+ d = Wire.obj(v, where)
1007
+ new(
1008
+ uid: Wire.get(d, "uid", where, :str),
1009
+ issued_at: Wire.get(d, "issued_at", where, :int)
1010
+ )
1011
+ end
1012
+ end
1013
+
1014
+ # UpdateUserStatusResult is the result of an update user status call. Empty
1015
+ # at the moment. Centrifugo PRO only.
1016
+ class UpdateUserStatusResult < Data.define
1017
+ include Message
1018
+
1019
+ # The message as Centrifugo reads it, fields at their zero value left out.
1020
+ #
1021
+ # @api private
1022
+ def to_wire(_where = "")
1023
+ {}
1024
+ end
1025
+
1026
+ # The message from the Hash JSON.parse gives for it.
1027
+ #
1028
+ # @api private
1029
+ def self.from_wire(v, where = "UpdateUserStatusResult")
1030
+ Wire.obj(v, where)
1031
+ new
1032
+ end
1033
+ end
1034
+
1035
+ # GetUserStatusResult is the result of a get user status call.
1036
+ # Centrifugo PRO only.
1037
+ #
1038
+ # @!attribute [r] statuses
1039
+ # @return [Array<UserStatus>] The statuses of the requested users, in the same order.
1040
+ class GetUserStatusResult < Data.define(:statuses)
1041
+ include Message
1042
+
1043
+ def initialize(statuses: []) = super
1044
+
1045
+ # The message as Centrifugo reads it, fields at their zero value left out.
1046
+ #
1047
+ # @api private
1048
+ def to_wire(where = "")
1049
+ w = {}
1050
+ Wire.put(w, "statuses", statuses, where, UserStatus, :list)
1051
+ w
1052
+ end
1053
+
1054
+ # The message from the Hash JSON.parse gives for it.
1055
+ #
1056
+ # @api private
1057
+ def self.from_wire(v, where = "GetUserStatusResult")
1058
+ d = Wire.obj(v, where)
1059
+ new(
1060
+ statuses: Wire.get(d, "statuses", where, UserStatus, :list)
1061
+ )
1062
+ end
1063
+ end
1064
+
1065
+ # UserStatus is the status of a user. Centrifugo PRO only.
1066
+ #
1067
+ # @!attribute [r] user
1068
+ # @return [String] The user ID.
1069
+ # @!attribute [r] active
1070
+ # @return [Integer] The last active time as Unix seconds. Not set if unknown.
1071
+ # @!attribute [r] online
1072
+ # @return [Integer] The last online time as Unix seconds, updated by Centrifugo
1073
+ # while the user is connected. Not set if unknown.
1074
+ # @!attribute [r] state
1075
+ # @return [String] The custom state set with UpdateUserStatusRequest.state, if
1076
+ # any.
1077
+ class UserStatus < Data.define(:user, :active, :online, :state)
1078
+ include Message
1079
+
1080
+ def initialize(
1081
+ user: "",
1082
+ active: 0,
1083
+ online: 0,
1084
+ state: ""
1085
+ )
1086
+ super
1087
+ end
1088
+
1089
+ # The message as Centrifugo reads it, fields at their zero value left out.
1090
+ #
1091
+ # @api private
1092
+ def to_wire(where = "")
1093
+ w = {}
1094
+ Wire.put(w, "user", user, where, :str)
1095
+ Wire.put(w, "active", active, where, :int)
1096
+ Wire.put(w, "online", online, where, :int)
1097
+ Wire.put(w, "state", state, where, :str)
1098
+ w
1099
+ end
1100
+
1101
+ # The message from the Hash JSON.parse gives for it.
1102
+ #
1103
+ # @api private
1104
+ def self.from_wire(v, where = "UserStatus")
1105
+ d = Wire.obj(v, where)
1106
+ new(
1107
+ user: Wire.get(d, "user", where, :str),
1108
+ active: Wire.get(d, "active", where, :int),
1109
+ online: Wire.get(d, "online", where, :int),
1110
+ state: Wire.get(d, "state", where, :str)
1111
+ )
1112
+ end
1113
+ end
1114
+
1115
+ # DeleteUserStatusResult is the result of a delete user status call. Empty
1116
+ # at the moment. Centrifugo PRO only.
1117
+ class DeleteUserStatusResult < Data.define
1118
+ include Message
1119
+
1120
+ # The message as Centrifugo reads it, fields at their zero value left out.
1121
+ #
1122
+ # @api private
1123
+ def to_wire(_where = "")
1124
+ {}
1125
+ end
1126
+
1127
+ # The message from the Hash JSON.parse gives for it.
1128
+ #
1129
+ # @api private
1130
+ def self.from_wire(v, where = "DeleteUserStatusResult")
1131
+ Wire.obj(v, where)
1132
+ new
1133
+ end
1134
+ end
1135
+
1136
+ # BlockUserResult is the result of a block user call. Empty at the moment.
1137
+ # Centrifugo PRO only.
1138
+ class BlockUserResult < Data.define
1139
+ include Message
1140
+
1141
+ # The message as Centrifugo reads it, fields at their zero value left out.
1142
+ #
1143
+ # @api private
1144
+ def to_wire(_where = "")
1145
+ {}
1146
+ end
1147
+
1148
+ # The message from the Hash JSON.parse gives for it.
1149
+ #
1150
+ # @api private
1151
+ def self.from_wire(v, where = "BlockUserResult")
1152
+ Wire.obj(v, where)
1153
+ new
1154
+ end
1155
+ end
1156
+
1157
+ # UnblockUserResult is the result of an unblock user call. Empty at the
1158
+ # moment. Centrifugo PRO only.
1159
+ class UnblockUserResult < Data.define
1160
+ include Message
1161
+
1162
+ # The message as Centrifugo reads it, fields at their zero value left out.
1163
+ #
1164
+ # @api private
1165
+ def to_wire(_where = "")
1166
+ {}
1167
+ end
1168
+
1169
+ # The message from the Hash JSON.parse gives for it.
1170
+ #
1171
+ # @api private
1172
+ def self.from_wire(v, where = "UnblockUserResult")
1173
+ Wire.obj(v, where)
1174
+ new
1175
+ end
1176
+ end
1177
+
1178
+ # RevokeTokenResult is the result of a revoke token call. Empty at the
1179
+ # moment. Centrifugo PRO only.
1180
+ class RevokeTokenResult < Data.define
1181
+ include Message
1182
+
1183
+ # The message as Centrifugo reads it, fields at their zero value left out.
1184
+ #
1185
+ # @api private
1186
+ def to_wire(_where = "")
1187
+ {}
1188
+ end
1189
+
1190
+ # The message from the Hash JSON.parse gives for it.
1191
+ #
1192
+ # @api private
1193
+ def self.from_wire(v, where = "RevokeTokenResult")
1194
+ Wire.obj(v, where)
1195
+ new
1196
+ end
1197
+ end
1198
+
1199
+ # InvalidateUserTokensResult is the result of an invalidate user tokens
1200
+ # call. Empty at the moment. Centrifugo PRO only.
1201
+ class InvalidateUserTokensResult < Data.define
1202
+ include Message
1203
+
1204
+ # The message as Centrifugo reads it, fields at their zero value left out.
1205
+ #
1206
+ # @api private
1207
+ def to_wire(_where = "")
1208
+ {}
1209
+ end
1210
+
1211
+ # The message from the Hash JSON.parse gives for it.
1212
+ #
1213
+ # @api private
1214
+ def self.from_wire(v, where = "InvalidateUserTokensResult")
1215
+ Wire.obj(v, where)
1216
+ new
1217
+ end
1218
+ end
1219
+
1220
+ # DeviceUserUpdate sets the user of devices. Centrifugo PRO only.
1221
+ #
1222
+ # @!attribute [r] user
1223
+ # @return [String] The user ID to set. Required. "" detaches the devices from their
1224
+ # user.
1225
+ class DeviceUserUpdate < Data.define(:user)
1226
+ include Message
1227
+
1228
+ # The message as Centrifugo reads it, fields at their zero value left out.
1229
+ #
1230
+ # @api private
1231
+ def to_wire(where = "")
1232
+ w = {}
1233
+ Wire.put(w, "user", user, where, :str)
1234
+ w
1235
+ end
1236
+
1237
+ # The message from the Hash JSON.parse gives for it.
1238
+ #
1239
+ # @api private
1240
+ def self.from_wire(v, where = "DeviceUserUpdate")
1241
+ d = Wire.obj(v, where)
1242
+ new(
1243
+ user: Wire.get(d, "user", where, :str)
1244
+ )
1245
+ end
1246
+ end
1247
+
1248
+ # DeviceTimezoneUpdate sets the timezone of devices. Centrifugo PRO only.
1249
+ #
1250
+ # @!attribute [r] timezone
1251
+ # @return [String] The IANA time zone to set. Required. "" clears it.
1252
+ class DeviceTimezoneUpdate < Data.define(:timezone)
1253
+ include Message
1254
+
1255
+ # The message as Centrifugo reads it, fields at their zero value left out.
1256
+ #
1257
+ # @api private
1258
+ def to_wire(where = "")
1259
+ w = {}
1260
+ Wire.put(w, "timezone", timezone, where, :str)
1261
+ w
1262
+ end
1263
+
1264
+ # The message from the Hash JSON.parse gives for it.
1265
+ #
1266
+ # @api private
1267
+ def self.from_wire(v, where = "DeviceTimezoneUpdate")
1268
+ d = Wire.obj(v, where)
1269
+ new(
1270
+ timezone: Wire.get(d, "timezone", where, :str)
1271
+ )
1272
+ end
1273
+ end
1274
+
1275
+ # DeviceLocaleUpdate sets the locale of devices. Centrifugo PRO only.
1276
+ #
1277
+ # @!attribute [r] locale
1278
+ # @return [String] The locale to set. Required. "" clears it.
1279
+ class DeviceLocaleUpdate < Data.define(:locale)
1280
+ include Message
1281
+
1282
+ # The message as Centrifugo reads it, fields at their zero value left out.
1283
+ #
1284
+ # @api private
1285
+ def to_wire(where = "")
1286
+ w = {}
1287
+ Wire.put(w, "locale", locale, where, :str)
1288
+ w
1289
+ end
1290
+
1291
+ # The message from the Hash JSON.parse gives for it.
1292
+ #
1293
+ # @api private
1294
+ def self.from_wire(v, where = "DeviceLocaleUpdate")
1295
+ d = Wire.obj(v, where)
1296
+ new(
1297
+ locale: Wire.get(d, "locale", where, :str)
1298
+ )
1299
+ end
1300
+ end
1301
+
1302
+ # DeviceMetaUpdate sets the meta of devices. Centrifugo PRO only.
1303
+ #
1304
+ # @!attribute [r] meta
1305
+ # @return [Hash{String => String}] The meta to set. Required. An empty map clears it.
1306
+ class DeviceMetaUpdate < Data.define(:meta)
1307
+ include Message
1308
+
1309
+ # The message as Centrifugo reads it, fields at their zero value left out.
1310
+ #
1311
+ # @api private
1312
+ def to_wire(where = "")
1313
+ w = {}
1314
+ Wire.put(w, "meta", meta, where, :str, :map)
1315
+ w
1316
+ end
1317
+
1318
+ # The message from the Hash JSON.parse gives for it.
1319
+ #
1320
+ # @api private
1321
+ def self.from_wire(v, where = "DeviceMetaUpdate")
1322
+ d = Wire.obj(v, where)
1323
+ new(
1324
+ meta: Wire.get(d, "meta", where, :str, :map)
1325
+ )
1326
+ end
1327
+ end
1328
+
1329
+ # DeviceTopicsUpdate changes the topics of devices. Centrifugo PRO only.
1330
+ #
1331
+ # @!attribute [r] op
1332
+ # @return [String] The operation. Required. One of: add, remove, set.
1333
+ # @!attribute [r] topics
1334
+ # @return [Array<String>] The topics for the operation.
1335
+ class DeviceTopicsUpdate < Data.define(:op, :topics)
1336
+ include Message
1337
+
1338
+ def initialize(op:, topics: []) = super
1339
+
1340
+ # The message as Centrifugo reads it, fields at their zero value left out.
1341
+ #
1342
+ # @api private
1343
+ def to_wire(where = "")
1344
+ w = {}
1345
+ Wire.put(w, "op", op, where, :str)
1346
+ Wire.put(w, "topics", topics, where, :str, :list)
1347
+ w
1348
+ end
1349
+
1350
+ # The message from the Hash JSON.parse gives for it.
1351
+ #
1352
+ # @api private
1353
+ def self.from_wire(v, where = "DeviceTopicsUpdate")
1354
+ d = Wire.obj(v, where)
1355
+ new(
1356
+ op: Wire.get(d, "op", where, :str),
1357
+ topics: Wire.get(d, "topics", where, :str, :list)
1358
+ )
1359
+ end
1360
+ end
1361
+
1362
+ # DeviceFilter selects devices. Centrifugo PRO only.
1363
+ #
1364
+ # @!attribute [r] ids
1365
+ # @return [Array<String>] Selects devices by ID.
1366
+ # @!attribute [r] users
1367
+ # @return [Array<String>] Selects devices by user.
1368
+ # @!attribute [r] topics
1369
+ # @return [Array<String>] Selects devices by subscribed topic.
1370
+ # @!attribute [r] providers
1371
+ # @return [Array<String>] Selects devices by token provider.
1372
+ # @!attribute [r] platforms
1373
+ # @return [Array<String>] Selects devices by platform.
1374
+ class DeviceFilter < Data.define(:ids, :users, :topics, :providers, :platforms)
1375
+ include Message
1376
+
1377
+ def initialize(
1378
+ ids: [],
1379
+ users: [],
1380
+ topics: [],
1381
+ providers: [],
1382
+ platforms: []
1383
+ )
1384
+ super
1385
+ end
1386
+
1387
+ # The message as Centrifugo reads it, fields at their zero value left out.
1388
+ #
1389
+ # @api private
1390
+ def to_wire(where = "")
1391
+ w = {}
1392
+ Wire.put(w, "ids", ids, where, :str, :list)
1393
+ Wire.put(w, "users", users, where, :str, :list)
1394
+ Wire.put(w, "topics", topics, where, :str, :list)
1395
+ Wire.put(w, "providers", providers, where, :str, :list)
1396
+ Wire.put(w, "platforms", platforms, where, :str, :list)
1397
+ w
1398
+ end
1399
+
1400
+ # The message from the Hash JSON.parse gives for it.
1401
+ #
1402
+ # @api private
1403
+ def self.from_wire(v, where = "DeviceFilter")
1404
+ d = Wire.obj(v, where)
1405
+ new(
1406
+ ids: Wire.get(d, "ids", where, :str, :list),
1407
+ users: Wire.get(d, "users", where, :str, :list),
1408
+ topics: Wire.get(d, "topics", where, :str, :list),
1409
+ providers: Wire.get(d, "providers", where, :str, :list),
1410
+ platforms: Wire.get(d, "platforms", where, :str, :list)
1411
+ )
1412
+ end
1413
+ end
1414
+
1415
+ # DeviceTopicFilter selects device topic subscriptions. Centrifugo PRO only.
1416
+ #
1417
+ # @!attribute [r] device_ids
1418
+ # @return [Array<String>] Selects by device ID.
1419
+ # @!attribute [r] device_providers
1420
+ # @return [Array<String>] Selects by device token provider.
1421
+ # @!attribute [r] device_platforms
1422
+ # @return [Array<String>] Selects by device platform.
1423
+ # @!attribute [r] device_users
1424
+ # @return [Array<String>] Selects by device user.
1425
+ # @!attribute [r] topics
1426
+ # @return [Array<String>] Selects by topic.
1427
+ # @!attribute [r] topic_prefix
1428
+ # @return [String] Selects by topic prefix.
1429
+ class DeviceTopicFilter < Data.define(:device_ids, :device_providers, :device_platforms, :device_users, :topics, :topic_prefix)
1430
+ include Message
1431
+
1432
+ def initialize(
1433
+ device_ids: [],
1434
+ device_providers: [],
1435
+ device_platforms: [],
1436
+ device_users: [],
1437
+ topics: [],
1438
+ topic_prefix: ""
1439
+ )
1440
+ super
1441
+ end
1442
+
1443
+ # The message as Centrifugo reads it, fields at their zero value left out.
1444
+ #
1445
+ # @api private
1446
+ def to_wire(where = "")
1447
+ w = {}
1448
+ Wire.put(w, "device_ids", device_ids, where, :str, :list)
1449
+ Wire.put(w, "device_providers", device_providers, where, :str, :list)
1450
+ Wire.put(w, "device_platforms", device_platforms, where, :str, :list)
1451
+ Wire.put(w, "device_users", device_users, where, :str, :list)
1452
+ Wire.put(w, "topics", topics, where, :str, :list)
1453
+ Wire.put(w, "topic_prefix", topic_prefix, where, :str)
1454
+ w
1455
+ end
1456
+
1457
+ # The message from the Hash JSON.parse gives for it.
1458
+ #
1459
+ # @api private
1460
+ def self.from_wire(v, where = "DeviceTopicFilter")
1461
+ d = Wire.obj(v, where)
1462
+ new(
1463
+ device_ids: Wire.get(d, "device_ids", where, :str, :list),
1464
+ device_providers: Wire.get(d, "device_providers", where, :str, :list),
1465
+ device_platforms: Wire.get(d, "device_platforms", where, :str, :list),
1466
+ device_users: Wire.get(d, "device_users", where, :str, :list),
1467
+ topics: Wire.get(d, "topics", where, :str, :list),
1468
+ topic_prefix: Wire.get(d, "topic_prefix", where, :str)
1469
+ )
1470
+ end
1471
+ end
1472
+
1473
+ # UserTopicFilter selects user topic subscriptions. Centrifugo PRO only.
1474
+ #
1475
+ # @!attribute [r] users
1476
+ # @return [Array<String>] Selects by user.
1477
+ # @!attribute [r] topics
1478
+ # @return [Array<String>] Selects by topic.
1479
+ # @!attribute [r] topic_prefix
1480
+ # @return [String] Selects by topic prefix.
1481
+ class UserTopicFilter < Data.define(:users, :topics, :topic_prefix)
1482
+ include Message
1483
+
1484
+ def initialize(users: [], topics: [], topic_prefix: "") = super
1485
+
1486
+ # The message as Centrifugo reads it, fields at their zero value left out.
1487
+ #
1488
+ # @api private
1489
+ def to_wire(where = "")
1490
+ w = {}
1491
+ Wire.put(w, "users", users, where, :str, :list)
1492
+ Wire.put(w, "topics", topics, where, :str, :list)
1493
+ Wire.put(w, "topic_prefix", topic_prefix, where, :str)
1494
+ w
1495
+ end
1496
+
1497
+ # The message from the Hash JSON.parse gives for it.
1498
+ #
1499
+ # @api private
1500
+ def self.from_wire(v, where = "UserTopicFilter")
1501
+ d = Wire.obj(v, where)
1502
+ new(
1503
+ users: Wire.get(d, "users", where, :str, :list),
1504
+ topics: Wire.get(d, "topics", where, :str, :list),
1505
+ topic_prefix: Wire.get(d, "topic_prefix", where, :str)
1506
+ )
1507
+ end
1508
+ end
1509
+
1510
+ # DeviceRegisterResult is the result of a device register call.
1511
+ # Centrifugo PRO only.
1512
+ #
1513
+ # @!attribute [r] id
1514
+ # @return [String] The ID of the registered or updated device.
1515
+ class DeviceRegisterResult < Data.define(:id)
1516
+ include Message
1517
+
1518
+ def initialize(id: "") = super
1519
+
1520
+ # The message as Centrifugo reads it, fields at their zero value left out.
1521
+ #
1522
+ # @api private
1523
+ def to_wire(where = "")
1524
+ w = {}
1525
+ Wire.put(w, "id", id, where, :str)
1526
+ w
1527
+ end
1528
+
1529
+ # The message from the Hash JSON.parse gives for it.
1530
+ #
1531
+ # @api private
1532
+ def self.from_wire(v, where = "DeviceRegisterResult")
1533
+ d = Wire.obj(v, where)
1534
+ new(
1535
+ id: Wire.get(d, "id", where, :str)
1536
+ )
1537
+ end
1538
+ end
1539
+
1540
+ # DeviceUpdateResult is the result of a device update call. Empty at the
1541
+ # moment. Centrifugo PRO only.
1542
+ class DeviceUpdateResult < Data.define
1543
+ include Message
1544
+
1545
+ # The message as Centrifugo reads it, fields at their zero value left out.
1546
+ #
1547
+ # @api private
1548
+ def to_wire(_where = "")
1549
+ {}
1550
+ end
1551
+
1552
+ # The message from the Hash JSON.parse gives for it.
1553
+ #
1554
+ # @api private
1555
+ def self.from_wire(v, where = "DeviceUpdateResult")
1556
+ Wire.obj(v, where)
1557
+ new
1558
+ end
1559
+ end
1560
+
1561
+ # DeviceRemoveResult is the result of a device remove call. Empty at the
1562
+ # moment. Centrifugo PRO only.
1563
+ class DeviceRemoveResult < Data.define
1564
+ include Message
1565
+
1566
+ # The message as Centrifugo reads it, fields at their zero value left out.
1567
+ #
1568
+ # @api private
1569
+ def to_wire(_where = "")
1570
+ {}
1571
+ end
1572
+
1573
+ # The message from the Hash JSON.parse gives for it.
1574
+ #
1575
+ # @api private
1576
+ def self.from_wire(v, where = "DeviceRemoveResult")
1577
+ Wire.obj(v, where)
1578
+ new
1579
+ end
1580
+ end
1581
+
1582
+ # DeviceListResult is the result of a device list call.
1583
+ # Centrifugo PRO only.
1584
+ #
1585
+ # @!attribute [r] items
1586
+ # @return [Array<Device>] The devices of this page.
1587
+ # @!attribute [r] next_cursor
1588
+ # @return [String] The cursor of the next page. Empty if there is no next
1589
+ # page.
1590
+ # @!attribute [r] total_count
1591
+ # @return [Integer] The total count for the filter, if include_total_count
1592
+ # was set.
1593
+ class DeviceListResult < Data.define(:items, :next_cursor, :total_count)
1594
+ include Message
1595
+
1596
+ def initialize(items: [], next_cursor: "", total_count: 0) = super
1597
+
1598
+ # The message as Centrifugo reads it, fields at their zero value left out.
1599
+ #
1600
+ # @api private
1601
+ def to_wire(where = "")
1602
+ w = {}
1603
+ Wire.put(w, "items", items, where, Device, :list)
1604
+ Wire.put(w, "next_cursor", next_cursor, where, :str)
1605
+ Wire.put(w, "total_count", total_count, where, :int)
1606
+ w
1607
+ end
1608
+
1609
+ # The message from the Hash JSON.parse gives for it.
1610
+ #
1611
+ # @api private
1612
+ def self.from_wire(v, where = "DeviceListResult")
1613
+ d = Wire.obj(v, where)
1614
+ new(
1615
+ items: Wire.get(d, "items", where, Device, :list),
1616
+ next_cursor: Wire.get(d, "next_cursor", where, :str),
1617
+ total_count: Wire.get(d, "total_count", where, :int)
1618
+ )
1619
+ end
1620
+ end
1621
+
1622
+ # Device is a device registered for push notifications. Centrifugo PRO only.
1623
+ #
1624
+ # @!attribute [r] id
1625
+ # @return [String] The device ID.
1626
+ # @!attribute [r] platform
1627
+ # @return [String] The device platform.
1628
+ # @!attribute [r] provider
1629
+ # @return [String] The device token provider.
1630
+ # @!attribute [r] token
1631
+ # @return [String] The device token. For webpush, it is the subscription
1632
+ # endpoint.
1633
+ # @!attribute [r] user
1634
+ # @return [String] The user associated with the device.
1635
+ # @!attribute [r] created_at
1636
+ # @return [Integer] The Unix time in milliseconds when the device was
1637
+ # created.
1638
+ # @!attribute [r] updated_at
1639
+ # @return [Integer] The Unix time in milliseconds when the device was last
1640
+ # updated.
1641
+ # @!attribute [r] meta
1642
+ # @return [Hash{String => String}] The device meta. Only set if include_meta was requested.
1643
+ # @!attribute [r] topics
1644
+ # @return [Array<String>] The device topics. Only set if include_topics was
1645
+ # requested.
1646
+ # @!attribute [r] timezone
1647
+ # @return [String] The device timezone.
1648
+ # @!attribute [r] locale
1649
+ # @return [String] The device locale.
1650
+ # @!attribute [r] webpush_keys
1651
+ # @return [String] The Web Push subscription keys JSON ({p256dh, auth}).
1652
+ # Only set if include_webpush_keys was requested.
1653
+ class Device < Data.define(:id, :platform, :provider, :token, :user, :created_at, :updated_at, :meta, :topics, :timezone, :locale, :webpush_keys)
1654
+ include Message
1655
+
1656
+ def initialize(
1657
+ id: "",
1658
+ platform: "",
1659
+ provider: "",
1660
+ token: "",
1661
+ user: "",
1662
+ created_at: 0,
1663
+ updated_at: 0,
1664
+ meta: {},
1665
+ topics: [],
1666
+ timezone: "",
1667
+ locale: "",
1668
+ webpush_keys: ""
1669
+ )
1670
+ super
1671
+ end
1672
+
1673
+ # The message as Centrifugo reads it, fields at their zero value left out.
1674
+ #
1675
+ # @api private
1676
+ def to_wire(where = "")
1677
+ w = {}
1678
+ Wire.put(w, "id", id, where, :str)
1679
+ Wire.put(w, "platform", platform, where, :str)
1680
+ Wire.put(w, "provider", provider, where, :str)
1681
+ Wire.put(w, "token", token, where, :str)
1682
+ Wire.put(w, "user", user, where, :str)
1683
+ Wire.put(w, "created_at", created_at, where, :int)
1684
+ Wire.put(w, "updated_at", updated_at, where, :int)
1685
+ Wire.put(w, "meta", meta, where, :str, :map)
1686
+ Wire.put(w, "topics", topics, where, :str, :list)
1687
+ Wire.put(w, "timezone", timezone, where, :str)
1688
+ Wire.put(w, "locale", locale, where, :str)
1689
+ Wire.put(w, "webpush_keys", webpush_keys, where, :str)
1690
+ w
1691
+ end
1692
+
1693
+ # The message from the Hash JSON.parse gives for it.
1694
+ #
1695
+ # @api private
1696
+ def self.from_wire(v, where = "Device")
1697
+ d = Wire.obj(v, where)
1698
+ new(
1699
+ id: Wire.get(d, "id", where, :str),
1700
+ platform: Wire.get(d, "platform", where, :str),
1701
+ provider: Wire.get(d, "provider", where, :str),
1702
+ token: Wire.get(d, "token", where, :str),
1703
+ user: Wire.get(d, "user", where, :str),
1704
+ created_at: Wire.get(d, "created_at", where, :int),
1705
+ updated_at: Wire.get(d, "updated_at", where, :int),
1706
+ meta: Wire.get(d, "meta", where, :str, :map),
1707
+ topics: Wire.get(d, "topics", where, :str, :list),
1708
+ timezone: Wire.get(d, "timezone", where, :str),
1709
+ locale: Wire.get(d, "locale", where, :str),
1710
+ webpush_keys: Wire.get(d, "webpush_keys", where, :str)
1711
+ )
1712
+ end
1713
+ end
1714
+
1715
+ # DeviceTopicListResult is the result of a device topic list call.
1716
+ # Centrifugo PRO only.
1717
+ #
1718
+ # @!attribute [r] items
1719
+ # @return [Array<DeviceTopic>] The device topics of this page.
1720
+ # @!attribute [r] next_cursor
1721
+ # @return [String] The cursor of the next page. Empty if there is no next
1722
+ # page.
1723
+ # @!attribute [r] total_count
1724
+ # @return [Integer] The total count for the filter, if include_total_count
1725
+ # was set.
1726
+ class DeviceTopicListResult < Data.define(:items, :next_cursor, :total_count)
1727
+ include Message
1728
+
1729
+ def initialize(items: [], next_cursor: "", total_count: 0) = super
1730
+
1731
+ # The message as Centrifugo reads it, fields at their zero value left out.
1732
+ #
1733
+ # @api private
1734
+ def to_wire(where = "")
1735
+ w = {}
1736
+ Wire.put(w, "items", items, where, DeviceTopic, :list)
1737
+ Wire.put(w, "next_cursor", next_cursor, where, :str)
1738
+ Wire.put(w, "total_count", total_count, where, :int)
1739
+ w
1740
+ end
1741
+
1742
+ # The message from the Hash JSON.parse gives for it.
1743
+ #
1744
+ # @api private
1745
+ def self.from_wire(v, where = "DeviceTopicListResult")
1746
+ d = Wire.obj(v, where)
1747
+ new(
1748
+ items: Wire.get(d, "items", where, DeviceTopic, :list),
1749
+ next_cursor: Wire.get(d, "next_cursor", where, :str),
1750
+ total_count: Wire.get(d, "total_count", where, :int)
1751
+ )
1752
+ end
1753
+ end
1754
+
1755
+ # DeviceTopic is a topic subscription of a device. Centrifugo PRO only.
1756
+ #
1757
+ # @!attribute [r] id
1758
+ # @return [String] The ID of the device topic.
1759
+ # @!attribute [r] topic
1760
+ # @return [String] The topic.
1761
+ # @!attribute [r] device
1762
+ # @return [Device, nil] The device. Only set if include_device was requested.
1763
+ class DeviceTopic < Data.define(:id, :topic, :device)
1764
+ include Message
1765
+
1766
+ def initialize(id: "", topic: "", device: nil) = super
1767
+
1768
+ # The message as Centrifugo reads it, fields at their zero value left out.
1769
+ #
1770
+ # @api private
1771
+ def to_wire(where = "")
1772
+ w = {}
1773
+ Wire.put(w, "id", id, where, :str)
1774
+ Wire.put(w, "topic", topic, where, :str)
1775
+ Wire.put(w, "device", device, where, Device)
1776
+ w
1777
+ end
1778
+
1779
+ # The message from the Hash JSON.parse gives for it.
1780
+ #
1781
+ # @api private
1782
+ def self.from_wire(v, where = "DeviceTopic")
1783
+ d = Wire.obj(v, where)
1784
+ new(
1785
+ id: Wire.get(d, "id", where, :str),
1786
+ topic: Wire.get(d, "topic", where, :str),
1787
+ device: Wire.get(d, "device", where, Device)
1788
+ )
1789
+ end
1790
+ end
1791
+
1792
+ # UserTopicListResult is the result of a user topic list call.
1793
+ # Centrifugo PRO only.
1794
+ #
1795
+ # @!attribute [r] items
1796
+ # @return [Array<UserTopic>] The user topics of this page.
1797
+ # @!attribute [r] next_cursor
1798
+ # @return [String] The cursor of the next page. Empty if there is no next
1799
+ # page.
1800
+ # @!attribute [r] total_count
1801
+ # @return [Integer] The total count for the filter, if include_total_count
1802
+ # was set.
1803
+ class UserTopicListResult < Data.define(:items, :next_cursor, :total_count)
1804
+ include Message
1805
+
1806
+ def initialize(items: [], next_cursor: "", total_count: 0) = super
1807
+
1808
+ # The message as Centrifugo reads it, fields at their zero value left out.
1809
+ #
1810
+ # @api private
1811
+ def to_wire(where = "")
1812
+ w = {}
1813
+ Wire.put(w, "items", items, where, UserTopic, :list)
1814
+ Wire.put(w, "next_cursor", next_cursor, where, :str)
1815
+ Wire.put(w, "total_count", total_count, where, :int)
1816
+ w
1817
+ end
1818
+
1819
+ # The message from the Hash JSON.parse gives for it.
1820
+ #
1821
+ # @api private
1822
+ def self.from_wire(v, where = "UserTopicListResult")
1823
+ d = Wire.obj(v, where)
1824
+ new(
1825
+ items: Wire.get(d, "items", where, UserTopic, :list),
1826
+ next_cursor: Wire.get(d, "next_cursor", where, :str),
1827
+ total_count: Wire.get(d, "total_count", where, :int)
1828
+ )
1829
+ end
1830
+ end
1831
+
1832
+ # DeviceTopicUpdateResult is the result of a device topic update call.
1833
+ # Empty at the moment. Centrifugo PRO only.
1834
+ class DeviceTopicUpdateResult < Data.define
1835
+ include Message
1836
+
1837
+ # The message as Centrifugo reads it, fields at their zero value left out.
1838
+ #
1839
+ # @api private
1840
+ def to_wire(_where = "")
1841
+ {}
1842
+ end
1843
+
1844
+ # The message from the Hash JSON.parse gives for it.
1845
+ #
1846
+ # @api private
1847
+ def self.from_wire(v, where = "DeviceTopicUpdateResult")
1848
+ Wire.obj(v, where)
1849
+ new
1850
+ end
1851
+ end
1852
+
1853
+ # UserTopicUpdateResult is the result of a user topic update call. Empty at
1854
+ # the moment. Centrifugo PRO only.
1855
+ class UserTopicUpdateResult < Data.define
1856
+ include Message
1857
+
1858
+ # The message as Centrifugo reads it, fields at their zero value left out.
1859
+ #
1860
+ # @api private
1861
+ def to_wire(_where = "")
1862
+ {}
1863
+ end
1864
+
1865
+ # The message from the Hash JSON.parse gives for it.
1866
+ #
1867
+ # @api private
1868
+ def self.from_wire(v, where = "UserTopicUpdateResult")
1869
+ Wire.obj(v, where)
1870
+ new
1871
+ end
1872
+ end
1873
+
1874
+ # UserTopic is a topic subscription of a user. Centrifugo PRO only.
1875
+ #
1876
+ # @!attribute [r] id
1877
+ # @return [String] The ID of the user topic.
1878
+ # @!attribute [r] user
1879
+ # @return [String] The user ID.
1880
+ # @!attribute [r] topic
1881
+ # @return [String] The topic.
1882
+ class UserTopic < Data.define(:id, :user, :topic)
1883
+ include Message
1884
+
1885
+ def initialize(id: "", user: "", topic: "") = super
1886
+
1887
+ # The message as Centrifugo reads it, fields at their zero value left out.
1888
+ #
1889
+ # @api private
1890
+ def to_wire(where = "")
1891
+ w = {}
1892
+ Wire.put(w, "id", id, where, :str)
1893
+ Wire.put(w, "user", user, where, :str)
1894
+ Wire.put(w, "topic", topic, where, :str)
1895
+ w
1896
+ end
1897
+
1898
+ # The message from the Hash JSON.parse gives for it.
1899
+ #
1900
+ # @api private
1901
+ def self.from_wire(v, where = "UserTopic")
1902
+ d = Wire.obj(v, where)
1903
+ new(
1904
+ id: Wire.get(d, "id", where, :str),
1905
+ user: Wire.get(d, "user", where, :str),
1906
+ topic: Wire.get(d, "topic", where, :str)
1907
+ )
1908
+ end
1909
+ end
1910
+
1911
+ # PushRecipient describes who receives a push notification. Set only one
1912
+ # of its fields. Centrifugo PRO only.
1913
+ #
1914
+ # @!attribute [r] filter
1915
+ # @return [DeviceFilter, nil] Sends to devices from Centrifugo device storage that match the
1916
+ # filter.
1917
+ # @!attribute [r] fcm_tokens
1918
+ # @return [Array<String>] Sends to a list of FCM native tokens.
1919
+ # @!attribute [r] fcm_topic
1920
+ # @return [String] Sends to an FCM native topic.
1921
+ # @!attribute [r] fcm_condition
1922
+ # @return [String] Sends to an FCM native condition.
1923
+ # @!attribute [r] hms_tokens
1924
+ # @return [Array<String>] Sends to a list of HMS native tokens.
1925
+ # @!attribute [r] hms_topic
1926
+ # @return [String] Sends to an HMS native topic.
1927
+ # @!attribute [r] hms_condition
1928
+ # @return [String] Sends to an HMS native condition.
1929
+ # @!attribute [r] apns_tokens
1930
+ # @return [Array<String>] Sends to a list of APNs native tokens.
1931
+ # @!attribute [r] webpush_tokens
1932
+ # @return [Array<String>] Sends to a list of raw Web Push subscriptions, each a
1933
+ # PushSubscription JSON string.
1934
+ class PushRecipient < Data.define(:filter, :fcm_tokens, :fcm_topic, :fcm_condition, :hms_tokens, :hms_topic, :hms_condition, :apns_tokens, :webpush_tokens)
1935
+ include Message
1936
+
1937
+ def initialize(
1938
+ filter: nil,
1939
+ fcm_tokens: [],
1940
+ fcm_topic: "",
1941
+ fcm_condition: "",
1942
+ hms_tokens: [],
1943
+ hms_topic: "",
1944
+ hms_condition: "",
1945
+ apns_tokens: [],
1946
+ webpush_tokens: []
1947
+ )
1948
+ super
1949
+ end
1950
+
1951
+ # The message as Centrifugo reads it, fields at their zero value left out.
1952
+ #
1953
+ # @api private
1954
+ def to_wire(where = "")
1955
+ w = {}
1956
+ Wire.put(w, "filter", filter, where, DeviceFilter)
1957
+ Wire.put(w, "fcm_tokens", fcm_tokens, where, :str, :list)
1958
+ Wire.put(w, "fcm_topic", fcm_topic, where, :str)
1959
+ Wire.put(w, "fcm_condition", fcm_condition, where, :str)
1960
+ Wire.put(w, "hms_tokens", hms_tokens, where, :str, :list)
1961
+ Wire.put(w, "hms_topic", hms_topic, where, :str)
1962
+ Wire.put(w, "hms_condition", hms_condition, where, :str)
1963
+ Wire.put(w, "apns_tokens", apns_tokens, where, :str, :list)
1964
+ Wire.put(w, "webpush_tokens", webpush_tokens, where, :str, :list)
1965
+ w
1966
+ end
1967
+
1968
+ # The message from the Hash JSON.parse gives for it.
1969
+ #
1970
+ # @api private
1971
+ def self.from_wire(v, where = "PushRecipient")
1972
+ d = Wire.obj(v, where)
1973
+ new(
1974
+ filter: Wire.get(d, "filter", where, DeviceFilter),
1975
+ fcm_tokens: Wire.get(d, "fcm_tokens", where, :str, :list),
1976
+ fcm_topic: Wire.get(d, "fcm_topic", where, :str),
1977
+ fcm_condition: Wire.get(d, "fcm_condition", where, :str),
1978
+ hms_tokens: Wire.get(d, "hms_tokens", where, :str, :list),
1979
+ hms_topic: Wire.get(d, "hms_topic", where, :str),
1980
+ hms_condition: Wire.get(d, "hms_condition", where, :str),
1981
+ apns_tokens: Wire.get(d, "apns_tokens", where, :str, :list),
1982
+ webpush_tokens: Wire.get(d, "webpush_tokens", where, :str, :list)
1983
+ )
1984
+ end
1985
+ end
1986
+
1987
+ # PushNotification is a push notification in the format of each provider.
1988
+ # Centrifugo PRO only.
1989
+ #
1990
+ # @!attribute [r] fcm
1991
+ # @return [FcmPushNotification, nil] The notification for FCM.
1992
+ # @!attribute [r] hms
1993
+ # @return [HmsPushNotification, nil] The notification for HMS.
1994
+ # @!attribute [r] apns
1995
+ # @return [ApnsPushNotification, nil] The notification for APNs.
1996
+ # @!attribute [r] webpush
1997
+ # @return [WebPushPushNotification, nil] The notification for Web Push.
1998
+ # @!attribute [r] expire_at
1999
+ # @return [Integer] The Unix time in seconds when Centrifugo stops trying to
2000
+ # send the notification. Not related to the providers' TTL fields.
2001
+ # Required when the request sets limit_strategy.
2002
+ class PushNotification < Data.define(:fcm, :hms, :apns, :webpush, :expire_at)
2003
+ include Message
2004
+
2005
+ def initialize(
2006
+ fcm: nil,
2007
+ hms: nil,
2008
+ apns: nil,
2009
+ webpush: nil,
2010
+ expire_at: 0
2011
+ )
2012
+ super
2013
+ end
2014
+
2015
+ # The message as Centrifugo reads it, fields at their zero value left out.
2016
+ #
2017
+ # @api private
2018
+ def to_wire(where = "")
2019
+ w = {}
2020
+ Wire.put(w, "fcm", fcm, where, FcmPushNotification)
2021
+ Wire.put(w, "hms", hms, where, HmsPushNotification)
2022
+ Wire.put(w, "apns", apns, where, ApnsPushNotification)
2023
+ Wire.put(w, "webpush", webpush, where, WebPushPushNotification)
2024
+ Wire.put(w, "expire_at", expire_at, where, :int)
2025
+ w
2026
+ end
2027
+
2028
+ # The message from the Hash JSON.parse gives for it.
2029
+ #
2030
+ # @api private
2031
+ def self.from_wire(v, where = "PushNotification")
2032
+ d = Wire.obj(v, where)
2033
+ new(
2034
+ fcm: Wire.get(d, "fcm", where, FcmPushNotification),
2035
+ hms: Wire.get(d, "hms", where, HmsPushNotification),
2036
+ apns: Wire.get(d, "apns", where, ApnsPushNotification),
2037
+ webpush: Wire.get(d, "webpush", where, WebPushPushNotification),
2038
+ expire_at: Wire.get(d, "expire_at", where, :int)
2039
+ )
2040
+ end
2041
+ end
2042
+
2043
+ # FcmPushNotification is a notification for FCM. Centrifugo PRO only.
2044
+ #
2045
+ # @!attribute [r] message
2046
+ # @return [Object, nil] The FCM Message object as JSON. Required.
2047
+ class FcmPushNotification < Data.define(:message)
2048
+ include Message
2049
+
2050
+ # The message as Centrifugo reads it, fields at their zero value left out.
2051
+ #
2052
+ # @api private
2053
+ def to_wire(where = "")
2054
+ w = {}
2055
+ Wire.put(w, "message", message, where, :json)
2056
+ w
2057
+ end
2058
+
2059
+ # The message from the Hash JSON.parse gives for it.
2060
+ #
2061
+ # @api private
2062
+ def self.from_wire(v, where = "FcmPushNotification")
2063
+ d = Wire.obj(v, where)
2064
+ new(
2065
+ message: Wire.get(d, "message", where, :json)
2066
+ )
2067
+ end
2068
+ end
2069
+
2070
+ # HmsPushNotification is a notification for HMS. Centrifugo PRO only.
2071
+ #
2072
+ # @!attribute [r] message
2073
+ # @return [Object, nil] The HMS Message object as JSON. Required.
2074
+ class HmsPushNotification < Data.define(:message)
2075
+ include Message
2076
+
2077
+ # The message as Centrifugo reads it, fields at their zero value left out.
2078
+ #
2079
+ # @api private
2080
+ def to_wire(where = "")
2081
+ w = {}
2082
+ Wire.put(w, "message", message, where, :json)
2083
+ w
2084
+ end
2085
+
2086
+ # The message from the Hash JSON.parse gives for it.
2087
+ #
2088
+ # @api private
2089
+ def self.from_wire(v, where = "HmsPushNotification")
2090
+ d = Wire.obj(v, where)
2091
+ new(
2092
+ message: Wire.get(d, "message", where, :json)
2093
+ )
2094
+ end
2095
+ end
2096
+
2097
+ # ApnsPushNotification is a notification for APNs. Centrifugo PRO only.
2098
+ #
2099
+ # @!attribute [r] headers
2100
+ # @return [Hash{String => String}] The APNs request headers.
2101
+ # @!attribute [r] payload
2102
+ # @return [Object, nil] The APNs payload as JSON. Required.
2103
+ class ApnsPushNotification < Data.define(:headers, :payload)
2104
+ include Message
2105
+
2106
+ def initialize(payload:, headers: {}) = super
2107
+
2108
+ # The message as Centrifugo reads it, fields at their zero value left out.
2109
+ #
2110
+ # @api private
2111
+ def to_wire(where = "")
2112
+ w = {}
2113
+ Wire.put(w, "headers", headers, where, :str, :map)
2114
+ Wire.put(w, "payload", payload, where, :json)
2115
+ w
2116
+ end
2117
+
2118
+ # The message from the Hash JSON.parse gives for it.
2119
+ #
2120
+ # @api private
2121
+ def self.from_wire(v, where = "ApnsPushNotification")
2122
+ d = Wire.obj(v, where)
2123
+ new(
2124
+ headers: Wire.get(d, "headers", where, :str, :map),
2125
+ payload: Wire.get(d, "payload", where, :json)
2126
+ )
2127
+ end
2128
+ end
2129
+
2130
+ # WebPushPushNotification is a notification for Web Push.
2131
+ # Centrifugo PRO only.
2132
+ #
2133
+ # @!attribute [r] headers
2134
+ # @return [Hash{String => String}] Web Push HTTP headers. Recognized keys: TTL (seconds,
2135
+ # default 4 weeks), Urgency (very-low, low, normal, high) and Topic.
2136
+ # @!attribute [r] payload
2137
+ # @return [Object, nil] The JSON payload delivered to the browser service worker.
2138
+ # Required.
2139
+ class WebPushPushNotification < Data.define(:headers, :payload)
2140
+ include Message
2141
+
2142
+ def initialize(payload:, headers: {}) = super
2143
+
2144
+ # The message as Centrifugo reads it, fields at their zero value left out.
2145
+ #
2146
+ # @api private
2147
+ def to_wire(where = "")
2148
+ w = {}
2149
+ Wire.put(w, "headers", headers, where, :str, :map)
2150
+ Wire.put(w, "payload", payload, where, :json)
2151
+ w
2152
+ end
2153
+
2154
+ # The message from the Hash JSON.parse gives for it.
2155
+ #
2156
+ # @api private
2157
+ def self.from_wire(v, where = "WebPushPushNotification")
2158
+ d = Wire.obj(v, where)
2159
+ new(
2160
+ headers: Wire.get(d, "headers", where, :str, :map),
2161
+ payload: Wire.get(d, "payload", where, :json)
2162
+ )
2163
+ end
2164
+ end
2165
+
2166
+ # PushLocalization holds translations for one language/locale.
2167
+ # Centrifugo PRO only.
2168
+ #
2169
+ # @!attribute [r] translations
2170
+ # @return [Hash{String => String}] Maps variable name to value for the language/locale.
2171
+ class PushLocalization < Data.define(:translations)
2172
+ include Message
2173
+
2174
+ def initialize(translations: {}) = super
2175
+
2176
+ # The message as Centrifugo reads it, fields at their zero value left out.
2177
+ #
2178
+ # @api private
2179
+ def to_wire(where = "")
2180
+ w = {}
2181
+ Wire.put(w, "translations", translations, where, :str, :map)
2182
+ w
2183
+ end
2184
+
2185
+ # The message from the Hash JSON.parse gives for it.
2186
+ #
2187
+ # @api private
2188
+ def self.from_wire(v, where = "PushLocalization")
2189
+ d = Wire.obj(v, where)
2190
+ new(
2191
+ translations: Wire.get(d, "translations", where, :str, :map)
2192
+ )
2193
+ end
2194
+ end
2195
+
2196
+ # PushLimitStrategy limits when and how often pushes are sent.
2197
+ # Centrifugo PRO only.
2198
+ #
2199
+ # @!attribute [r] rate_limit
2200
+ # @return [PushRateLimitStrategy, nil] Sets rate limit policies.
2201
+ # @!attribute [r] time_limit
2202
+ # @return [PushTimeLimitStrategy, nil] Sets a time limit policy based on the device timezone.
2203
+ class PushLimitStrategy < Data.define(:rate_limit, :time_limit)
2204
+ include Message
2205
+
2206
+ def initialize(rate_limit: nil, time_limit: nil) = super
2207
+
2208
+ # The message as Centrifugo reads it, fields at their zero value left out.
2209
+ #
2210
+ # @api private
2211
+ def to_wire(where = "")
2212
+ w = {}
2213
+ Wire.put(w, "rate_limit", rate_limit, where, PushRateLimitStrategy)
2214
+ Wire.put(w, "time_limit", time_limit, where, PushTimeLimitStrategy)
2215
+ w
2216
+ end
2217
+
2218
+ # The message from the Hash JSON.parse gives for it.
2219
+ #
2220
+ # @api private
2221
+ def self.from_wire(v, where = "PushLimitStrategy")
2222
+ d = Wire.obj(v, where)
2223
+ new(
2224
+ rate_limit: Wire.get(d, "rate_limit", where, PushRateLimitStrategy),
2225
+ time_limit: Wire.get(d, "time_limit", where, PushTimeLimitStrategy)
2226
+ )
2227
+ end
2228
+ end
2229
+
2230
+ # PushTimeLimitStrategy sends pushes within a window of the device local
2231
+ # time. Centrifugo PRO only.
2232
+ #
2233
+ # @!attribute [r] send_after_time
2234
+ # @return [String] The local time, as HH:MM:SS, after which the push
2235
+ # may be sent. Required.
2236
+ # @!attribute [r] send_before_time
2237
+ # @return [String] The local time, as HH:MM:SS, before which the push
2238
+ # must be sent. Required.
2239
+ # @!attribute [r] no_tz_send_now
2240
+ # @return [Boolean] Sends the push immediately if the device timezone is
2241
+ # not set. By default such pushes are dropped.
2242
+ class PushTimeLimitStrategy < Data.define(:send_after_time, :send_before_time, :no_tz_send_now)
2243
+ include Message
2244
+
2245
+ def initialize(send_after_time:, send_before_time:, no_tz_send_now: false) = super
2246
+
2247
+ # The message as Centrifugo reads it, fields at their zero value left out.
2248
+ #
2249
+ # @api private
2250
+ def to_wire(where = "")
2251
+ w = {}
2252
+ Wire.put(w, "send_after_time", send_after_time, where, :str)
2253
+ Wire.put(w, "send_before_time", send_before_time, where, :str)
2254
+ Wire.put(w, "no_tz_send_now", no_tz_send_now, where, :bool)
2255
+ w
2256
+ end
2257
+
2258
+ # The message from the Hash JSON.parse gives for it.
2259
+ #
2260
+ # @api private
2261
+ def self.from_wire(v, where = "PushTimeLimitStrategy")
2262
+ d = Wire.obj(v, where)
2263
+ new(
2264
+ send_after_time: Wire.get(d, "send_after_time", where, :str),
2265
+ send_before_time: Wire.get(d, "send_before_time", where, :str),
2266
+ no_tz_send_now: Wire.get(d, "no_tz_send_now", where, :bool)
2267
+ )
2268
+ end
2269
+ end
2270
+
2271
+ # PushRateLimitStrategy rate limits pushes per device. Centrifugo PRO only.
2272
+ #
2273
+ # @!attribute [r] key
2274
+ # @return [String] An optional key for the rate limit policy. Supports variables
2275
+ # (device.id and device.user).
2276
+ # @!attribute [r] policies
2277
+ # @return [Array<RateLimitPolicy>] The rate limit policies to apply.
2278
+ # @!attribute [r] drop_if_rate_limited
2279
+ # @return [Boolean] Drops a rate limited push instead of queuing it
2280
+ # for later.
2281
+ class PushRateLimitStrategy < Data.define(:key, :policies, :drop_if_rate_limited)
2282
+ include Message
2283
+
2284
+ def initialize(key: "", policies: [], drop_if_rate_limited: false) = super
2285
+
2286
+ # The message as Centrifugo reads it, fields at their zero value left out.
2287
+ #
2288
+ # @api private
2289
+ def to_wire(where = "")
2290
+ w = {}
2291
+ Wire.put(w, "key", key, where, :str)
2292
+ Wire.put(w, "policies", policies, where, RateLimitPolicy, :list)
2293
+ Wire.put(w, "drop_if_rate_limited", drop_if_rate_limited, where, :bool)
2294
+ w
2295
+ end
2296
+
2297
+ # The message from the Hash JSON.parse gives for it.
2298
+ #
2299
+ # @api private
2300
+ def self.from_wire(v, where = "PushRateLimitStrategy")
2301
+ d = Wire.obj(v, where)
2302
+ new(
2303
+ key: Wire.get(d, "key", where, :str),
2304
+ policies: Wire.get(d, "policies", where, RateLimitPolicy, :list),
2305
+ drop_if_rate_limited: Wire.get(d, "drop_if_rate_limited", where, :bool)
2306
+ )
2307
+ end
2308
+ end
2309
+
2310
+ # RateLimitPolicy allows rate pushes per interval_ms. Centrifugo PRO only.
2311
+ #
2312
+ # @!attribute [r] rate
2313
+ # @return [Integer] The allowed number of pushes per interval. Required.
2314
+ # @!attribute [r] interval_ms
2315
+ # @return [Integer] The interval in milliseconds. Required.
2316
+ class RateLimitPolicy < Data.define(:rate, :interval_ms)
2317
+ include Message
2318
+
2319
+ # The message as Centrifugo reads it, fields at their zero value left out.
2320
+ #
2321
+ # @api private
2322
+ def to_wire(where = "")
2323
+ w = {}
2324
+ Wire.put(w, "rate", rate, where, :int)
2325
+ Wire.put(w, "interval_ms", interval_ms, where, :int)
2326
+ w
2327
+ end
2328
+
2329
+ # The message from the Hash JSON.parse gives for it.
2330
+ #
2331
+ # @api private
2332
+ def self.from_wire(v, where = "RateLimitPolicy")
2333
+ d = Wire.obj(v, where)
2334
+ new(
2335
+ rate: Wire.get(d, "rate", where, :int),
2336
+ interval_ms: Wire.get(d, "interval_ms", where, :int)
2337
+ )
2338
+ end
2339
+ end
2340
+
2341
+ # SendPushNotificationResult is the result of a send push notification
2342
+ # call. Centrifugo PRO only.
2343
+ #
2344
+ # @!attribute [r] uid
2345
+ # @return [String] The unique identifier of the send request (not a provider
2346
+ # message ID). Matches the request uid if it was set.
2347
+ class SendPushNotificationResult < Data.define(:uid)
2348
+ include Message
2349
+
2350
+ def initialize(uid: "") = super
2351
+
2352
+ # The message as Centrifugo reads it, fields at their zero value left out.
2353
+ #
2354
+ # @api private
2355
+ def to_wire(where = "")
2356
+ w = {}
2357
+ Wire.put(w, "uid", uid, where, :str)
2358
+ w
2359
+ end
2360
+
2361
+ # The message from the Hash JSON.parse gives for it.
2362
+ #
2363
+ # @api private
2364
+ def self.from_wire(v, where = "SendPushNotificationResult")
2365
+ d = Wire.obj(v, where)
2366
+ new(
2367
+ uid: Wire.get(d, "uid", where, :str)
2368
+ )
2369
+ end
2370
+ end
2371
+
2372
+ # UpdatePushStatusResult is the result of an update push status call.
2373
+ # Empty at the moment. Centrifugo PRO only.
2374
+ class UpdatePushStatusResult < Data.define
2375
+ include Message
2376
+
2377
+ # The message as Centrifugo reads it, fields at their zero value left out.
2378
+ #
2379
+ # @api private
2380
+ def to_wire(_where = "")
2381
+ {}
2382
+ end
2383
+
2384
+ # The message from the Hash JSON.parse gives for it.
2385
+ #
2386
+ # @api private
2387
+ def self.from_wire(v, where = "UpdatePushStatusResult")
2388
+ Wire.obj(v, where)
2389
+ new
2390
+ end
2391
+ end
2392
+
2393
+ # CancelPushResult is the result of a cancel push call. Empty at the
2394
+ # moment. Centrifugo PRO only.
2395
+ class CancelPushResult < Data.define
2396
+ include Message
2397
+
2398
+ # The message as Centrifugo reads it, fields at their zero value left out.
2399
+ #
2400
+ # @api private
2401
+ def to_wire(_where = "")
2402
+ {}
2403
+ end
2404
+
2405
+ # The message from the Hash JSON.parse gives for it.
2406
+ #
2407
+ # @api private
2408
+ def self.from_wire(v, where = "CancelPushResult")
2409
+ Wire.obj(v, where)
2410
+ new
2411
+ end
2412
+ end
2413
+
2414
+ # MapPublishResult is the result of a map publish call.
2415
+ #
2416
+ # @!attribute [r] offset
2417
+ # @return [Integer] The offset in the channel stream.
2418
+ # @!attribute [r] epoch
2419
+ # @return [String] The epoch of the channel stream.
2420
+ # @!attribute [r] suppressed
2421
+ # @return [Boolean] True if the publish was not applied, see
2422
+ # suppress_reason.
2423
+ # @!attribute [r] suppress_reason
2424
+ # @return [String] Explains why the publish was suppressed, for example
2425
+ # "idempotency", "version", "key_exists" or "key_not_found".
2426
+ class MapPublishResult < Data.define(:offset, :epoch, :suppressed, :suppress_reason)
2427
+ include Message
2428
+
2429
+ def initialize(
2430
+ offset: 0,
2431
+ epoch: "",
2432
+ suppressed: false,
2433
+ suppress_reason: ""
2434
+ )
2435
+ super
2436
+ end
2437
+
2438
+ # The message as Centrifugo reads it, fields at their zero value left out.
2439
+ #
2440
+ # @api private
2441
+ def to_wire(where = "")
2442
+ w = {}
2443
+ Wire.put(w, "offset", offset, where, :int)
2444
+ Wire.put(w, "epoch", epoch, where, :str)
2445
+ Wire.put(w, "suppressed", suppressed, where, :bool)
2446
+ Wire.put(w, "suppress_reason", suppress_reason, where, :str)
2447
+ w
2448
+ end
2449
+
2450
+ # The message from the Hash JSON.parse gives for it.
2451
+ #
2452
+ # @api private
2453
+ def self.from_wire(v, where = "MapPublishResult")
2454
+ d = Wire.obj(v, where)
2455
+ new(
2456
+ offset: Wire.get(d, "offset", where, :int),
2457
+ epoch: Wire.get(d, "epoch", where, :str),
2458
+ suppressed: Wire.get(d, "suppressed", where, :bool),
2459
+ suppress_reason: Wire.get(d, "suppress_reason", where, :str)
2460
+ )
2461
+ end
2462
+ end
2463
+
2464
+ # MapRemoveResult is the result of a map remove call.
2465
+ #
2466
+ # @!attribute [r] offset
2467
+ # @return [Integer] The offset in the channel stream.
2468
+ # @!attribute [r] epoch
2469
+ # @return [String] The epoch of the channel stream.
2470
+ # @!attribute [r] suppressed
2471
+ # @return [Boolean] True if the removal was not applied, see
2472
+ # suppress_reason.
2473
+ # @!attribute [r] suppress_reason
2474
+ # @return [String] Explains why the removal was suppressed, for example
2475
+ # "idempotency" or "key_not_found".
2476
+ class MapRemoveResult < Data.define(:offset, :epoch, :suppressed, :suppress_reason)
2477
+ include Message
2478
+
2479
+ def initialize(
2480
+ offset: 0,
2481
+ epoch: "",
2482
+ suppressed: false,
2483
+ suppress_reason: ""
2484
+ )
2485
+ super
2486
+ end
2487
+
2488
+ # The message as Centrifugo reads it, fields at their zero value left out.
2489
+ #
2490
+ # @api private
2491
+ def to_wire(where = "")
2492
+ w = {}
2493
+ Wire.put(w, "offset", offset, where, :int)
2494
+ Wire.put(w, "epoch", epoch, where, :str)
2495
+ Wire.put(w, "suppressed", suppressed, where, :bool)
2496
+ Wire.put(w, "suppress_reason", suppress_reason, where, :str)
2497
+ w
2498
+ end
2499
+
2500
+ # The message from the Hash JSON.parse gives for it.
2501
+ #
2502
+ # @api private
2503
+ def self.from_wire(v, where = "MapRemoveResult")
2504
+ d = Wire.obj(v, where)
2505
+ new(
2506
+ offset: Wire.get(d, "offset", where, :int),
2507
+ epoch: Wire.get(d, "epoch", where, :str),
2508
+ suppressed: Wire.get(d, "suppressed", where, :bool),
2509
+ suppress_reason: Wire.get(d, "suppress_reason", where, :str)
2510
+ )
2511
+ end
2512
+ end
2513
+
2514
+ # MapReadStateResult is the result of a map read state call.
2515
+ #
2516
+ # @!attribute [r] entries
2517
+ # @return [Array<MapEntry>] The state entries of this page.
2518
+ # @!attribute [r] offset
2519
+ # @return [Integer] The offset of the channel stream position.
2520
+ # @!attribute [r] epoch
2521
+ # @return [String] The epoch of the channel stream position.
2522
+ # @!attribute [r] cursor
2523
+ # @return [String] The cursor of the next page. Empty if there are no more
2524
+ # entries.
2525
+ class MapReadStateResult < Data.define(:entries, :offset, :epoch, :cursor)
2526
+ include Message
2527
+
2528
+ def initialize(
2529
+ entries: [],
2530
+ offset: 0,
2531
+ epoch: "",
2532
+ cursor: ""
2533
+ )
2534
+ super
2535
+ end
2536
+
2537
+ # The message as Centrifugo reads it, fields at their zero value left out.
2538
+ #
2539
+ # @api private
2540
+ def to_wire(where = "")
2541
+ w = {}
2542
+ Wire.put(w, "entries", entries, where, MapEntry, :list)
2543
+ Wire.put(w, "offset", offset, where, :int)
2544
+ Wire.put(w, "epoch", epoch, where, :str)
2545
+ Wire.put(w, "cursor", cursor, where, :str)
2546
+ w
2547
+ end
2548
+
2549
+ # The message from the Hash JSON.parse gives for it.
2550
+ #
2551
+ # @api private
2552
+ def self.from_wire(v, where = "MapReadStateResult")
2553
+ d = Wire.obj(v, where)
2554
+ new(
2555
+ entries: Wire.get(d, "entries", where, MapEntry, :list),
2556
+ offset: Wire.get(d, "offset", where, :int),
2557
+ epoch: Wire.get(d, "epoch", where, :str),
2558
+ cursor: Wire.get(d, "cursor", where, :str)
2559
+ )
2560
+ end
2561
+ end
2562
+
2563
+ # MapEntry is an entry of a map channel state or stream.
2564
+ #
2565
+ # @!attribute [r] key
2566
+ # @return [String] The entry key.
2567
+ # @!attribute [r] data
2568
+ # @return [Object, nil] The entry data.
2569
+ # @!attribute [r] tags
2570
+ # @return [Hash{String => String}] The entry tags.
2571
+ # @!attribute [r] offset
2572
+ # @return [Integer] The offset of the entry in the channel stream.
2573
+ # @!attribute [r] score
2574
+ # @return [Integer] The sort value of the entry in ordered map channels.
2575
+ # @!attribute [r] removed
2576
+ # @return [Boolean] True for a removal event.
2577
+ # @!attribute [r] time
2578
+ # @return [Integer] The time of the publication as Unix milliseconds, if known.
2579
+ class MapEntry < Data.define(:key, :data, :tags, :offset, :score, :removed, :time)
2580
+ include Message
2581
+
2582
+ def initialize(
2583
+ key: "",
2584
+ data: nil,
2585
+ tags: {},
2586
+ offset: 0,
2587
+ score: 0,
2588
+ removed: false,
2589
+ time: 0
2590
+ )
2591
+ super
2592
+ end
2593
+
2594
+ # The message as Centrifugo reads it, fields at their zero value left out.
2595
+ #
2596
+ # @api private
2597
+ def to_wire(where = "")
2598
+ w = {}
2599
+ Wire.put(w, "key", key, where, :str)
2600
+ Wire.put(w, "data", data, where, :json)
2601
+ Wire.put(w, "tags", tags, where, :str, :map)
2602
+ Wire.put(w, "offset", offset, where, :int)
2603
+ Wire.put(w, "score", score, where, :int)
2604
+ Wire.put(w, "removed", removed, where, :bool)
2605
+ Wire.put(w, "time", time, where, :int)
2606
+ w
2607
+ end
2608
+
2609
+ # The message from the Hash JSON.parse gives for it.
2610
+ #
2611
+ # @api private
2612
+ def self.from_wire(v, where = "MapEntry")
2613
+ d = Wire.obj(v, where)
2614
+ new(
2615
+ key: Wire.get(d, "key", where, :str),
2616
+ data: Wire.get(d, "data", where, :json),
2617
+ tags: Wire.get(d, "tags", where, :str, :map),
2618
+ offset: Wire.get(d, "offset", where, :int),
2619
+ score: Wire.get(d, "score", where, :int),
2620
+ removed: Wire.get(d, "removed", where, :bool),
2621
+ time: Wire.get(d, "time", where, :int)
2622
+ )
2623
+ end
2624
+ end
2625
+
2626
+ # MapReadStreamResult is the result of a map read stream call.
2627
+ #
2628
+ # @!attribute [r] entries
2629
+ # @return [Array<MapEntry>] The stream entries.
2630
+ # @!attribute [r] offset
2631
+ # @return [Integer] The top offset of the channel stream.
2632
+ # @!attribute [r] epoch
2633
+ # @return [String] The epoch of the channel stream.
2634
+ class MapReadStreamResult < Data.define(:entries, :offset, :epoch)
2635
+ include Message
2636
+
2637
+ def initialize(entries: [], offset: 0, epoch: "") = super
2638
+
2639
+ # The message as Centrifugo reads it, fields at their zero value left out.
2640
+ #
2641
+ # @api private
2642
+ def to_wire(where = "")
2643
+ w = {}
2644
+ Wire.put(w, "entries", entries, where, MapEntry, :list)
2645
+ Wire.put(w, "offset", offset, where, :int)
2646
+ Wire.put(w, "epoch", epoch, where, :str)
2647
+ w
2648
+ end
2649
+
2650
+ # The message from the Hash JSON.parse gives for it.
2651
+ #
2652
+ # @api private
2653
+ def self.from_wire(v, where = "MapReadStreamResult")
2654
+ d = Wire.obj(v, where)
2655
+ new(
2656
+ entries: Wire.get(d, "entries", where, MapEntry, :list),
2657
+ offset: Wire.get(d, "offset", where, :int),
2658
+ epoch: Wire.get(d, "epoch", where, :str)
2659
+ )
2660
+ end
2661
+ end
2662
+
2663
+ # MapStatsResult is the result of a map stats call.
2664
+ #
2665
+ # @!attribute [r] num_keys
2666
+ # @return [Integer] The number of entries in the channel state.
2667
+ class MapStatsResult < Data.define(:num_keys)
2668
+ include Message
2669
+
2670
+ def initialize(num_keys: 0) = super
2671
+
2672
+ # The message as Centrifugo reads it, fields at their zero value left out.
2673
+ #
2674
+ # @api private
2675
+ def to_wire(where = "")
2676
+ w = {}
2677
+ Wire.put(w, "num_keys", num_keys, where, :int)
2678
+ w
2679
+ end
2680
+
2681
+ # The message from the Hash JSON.parse gives for it.
2682
+ #
2683
+ # @api private
2684
+ def self.from_wire(v, where = "MapStatsResult")
2685
+ d = Wire.obj(v, where)
2686
+ new(
2687
+ num_keys: Wire.get(d, "num_keys", where, :int)
2688
+ )
2689
+ end
2690
+ end
2691
+
2692
+ # MapClearResult is the result of a map clear call. Empty at the moment.
2693
+ class MapClearResult < Data.define
2694
+ include Message
2695
+
2696
+ # The message as Centrifugo reads it, fields at their zero value left out.
2697
+ #
2698
+ # @api private
2699
+ def to_wire(_where = "")
2700
+ {}
2701
+ end
2702
+
2703
+ # The message from the Hash JSON.parse gives for it.
2704
+ #
2705
+ # @api private
2706
+ def self.from_wire(v, where = "MapClearResult")
2707
+ Wire.obj(v, where)
2708
+ new
2709
+ end
2710
+ end
2711
+
2712
+ # SharedPollPublishResult is the result of a shared poll publish call.
2713
+ # Empty at the moment.
2714
+ class SharedPollPublishResult < Data.define
2715
+ include Message
2716
+
2717
+ # The message as Centrifugo reads it, fields at their zero value left out.
2718
+ #
2719
+ # @api private
2720
+ def to_wire(_where = "")
2721
+ {}
2722
+ end
2723
+
2724
+ # The message from the Hash JSON.parse gives for it.
2725
+ #
2726
+ # @api private
2727
+ def self.from_wire(v, where = "SharedPollPublishResult")
2728
+ Wire.obj(v, where)
2729
+ new
2730
+ end
2731
+ end
2732
+
2733
+ # The values of FilterNode.op. The field is a String: a value Centrifugo sends
2734
+ # or accepts which these do not name is still a valid one.
2735
+
2736
+ # The FilterNodeOp "and".
2737
+ FILTER_NODE_OP_AND = "and"
2738
+
2739
+ # The FilterNodeOp "or".
2740
+ FILTER_NODE_OP_OR = "or"
2741
+
2742
+ # The FilterNodeOp "not".
2743
+ FILTER_NODE_OP_NOT = "not"
2744
+
2745
+ # The values of FilterNode.cmp. The field is a String: a value Centrifugo
2746
+ # sends or accepts which these do not name is still a valid one.
2747
+
2748
+ # The Cmp "eq".
2749
+ CMP_EQ = "eq"
2750
+
2751
+ # The Cmp "neq".
2752
+ CMP_NEQ = "neq"
2753
+
2754
+ # The Cmp "in".
2755
+ CMP_IN = "in"
2756
+
2757
+ # The Cmp "nin".
2758
+ CMP_NIN = "nin"
2759
+
2760
+ # The Cmp "ex".
2761
+ CMP_EX = "ex"
2762
+
2763
+ # The Cmp "nex".
2764
+ CMP_NEX = "nex"
2765
+
2766
+ # The Cmp "sw".
2767
+ CMP_SW = "sw"
2768
+
2769
+ # The Cmp "ew".
2770
+ CMP_EW = "ew"
2771
+
2772
+ # The Cmp "ct".
2773
+ CMP_CT = "ct"
2774
+
2775
+ # The Cmp "gt".
2776
+ CMP_GT = "gt"
2777
+
2778
+ # The Cmp "gte".
2779
+ CMP_GTE = "gte"
2780
+
2781
+ # The Cmp "lt".
2782
+ CMP_LT = "lt"
2783
+
2784
+ # The Cmp "lte".
2785
+ CMP_LTE = "lte"
2786
+
2787
+ # The values of DeviceRegisterRequest.provider. The field is a String: a value
2788
+ # Centrifugo sends or accepts which these do not name is still a valid one.
2789
+
2790
+ # The Provider "fcm".
2791
+ PROVIDER_FCM = "fcm"
2792
+
2793
+ # The Provider "hms".
2794
+ PROVIDER_HMS = "hms"
2795
+
2796
+ # The Provider "apns".
2797
+ PROVIDER_APNS = "apns"
2798
+
2799
+ # The Provider "webpush".
2800
+ PROVIDER_WEBPUSH = "webpush"
2801
+
2802
+ # The values of DeviceRegisterRequest.platform. The field is a String: a value
2803
+ # Centrifugo sends or accepts which these do not name is still a valid one.
2804
+
2805
+ # The Platform "ios".
2806
+ PLATFORM_IOS = "ios"
2807
+
2808
+ # The Platform "android".
2809
+ PLATFORM_ANDROID = "android"
2810
+
2811
+ # The Platform "web".
2812
+ PLATFORM_WEB = "web"
2813
+
2814
+ # The values of DeviceTopicsUpdate.op, DeviceTopicUpdateRequest.op and
2815
+ # UserTopicUpdateRequest.op. The field is a String: a value Centrifugo sends
2816
+ # or accepts which these do not name is still a valid one.
2817
+
2818
+ # The Op "add".
2819
+ OP_ADD = "add"
2820
+
2821
+ # The Op "remove".
2822
+ OP_REMOVE = "remove"
2823
+
2824
+ # The Op "set".
2825
+ OP_SET = "set"
2826
+
2827
+ # The values of UpdatePushStatusRequest.status. The field is a String: a value
2828
+ # Centrifugo sends or accepts which these do not name is still a valid one.
2829
+
2830
+ # The Status "delivered".
2831
+ STATUS_DELIVERED = "delivered"
2832
+
2833
+ # The Status "interacted".
2834
+ STATUS_INTERACTED = "interacted"
2835
+
2836
+ # The values of MapPublishRequest.key_mode. The field is a String: a value
2837
+ # Centrifugo sends or accepts which these do not name is still a valid one.
2838
+
2839
+ # The KeyMode "if_new".
2840
+ KEY_MODE_IF_NEW = "if_new"
2841
+
2842
+ # The KeyMode "if_exists".
2843
+ KEY_MODE_IF_EXISTS = "if_exists"
2844
+ end